watson-developer-cloud / speech-javascript-sdk

Library for using the IBM Watson Speech to Text and Text to Speech services in web browsers.
https://watson-speech.mybluemix.net/
260 stars 133 forks source link

what is the filter logic in the webaudio-L16-stream module doing? #28

Closed mreinstein closed 7 years ago

mreinstein commented 7 years ago

I'm looking at this:

https://github.com/watson-developer-cloud/speech-javascript-sdk/blob/master/speech-to-text/webaudio-l16-stream.js#L84

It appears that a filter of some kind is being applied to the audio stream. I'm curious what this is doing, any why. :)

nfriedly commented 7 years ago

I didn't write that, someone on the Speech team did, and I just reused it from the original Speech to Text demo. It's part of downsampling the audio - you can't just drop or average samples because it won't sound right; it's the same idea as anti-aliasing jagged edges in game graphics.

To be honest, I don't fully understand the topic myself, but there's some good explanations of the idea here: http://dsp.stackexchange.com/questions/20303/trying-to-downsample-audio

mreinstein commented 7 years ago

Thanks for the description. I sent a PR incorporating your explanation. I think what you provide is much more valuable then what was there prior.