Search code examples
pythonpython-3.xvoice-recognitionpyaudio

Ignore background noise?


I am making a voice recognition software for my computer but I have some problems: 1) Is there a way to ignore background noise? I want the program to end when there is x amount of time without noise but background noise could keep it awake indefinitely. 2) same thing but reverse, I want it to start when it hears a voice but loud enough background noise will start it as well.


Solution

  • Sorry, I can't provide any code, only pseudocode. You can create en enum, or a list, of possible phonemes spoken. Activate the program only when the ADSR pattern of the phoneme is recognized, with volume as a secondary indicator, to separate "background" phonemes. If the background noise is so loud that it interferes with the recognition of the phoneme, then it shouldn't be considered a background sound in the first place.

    Aah = 1
    Ahh = 2
    Ehh = 3 
    ...
    if soundEvent == true:
    
        if phoneme.type = Aah:
        what_i_said = "a"
    ...