Macro | 1 Dec 2008 11:20
Picon

Why the soxi is not work?

I compile the sox with the following configuration:

./configure --prefix=/usr --enable-shared --without-magic
make && make install

Now, I can use the sox to edit mp3,mp4 and so on.
But when I type the command:
soxi -t 111.wav
or
soxi -d 111.wav

It's display a help content which is same with "sox --help".
How can I run the command correctly?

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Sox-users mailing list
Sox-users <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sox-users
Michael Bolton | 2 Dec 2008 20:06
Picon
Favicon

help trying to diagnose 0 samples output problem with reverse

I'm using SoX 14.0.0 on a CentOS release 4.5 (Final) machine and when I attempt to reverse an MP3 and write it
as WAV, file, no samples are written.  The only thing in the output is a single WAV (RIFF) header.  When I try
the command with MP3 -> MP3, I get the same behavior but with a single MP3 header in the output.

I tried the same thing on an Ubuntu 8.04.1 machine using the same version of SoX (14.0.0) with the same inputs
and the WAV file is properly written.  It must be a difference between the two environments but I haven't
been able to find from SoX or otherwise diagnose why no samples are written in one case but are in the other.

I've pasted the two test cases below (first is CentOS, second is Ubuntu for comparison).

Also is there a more effective way to truncate a file than using a "reverse trim NNN reverse" pipeline?

$ cat test.mp3 | sox -V4 -t mp3 - -t wav out.wav reverse
sox: SoX v14.0.0

Input File     : '-' (mp3)
Sample Size    : 16-bit (2 bytes)
Sample Encoding: MPEG audio (layer I, II or III)
Channels       : 2
Sample Rate    : 44100
Endian Type    : little
Reverse Nibbles: no
Reverse Bits   : no

sox wav: Do not support MPEG audio (layer I, II or III) with 16-bit data.  Forcing to Signed.
sox wav: Writing Wave file: Microsoft PCM format, 2 channels, 44100 samp/sec
sox wav:         176400 byte/sec, 4 block align, 16 bits/samp

Output File    : 'out.wav'
Sample Size    : 16-bit (2 bytes)
Sample Encoding: signed (2's complement)
Channels       : 2
Sample Rate    : 44100
Endian Type    : little
Reverse Nibbles: no
Reverse Bits   : no
Comment        : 'Processed by SoX'

sox sox: effects chain: input      44100Hz 2 channels 16 bits (multi)
sox sox: effects chain: reverse    44100Hz 2 channels 16 bits 
sox sox: effects chain: output     44100Hz 2 channels 16 bits (multi)
sox wav: Finished writing Wave file, 0 data bytes 0 samples
$ strings out.wav
RIFF$
WAVEfmt 
data
$ du -b out.wav 
44    out.wav
$ ldd /usr/local/bin/sox
    libsox.so.0 => /usr/local/lib/libsox.so.0 (0x0064e000)
    libsfx.so.0 => /usr/local/lib/libsfx.so.0 (0x003c4000)
    libmad.so.0 => /usr/local/lib/libmad.so.0 (0x002da000)
    libmp3lame.so.0 => /usr/local/lib/libmp3lame.so.0 (0x00e6e000)
    libm.so.6 => /lib/tls/libm.so.6 (0x00111000)
    libc.so.6 => /lib/tls/libc.so.6 (0x0019d000)
    /lib/ld-linux.so.2 (0x0017f000)

It was created by SoX configure 14.0.0, which was
generated by GNU Autoconf 2.61.  Invocation command line was

  $ ./configure --prefix=/usr/local --with-mad --with-lame

$ cat test.mp3 | sox -V4 -t mp3 - -t wav out.wav reverse 
sox: SoX v14.0.0

Input File     : '-' (mp3)
Sample Size    : 16-bit (2 bytes)
Sample Encoding: MPEG audio (layer I, II or III)
Channels       : 2
Sample Rate    : 44100
Endian Type    : little
Reverse Nibbles: no
Reverse Bits   : no

sox wav: Do not support MPEG audio (layer I, II or III) with 16-bit data.  Forcing to Signed.
sox wav: Writing Wave file: Microsoft PCM format, 2 channels, 44100 samp/sec
sox wav:         176400 byte/sec, 4 block align, 16 bits/samp

Output File    : 'out.wav'
Sample Size    : 16-bit (2 bytes)
Sample Encoding: signed (2's complement)
Channels       : 2
Sample Rate    : 44100
Endian Type    : little
Reverse Nibbles: no
Reverse Bits   : no
Comment        : 'Processed by SoX'

sox sox: effects chain: input      44100Hz 2 channels 16 bits (multi)
sox sox: effects chain: reverse    44100Hz 2 channels 16 bits 
sox sox: effects chain: output     44100Hz 2 channels 16 bits (multi)
sox wav: Finished writing Wave file, 45088768 data bytes 11272192 samples

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
robs | 3 Dec 2008 18:36
Picon
Favicon

Re: help trying to diagnose 0 samples output problem with reverse

--- On Tue, 2/12/08, Michael Bolton <sndprctst <at> yahoo.com> wrote:
> I'm using SoX 14.0.0 on a CentOS release 4.5 (Final)
> machine and when I attempt to reverse an MP3 and write it as
> WAV, file, no samples are written.  The only thing in the
> output is a single WAV (RIFF) header.

Weird.  It's obviously a bug, but I can't reproduce it here (with 14.0.0).  Maybe the bug has since been
fixed---can you try 14.2.0?
If so, and you still see the problem do you see a similar problem if you replace the reverse effect with the
norm effect?

> Also is there a more effective way to truncate a file than
> using a "reverse trim NNN reverse" pipeline?

With 14.2.0, there are a couple of other options, e.g.:
  sox infile outfile trim 0 0 NNNN
if the length of infile can be determined from its header, or
  sox infile outfile trim 0 LLLL NNNN
where LLLL is the length of the audio, determined perhaps using `stat'.

Hope this helps,
Rob

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
robs | 3 Dec 2008 19:12
Picon
Favicon

Re: Why the soxi is not work?

--- On Mon, 1/12/08, Macro <macro776 <at> gmail.com> wrote:
> I compile the sox with the following configuration:
> 
> ./configure --prefix=/usr --enable-shared --without-magic
> make && make install
> 
> Now, I can use the sox to edit mp3,mp4 and so on.
> But when I type the command:
> soxi -t 111.wav
> or
> soxi -d 111.wav
> 
> It's display a help content which is same with
> "sox --help".

Another weird one :)
Please check (and post if necessary) the output of:
  ls -l `which soxi`
and
  ls -l `which sox`

/Rob

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
AlgoMantra | 4 Dec 2008 06:39
Picon

Recording /dev/dsp script output

Dear All -

I have a c script that when executed makes weird sounds
by feeding numerical arrays to /dev/dsp as the output. I'm
on Ubuntu 8.04. I want to record some of these suounds using
sox, like...by feeding the output to sox instead of the speakers.

What's the most efficient way of achieving this? I'll appreciate
any help in this...

thanks,
fadereu

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Sox-users mailing list
Sox-users <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sox-users
Chris Bagwell | 4 Dec 2008 19:53

Re: help trying to diagnose 0 samples output problem with reverse

robs wrote:
> --- On Tue, 2/12/08, Michael Bolton <sndprctst <at> yahoo.com> wrote:
>   
>> I'm using SoX 14.0.0 on a CentOS release 4.5 (Final)
>> machine and when I attempt to reverse an MP3 and write it as
>> WAV, file, no samples are written.  The only thing in the
>> output is a single WAV (RIFF) header.
>>     
>
> Weird.  It's obviously a bug, but I can't reproduce it here (with 14.0.0).  Maybe the bug has since been
fixed---can you try 14.2.0?
> If so, and you still see the problem do you see a similar problem if you replace the reverse effect with the
norm effect?
>   
My only guess is to check /tmp has enough disk space to handle to store 
a temporary file that is at least 2 times the size of the uncompressed 
WAV file and that local directory has enough space to store WAV file.  
There is a comment in 14.1.0 ChangeLog that says something about fixing 
ungraceful handling of out of disk space.  That would explain why no 
error messages printed.

>   
>> Also is there a more effective way to truncate a file than
>> using a "reverse trim NNN reverse" pipeline?
>>     
>
> With 14.2.0, there are a couple of other options, e.g.:
>   sox infile outfile trim 0 0 NNNN
> if the length of infile can be determined from its header, or
>   sox infile outfile trim 0 LLLL NNNN
> where LLLL is the length of the audio, determined perhaps using `stat'.
>
>   
First option is the best and 2nd option is pretty good because its 
scanning over audio in a format much more compact then "reverse" does.  
Here is a 3rd option that may or may not be faster then the second 
option above.  With 14.2.0, if you know that all your audio files will 
be at least some minimum size then you can copy over that amount before 
performing reverse and so not have to unreverse so much of the audio 
file.  For example, if audio will always be at least 1 minute:

sox infile.mp3 out.wav trim 0 1:00 : reverse trim NNN reverse

Chris

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
robs | 4 Dec 2008 19:54
Picon
Favicon

Re: Recording /dev/dsp script output

--- On Thu, 4/12/08, AlgoMantra <algomantra <at> gmail.com> wrote:
> on Ubuntu 8.04. I want to record some of these suounds
> using
> sox, like...by feeding the output to sox instead of the
> speakers.

If your program can send its data to stdout, try something like:

  your_program | sox -s -2 -c 1 -r 16000 -t raw - sounds.wav

/Rob

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
Chris Bagwell | 4 Dec 2008 19:37

Re: Why the soxi is not work?

robs wrote:
> --- On Mon, 1/12/08, Macro <macro776 <at> gmail.com> wrote:
>   
>> I compile the sox with the following configuration:
>>
>> ./configure --prefix=/usr --enable-shared --without-magic
>> make && make install
>>
>> Now, I can use the sox to edit mp3,mp4 and so on.
>> But when I type the command:
>> soxi -t 111.wav
>> or
>> soxi -d 111.wav
>>
>> It's display a help content which is same with
>> "sox --help".
>>     
>
> Another weird one :)
> Please check (and post if necessary) the output of:
>   ls -l `which soxi`
> and
>   ls -l `which sox`
>
> /Rob      
I am seeing something similar on Fedora 10 box.  Once you find which 
executable is running from above command,  make sure its executing the 
sox you installed.  If not, you can further verify if your seeing the 
same thing I am by running:

ldd /path/to/bin/soxi

Does that show /path/to/soxi is also using similar /path/to/lib/libsox.so?

What was happening on my box is that I installed sox into /usr/local and 
also had /usr/local/lib in my /etc/ld.so.conf.  If I execute 
/usr/bin/sox it would use /usr/local/lib/libsox.so mistakenly.

Fedora is using a snapshot of SoX thats about 2 days before I fixed the 
bug were we were mistakenly using libc getopt().  So /usr/bin/sox was 
half using libc's getopt() and half using libsox.so getopt().

My solution was to remove /usr/local/lib from my ld.so.conf file because 
I don't really need that right now (because most things like with rpath; 
including sox).  If thats not an option then just always specify the 
path to the sox install path when you execute it and hope nothing else 
references /usr/bin/{sox|soxi|play|rec}.

As distributions upgrade to latest SoX, this will not be a probably any 
more.

Chris

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
AlgoMantra | 5 Dec 2008 02:48
Picon

Re: Recording /dev/dsp script output



On Fri, Dec 5, 2008 at 12:24 AM, robs <aquegg <at> yahoo.co.uk> wrote:
--- On Thu, 4/12/08, AlgoMantra <algomantra <at> gmail.com> wrote:
> on Ubuntu 8.04. I want to record some of these suounds
> using
> sox, like...by feeding the output to sox instead of the
> speakers.

If your program can send its data to stdout, try something like:

 your_program | sox -s -2 -c 1 -r 16000 -t raw - sounds.wav

Thanks....I tried this....but the program plays the sounds (i can hear it) and then exits
as usual, leaving an empty file called sounds.wav

Just to clarify what the program is doing, I'm pasting it below.....

----------------------------------------

#include <math.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/ioctl.h>
#include <linux/soundcard.h>
#include <stdio.h>

void doomsday(int day,unsigned short int foo[]);

int main(void) {
    unsigned short int zap[44100];
    int c; int out; int f=150;
    out=open("/dev/dsp", O_WRONLY);
    c=16;
    ioctl(out, SOUND_PCM_WRITE_BITS, &c);
    c=1;
    ioctl(out,SOUND_PCM_WRITE_CHANNELS, &c);
    c=44100;
    ioctl(out,SOUND_PCM_WRITE_RATE, &c);
    doomsday(f,zap);
    for(c=0;c<4;c++){        
        write(out, zap, sizeof(zap));
        }
    close(out);
        return c;
}

void doomsday(int day,unsigned short int foo[])
{
   int n,m,z,c;
   for (m=1;m<1471;m++){
       c=0;
    for(n=1;n<16;n=n++){
          foo[m*n] = 10000*sin(day*2*M_PI*(m*n)/44100);
          }
    z=m*n;
    for (n=16;n<30;n++){
        foo[m*n] = foo[z-c];
        c=c++;
       }
    }
}

----------------------------------------------------------------------------
------------------------------------------------------------------------------
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you.  Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
_______________________________________________
Sox-users mailing list
Sox-users <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sox-users
Chris Bagwell | 5 Dec 2008 16:54

Re: Recording /dev/dsp script output

AlgoMantra wrote:
>
>
> On Fri, Dec 5, 2008 at 12:24 AM, robs <aquegg <at> yahoo.co.uk 
> <mailto:aquegg <at> yahoo.co.uk>> wrote:
>
>
>     If your program can send its data to stdout, try something like:
>
>      your_program | sox -s -2 -c 1 -r 16000 -t raw - sounds.wav
>
>
> Thanks....I tried this....but the program plays the sounds (i can hear 
> it) and then exits
> as usual, leaving an empty file called sounds.wav
>
> Just to clarify what the program is doing, I'm pasting it below.....
>
In your program, get rid of all the open() calls and ioctl() calls.   
Add "out = 1" at the top to point to stdout.  Recompile and run like 
this (just changed rate option from above since your using 44100):

your_program | sox -t raw -s -2 -r 44100 - sounds.wav

Chris

------------------------------------------------------------------------------
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you.  Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/

Gmane