Stat

classic Classic list List threaded Threaded
17 messages Options
Reply | Threaded
Open this post in threaded view
|

Stat

Mew, Peter
Hi
Could someone point me at the correct syntax for this command.
I'm using
Sox stat -v <file name>.   To get the volume adjustment value.
I'm trying to get the headroom of a bunch of files
I keep getting "sox FAIL sox not enough input file names specified."
Ive also tried the stat -v command at the end

Thanks
-pm

Sent from my iPad

________________________________

“**Confidentiality**
The information contained in this e-mail is confidential, may be privileged and is intended solely for the use of the named addressee. Access to this e-mail by any other person is not authorised. If you are not the intended recipient, you should not disclose, copy, distribute, take any action or rely on it and you should please notify the sender by reply. Any opinions expressed are not necessarily those of the company.

We may monitor all incoming and outgoing emails in line with current legislation. We have taken steps to ensure that this email and attachments are free from any virus, but it remains your responsibility to ensure that viruses do not adversely affect you.
------------------------------------------------------------------------------
November Webinars for C, C++, Fortran Developers
Accelerate application performance with scalable programming models. Explore
techniques for threading, error checking, porting, and tuning. Get the most
from the latest Intel processors and coprocessors. See abstracts and register
http://pubads.g.doubleclick.net/gampad/clk?id=60136231&iu=/4140/ostg.clktrk
_______________________________________________
Sox-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/sox-users
Reply | Threaded
Open this post in threaded view
|

Re: Stat

keghn



sox your.wav -n stat -v

------------------------------------------------------------------------------
November Webinars for C, C++, Fortran Developers
Accelerate application performance with scalable programming models. Explore
techniques for threading, error checking, porting, and tuning. Get the most
from the latest Intel processors and coprocessors. See abstracts and register
http://pubads.g.doubleclick.net/gampad/clk?id=60136231&iu=/4140/ostg.clktrk
_______________________________________________
Sox-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/sox-users
Reply | Threaded
Open this post in threaded view
|

Re: Stat

keghn
In reply to this post by Mew, Peter

 Work for ogg, wav, and flac.
 Could not get it to work for mp3

 Cheers.
    keghn

------------------------------------------------------------------------------
November Webinars for C, C++, Fortran Developers
Accelerate application performance with scalable programming models. Explore
techniques for threading, error checking, porting, and tuning. Get the most
from the latest Intel processors and coprocessors. See abstracts and register
http://pubads.g.doubleclick.net/gampad/clk?id=60136231&iu=/4140/ostg.clktrk
_______________________________________________
Sox-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/sox-users
Reply | Threaded
Open this post in threaded view
|

Re: Stat

Gregorio Garcia Karman
sox your.mp3 -n stat -v

works fine here. sox 14.4.1

On 10.11.2013, at 22:37, [hidden email] wrote:

>
>  Work for ogg, wav, and flac.
>  Could not get it to work for mp3
>
>
>  Cheers.
>     keghn
> ------------------------------------------------------------------------------
> November Webinars for C, C++, Fortran Developers
> Accelerate application performance with scalable programming models. Explore
> techniques for threading, error checking, porting, and tuning. Get the most
> from the latest Intel processors and coprocessors. See abstracts and register
> http://pubads.g.doubleclick.net/gampad/clk?id=60136231&iu=/4140/ostg.clktrk_______________________________________________
> Sox-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/sox-users


------------------------------------------------------------------------------
November Webinars for C, C++, Fortran Developers
Accelerate application performance with scalable programming models. Explore
techniques for threading, error checking, porting, and tuning. Get the most
from the latest Intel processors and coprocessors. See abstracts and register
http://pubads.g.doubleclick.net/gampad/clk?id=60136231&iu=/4140/ostg.clktrk
_______________________________________________
Sox-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/sox-users
Reply | Threaded
Open this post in threaded view
|

Re: Stat

Mew, Peter
In reply to this post by keghn
Hi
Great thanks
Where do you Get the -n switch from
The documentation I have doesn't mention a -n switch.
Where can the latest docs be found?

Thanks
-pm

Sent from my iPad

On 10 Nov 2013, at 21:13, "[hidden email]" <[hidden email]> wrote:




sox your.wav -n stat -v
------------------------------------------------------------------------------
November Webinars for C, C++, Fortran Developers
Accelerate application performance with scalable programming models. Explore
techniques for threading, error checking, porting, and tuning. Get the most
from the latest Intel processors and coprocessors. See abstracts and register
http://pubads.g.doubleclick.net/gampad/clk?id=60136231&iu=/4140/ostg.clktrk
_______________________________________________
Sox-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/sox-users



“**Confidentiality**
The information contained in this e-mail is confidential, may be privileged and is intended solely for the use of the named addressee. Access to this e-mail by any other person is not authorised. If you are not the intended recipient, you should not disclose, copy, distribute, take any action or rely on it and you should please notify the sender by reply. Any opinions expressed are not necessarily those of the company.

We may monitor all incoming and outgoing emails in line with current legislation. We have taken steps to ensure that this email and attachments are free from any virus, but it remains your responsibility to ensure that viruses do not adversely affect you.

------------------------------------------------------------------------------
November Webinars for C, C++, Fortran Developers
Accelerate application performance with scalable programming models. Explore
techniques for threading, error checking, porting, and tuning. Get the most
from the latest Intel processors and coprocessors. See abstracts and register
http://pubads.g.doubleclick.net/gampad/clk?id=60136231&iu=/4140/ostg.clktrk
_______________________________________________
Sox-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/sox-users
Reply | Threaded
Open this post in threaded view
|

Re: Stat

keghn


http://billposer.org/Linguistics/Computation/SoxTutorial.html

http://sox.sourceforge.net/sox.html

http://www.thegeekstuff.com/2009/05/sound-exchange-sox-15-examples-to-manipulate-audio-files/#more-486


I also google with:

   sox -red -white -runs -base -hits n v volume adjustment

 A minus sign in front of the word or character mean remove it form the search.
 So if you looking for a switch take the minus sign out. 

------------------------------------------------------------------------------
November Webinars for C, C++, Fortran Developers
Accelerate application performance with scalable programming models. Explore
techniques for threading, error checking, porting, and tuning. Get the most
from the latest Intel processors and coprocessors. See abstracts and register
http://pubads.g.doubleclick.net/gampad/clk?id=60136231&iu=/4140/ostg.clktrk
_______________________________________________
Sox-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/sox-users
Reply | Threaded
Open this post in threaded view
|

Re: Stat

Jan Stary
In reply to this post by Mew, Peter
On Nov 10 23:39:01, [hidden email] wrote:
> Where do you Get the -n switch from
> The documentation I have doesn't mention a -n switch.

It's not a switch, it's a "null file".
It's quite clearly described in the manpage.

> Where can the latest docs be found?

With your SoX installation, as well as online:
http://sox.sourceforge.net/sox.html

Please read it in its entirety before
asking any more questions.


------------------------------------------------------------------------------
November Webinars for C, C++, Fortran Developers
Accelerate application performance with scalable programming models. Explore
techniques for threading, error checking, porting, and tuning. Get the most
from the latest Intel processors and coprocessors. See abstracts and register
http://pubads.g.doubleclick.net/gampad/clk?id=60136231&iu=/4140/ostg.clktrk
_______________________________________________
Sox-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/sox-users
Reply | Threaded
Open this post in threaded view
|

Re: Stat

keghn
 
 Anybody know any good places or locations of simple working examples of sox.
 The manual is good reference for  sox veterans.

------------------------------------------------------------------------------
November Webinars for C, C++, Fortran Developers
Accelerate application performance with scalable programming models. Explore
techniques for threading, error checking, porting, and tuning. Get the most
from the latest Intel processors and coprocessors. See abstracts and register
http://pubads.g.doubleclick.net/gampad/clk?id=60136231&iu=/4140/ostg.clktrk
_______________________________________________
Sox-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/sox-users
Reply | Threaded
Open this post in threaded view
|

Re: Stat

Jesse Ross-6
"man soxexam" is great. If that man page is not installed on your system, you can view it here: http://linux.die.net/man/1/soxexam

best,
jesse


On Mon, Nov 11, 2013 at 10:07 AM, <[hidden email]> wrote:
 
 Anybody know any good places or locations of simple working examples of sox.
 The manual is good reference for  sox veterans.

------------------------------------------------------------------------------
November Webinars for C, C++, Fortran Developers
Accelerate application performance with scalable programming models. Explore
techniques for threading, error checking, porting, and tuning. Get the most
from the latest Intel processors and coprocessors. See abstracts and register
http://pubads.g.doubleclick.net/gampad/clk?id=60136231&iu=/4140/ostg.clktrk
_______________________________________________
Sox-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/sox-users



------------------------------------------------------------------------------
November Webinars for C, C++, Fortran Developers
Accelerate application performance with scalable programming models. Explore
techniques for threading, error checking, porting, and tuning. Get the most
from the latest Intel processors and coprocessors. See abstracts and register
http://pubads.g.doubleclick.net/gampad/clk?id=60136231&iu=/4140/ostg.clktrk
_______________________________________________
Sox-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/sox-users
Reply | Threaded
Open this post in threaded view
|

Re: Stat

Jan Stary
In reply to this post by keghn
On Nov 11 10:07:53, [hidden email] wrote:
> Anybody know any good places or locations
> of simple working examples of sox.

The Introduction section of the SoX manual. Duh.
That's a good place, and possibly even a good location.

Also, there is this thing called Google:
http://lmgtfy.com/?q=SoX+audio+processing+examples

>  The manual is good reference for  sox veterans.

The manual is what a manual is: the first place to look;
the ultimate source of all information about SoX; written
and maintained by the authors of the software itself.

Should that not be enough for you, there are tons
of outdated howtos on teh interwebz of course.


------------------------------------------------------------------------------
November Webinars for C, C++, Fortran Developers
Accelerate application performance with scalable programming models. Explore
techniques for threading, error checking, porting, and tuning. Get the most
from the latest Intel processors and coprocessors. See abstracts and register
http://pubads.g.doubleclick.net/gampad/clk?id=60136231&iu=/4140/ostg.clktrk
_______________________________________________
Sox-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/sox-users
Reply | Threaded
Open this post in threaded view
|

Re: Stat

Mew, Peter
Hi
I have read the man pages several times, but I can't find an answer to this question
When I use -n stat -v on a 16 bit file I get the expected output
When I use -n stat -v on a 24 bit file, I get the output for the stats command

Any ideas
Thanks
-pm


Sent from my iPad

> On 11 Nov 2013, at 17:37, "Jan Stary" <[hidden email]> wrote:
>
>> On Nov 11 10:07:53, [hidden email] wrote:
>> Anybody know any good places or locations
>> of simple working examples of sox.
>
> The Introduction section of the SoX manual. Duh.
> That's a good place, and possibly even a good location.
>
> Also, there is this thing called Google:
> http://lmgtfy.com/?q=SoX+audio+processing+examples
>
>> The manual is good reference for  sox veterans.
>
> The manual is what a manual is: the first place to look;
> the ultimate source of all information about SoX; written
> and maintained by the authors of the software itself.
>
> Should that not be enough for you, there are tons
> of outdated howtos on teh interwebz of course.
>
>
> ------------------------------------------------------------------------------
> November Webinars for C, C++, Fortran Developers
> Accelerate application performance with scalable programming models. Explore
> techniques for threading, error checking, porting, and tuning. Get the most
> from the latest Intel processors and coprocessors. See abstracts and register
> http://pubads.g.doubleclick.net/gampad/clk?id=60136231&iu=/4140/ostg.clktrk
> _______________________________________________
> Sox-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/sox-users
>

________________________________

“**Confidentiality**
The information contained in this e-mail is confidential, may be privileged and is intended solely for the use of the named addressee. Access to this e-mail by any other person is not authorised. If you are not the intended recipient, you should not disclose, copy, distribute, take any action or rely on it and you should please notify the sender by reply. Any opinions expressed are not necessarily those of the company.

We may monitor all incoming and outgoing emails in line with current legislation. We have taken steps to ensure that this email and attachments are free from any virus, but it remains your responsibility to ensure that viruses do not adversely affect you.
------------------------------------------------------------------------------
DreamFactory - Open Source REST & JSON Services for HTML5 & Native Apps
OAuth, Users, Roles, SQL, NoSQL, BLOB Storage and External API Access
Free app hosting. Or install the open source package on any LAMP server.
Sign up and see examples for AngularJS, jQuery, Sencha Touch and Native!
http://pubads.g.doubleclick.net/gampad/clk?id=63469471&iu=/4140/ostg.clktrk
_______________________________________________
Sox-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/sox-users
Reply | Threaded
Open this post in threaded view
|

Re: Stat

Jan Stary
On Nov 12 21:48:25, [hidden email] wrote:
> Hi
> I have read the man pages several times, but I can't find an answer to this question
> When I use -n stat -v on a 16 bit file I get the expected output
> When I use -n stat -v on a 24 bit file, I get the output for the stats command

$ sox -n file.wav synth 5 sin 440 gain -6
$ sox file.wav -n stat -v
1.995

$ sox -n -b 24 file.wav synth 5 sin 440 gain -6
$ sox file.wav -n stat -v
1.995

You need to tell us, as always, your full and exact command line,
and the full and exact response.

script(1) is your friend.



------------------------------------------------------------------------------
DreamFactory - Open Source REST & JSON Services for HTML5 & Native Apps
OAuth, Users, Roles, SQL, NoSQL, BLOB Storage and External API Access
Free app hosting. Or install the open source package on any LAMP server.
Sign up and see examples for AngularJS, jQuery, Sencha Touch and Native!
http://pubads.g.doubleclick.net/gampad/clk?id=63469471&iu=/4140/ostg.clktrk
_______________________________________________
Sox-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/sox-users
Reply | Threaded
Open this post in threaded view
|

Re: Stat

Mew, Peter
Hi Jan
I am trying to check they two files that are supposed to be the same, actually are, by applying a null test
I have the two files source1.wav & source2 .wav
I firstly reverse the polarity of source1.wav using "sox source1.wav source1reversed.wav vol -1"
I then mix source1reversed with source2 using "sox -m source1reversed.wav source2.wav mixed.wav"
Finally I get the head room from "sox mixed.wav -n stat -v"

If source1.wav and source2.wav are 16bit the final output from sox reads 87.850 or similar ,

this is OK because there is always some difference in the least significant bit depending on what pieces of digital equipment were in the chain during the making of source2.wav

If source1.wav and source2.wav are 24 bit the final output from sox reads

Samples read.      24969216
Length (seconds)   283.097687
Scaled by.    2147483647.0
Maximum amplitude.     0.0000000000
Minimum amplitude.      0.0000000000
Midline amplitude.          0.0000000000
Mean norm.                    0.0000000000
Mean amplitude.             0.0000000000
RMS amplitude.              0.0000000000
Maximum delta.              0.0000000000
Minimum delta.               0.0000000000

I am sure I have followed the guidelines
To mix 2 files together -m goes at the start
Effects go after the file to be changed, in this case the output file.

I would be grateful for any insight you, or anyone else, could give in resolving my error
This is using the latest version of sox

Thank you
-pm


Sent from my iPad

> On 12 Nov 2013, at 22:45, "Jan Stary" <[hidden email]> wrote:
>
>> On Nov 12 21:48:25, [hidden email] wrote:
>> Hi
>> I have read the man pages several times, but I can't find an answer to this question
>> When I use -n stat -v on a 16 bit file I get the expected output
>> When I use -n stat -v on a 24 bit file, I get the output for the stats command
>
> $ sox -n file.wav synth 5 sin 440 gain -6
> $ sox file.wav -n stat -v
> 1.995
>
> $ sox -n -b 24 file.wav synth 5 sin 440 gain -6
> $ sox file.wav -n stat -v
> 1.995
>
> You need to tell us, as always, your full and exact command line,
> and the full and exact response.
>
> script(1) is your friend.
>
>
>
> ------------------------------------------------------------------------------
> DreamFactory - Open Source REST & JSON Services for HTML5 & Native Apps
> OAuth, Users, Roles, SQL, NoSQL, BLOB Storage and External API Access
> Free app hosting. Or install the open source package on any LAMP server.
> Sign up and see examples for AngularJS, jQuery, Sencha Touch and Native!
> http://pubads.g.doubleclick.net/gampad/clk?id=63469471&iu=/4140/ostg.clktrk
> _______________________________________________
> Sox-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/sox-users
>

________________________________

“**Confidentiality**
The information contained in this e-mail is confidential, may be privileged and is intended solely for the use of the named addressee. Access to this e-mail by any other person is not authorised. If you are not the intended recipient, you should not disclose, copy, distribute, take any action or rely on it and you should please notify the sender by reply. Any opinions expressed are not necessarily those of the company.

We may monitor all incoming and outgoing emails in line with current legislation. We have taken steps to ensure that this email and attachments are free from any virus, but it remains your responsibility to ensure that viruses do not adversely affect you.
------------------------------------------------------------------------------
DreamFactory - Open Source REST & JSON Services for HTML5 & Native Apps
OAuth, Users, Roles, SQL, NoSQL, BLOB Storage and External API Access
Free app hosting. Or install the open source package on any LAMP server.
Sign up and see examples for AngularJS, jQuery, Sencha Touch and Native!
http://pubads.g.doubleclick.net/gampad/clk?id=63469471&iu=/4140/ostg.clktrk
_______________________________________________
Sox-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/sox-users
Reply | Threaded
Open this post in threaded view
|

Re: Stat

Jan Stary
On Nov 13 19:23:26, [hidden email] wrote:

> Hi Jan
> I am trying to check they two files that are supposed to be the same, actually are, by applying a null test
> I have the two files source1.wav & source2 .wav
> I firstly reverse the polarity of source1.wav using "sox source1.wav source1reversed.wav vol -1"
> I then mix source1reversed with source2 using "sox -m source1reversed.wav source2.wav mixed.wav"
> Finally I get the head room from "sox mixed.wav -n stat -v"
>
> If source1.wav and source2.wav are 16bit the final output from sox reads 87.850 or similar ,
>
> this is OK because there is always some difference in the least significant bit depending on what pieces of digital equipment were in the chain during the making of source2.wav
>
> If source1.wav and source2.wav are 24 bit the final output from sox reads

How exactly did you produce the 16bit sources,
and how exactly did you produce the 24bit sources?

Because your 16bit files are not the same,
while the 24bit files are the same.


> Samples read.      24969216
> Length (seconds)   283.097687
> Scaled by.    2147483647.0
> Maximum amplitude.     0.0000000000
> Minimum amplitude.      0.0000000000
> Midline amplitude.          0.0000000000
> Mean norm.                    0.0000000000
> Mean amplitude.             0.0000000000
> RMS amplitude.              0.0000000000
> Maximum delta.              0.0000000000
> Minimum delta.               0.0000000000


I can reproduce your situation with

  $ sox -n -b 24 file1.wav synth 5 sin 440 gain -6
  $ sox -n -b 24 file2.wav synth 5 sin 440 gain -6
  $ sox file1.wav file1rev.wav  vol -1      
  $ sox -m file1rev.wav file2.wav mixed.wav  
  $ sox mixed.wav -n stat -v                

The same happens with 32bit files.
With 16bit wavs, the result is just the -v number.


BUT this only happens if the files are exactly the same.
With an actual difference (nonzero max amplitude of the mixed diff),
stat -v reports just the number even for 24bit or 32bit files.

  $ sox -n -b 32 file1.wav synth 5 sin 440 gain -6
  $ sox -n -b 32 file2.wav synth 5 sin 441 gain -6
  $ sox file1.wav file1rev.wav  vol -1            
  $ sox -m file1rev.wav file2.wav mixed.wav        
  $ sox mixed.wav -n stat -v                      
  1.995


If the two files are exactly the same, the difference is a constant zero.
Looking at the source, namely stat.c:256 of current git, in that case:

        amp = -stat->min;
        if (amp < stat->max)
                amp = stat->max;

        /* Just print the volume adjustment */
        if (stat->volume == 1 && amp > 0) {
                fprintf(stderr, "%.3f\n", SOX_SAMPLE_MAX/(amp*scale));
                return SOX_SUCCESS;
        }
        if (stat->volume == 2)
                fprintf(stderr, "\n\n");
        /* print out the info */
        fprintf(stderr, "Samples read:      %12" PRIu64 "\n", stat->read);
        /* ... */


It seems that SoX deliberately prints just the single -v number
only if it makes sense; otherwise it just prints the whole info.

        Jan



> > On 12 Nov 2013, at 22:45, "Jan Stary" <[hidden email]> wrote:
> >
> >> On Nov 12 21:48:25, [hidden email] wrote:
> >> Hi
> >> I have read the man pages several times, but I can't find an answer to this question
> >> When I use -n stat -v on a 16 bit file I get the expected output
> >> When I use -n stat -v on a 24 bit file, I get the output for the stats command
> >
> > $ sox -n file.wav synth 5 sin 440 gain -6
> > $ sox file.wav -n stat -v
> > 1.995
> >
> > $ sox -n -b 24 file.wav synth 5 sin 440 gain -6
> > $ sox file.wav -n stat -v
> > 1.995
> >
> > You need to tell us, as always, your full and exact command line,
> > and the full and exact response.
> >
> > script(1) is your friend.
> >
> >
> >
> > ------------------------------------------------------------------------------
> > DreamFactory - Open Source REST & JSON Services for HTML5 & Native Apps
> > OAuth, Users, Roles, SQL, NoSQL, BLOB Storage and External API Access
> > Free app hosting. Or install the open source package on any LAMP server.
> > Sign up and see examples for AngularJS, jQuery, Sencha Touch and Native!
> > http://pubads.g.doubleclick.net/gampad/clk?id=63469471&iu=/4140/ostg.clktrk
> > _______________________________________________
> > Sox-users mailing list
> > [hidden email]
> > https://lists.sourceforge.net/lists/listinfo/sox-users
> >
>
> ________________________________
>
> ???**Confidentiality**
> The information contained in this e-mail is confidential, may be privileged and is intended solely for the use of the named addressee. Access to this e-mail by any other person is not authorised. If you are not the intended recipient, you should not disclose, copy, distribute, take any action or rely on it and you should please notify the sender by reply. Any opinions expressed are not necessarily those of the company.
>
> We may monitor all incoming and outgoing emails in line with current legislation. We have taken steps to ensure that this email and attachments are free from any virus, but it remains your responsibility to ensure that viruses do not adversely affect you.
> ------------------------------------------------------------------------------
> DreamFactory - Open Source REST & JSON Services for HTML5 & Native Apps
> OAuth, Users, Roles, SQL, NoSQL, BLOB Storage and External API Access
> Free app hosting. Or install the open source package on any LAMP server.
> Sign up and see examples for AngularJS, jQuery, Sencha Touch and Native!
> http://pubads.g.doubleclick.net/gampad/clk?id=63469471&iu=/4140/ostg.clktrk
> _______________________________________________
> Sox-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/sox-users

------------------------------------------------------------------------------
DreamFactory - Open Source REST & JSON Services for HTML5 & Native Apps
OAuth, Users, Roles, SQL, NoSQL, BLOB Storage and External API Access
Free app hosting. Or install the open source package on any LAMP server.
Sign up and see examples for AngularJS, jQuery, Sencha Touch and Native!
http://pubads.g.doubleclick.net/gampad/clk?id=63469471&iu=/4140/ostg.clktrk
_______________________________________________
Sox-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/sox-users
Reply | Threaded
Open this post in threaded view
|

Re: Stat

Mew, Peter
16 bit sources come from CD  source1 is from CD source2 is a copy of source1 that has been into a digital audio work station and out again.
24 bit sources are A to D converted from analogue tape, with source2 going into DAW and out again
They are not the same data, but each pair of files has been treated in the same way
If I get a complete null of the 24 bit files,I would expect -n stat -v to yield 144 as the result
Likewise a perfect null on 2 16 bit files should result in 96
Or is this not so in sox
I have found in the past that a 24 bit file, level changed in sox, and compared, in a DAW, with a. File, level changed in the DAW, will only null to around -139 or so.
I believe this is due to the way the different systems handle LSB when truncating the internal architecture (32bit float, 48bit integer etc ) to 24 bit
Is there a better way of comparing 2  files in sox?

Thanks for your help
-pm

Sent from my iPad

> On 13 Nov 2013, at 20:35, "Jan Stary" <[hidden email]> wrote:
>
>> On Nov 13 19:23:26, [hidden email] wrote:
>> Hi Jan
>> I am trying to check they two files that are supposed to be the same, actually are, by applying a null test
>> I have the two files source1.wav & source2 .wav
>> I firstly reverse the polarity of source1.wav using "sox source1.wav source1reversed.wav vol -1"
>> I then mix source1reversed with source2 using "sox -m source1reversed.wav source2.wav mixed.wav"
>> Finally I get the head room from "sox mixed.wav -n stat -v"
>>
>> If source1.wav and source2.wav are 16bit the final output from sox reads 87.850 or similar ,
>>
>> this is OK because there is always some difference in the least significant bit depending on what pieces of digital equipment were in the chain during the making of source2.wav
>>
>> If source1.wav and source2.wav are 24 bit the final output from sox reads
>
> How exactly did you produce the 16bit sources,
> and how exactly did you produce the 24bit sources?
>
> Because your 16bit files are not the same,
> while the 24bit files are the same.
>
>
>> Samples read.      24969216
>> Length (seconds)   283.097687
>> Scaled by.    2147483647.0
>> Maximum amplitude.     0.0000000000
>> Minimum amplitude.      0.0000000000
>> Midline amplitude.          0.0000000000
>> Mean norm.                    0.0000000000
>> Mean amplitude.             0.0000000000
>> RMS amplitude.              0.0000000000
>> Maximum delta.              0.0000000000
>> Minimum delta.               0.0000000000
>
>
> I can reproduce your situation with
>
>  $ sox -n -b 24 file1.wav synth 5 sin 440 gain -6
>  $ sox -n -b 24 file2.wav synth 5 sin 440 gain -6
>  $ sox file1.wav file1rev.wav  vol -1
>  $ sox -m file1rev.wav file2.wav mixed.wav
>  $ sox mixed.wav -n stat -v
>
> The same happens with 32bit files.
> With 16bit wavs, the result is just the -v number.
>
>
> BUT this only happens if the files are exactly the same.
> With an actual difference (nonzero max amplitude of the mixed diff),
> stat -v reports just the number even for 24bit or 32bit files.
>
>  $ sox -n -b 32 file1.wav synth 5 sin 440 gain -6
>  $ sox -n -b 32 file2.wav synth 5 sin 441 gain -6
>  $ sox file1.wav file1rev.wav  vol -1
>  $ sox -m file1rev.wav file2.wav mixed.wav
>  $ sox mixed.wav -n stat -v
>  1.995
>
>
> If the two files are exactly the same, the difference is a constant zero.
> Looking at the source, namely stat.c:256 of current git, in that case:
>
>    amp = -stat->min;
>    if (amp < stat->max)
>        amp = stat->max;
>
>    /* Just print the volume adjustment */
>    if (stat->volume == 1 && amp > 0) {
>        fprintf(stderr, "%.3f\n", SOX_SAMPLE_MAX/(amp*scale));
>        return SOX_SUCCESS;
>    }
>    if (stat->volume == 2)
>        fprintf(stderr, "\n\n");
>    /* print out the info */
>    fprintf(stderr, "Samples read:      %12" PRIu64 "\n", stat->read);
>    /* ... */
>
>
> It seems that SoX deliberately prints just the single -v number
> only if it makes sense; otherwise it just prints the whole info.
>
>    Jan
>
>
>
>>>> On 12 Nov 2013, at 22:45, "Jan Stary" <[hidden email]> wrote:
>>>>
>>>> On Nov 12 21:48:25, [hidden email] wrote:
>>>> Hi
>>>> I have read the man pages several times, but I can't find an answer to this question
>>>> When I use -n stat -v on a 16 bit file I get the expected output
>>>> When I use -n stat -v on a 24 bit file, I get the output for the stats command
>>>
>>> $ sox -n file.wav synth 5 sin 440 gain -6
>>> $ sox file.wav -n stat -v
>>> 1.995
>>>
>>> $ sox -n -b 24 file.wav synth 5 sin 440 gain -6
>>> $ sox file.wav -n stat -v
>>> 1.995
>>>
>>> You need to tell us, as always, your full and exact command line,
>>> and the full and exact response.
>>>
>>> script(1) is your friend.
>>>
>>>
>>>
>>> ------------------------------------------------------------------------------
>>> DreamFactory - Open Source REST & JSON Services for HTML5 & Native Apps
>>> OAuth, Users, Roles, SQL, NoSQL, BLOB Storage and External API Access
>>> Free app hosting. Or install the open source package on any LAMP server.
>>> Sign up and see examples for AngularJS, jQuery, Sencha Touch and Native!
>>> http://pubads.g.doubleclick.net/gampad/clk?id=63469471&iu=/4140/ostg.clktrk
>>> _______________________________________________
>>> Sox-users mailing list
>>> [hidden email]
>>> https://lists.sourceforge.net/lists/listinfo/sox-users
>>
>> ________________________________
>>
>> ???**Confidentiality**
>> The information contained in this e-mail is confidential, may be privileged and is intended solely for the use of the named addressee. Access to this e-mail by any other person is not authorised. If you are not the intended recipient, you should not disclose, copy, distribute, take any action or rely on it and you should please notify the sender by reply. Any opinions expressed are not necessarily those of the company.
>>
>> We may monitor all incoming and outgoing emails in line with current legislation. We have taken steps to ensure that this email and attachments are free from any virus, but it remains your responsibility to ensure that viruses do not adversely affect you.
>> ------------------------------------------------------------------------------
>> DreamFactory - Open Source REST & JSON Services for HTML5 & Native Apps
>> OAuth, Users, Roles, SQL, NoSQL, BLOB Storage and External API Access
>> Free app hosting. Or install the open source package on any LAMP server.
>> Sign up and see examples for AngularJS, jQuery, Sencha Touch and Native!
>> http://pubads.g.doubleclick.net/gampad/clk?id=63469471&iu=/4140/ostg.clktrk
>> _______________________________________________
>> Sox-users mailing list
>> [hidden email]
>> https://lists.sourceforge.net/lists/listinfo/sox-users
>
> ------------------------------------------------------------------------------
> DreamFactory - Open Source REST & JSON Services for HTML5 & Native Apps
> OAuth, Users, Roles, SQL, NoSQL, BLOB Storage and External API Access
> Free app hosting. Or install the open source package on any LAMP server.
> Sign up and see examples for AngularJS, jQuery, Sencha Touch and Native!
> http://pubads.g.doubleclick.net/gampad/clk?id=63469471&iu=/4140/ostg.clktrk
> _______________________________________________
> Sox-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/sox-users
>

________________________________

“**Confidentiality**
The information contained in this e-mail is confidential, may be privileged and is intended solely for the use of the named addressee. Access to this e-mail by any other person is not authorised. If you are not the intended recipient, you should not disclose, copy, distribute, take any action or rely on it and you should please notify the sender by reply. Any opinions expressed are not necessarily those of the company.

We may monitor all incoming and outgoing emails in line with current legislation. We have taken steps to ensure that this email and attachments are free from any virus, but it remains your responsibility to ensure that viruses do not adversely affect you.
------------------------------------------------------------------------------
DreamFactory - Open Source REST & JSON Services for HTML5 & Native Apps
OAuth, Users, Roles, SQL, NoSQL, BLOB Storage and External API Access
Free app hosting. Or install the open source package on any LAMP server.
Sign up and see examples for AngularJS, jQuery, Sencha Touch and Native!
http://pubads.g.doubleclick.net/gampad/clk?id=63469471&iu=/4140/ostg.clktrk
_______________________________________________
Sox-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/sox-users
Reply | Threaded
Open this post in threaded view
|

Re: Stat

Jan Stary
On Nov 13 22:03:20, [hidden email] wrote:
> 16 bit sources come from CD  source1 is from CD source2 is a copy of source1 that has been into a digital audio work station and out again.
> 24 bit sources are A to D converted from analogue tape, with source2 going into DAW and out again
> They are not the same data, but each pair of files has been treated in the same way
> If I get a complete null of the 24 bit files,I would expect -n stat -v to yield 144 as the result
> Likewise a perfect null on 2 16 bit files should result in 96

Why do you expect 144? The -v number is, quote,

        The parameter to the vol effect
        which would make the audio as loud as possible
        without clipping.

How much can you multiply zero to avoid clipping? Times 144?

> I have found in the past that a 24 bit file, level changed in sox,
> and compared, in a DAW, with a. File, level changed in the DAW,
> will only null to around -139 or so.

-139 in what encoding?

> I believe this is due to the way the different systems handle LSB
> when truncating the internal architecture (32bit float, 48bit integer etc )
> to 24 bit.

Possibly, but there might be other differences involved.
Do you know what _exactly_ is happening to the audio data
inside your DAW?

BTW, why are you truncating to 24 bit at all?
SoX works with 32bit internally, I think.

> Is there a better way of comparing 2  files in sox?

But it does compare them for you:
it tells you that the mixed diff has a max amplitude of zero.


------------------------------------------------------------------------------
DreamFactory - Open Source REST & JSON Services for HTML5 & Native Apps
OAuth, Users, Roles, SQL, NoSQL, BLOB Storage and External API Access
Free app hosting. Or install the open source package on any LAMP server.
Sign up and see examples for AngularJS, jQuery, Sencha Touch and Native!
http://pubads.g.doubleclick.net/gampad/clk?id=63469471&iu=/4140/ostg.clktrk
_______________________________________________
Sox-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/sox-users
Reply | Threaded
Open this post in threaded view
|

Re: Stat

Mew, Peter
A 24 bit file has a maximum dynamic range go 144 dB a 16 bit file has a max dynamic range of 96db (6db per bit)
I misunderstood that, in this case, volume is a multiplier not an addition (ie the volume that you need to add to reach peak coding)
I think I can get what I want from -n stats -b and extract the RMS Tr dB value

Thanks for all your help
-pm

Sent from my iPad

> On 14 Nov 2013, at 13:53, "Jan Stary" <[hidden email]> wrote:
>
>> On Nov 13 22:03:20, [hidden email] wrote:
>> 16 bit sources come from CD  source1 is from CD source2 is a copy of source1 that has been into a digital audio work station and out again.
>> 24 bit sources are A to D converted from analogue tape, with source2 going into DAW and out again
>> They are not the same data, but each pair of files has been treated in the same way
>> If I get a complete null of the 24 bit files,I would expect -n stat -v to yield 144 as the result
>> Likewise a perfect null on 2 16 bit files should result in 96
>
> Why do you expect 144? The -v number is, quote,
>
>    The parameter to the vol effect
>    which would make the audio as loud as possible
>    without clipping.
>
> How much can you multiply zero to avoid clipping? Times 144?
>
>> I have found in the past that a 24 bit file, level changed in sox,
>> and compared, in a DAW, with a. File, level changed in the DAW,
>> will only null to around -139 or so.
>
> -139 in what encoding?
>
>> I believe this is due to the way the different systems handle LSB
>> when truncating the internal architecture (32bit float, 48bit integer etc )
>> to 24 bit.
>
> Possibly, but there might be other differences involved.
> Do you know what _exactly_ is happening to the audio data
> inside your DAW?
>
> BTW, why are you truncating to 24 bit at all?
> SoX works with 32bit internally, I think.
>
>> Is there a better way of comparing 2  files in sox?
>
> But it does compare them for you:
> it tells you that the mixed diff has a max amplitude of zero.
>
>
> ------------------------------------------------------------------------------
> DreamFactory - Open Source REST & JSON Services for HTML5 & Native Apps
> OAuth, Users, Roles, SQL, NoSQL, BLOB Storage and External API Access
> Free app hosting. Or install the open source package on any LAMP server.
> Sign up and see examples for AngularJS, jQuery, Sencha Touch and Native!
> http://pubads.g.doubleclick.net/gampad/clk?id=63469471&iu=/4140/ostg.clktrk
> _______________________________________________
> Sox-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/sox-users
>

________________________________

“**Confidentiality**
The information contained in this e-mail is confidential, may be privileged and is intended solely for the use of the named addressee. Access to this e-mail by any other person is not authorised. If you are not the intended recipient, you should not disclose, copy, distribute, take any action or rely on it and you should please notify the sender by reply. Any opinions expressed are not necessarily those of the company.

We may monitor all incoming and outgoing emails in line with current legislation. We have taken steps to ensure that this email and attachments are free from any virus, but it remains your responsibility to ensure that viruses do not adversely affect you.
------------------------------------------------------------------------------
DreamFactory - Open Source REST & JSON Services for HTML5 & Native Apps
OAuth, Users, Roles, SQL, NoSQL, BLOB Storage and External API Access
Free app hosting. Or install the open source package on any LAMP server.
Sign up and see examples for AngularJS, jQuery, Sencha Touch and Native!
http://pubads.g.doubleclick.net/gampad/clk?id=63469471&iu=/4140/ostg.clktrk
_______________________________________________
Sox-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/sox-users