Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

大神,请教一下哈,为什么时间久了就唤醒不了了? #2

Open
haha010508 opened this issue Sep 15, 2023 · 5 comments
Open

Comments

@haha010508
Copy link

这是我的代码:
`def detection(audio, kw):
if kw=='nihaoxiaojing':
kws=kws_xiaojing
elif kw=='hixiaowen' or kw=='nihaowenwen':
kws=kws_xiaowen

else:  # for other input data, we recommend xiaowen model
   kws=kws_xiaowen

kws.reset_all()
if audio is None:
    return "Input Error! Please enter one audio!"

# with wave.open(audio, 'rb') as fin:
#     assert fin.getnchannels() == 1
#     wav = fin.readframes(fin.getnframes())

y, _ = librosa.load(audio, sr=16000)
# NOTE: model supports 16k sample_rate
wav = (y * (1 << 15)).astype("int16").tobytes()

# We inference every 0.3 seconds, in streaming fashion.
interval = int(0.3 * 16000) * 2
for i in range(0, len(wav), interval):
    chunk_wav = wav[i: min(i + interval, len(wav))]
    result = kws.forward(chunk_wav)
    if 'state' in result and result['state'] == 1:
        keyword = result['keyword']
        start = result['start']
        end = result['end']
        txt = f'Activated: Detect {keyword} from {start} to {end} second.'
        kws.reset_all()
        print(txt)
return "Deactivated."`
@haha010508
Copy link
Author

我有录音文件,如果需要可以提供给您

@duj12
Copy link
Owner

duj12 commented Sep 15, 2023 via email

@haha010508
Copy link
Author

额,看不到了 v我? 15815571301

@haha010508
Copy link
Author

可以哈 打包一条可以复现的音频发我邮箱就行 杜靖 @.***

在 2023年9月15日,10:55,haha010508 @.***> 写道:  我有录音文件,如果需要可以提供给您 — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you are subscribed to this thread.

我看不到你的邮箱,还有其他方式可以传给您吗?

@duj12
Copy link
Owner

duj12 commented Sep 18, 2023

可以哈 打包一条可以复现的音频发我邮箱就行 杜靖 @.***

在 2023年9月15日,10:55,haha010508 @.***> 写道:  我有录音文件,如果需要可以提供给您 — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you are subscribed to this thread.

我看不到你的邮箱,还有其他方式可以传给您吗?

现在应该已经修复了,主要改动如下
fed8cc6
你可以拉最新代码再试试哈

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants