[gst-devel] Express volume in db instead of percent...

Yogesh Marwaha yogeshm.007 at gmail.com
Mon Jan 4 08:53:27 CET 2010


2010/1/2 Sjoerd Op 't Land <sjoerd at intercue.nl>:
> Op 1 jan 2010, om 10:23 heeft Yogesh Marwaha het volgende geschreven:
>
>> Is following a correct method for converting volume from percent to
>> decibel: -
>>
>> db = 20 * log (percent/100)
> Assuming that 'percent' is proportional to the voltage (for example,
> an RMS calculated from a number of samples), yes. In digital audio
> terms, this would then be dBFS (decibel full scale). See also:
>  http://en.wikipedia.org/wiki/DBFS
http://en.wikipedia.org/wiki/DBFS is not clear enough for me. Now I'll
try to be more specific on my question.
I am to use volume element as preamp for gstiirequalizer plugin and
as you must know that volume is expressed in percent whereas I want it
to be expressed in db. So, I want a formula to convert to and from
percent to decibel.
Here is what I got from searching the net:
volume_in_db = 20 * log (volume_in_percent / 100)
volume_in_percent = 10 ^ (volume_in_db / 20) * 100

When I peeked into gstreamer source, I get to see something like this
in gstiirequalizer.c

static inline gdouble
arg_to_scale (gdouble arg)
{
  return (pow (10.0, arg / 40.0));
}

while peeking into banshee source, I get following code in gstiirequalizer.c

static inline gdouble
arg_to_scale (gdouble arg)
{
  return (pow (10.0, arg / 20.0));
}

I have no idea about how above code is being used but banshee's
formula seems similar to what I got from internet.

Any ideas??

Regards,
>
> Regards,
> Sjoerd
>
>>
>>
>> Regards,
>>
>>
>> --
>> Yogesh M
>> http://sparklemedia.sourceforge.net/
>> http://mazedaar.wordpress.com/
>> http://snakeeyes.wordpress.com/
>>
>> ------------------------------------------------------------------------------
>> This SF.Net email is sponsored by the Verizon Developer Community
>> Take advantage of Verizon's best-in-class app development support
>> A streamlined, 14 day to market process makes app distribution fast
>> and easy
>> Join now and get one step closer to millions of Verizon customers
>> http://p.sf.net/sfu/verizon-dev2dev
>> _______________________________________________
>> gstreamer-devel mailing list
>> gstreamer-devel at lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
>>
>
>
> ------------------------------------------------------------------------------
> This SF.Net email is sponsored by the Verizon Developer Community
> Take advantage of Verizon's best-in-class app development support
> A streamlined, 14 day to market process makes app distribution fast and easy
> Join now and get one step closer to millions of Verizon customers
> http://p.sf.net/sfu/verizon-dev2dev
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
>



-- 
Yogesh M
http://sparklemedia.sourceforge.net/
http://mazedaar.wordpress.com/
http://snakeeyes.wordpress.com/




More information about the gstreamer-devel mailing list