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

How to detect long utterances use Yamnet VAD #15

Closed
developerzjy opened this issue Jul 26, 2023 · 2 comments
Closed

How to detect long utterances use Yamnet VAD #15

developerzjy opened this issue Jul 26, 2023 · 2 comments

Comments

@developerzjy
Copy link

hi, I want to detect long utterances use Yamnet VAD, but I can't find the api configuration. My purpose is to detect if someone speaks in a period of time, such as within 10 seconds someone said a word. I don't care about the result of each frame, I just want a final result. Does Yamnet support this case?what should I do?

@gkonovalov
Copy link
Owner

gkonovalov commented Jul 26, 2023

Hi @developerzjy

Yes, Yamnet VAD support continuous speech recognition, please see code below:

val vad = Vad.builder()
        .setContext(applicationContext)
        .setSampleRate(SampleRate.SAMPLE_RATE_16K)
        .setFrameSize(FrameSize.FRAME_SIZE_243)
        .setMode(Mode.NORMAL)
        .setSilenceDurationMs(30)
        .setSpeechDurationMs(30)
        .build()

    vad.setContinuousClassifierListener("Speech", audioData, object : VadListener {
        override fun onResult(event: SoundCategory) {
            when (event.label) {
                "Speech" -> "Speech Detected!" + event.score
                else -> "Noise Detected!" + event.score
            }
        }
    })

    vad.close()

Full code example: https://github.com/gkonovalov/android-vad/blob/main/example/src/main/java/com/konovalov/vad/example/VadYamnetFragment.kt

@developerzjy
Copy link
Author

I saw this code and run it, I need additional code to convert the result of each frame into a final result.
thank you

@uncleTan uncleTan mentioned this issue Nov 10, 2023
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