Knute Johnson ha scritto:
miraglia.c@gmail.com wrote:
How to detect the "silence" in a File.wav, during recording.
Thanks.
Kar
During recording or in a .wav file? If you are using Java Sound to
record from your sound card you will find detecting silence problematic.
When you collect sound data with Java it is in PCM format. The values
received reflect the level of sound. Zero would be no sound and in the
case of 8 bit data, 127 or -128 would be maximum level.
The problem I think you will find is that the sound cards have fairly
high levels of noise and you will have to pick some arbitrarily high
number to assume no sound. That will then give you a relatively small
dynamic range work with.
If you are trying to find silence in a .wav file you will have to know
that format that the .wav file is actually stored in. It can be PCM but
also many other formats. I don't know a lot about .wav but I'm sure you
could find plenty of info by searching Microsoft's web sites.
--
Knute Johnson
email s/nospam/knute/
First of all: thanks.
I collect audio data in PCM format and I found that the level of noise
is quite high.
I used a simple mathematic average like this:
if((numBytesRead= targetLine.read(data, 0, bufferLengthInBytes)) ==-1)
{break;}
somma=0;
for(int i = 800; i<20000; i+=1 ){
somma += Math.abs ( data [i]);
}
to work out a number for the thresholding. I also restricted the
frquency range because I want to find silence in speech.
What do you think about this method?
Thanks a lot.
Kar
That is a good idea. I worked on silence detection for quite a while
until I figured out the noise situation. By then the project had ended
so I dropped it. I haven't tried to analyze the frequency of the sound
card noise but that sounds like a good place to start looking. If you
come up with something, please post it back here. I know I would be
very curious to see it work.