News:

SMF - Just Installed!

Main Menu

Volume

Started by AntonioMSR, February 03, 2016, 08:04:00 PM

Previous topic - Next topic

AntonioMSR

Hello brilliant programming people! :D

I'm programming with Active Sound Editor and I'm needing of a practical idea, please. I am trying to get the volume in decibels ( dB ) of a sound file when it is loaded on my audio player. After that, I wish can save this sound file with a new value in decibels ( dB) for its volume.
If we can not do this directly , I thought to do as follows: set the new value in decibels ( dB ) and the program would get the equivalent value in percentage (%) and modify the file volume.

To make this, I tried to adapt my intention to part of the sample code in VB6/SoundEditor , specifically the code of "Apply flat volume " option of the menu Effects. And the code of frame frmVolume.frm

To get and set the volume in decibels ( dB ) I also tried using :
OutputVolumeSet method
OutputVolumeGet method

And it's Parameters
fValue
nScaleType
SCALE_LINEAR
0
SCALE_LOG
1

VolumeInDB = 20 * log10 (VolumeLinear/100)
VolumeLinear = 100 * pow (10, VolumeInDB/20);


:-[But in all of my several attempts: What a mess! Can someone please help me?
It will make me happy a lot and who can try to help me I want you to be blessed by this twice happiness!
Thank you very much!

Administrator

Hello,

the OutputVolumeSet and OutputVolumeGet methods work only during playback and are usually driven by a slider control: no modification is applied to the original audio file so they cannot be used for saving purposes.
Knowing the volume in dB of the overall audio file would probably require the implementation of a custom DSP that would perform the sound analysis and would determine the volume: unfortunately the component doesn't come with this specific DSP embedded so it would have to be implemented by a third-party.
You may eventually try applying a sort of normalization with the Effects.NormalizationSimpleApply method or with the Effects.NormalizationAdvancedApply method that allows specifying a target level for sounds having a low volume.

Hope this helps

Kind Regards

Severino Delaurenti
MultiMedia Soft