SoundWave icon indicating copy to clipboard operation
SoundWave copied to clipboard

sound wave from recording voice

Open sultan-arshi opened this issue 4 years ago • 2 comments

i am recording a voice and want to show sound wave for it but i am getting audioRecorder.averagePower(forChannel: 0) but i am getting value less then zero and greater then 1 and you library need values from 0 to 1
how can i convert this value ?

sultan-arshi avatar Mar 15 '20 21:03 sultan-arshi

Hi @sultan-arshi!

Do you know the minimum and maximum values for the number you are getting while recording a voice? If so, with a fairly simple calculation you can bring this value back in a range between 0 and 1.

If you don't know what minimum and maximum are, I would just do some experimentation to find arbitrary values and use that as constants in your codebase. It should be good enough to draw meaningful waves :)

bastienFalcou avatar Mar 15 '20 22:03 bastienFalcou

according to doc A return value of 0 dB indicates full scale, or maximum power; a return value of –160 dB indicates minimum power (that is, near silence). means max = 0 db and min = -160 db i tried a lot to convert them

sultan-arshi avatar Mar 16 '20 09:03 sultan-arshi