sox-users@lists.sourceforge.net unofficial mirror
 help / color / Atom feed
* Creating files with RMS gain level instead of Peak
@ 2018-07-07 15:05 James Trammell
  2018-07-07 17:25 ` Jeremy Nicoll - ml sox users
  0 siblings, 1 reply; 11+ messages in thread
From: James Trammell @ 2018-07-07 15:05 UTC (permalink / raw)
  To: sox-users

[-- Attachment #1.1: Type: text/plain, Size: 419 bytes --]

Hi,

I have been using SoX lately to generate white noise files. However, the
gain parameter in SoX only allows specifying amplitude as dBFS Peak. I need
dBFS RMS.

I use the following to generate a file of stereo white noise at -12dBFS
Peak:

sox -V -b 24 -r 96000 -n noise_white_stereo_24b_
96000Hz_m12dBFSpeak_tpdf_10s.wav synth 10 whitenoise whitenoise gain -12
dither

How can I get gain of -12dBFS RMS?


Thanks.

[-- Attachment #1.2: Type: text/html, Size: 597 bytes --]

<div dir="ltr"><div>Hi,</div><div><br></div><div>I have been using SoX lately to generate white noise files. However, the gain parameter in SoX only allows specifying amplitude as dBFS Peak. I need dBFS RMS. </div><div><br></div><div>I use the following to generate a file of stereo white noise at -12dBFS Peak:</div><div><br></div><div>sox -V -b 24 -r 96000 -n noise_white_stereo_24b_<wbr>96000Hz_m12dBFSpeak_tpdf_10s.<wbr>wav synth 10 whitenoise whitenoise gain -12 dither</div><div><br></div><div>How can I get gain of -12dBFS RMS?</div><div><br></div><div><br></div><div>Thanks.</div></div>

[-- Attachment #2: Type: text/plain, Size: 202 bytes --]

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot

[-- Attachment #3: Type: text/plain, Size: 158 bytes --]

_______________________________________________
Sox-users mailing list
Sox-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sox-users

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Creating files with RMS gain level instead of Peak
  2018-07-07 15:05 Creating files with RMS gain level instead of Peak James Trammell
@ 2018-07-07 17:25 ` Jeremy Nicoll - ml sox users
  2018-07-07 18:19   ` Måns Rullgård
  0 siblings, 1 reply; 11+ messages in thread
From: Jeremy Nicoll - ml sox users @ 2018-07-07 17:25 UTC (permalink / raw)
  To: sox-users

On 2018-07-07 16:05, James Trammell wrote:

> How can I get gain of -12dBFS RMS?

I don't understand the difference, but even I can see
that the manual describes -B and -b options for the
gain effect, in terms of RMS rather than peak levels.

I do not know if one or other of these options will do
what you want.

-- 
Jeremy Nicoll - my opinions are my own

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Sox-users mailing list
Sox-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sox-users

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Creating files with RMS gain level instead of Peak
  2018-07-07 17:25 ` Jeremy Nicoll - ml sox users
@ 2018-07-07 18:19   ` Måns Rullgård
  2018-07-07 19:52     ` Jeremy Nicoll - ml sox users
  0 siblings, 1 reply; 11+ messages in thread
From: Måns Rullgård @ 2018-07-07 18:19 UTC (permalink / raw)
  To: Jeremy Nicoll - ml sox users; +Cc: sox-users

Jeremy Nicoll - ml sox users <jn.ml.sxu.88@wingsandbeaks.org.uk> writes:

> On 2018-07-07 16:05, James Trammell wrote:
>
>> How can I get gain of -12dBFS RMS?
>
> I don't understand the difference, but even I can see
> that the manual describes -B and -b options for the
> gain effect, in terms of RMS rather than peak levels.
>
> I do not know if one or other of these options will do
> what you want.

Those options are for equalising channels using either peak or RMS
value as reference.

For a fixed scaling, the peak and RMS values are affected equally.
Dividing every sample by two, say, will halve both the peak and RMS
values.

-- 
Måns Rullgård

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Sox-users mailing list
Sox-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sox-users

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Creating files with RMS gain level instead of Peak
  2018-07-07 18:19   ` Måns Rullgård
@ 2018-07-07 19:52     ` Jeremy Nicoll - ml sox users
  2018-07-07 20:47       ` Måns Rullgård
  0 siblings, 1 reply; 11+ messages in thread
From: Jeremy Nicoll - ml sox users @ 2018-07-07 19:52 UTC (permalink / raw)
  To: sox-users

On 2018-07-07 19:19, Måns Rullgård wrote:
> Jeremy Nicoll - ml sox users <jn.ml.sxu.88@wingsandbeaks.org.uk> 
> writes:
> 
>> On 2018-07-07 16:05, James Trammell wrote:
>> 
>>> How can I get gain of -12dBFS RMS?
>> 
>> I don't understand the difference, but even I can see
>> that the manual describes -B and -b options for the
>> gain effect, in terms of RMS rather than peak levels.
>> 
>> I do not know if one or other of these options will do
>> what you want.
> 
> Those options are for equalising channels using either peak or RMS
> value as reference.

Ah, I read about the equalising and then forgot it...


> For a fixed scaling, the peak and RMS values are affected equally.
> Dividing every sample by two, say, will halve both the peak and RMS
> values.

Yes.  So does that mean that the OP should use something like the
'stat' effect to find out the peak RMS level of the audio file,
then work out how much gain or attenuation is needed, then use
a 'gain' effect with that calculated value?

-- 
Jeremy Nicoll - my opinions are my own

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Sox-users mailing list
Sox-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sox-users

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Creating files with RMS gain level instead of Peak
  2018-07-07 19:52     ` Jeremy Nicoll - ml sox users
@ 2018-07-07 20:47       ` Måns Rullgård
  2018-07-07 20:58         ` Jeremy Nicoll - ml sox users
  0 siblings, 1 reply; 11+ messages in thread
From: Måns Rullgård @ 2018-07-07 20:47 UTC (permalink / raw)
  To: Jeremy Nicoll - ml sox users; +Cc: sox-users

Jeremy Nicoll - ml sox users <jn.ml.sxu.88@wingsandbeaks.org.uk> writes:

> On 2018-07-07 19:19, Måns Rullgård wrote:
>> Jeremy Nicoll - ml sox users <jn.ml.sxu.88@wingsandbeaks.org.uk> writes:
>>
>>> On 2018-07-07 16:05, James Trammell wrote:
>>>
>>>> How can I get gain of -12dBFS RMS?
>>>
>>> I don't understand the difference, but even I can see
>>> that the manual describes -B and -b options for the
>>> gain effect, in terms of RMS rather than peak levels.
>>>
>>> I do not know if one or other of these options will do
>>> what you want.
>>
>> Those options are for equalising channels using either peak or RMS
>> value as reference.
>
> Ah, I read about the equalising and then forgot it...
>
>> For a fixed scaling, the peak and RMS values are affected equally.
>> Dividing every sample by two, say, will halve both the peak and RMS
>> values.
>
> Yes.  So does that mean that the OP should use something like the
> 'stat' effect to find out the peak RMS level of the audio file,
> then work out how much gain or attenuation is needed, then use
> a 'gain' effect with that calculated value?

No, he should just use the gain effect.  It adjusts both RMS and peak
values by the same amount because that is what happens when you multiply
each sample by a fixed amount, which is what the gain effect does.

The channel equaliser has both options because the crest factor is
unlikely to be exactly the same for all channels, so the gain required
to match the peaks won't be the same as that for matching the RMS
values.

-- 
Måns Rullgård

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Sox-users mailing list
Sox-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sox-users

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Creating files with RMS gain level instead of Peak
  2018-07-07 20:47       ` Måns Rullgård
@ 2018-07-07 20:58         ` Jeremy Nicoll - ml sox users
  2018-07-08 12:39           ` Måns Rullgård
  0 siblings, 1 reply; 11+ messages in thread
From: Jeremy Nicoll - ml sox users @ 2018-07-07 20:58 UTC (permalink / raw)
  To: ML - sox-users

On 2018-07-07 21:47, Måns Rullgård wrote:
> Jeremy Nicoll - ml sox users <jn.ml.sxu.88@wingsandbeaks.org.uk> 
> writes:

>> Yes.  So does that mean that the OP should use something like the
>> 'stat' effect to find out the peak RMS level of the audio file,
>> then work out how much gain or attenuation is needed, then use
>> a 'gain' effect with that calculated value?

> No, he should just use the gain effect.  It adjusts both RMS and peak
> values by the same amount because that is what happens when you 
> multiply
> each sample by a fixed amount, which is what the gain effect does.

Yes, I understand that gain is gain, but he has to decide how much
gain to apply.  If he's previously done that in terms of a pre-gain
peak level, but now wants to bring RMS levels to a certain point,
he surely has to find out what the file's RMS levels are first
then decide how much to modify it by?

-- 
Jeremy Nicoll - my opinions are my own

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Sox-users mailing list
Sox-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sox-users

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Creating files with RMS gain level instead of Peak
  2018-07-07 20:58         ` Jeremy Nicoll - ml sox users
@ 2018-07-08 12:39           ` Måns Rullgård
  2018-07-08 13:36             ` Mikko Olkkonen
  2018-07-08 14:45             ` James Trammell
  0 siblings, 2 replies; 11+ messages in thread
From: Måns Rullgård @ 2018-07-08 12:39 UTC (permalink / raw)
  To: Jeremy Nicoll - ml sox users; +Cc: ML - sox-users

Jeremy Nicoll - ml sox users <jn.ml.sxu.88@wingsandbeaks.org.uk> writes:

> On 2018-07-07 21:47, Måns Rullgård wrote:
>> Jeremy Nicoll - ml sox users <jn.ml.sxu.88@wingsandbeaks.org.uk> writes:
>
>>> Yes.  So does that mean that the OP should use something like the
>>> 'stat' effect to find out the peak RMS level of the audio file,
>>> then work out how much gain or attenuation is needed, then use
>>> a 'gain' effect with that calculated value?
>
>> No, he should just use the gain effect.  It adjusts both RMS and peak
>> values by the same amount because that is what happens when you multiply
>> each sample by a fixed amount, which is what the gain effect does.
>
> Yes, I understand that gain is gain, but he has to decide how much
> gain to apply.  If he's previously done that in terms of a pre-gain
> peak level, but now wants to bring RMS levels to a certain point,
> he surely has to find out what the file's RMS levels are first
> then decide how much to modify it by?

The question posed was how to obtain an RMS gain of -12 dB.  The answer
is that RMS gain is equal to peak gain, so "gain -12" will perform the
desired function.  If the question were how much gain to apply in order
to obtain a specific RMS level, then of course the initial value would
have to be known.

-- 
Måns Rullgård

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Sox-users mailing list
Sox-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sox-users

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Creating files with RMS gain level instead of Peak
  2018-07-08 12:39           ` Måns Rullgård
@ 2018-07-08 13:36             ` Mikko Olkkonen
  2018-07-08 14:45             ` James Trammell
  1 sibling, 0 replies; 11+ messages in thread
From: Mikko Olkkonen @ 2018-07-08 13:36 UTC (permalink / raw)
  To: sox-users

[-- Attachment #1.1: Type: text/plain, Size: 2256 bytes --]

I think that, for this specific type of white noise, the difference between
RMS and peak is 4.77. Therefore, you get desired output by replacing "gain
-12" in the original command with "gain -7.23"
( -7.23-4.77=-12). You can verify the magic 4.77 with sox stats command or
analytically by calculating the ratio between the linear white noise
standard deviation and peak.
br, Mikko



On Sun, Jul 8, 2018 at 3:39 PM, Måns Rullgård <mans@mansr.com> wrote:

> Jeremy Nicoll - ml sox users <jn.ml.sxu.88@wingsandbeaks.org.uk> writes:
>
> > On 2018-07-07 21:47, Måns Rullgård wrote:
> >> Jeremy Nicoll - ml sox users <jn.ml.sxu.88@wingsandbeaks.org.uk>
> writes:
> >
> >>> Yes.  So does that mean that the OP should use something like the
> >>> 'stat' effect to find out the peak RMS level of the audio file,
> >>> then work out how much gain or attenuation is needed, then use
> >>> a 'gain' effect with that calculated value?
> >
> >> No, he should just use the gain effect.  It adjusts both RMS and peak
> >> values by the same amount because that is what happens when you multiply
> >> each sample by a fixed amount, which is what the gain effect does.
> >
> > Yes, I understand that gain is gain, but he has to decide how much
> > gain to apply.  If he's previously done that in terms of a pre-gain
> > peak level, but now wants to bring RMS levels to a certain point,
> > he surely has to find out what the file's RMS levels are first
> > then decide how much to modify it by?
>
> The question posed was how to obtain an RMS gain of -12 dB.  The answer
> is that RMS gain is equal to peak gain, so "gain -12" will perform the
> desired function.  If the question were how much gain to apply in order
> to obtain a specific RMS level, then of course the initial value would
> have to be known.
>
> --
> Måns Rullgård
>
> ------------------------------------------------------------
> ------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> Sox-users mailing list
> Sox-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/sox-users
>

[-- Attachment #1.2: Type: text/html, Size: 3261 bytes --]

<div dir="ltr"><div>I think that, for this specific type of white noise, the difference between RMS and peak is 4.77. Therefore, you get desired output by replacing &quot;gain -12&quot; in the original command with &quot;gain -7.23&quot;  <br></div><div>( -7.23-4.77=-12). You can verify the magic 4.77 with sox stats command or analytically by calculating the ratio between the linear white noise standard deviation and peak.<br></div><div>br, Mikko</div><div><br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Jul 8, 2018 at 3:39 PM, Måns Rullgård <span dir="ltr">&lt;<a href="mailto:mans@mansr.com" target="_blank">mans@mansr.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Jeremy Nicoll - ml sox users &lt;<a href="mailto:jn.ml.sxu.88@wingsandbeaks.org.uk">jn.ml.sxu.88@wingsandbeaks.<wbr>org.uk</a>&gt; writes:<br>
<br>
&gt; On 2018-07-07 21:47, Måns Rullgård wrote:<br>
&gt;&gt; Jeremy Nicoll - ml sox users &lt;<a href="mailto:jn.ml.sxu.88@wingsandbeaks.org.uk">jn.ml.sxu.88@wingsandbeaks.<wbr>org.uk</a>&gt; writes:<br>
&gt;<br>
&gt;&gt;&gt; Yes.  So does that mean that the OP should use something like the<br>
&gt;&gt;&gt; &#39;stat&#39; effect to find out the peak RMS level of the audio file,<br>
&gt;&gt;&gt; then work out how much gain or attenuation is needed, then use<br>
&gt;&gt;&gt; a &#39;gain&#39; effect with that calculated value?<br>
&gt;<br>
&gt;&gt; No, he should just use the gain effect.  It adjusts both RMS and peak<br>
&gt;&gt; values by the same amount because that is what happens when you multiply<br>
&gt;&gt; each sample by a fixed amount, which is what the gain effect does.<br>
&gt;<br>
&gt; Yes, I understand that gain is gain, but he has to decide how much<br>
&gt; gain to apply.  If he&#39;s previously done that in terms of a pre-gain<br>
&gt; peak level, but now wants to bring RMS levels to a certain point,<br>
&gt; he surely has to find out what the file&#39;s RMS levels are first<br>
&gt; then decide how much to modify it by?<br>
<br>
The question posed was how to obtain an RMS gain of -12 dB.  The answer<br>
is that RMS gain is equal to peak gain, so &quot;gain -12&quot; will perform the<br>
desired function.  If the question were how much gain to apply in order<br>
to obtain a specific RMS level, then of course the initial value would<br>
have to be known.<br>
<span class="HOEnZb"><font color="#888888"><br>
-- <br>
Måns Rullgård<br>
<br>
------------------------------<wbr>------------------------------<wbr>------------------<br>
Check out the vibrant tech community on one of the world&#39;s most<br>
engaging tech sites, Slashdot.org! <a href="http://sdm.link/slashdot" rel="noreferrer" target="_blank">http://sdm.link/slashdot</a><br>
______________________________<wbr>_________________<br>
Sox-users mailing list<br>
<a href="mailto:Sox-users@lists.sourceforge.net">Sox-users@lists.sourceforge.<wbr>net</a><br>
<a href="https://lists.sourceforge.net/lists/listinfo/sox-users" rel="noreferrer" target="_blank">https://lists.sourceforge.net/<wbr>lists/listinfo/sox-users</a><br>
</font></span></blockquote></div><br></div>

[-- Attachment #2: Type: text/plain, Size: 202 bytes --]

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot

[-- Attachment #3: Type: text/plain, Size: 158 bytes --]

_______________________________________________
Sox-users mailing list
Sox-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sox-users

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Creating files with RMS gain level instead of Peak
  2018-07-08 12:39           ` Måns Rullgård
  2018-07-08 13:36             ` Mikko Olkkonen
@ 2018-07-08 14:45             ` James Trammell
  2018-07-08 15:39               ` Mikko Olkkonen
  2018-07-08 16:21               ` Måns Rullgård
  1 sibling, 2 replies; 11+ messages in thread
From: James Trammell @ 2018-07-08 14:45 UTC (permalink / raw)
  To: sox-users

[-- Attachment #1.1: Type: text/plain, Size: 3636 bytes --]

Måns,

Perhaps the following information will explain what I am seeing.

Files

1.
http://substrate.com/rms/sox,noise,white,stereo,24b,96000Hz,m12dBFSpeak,tpdf,10s.wav

Stereo white noise created by SoX; a 24bit 96kHz file at -12dBFS Peak and
10s duration, dithered with TPDF dither to 24 bits.
SoX invocation: "sox -V -b 24 -r 96000 -n
sox,noise,white,stereo,24b,96000Hz,m12dBFSpeak,tpdf,10s.wav synth 10
whitenoise whitenoise gain -12 dither"


2.
http://substrate.com/rms/rx6,noise,whiteuniform,stereo,24b,96000Hz,m12dBFSrms,tpdf,10s.wav

Stereo white noise created by iZotope RX6; a 24bit 96kHz file at -12dBFS
RMS and 10s duration, dithered with TPDF dither to 24 bits.



Screenshots

3. http://substrate.com/rms/filestats_sox.png

Brief RX6 analysis of the SoX file; notice the peak level is -12dBFS while
the RMS level is -13.76dBFS.


4. http://substrate.com/rms/filestats_rx6.png

Brief RX6 analysis of the RX6 file; notice the peak level is -10.24dBFS
while the RMS level is -12dBFS.


5. http://substrate.com/rms/rx6_whiteuniform.png

An FYI shot of the RX6 dialog box to point out that it only allows
amplitude specifying as RMS; there is no way to enter a peak value.


6. http://substrate.com/rms/rx6_whitechoices.png

An FYI shot to show that RX6 offers 4 flavors of white noise. I chose white
uniform for this exercise because that appears to match what SoX produces.
As a side question, it would be nice if someone here could confirm what
flavor of white noise SoX produces.


To recap what I am trying to do, so that my original question is not lost:
I want SoX, ideally natively via some appropriate command-line switch, to
output a white noise file with a specific RMS amplitude.


Thanks.


On Sun, Jul 8, 2018 at 8:39 AM, Måns Rullgård <mans@mansr.com> wrote:

> Jeremy Nicoll - ml sox users <jn.ml.sxu.88@wingsandbeaks.org.uk> writes:
>
> > On 2018-07-07 21:47, Måns Rullgård wrote:
> >> Jeremy Nicoll - ml sox users <jn.ml.sxu.88@wingsandbeaks.org.uk>
> writes:
> >
> >>> Yes.  So does that mean that the OP should use something like the
> >>> 'stat' effect to find out the peak RMS level of the audio file,
> >>> then work out how much gain or attenuation is needed, then use
> >>> a 'gain' effect with that calculated value?
> >
> >> No, he should just use the gain effect.  It adjusts both RMS and peak
> >> values by the same amount because that is what happens when you multiply
> >> each sample by a fixed amount, which is what the gain effect does.
> >
> > Yes, I understand that gain is gain, but he has to decide how much
> > gain to apply.  If he's previously done that in terms of a pre-gain
> > peak level, but now wants to bring RMS levels to a certain point,
> > he surely has to find out what the file's RMS levels are first
> > then decide how much to modify it by?
>
> The question posed was how to obtain an RMS gain of -12 dB.  The answer
> is that RMS gain is equal to peak gain, so "gain -12" will perform the
> desired function.  If the question were how much gain to apply in order
> to obtain a specific RMS level, then of course the initial value would
> have to be known.
>
> --
> Måns Rullgård
>
> ------------------------------------------------------------
> ------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> Sox-users mailing list
> Sox-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/sox-users
>

[-- Attachment #1.2: Type: text/html, Size: 5596 bytes --]

<div dir="ltr"><div>Måns,</div><div><br></div><div>Perhaps the following information will explain what I am seeing.</div><div><br></div><div>Files</div><div><br></div><div>1. <a href="http://substrate.com/rms/sox,noise,white,stereo,24b,96000Hz,m12dBFSpeak,tpdf,10s.wav">http://substrate.com/rms/sox,noise,white,stereo,24b,96000Hz,m12dBFSpeak,tpdf,10s.wav</a></div><div><br></div><div>Stereo white noise created by SoX; a 24bit 96kHz file at -12dBFS Peak and 10s duration, dithered with TPDF dither to 24 bits.</div><div>SoX invocation: &quot;sox -V -b 24 -r 96000 -n sox,noise,white,stereo,24b,96000Hz,m12dBFSpeak,tpdf,10s.wav synth 10 whitenoise whitenoise gain -12 dither&quot;</div><div><br></div><div><br></div><div>2. <a href="http://substrate.com/rms/rx6,noise,whiteuniform,stereo,24b,96000Hz,m12dBFSrms,tpdf,10s.wav">http://substrate.com/rms/rx6,noise,whiteuniform,stereo,24b,96000Hz,m12dBFSrms,tpdf,10s.wav</a><br></div><div><br></div><div>Stereo white noise created by iZotope RX6; a 24bit 96kHz file at -12dBFS RMS and 10s duration, dithered with TPDF dither to 24 bits.</div><div><br></div><div><br></div><div><br></div><div>Screenshots</div><div><br></div><div>3. <a href="http://substrate.com/rms/filestats_sox.png">http://substrate.com/rms/filestats_sox.png</a><br></div><div><br></div><div>Brief RX6 analysis of the SoX file; notice the peak level is -12dBFS while the RMS level is -13.76dBFS.</div><div><br></div><div><br></div><div>4. <a href="http://substrate.com/rms/filestats_rx6.png">http://substrate.com/rms/filestats_rx6.png</a><br></div><div><br></div><div>Brief RX6 analysis of the RX6 file; notice the peak level is -10.24dBFS while the RMS level is -12dBFS.</div><div><br></div><div><br></div><div>5. <a href="http://substrate.com/rms/rx6_whiteuniform.png">http://substrate.com/rms/rx6_whiteuniform.png</a><br></div><div><br></div><div>An FYI shot of the RX6 dialog box to point out that it only allows amplitude specifying as RMS; there is no way to enter a peak value.</div><div><br></div><div><br></div><div>6. <a href="http://substrate.com/rms/rx6_whitechoices.png">http://substrate.com/rms/rx6_whitechoices.png</a><br></div><div><br></div><div>An FYI shot to show that RX6 offers 4 flavors of white noise. I chose white uniform for this exercise because that appears to match what SoX produces. As a side question, it would be nice if someone here could confirm what flavor of white noise SoX produces.</div><div><br></div><div><br></div><div>To recap what I am trying to do, so that my original question is not lost: I want SoX, ideally natively via some appropriate command-line switch, to output a white noise file with a specific RMS amplitude. </div><div><br></div><div><br></div><div>Thanks.</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Jul 8, 2018 at 8:39 AM, Måns Rullgård <span dir="ltr">&lt;<a href="mailto:mans@mansr.com" target="_blank">mans@mansr.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">Jeremy Nicoll - ml sox users &lt;<a href="mailto:jn.ml.sxu.88@wingsandbeaks.org.uk">jn.ml.sxu.88@wingsandbeaks.<wbr>org.uk</a>&gt; writes:<br>
<br>
&gt; On 2018-07-07 21:47, Måns Rullgård wrote:<br>
&gt;&gt; Jeremy Nicoll - ml sox users &lt;<a href="mailto:jn.ml.sxu.88@wingsandbeaks.org.uk">jn.ml.sxu.88@wingsandbeaks.<wbr>org.uk</a>&gt; writes:<br>
&gt;<br>
&gt;&gt;&gt; Yes.  So does that mean that the OP should use something like the<br>
&gt;&gt;&gt; &#39;stat&#39; effect to find out the peak RMS level of the audio file,<br>
&gt;&gt;&gt; then work out how much gain or attenuation is needed, then use<br>
&gt;&gt;&gt; a &#39;gain&#39; effect with that calculated value?<br>
&gt;<br>
&gt;&gt; No, he should just use the gain effect.  It adjusts both RMS and peak<br>
&gt;&gt; values by the same amount because that is what happens when you multiply<br>
&gt;&gt; each sample by a fixed amount, which is what the gain effect does.<br>
&gt;<br>
&gt; Yes, I understand that gain is gain, but he has to decide how much<br>
&gt; gain to apply.  If he&#39;s previously done that in terms of a pre-gain<br>
&gt; peak level, but now wants to bring RMS levels to a certain point,<br>
&gt; he surely has to find out what the file&#39;s RMS levels are first<br>
&gt; then decide how much to modify it by?<br>
<br>
</span>The question posed was how to obtain an RMS gain of -12 dB.  The answer<br>
is that RMS gain is equal to peak gain, so &quot;gain -12&quot; will perform the<br>
desired function.  If the question were how much gain to apply in order<br>
to obtain a specific RMS level, then of course the initial value would<br>
have to be known.<br>
<span class="HOEnZb"><font color="#888888"><br>
-- <br>
Måns Rullgård<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
------------------------------<wbr>------------------------------<wbr>------------------<br>
Check out the vibrant tech community on one of the world&#39;s most<br>
engaging tech sites, Slashdot.org! <a href="http://sdm.link/slashdot" rel="noreferrer" target="_blank">http://sdm.link/slashdot</a><br>
______________________________<wbr>_________________<br>
Sox-users mailing list<br>
<a href="mailto:Sox-users@lists.sourceforge.net">Sox-users@lists.sourceforge.<wbr>net</a><br>
<a href="https://lists.sourceforge.net/lists/listinfo/sox-users" rel="noreferrer" target="_blank">https://lists.sourceforge.net/<wbr>lists/listinfo/sox-users</a><br>
</div></div></blockquote></div><br></div>

[-- Attachment #2: Type: text/plain, Size: 202 bytes --]

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot

[-- Attachment #3: Type: text/plain, Size: 158 bytes --]

_______________________________________________
Sox-users mailing list
Sox-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sox-users

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Creating files with RMS gain level instead of Peak
  2018-07-08 14:45             ` James Trammell
@ 2018-07-08 15:39               ` Mikko Olkkonen
  2018-07-08 16:21               ` Måns Rullgård
  1 sibling, 0 replies; 11+ messages in thread
From: Mikko Olkkonen @ 2018-07-08 15:39 UTC (permalink / raw)
  To: sox-users

[-- Attachment #1.1: Type: text/plain, Size: 5615 bytes --]

1. according to sox stats effect: your sox file has peak lev db -12 and rms
lev db -16.77. Same result when I generate the file with your command.
2. according to sox stats effect your rx6 file has rms lev db -15.02 (not
-12).
That is, there are discrepancies between your screenshots and rms level
figures reported by sox.
I would abandon rx in the process and use the method I described earlier.
If you want to reach -12 rms (as reported by the rx) you should be able to
easily alter the gain in your sox command until you reach desired -12 rms
lev db.
You could be additionally able to eliminate the discrepancy described above
by altering the RMS calculation methods in the rx preferences. I guess in
your current setup it calculates RMS level in a "nonstandard way".

>As a side question, it would be nice if someone here could confirm what
flavor of white noise SoX produces.
Yes, I can confirm that your command in my environment delivers _uniform_
type of white noise.

>I want SoX, ideally natively via some appropriate command-line switch, to
output a white noise file with a specific RMS amplitude.
Yes, that could be nice feature. But I suppose you can easility generate
desired RMS level db with sox by using my magic number 4.77 (or other
number if you use your current RMS calculation standard).
br, Mikko




On Sun, Jul 8, 2018 at 5:45 PM, James Trammell <james.trammell@gmail.com>
wrote:

> Måns,
>
> Perhaps the following information will explain what I am seeing.
>
> Files
>
> 1. http://substrate.com/rms/sox,noise,white,stereo,24b,
> 96000Hz,m12dBFSpeak,tpdf,10s.wav
>
> Stereo white noise created by SoX; a 24bit 96kHz file at -12dBFS Peak and
> 10s duration, dithered with TPDF dither to 24 bits.
> SoX invocation: "sox -V -b 24 -r 96000 -n sox,noise,white,stereo,24b,
> 96000Hz,m12dBFSpeak,tpdf,10s.wav synth 10 whitenoise whitenoise gain -12
> dither"
>
>
> 2. http://substrate.com/rms/rx6,noise,whiteuniform,stereo,24b,
> 96000Hz,m12dBFSrms,tpdf,10s.wav
>
> Stereo white noise created by iZotope RX6; a 24bit 96kHz file at -12dBFS
> RMS and 10s duration, dithered with TPDF dither to 24 bits.
>
>
>
> Screenshots
>
> 3. http://substrate.com/rms/filestats_sox.png
>
> Brief RX6 analysis of the SoX file; notice the peak level is -12dBFS while
> the RMS level is -13.76dBFS.
>
>
> 4. http://substrate.com/rms/filestats_rx6.png
>
> Brief RX6 analysis of the RX6 file; notice the peak level is -10.24dBFS
> while the RMS level is -12dBFS.
>
>
> 5. http://substrate.com/rms/rx6_whiteuniform.png
>
> An FYI shot of the RX6 dialog box to point out that it only allows
> amplitude specifying as RMS; there is no way to enter a peak value.
>
>
> 6. http://substrate.com/rms/rx6_whitechoices.png
>
> An FYI shot to show that RX6 offers 4 flavors of white noise. I chose
> white uniform for this exercise because that appears to match what SoX
> produces. As a side question, it would be nice if someone here could
> confirm what flavor of white noise SoX produces.
>
>
> To recap what I am trying to do, so that my original question is not lost:
> I want SoX, ideally natively via some appropriate command-line switch, to
> output a white noise file with a specific RMS amplitude.
>
>
> Thanks.
>
>
> On Sun, Jul 8, 2018 at 8:39 AM, Måns Rullgård <mans@mansr.com> wrote:
>
>> Jeremy Nicoll - ml sox users <jn.ml.sxu.88@wingsandbeaks.org.uk> writes:
>>
>> > On 2018-07-07 21:47, Måns Rullgård wrote:
>> >> Jeremy Nicoll - ml sox users <jn.ml.sxu.88@wingsandbeaks.org.uk>
>> writes:
>> >
>> >>> Yes.  So does that mean that the OP should use something like the
>> >>> 'stat' effect to find out the peak RMS level of the audio file,
>> >>> then work out how much gain or attenuation is needed, then use
>> >>> a 'gain' effect with that calculated value?
>> >
>> >> No, he should just use the gain effect.  It adjusts both RMS and peak
>> >> values by the same amount because that is what happens when you
>> multiply
>> >> each sample by a fixed amount, which is what the gain effect does.
>> >
>> > Yes, I understand that gain is gain, but he has to decide how much
>> > gain to apply.  If he's previously done that in terms of a pre-gain
>> > peak level, but now wants to bring RMS levels to a certain point,
>> > he surely has to find out what the file's RMS levels are first
>> > then decide how much to modify it by?
>>
>> The question posed was how to obtain an RMS gain of -12 dB.  The answer
>> is that RMS gain is equal to peak gain, so "gain -12" will perform the
>> desired function.  If the question were how much gain to apply in order
>> to obtain a specific RMS level, then of course the initial value would
>> have to be known.
>>
>> --
>> Måns Rullgård
>>
>> ------------------------------------------------------------
>> ------------------
>> Check out the vibrant tech community on one of the world's most
>> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
>> _______________________________________________
>> Sox-users mailing list
>> Sox-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/sox-users
>>
>
>
> ------------------------------------------------------------
> ------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> Sox-users mailing list
> Sox-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/sox-users
>
>

[-- Attachment #1.2: Type: text/html, Size: 8484 bytes --]

<div dir="ltr"><div>1. according to sox stats effect: your sox file has peak lev db -12 and rms lev db -16.77. Same result when I generate the file with your command.<br></div><div>2. according to sox stats effect your rx6 file has rms lev db -15.02 (not -12).</div><div>That is, there are discrepancies between your screenshots and rms level figures reported by sox.</div><div>I would abandon rx in the process and use the method I described earlier. If you want to reach -12 rms (as reported by the rx) you should be able to easily alter the gain in your sox command until you reach desired -12 rms lev db.</div><div>You could be additionally able to eliminate the discrepancy described above by altering the RMS calculation methods in the rx preferences. I guess in your current setup it calculates RMS level in a &quot;nonstandard way&quot;.</div><div><br></div><div></div><div>&gt;As a side question, it would be nice if someone here could confirm what flavor of white noise SoX produces.<br></div><div>Yes, I can confirm that your command in my environment delivers _uniform_ type of white noise.</div><div><br></div><div>&gt;I want SoX, ideally natively via some appropriate command-line switch, 
to output a white noise file with a specific RMS amplitude. <br></div><div>Yes, that could be nice feature. But I suppose you can easility generate desired RMS level db with sox by using my magic number 4.77 (or other number if you use your current RMS calculation standard).<br></div><div>br, Mikko</div><div><br></div><div><br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Jul 8, 2018 at 5:45 PM, James Trammell <span dir="ltr">&lt;<a href="mailto:james.trammell@gmail.com" target="_blank">james.trammell@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Måns,</div><div><br></div><div>Perhaps the following information will explain what I am seeing.</div><div><br></div><div>Files</div><div><br></div><div>1. <a href="http://substrate.com/rms/sox,noise,white,stereo,24b,96000Hz,m12dBFSpeak,tpdf,10s.wav" target="_blank">http://substrate.com/rms/sox,<wbr>noise,white,stereo,24b,<wbr>96000Hz,m12dBFSpeak,tpdf,10s.<wbr>wav</a></div><div><br></div><div>Stereo white noise created by SoX; a 24bit 96kHz file at -12dBFS Peak and 10s duration, dithered with TPDF dither to 24 bits.</div><div>SoX invocation: &quot;sox -V -b 24 -r 96000 -n sox,noise,white,stereo,24b,<wbr>96000Hz,m12dBFSpeak,tpdf,10s.<wbr>wav synth 10 whitenoise whitenoise gain -12 dither&quot;</div><div><br></div><div><br></div><div>2. <a href="http://substrate.com/rms/rx6,noise,whiteuniform,stereo,24b,96000Hz,m12dBFSrms,tpdf,10s.wav" target="_blank">http://substrate.com/rms/rx6,<wbr>noise,whiteuniform,stereo,24b,<wbr>96000Hz,m12dBFSrms,tpdf,10s.<wbr>wav</a><br></div><div><br></div><div>Stereo white noise created by iZotope RX6; a 24bit 96kHz file at -12dBFS RMS and 10s duration, dithered with TPDF dither to 24 bits.</div><div><br></div><div><br></div><div><br></div><div>Screenshots</div><div><br></div><div>3. <a href="http://substrate.com/rms/filestats_sox.png" target="_blank">http://substrate.com/rms/<wbr>filestats_sox.png</a><br></div><div><br></div><div>Brief RX6 analysis of the SoX file; notice the peak level is -12dBFS while the RMS level is -13.76dBFS.</div><div><br></div><div><br></div><div>4. <a href="http://substrate.com/rms/filestats_rx6.png" target="_blank">http://substrate.com/rms/<wbr>filestats_rx6.png</a><br></div><div><br></div><div>Brief RX6 analysis of the RX6 file; notice the peak level is -10.24dBFS while the RMS level is -12dBFS.</div><div><br></div><div><br></div><div>5. <a href="http://substrate.com/rms/rx6_whiteuniform.png" target="_blank">http://substrate.com/rms/rx6_<wbr>whiteuniform.png</a><br></div><div><br></div><div>An FYI shot of the RX6 dialog box to point out that it only allows amplitude specifying as RMS; there is no way to enter a peak value.</div><div><br></div><div><br></div><div>6. <a href="http://substrate.com/rms/rx6_whitechoices.png" target="_blank">http://substrate.com/rms/rx6_<wbr>whitechoices.png</a><br></div><div><br></div><div>An FYI shot to show that RX6 offers 4 flavors of white noise. I chose white uniform for this exercise because that appears to match what SoX produces. As a side question, it would be nice if someone here could confirm what flavor of white noise SoX produces.</div><div><br></div><div><br></div><div>To recap what I am trying to do, so that my original question is not lost: I want SoX, ideally natively via some appropriate command-line switch, to output a white noise file with a specific RMS amplitude. </div><div><br></div><div><br></div><div>Thanks.</div><div><br></div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Jul 8, 2018 at 8:39 AM, Måns Rullgård <span dir="ltr">&lt;<a href="mailto:mans@mansr.com" target="_blank">mans@mansr.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span>Jeremy Nicoll - ml sox users &lt;<a href="mailto:jn.ml.sxu.88@wingsandbeaks.org.uk" target="_blank">jn.ml.sxu.88@wingsandbeaks.or<wbr>g.uk</a>&gt; writes:<br>
<br>
&gt; On 2018-07-07 21:47, Måns Rullgård wrote:<br>
&gt;&gt; Jeremy Nicoll - ml sox users &lt;<a href="mailto:jn.ml.sxu.88@wingsandbeaks.org.uk" target="_blank">jn.ml.sxu.88@wingsandbeaks.or<wbr>g.uk</a>&gt; writes:<br>
&gt;<br>
&gt;&gt;&gt; Yes.  So does that mean that the OP should use something like the<br>
&gt;&gt;&gt; &#39;stat&#39; effect to find out the peak RMS level of the audio file,<br>
&gt;&gt;&gt; then work out how much gain or attenuation is needed, then use<br>
&gt;&gt;&gt; a &#39;gain&#39; effect with that calculated value?<br>
&gt;<br>
&gt;&gt; No, he should just use the gain effect.  It adjusts both RMS and peak<br>
&gt;&gt; values by the same amount because that is what happens when you multiply<br>
&gt;&gt; each sample by a fixed amount, which is what the gain effect does.<br>
&gt;<br>
&gt; Yes, I understand that gain is gain, but he has to decide how much<br>
&gt; gain to apply.  If he&#39;s previously done that in terms of a pre-gain<br>
&gt; peak level, but now wants to bring RMS levels to a certain point,<br>
&gt; he surely has to find out what the file&#39;s RMS levels are first<br>
&gt; then decide how much to modify it by?<br>
<br>
</span>The question posed was how to obtain an RMS gain of -12 dB.  The answer<br>
is that RMS gain is equal to peak gain, so &quot;gain -12&quot; will perform the<br>
desired function.  If the question were how much gain to apply in order<br>
to obtain a specific RMS level, then of course the initial value would<br>
have to be known.<br>
<span class="m_3044873257703597340HOEnZb"><font color="#888888"><br>
-- <br>
Måns Rullgård<br>
</font></span><div class="m_3044873257703597340HOEnZb"><div class="m_3044873257703597340h5"><br>
------------------------------<wbr>------------------------------<wbr>------------------<br>
Check out the vibrant tech community on one of the world&#39;s most<br>
engaging tech sites, Slashdot.org! <a href="http://sdm.link/slashdot" rel="noreferrer" target="_blank">http://sdm.link/slashdot</a><br>
______________________________<wbr>_________________<br>
Sox-users mailing list<br>
<a href="mailto:Sox-users@lists.sourceforge.net" target="_blank">Sox-users@lists.sourceforge.ne<wbr>t</a><br>
<a href="https://lists.sourceforge.net/lists/listinfo/sox-users" rel="noreferrer" target="_blank">https://lists.sourceforge.net/<wbr>lists/listinfo/sox-users</a><br>
</div></div></blockquote></div><br></div>
</div></div><br>------------------------------<wbr>------------------------------<wbr>------------------<br>
Check out the vibrant tech community on one of the world&#39;s most<br>
engaging tech sites, Slashdot.org! <a href="http://sdm.link/slashdot" rel="noreferrer" target="_blank">http://sdm.link/slashdot</a><br>______________________________<wbr>_________________<br>
Sox-users mailing list<br>
<a href="mailto:Sox-users@lists.sourceforge.net">Sox-users@lists.sourceforge.<wbr>net</a><br>
<a href="https://lists.sourceforge.net/lists/listinfo/sox-users" rel="noreferrer" target="_blank">https://lists.sourceforge.net/<wbr>lists/listinfo/sox-users</a><br>
<br></blockquote></div><br></div>

[-- Attachment #2: Type: text/plain, Size: 202 bytes --]

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot

[-- Attachment #3: Type: text/plain, Size: 158 bytes --]

_______________________________________________
Sox-users mailing list
Sox-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sox-users

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Creating files with RMS gain level instead of Peak
  2018-07-08 14:45             ` James Trammell
  2018-07-08 15:39               ` Mikko Olkkonen
@ 2018-07-08 16:21               ` Måns Rullgård
  1 sibling, 0 replies; 11+ messages in thread
From: Måns Rullgård @ 2018-07-08 16:21 UTC (permalink / raw)
  To: James Trammell; +Cc: sox-users

James Trammell <james.trammell@gmail.com> writes:

> I want SoX, ideally natively via some appropriate command-line switch, to
> output a white noise file with a specific RMS amplitude.

You can get this by using the standard "gain" effect and offsetting the
amount by 4.78 dB.  If you want to abuse the existing options a bit, you
could produce a stereo white noise file with a given RMS level like
this:

$ sox -n out.wav synth 10 square whitenoise whitenoise gain -12 gain -B remix 2 3

Not the most efficient or intuitive, I know.

-- 
Måns Rullgård

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Sox-users mailing list
Sox-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sox-users

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, back to index

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-07 15:05 Creating files with RMS gain level instead of Peak James Trammell
2018-07-07 17:25 ` Jeremy Nicoll - ml sox users
2018-07-07 18:19   ` Måns Rullgård
2018-07-07 19:52     ` Jeremy Nicoll - ml sox users
2018-07-07 20:47       ` Måns Rullgård
2018-07-07 20:58         ` Jeremy Nicoll - ml sox users
2018-07-08 12:39           ` Måns Rullgård
2018-07-08 13:36             ` Mikko Olkkonen
2018-07-08 14:45             ` James Trammell
2018-07-08 15:39               ` Mikko Olkkonen
2018-07-08 16:21               ` Måns Rullgård

sox-users@lists.sourceforge.net unofficial mirror

Archives are clonable: git clone --mirror https://public-inbox.org/sox-users

Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.audio.sox
	nntp://ou63pmih66umazou.onion/inbox.comp.audio.sox
	nntp://news.gmane.org/gmane.comp.audio.sox

 note: .onion URLs require Tor: https://www.torproject.org/

AGPL code for this site: git clone https://public-inbox.org/ public-inbox