C
cpptutor2000
Could some DSP or Java guru please help me ? I have a simple Java
application that records audio signals and does simple analysis on the
collected data. I am using PCM encoding, with sampling frequency 16000
Hz, 16 bits resolution, single or mono channel, little endian and
signed.
The data is read into a ByteArrayOutputStream and then as soon as I
stop recording, the stream contents are written to a byte array, using
'toByteArray()'. After that, I can get the size of this byte array,
which gives me the total number of bytes collected, keeping in mind
that I am using 16 bit resolution, i.e., each sound sample is 16 bits
long. I am using a software tone generator, with the frequency set at
500.0 Hertz.
Now, from simple DSP principles, we know that if the number of samples
collected is 'n' and the sampling frequency is 'fs', then the time
needed to collect these 'n' samples is n/fs, and the fundamental
frequency recorded is the inverse of this time value.
However, I am only getting frequencies as low as 7 Hz, or 8Hz, which
is just absurd. Could someone please tell me if I am doing something
totally incorrect, or where the flaw in my reasoning is. Any help
would be greatly appreciated. Thanks in advance for your help.
application that records audio signals and does simple analysis on the
collected data. I am using PCM encoding, with sampling frequency 16000
Hz, 16 bits resolution, single or mono channel, little endian and
signed.
The data is read into a ByteArrayOutputStream and then as soon as I
stop recording, the stream contents are written to a byte array, using
'toByteArray()'. After that, I can get the size of this byte array,
which gives me the total number of bytes collected, keeping in mind
that I am using 16 bit resolution, i.e., each sound sample is 16 bits
long. I am using a software tone generator, with the frequency set at
500.0 Hertz.
Now, from simple DSP principles, we know that if the number of samples
collected is 'n' and the sampling frequency is 'fs', then the time
needed to collect these 'n' samples is n/fs, and the fundamental
frequency recorded is the inverse of this time value.
However, I am only getting frequencies as low as 7 Hz, or 8Hz, which
is just absurd. Could someone please tell me if I am doing something
totally incorrect, or where the flaw in my reasoning is. Any help
would be greatly appreciated. Thanks in advance for your help.