i am working on my final year project at the university. I am implementing AI on my project in baby crying detection. the problem is that i am recording live audio using max9814 which gives values from 0 to 500 approx and 250 as center value. when i takes values from pre recorded audio of baby crying, then i use two different libraries in AI python. one library gives values from -0.8 to 1.03 in this range. and other one gives -25000 to +25000 range values. So i don't know how to convert values from one range to the second range accurately. because i don't know what type of audio i am dealing with. and the above provided ranges are not proper because baby crying audios don't have a very loud sound so that the values hit its peak and i can know correct range. So what i want is to convert one type of values to another type. lets say i want all values to be in the range from -1 to 1. Kindly help if you have any information regarding this. thankyou! :)

1 Answer 1


It seems to me you have a long way to go. I will try to fill in some of that. Some it you will already know but bear with me.

Sound is:

  • change in air pressure, positiv and negative
  • change over time

The way to work with this in a "computer" is by sampling the value often enough. In music recording we might select to sample 48000 times per second. Each sample will show the difference in pressure, positive or negative.

To make it simpler to discuss and work with, we might look at these values as a range from (almost) -1.0 up to (almost) +1.0. The mean value looked over a longer time is zero.

If you download a sound program, say Audacity that is free, you may look at these samples as a wave form. Audacity also allows you to modify the sound: amplify it, filter or eq frequencies, compress or otherwise alter the sound. I highly suggest you test something like this on your computer.

In order to do something with a sound one single sample is meaningless in itself. We need to take a number of samples and look at them together. One thing we could do is to check the "sound level". This can be done by looking at a number of samples and measure the difference between the largest (+0.xxx) and smallest (-0.xxx). In audio we generally express this loudness in dBFS. 0dBFS (FS here is Full Scael) is maximum value and smaller signals could be as example -20dB.

Another thing we could do with the signal is to look at what frequencies of signals it contains. Note that this probably changes all the time. The function we use is called Fourier transform. Often we use a program "short-cut" known as FFT for Fast-Forier-Transform.

My guess is that the first step with your samples 0 to 500 is to change it into range -1.0 to +1.0. Simplest is to outvalue = (invalue -250) / 250.

The rest is, as they said in some books, left to the reader.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.