You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
with 2 bytesPerSample, the code has allocated space for 319 doubles, but when it's done everything after bytesPerSample[159] is 0.0
back in getFrequency() I end up with an array of 319 Complex values, but again, everything after 159 is 0.0, 0.0
In FFT() you check:
// radix 2 Cooley-Tukey FFTif (N % 2 != 0) { thrownewRuntimeException("N is not a power of 2"); }
...At first I thought "that's not checking if it is a power of 2", but then you call it recursively, this would eventually be a valid test. As it happens, the excheption is thrown the first time through because I've got 160 values in an array with capacity for 319.
The text was updated successfully, but these errors were encountered:
nalbion
changed the title
bytesToDoubleArray() sizing
bytesToDoubleArray() sizing & FFT
Jul 13, 2017
I've changed my window size to 8ms and removed the "+1" mentioned above, but now when FFT returns the first element always a 0.0 imaginary component, and as a result findMaxMagnitude() finds a huge value at index 0 and votes it as the top result - so the frequency is always 0 and my VAD never detects any speech
As per the recommendations of Moattar and Homayounpour I'm trying to detect voice activity using a 10ms sliding window.
For 10ms of 16kHz 16bit mono audio,
getNumBytes(.01)
returns 320. (it would be 320.5, but it is stored in an int)...why add the .5?
then
getFrequency()
callsbytesToDoubleArray()
, passing the 320 bytes. Another point of confusion is the calculation of the size ofmicBufferData
:with 2 bytesPerSample, the code has allocated space for 319 doubles, but when it's done everything after
bytesPerSample[159]
is 0.0back in
getFrequency()
I end up with an array of 319Complex
values, but again, everything after159
is0.0, 0.0
In
FFT()
you check:...At first I thought "that's not checking if it is a power of 2", but then you call it recursively, this would eventually be a valid test. As it happens, the excheption is thrown the first time through because I've got 160 values in an array with capacity for 319.
The text was updated successfully, but these errors were encountered: