David Graff | 1 Sep 2005 14:42
Favicon

Re: sound file interrogation: length of play


mytofi <at> hotmail.com said:
> I am a software developer and am looking for a way to query a sound file
> (ie: wav or au) to see how long it will take to play the sound file.  My
> work is on a Linux system, thus I have been looking at sox, but don't see
> anything obvious, and don't see anything after looking it over a bit. 

This command line will spit out a summary of header contents on stderr:

  sox -V file.name -e

Here's a sample of output for a .wav file:

 sox: Detected file format type: wav

 sox: WAV Chunk fmt 
 sox: WAV Chunk data
 sox: Reading Wave file: Microsoft PCM format, 1 channel, 8000 samp/sec
 sox:         16000 byte/sec, 2 block align, 16 bits/samp, 72116 data bytes
 sox: Input file sw02015-A0008.wav: using sample rate 8000
         size shorts, encoding signed (2's complement), 1 channel

And for a .au file:

 sox: Detected file format type: au

 sox: Found Sun/NeXT magic word
 sox: Input file 1552.au: using sample rate 20000
        size shorts, encoding signed (2's complement), 1 channel

(Continue reading)

David Graff | 1 Sep 2005 18:08
Favicon

Re: sound file interrogation: length of play


mytofi <at> hotmail.com said:
> I looked further into sox and found the "-e stat" option and noticed
> that it yielded a list of attributes, one of which was the length in
> seconds.

Bear in mind that "-e stat"  entails reading the entire data file, to work
out all the information it presents.  If you're going to use the overall
amplitude information as well as duration, then this is a good way to go.

But if all you want to know is the duration, and you need to deal with lots
of very large data files, you might prefer to look up the header specs and
work out the function (which would be quite simple) to compute duration
based on header data and file size -- it'll save a lot of runtime.

(Then again, if runtime doesn't matter, "-e stat" is fine.)

	Dave Graff

-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
none none | 1 Sep 2005 17:44
Picon
Favicon

Re: sound file interrogation: length of play

Dave,

Thanks for the quick suggestion - however, shortly after I sent my email 
out, I looked further into sox and found the "-e stat" option and noticed 
that it yielded a list of attributes, one of which was the length in 
seconds.  This worked for both au and wav files.  (I used it without the -V 
option.)  months agoi, I went digging into sox, and did not find anything, 
but ehn, after a few minutes the other day, i found the "-e stat" and life 
was good :)

(FYI - I was on a RedHat E3 system.)

Thanks again,

Tom

>From: David Graff <graff <at> ldc.upenn.edu>
>To: "none none" <mytofi <at> hotmail.com>
>CC: sox-users <at> lists.sourceforge.net
>Subject: Re: [SoX-users] sound file interrogation: length of play Date: 
>Thu, 01 Sep 2005 08:42:52 -0400
>
>
>mytofi <at> hotmail.com said:
> > I am a software developer and am looking for a way to query a sound file
> > (ie: wav or au) to see how long it will take to play the sound file.  My
> > work is on a Linux system, thus I have been looking at sox, but don't 
>see
> > anything obvious, and don't see anything after looking it over a bit.
>
(Continue reading)

none none | 2 Sep 2005 22:24
Picon
Favicon

Re: sound file interrogation: length of play

Dave,

Good to know.  Luckily, a large majority of the files I will be dealing with 
are less than one second long, and thus pretty small.

Thanks again,

Tom

>From: David Graff <graff <at> ldc.upenn.edu>
>To: "none none" <mytofi <at> hotmail.com>
>CC: sox-users <at> lists.sourceforge.net, graff <at> ldc.upenn.edu
>Subject: Re: [SoX-users] sound file interrogation: length of play Date: 
>Thu, 01 Sep 2005 12:08:13 -0400
>
>
>mytofi <at> hotmail.com said:
> > I looked further into sox and found the "-e stat" option and noticed
> > that it yielded a list of attributes, one of which was the length in
> > seconds.
>
>Bear in mind that "-e stat"  entails reading the entire data file, to work
>out all the information it presents.  If you're going to use the overall
>amplitude information as well as duration, then this is a good way to go.
>
>But if all you want to know is the duration, and you need to deal with lots
>of very large data files, you might prefer to look up the header specs and
>work out the function (which would be quite simple) to compute duration
>based on header data and file size -- it'll save a lot of runtime.
>
(Continue reading)

Chris Bagwell | 11 Sep 2005 03:47

Re: Re: Bug#306005: sox: resampling sometimes changes playback length

Thanks for forwarding this Guenter... Wanted to reply to the mailing 
list about it.

I've found and fixed the problem in CVS.   It will effect anyone working 
with mono files and using the -r and -c options together on the output 
file.  If this effects you, you may wish to switch to CVS version until 
a new release is out.

Chris

Geiger Guenter wrote:

>Hi, 
>
>I am forwarding this to the upstream mailing list, so that the sox
>developers know about the problem. It is very likely that this is
>not Debian specific. Thanks for reporting, hope we can find a
>fix for your problem.
>
>Guenter
>
>On Sat, Apr 23, 2005 at 10:32:59PM +0800, Michael Deegan wrote:
>  
>
>>Package: sox
>>Version: 12.17.7-2
>>Severity: normal
>>
>>I pipe all my system beeps through sox as a workaround for ALSA getting it
>>wrong on 8-bit sounds. However recently I noticed (on a machine I don't use
(Continue reading)

Chris Bagwell | 13 Sep 2005 02:05

Re: interactive sox

Hi Rafal!

Sorry to ignore your email for so long.  Its been difficult for me to 
find time to look at large patches.

I like your patch and will try to incorporate it into sox soon.  Please 
forward any updates if you've made them since this original email.  I've 
been wanting similar interactive support so I could do things like fast 
forward threw songs or skip to next song when I'm playing them with sox.

Anyways, the only questionable part is in the util.c file were you print 
to a buffer for things like  st_fail().  I like the concept alot but I 
need to generalize it (for example, just rename the flag from dointeract 
to do_buffer_error_messages or something equally nuetral).

For the interactive.c file, I'm not real concerned on what it looks like 
or does at first.  I'll consider it experiemental for a while so it can 
get some design review on what best interface people would like.

Thanks again for your work,
Chris

Rafal Maszkowski wrote:

>Hi soxers!
>
>I need an interactive sound player playing with variable speed. For some time I
>was using alsaplayer and sox in batch mode. Unfortunately alsaplayer does not
>scale the pitch while playing with changed speed. Sox does scale it with
>stretch  command but is not interactive. I do not know about any other players
(Continue reading)

Chris Bagwell | 15 Sep 2005 00:47

SoX progress indication

Hi all,

I've commited to CVS a first round at displaying information while 
processing audio files.  I'd like to get feedback from people on it.  
Normally, you'll have to add the "-S" option to the command line to see 
it but when playing to audio devices, it will be auto enabled (seeing 
song status is the main reason I wanted to add this).

Sample output (you'll notice I borrowed from ogg123 heavily):

./sox monkey.wav -t ossdsp /dev/dsp

Input Filename : monkey.wav
Sample Size    : 8-bits
Sample Encoding: u-law
Channels       : 1
Sample Rate    : 8012

Time: 00:00.21 [00:00.00] of 00:00.21 ( 100.0%) Output Buffer:     1K

Done.

Chris

-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download
it for free - -and be entered to win a 42" plasma tv or your very own
Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
(Continue reading)

Kevin Cosgrove | 15 Sep 2005 00:59

Re: SoX progress indication


On 14 September 2005 at 17:47, Chris Bagwell <chris <at> cnpbagwell.com> wrote:

> I've commited to CVS a first round at displaying information while 
> processing audio files.  I'd like to get feedback from people on it.  
> Normally, you'll have to add the "-S" option to the command line to see 
> it but when playing to audio devices, it will be auto enabled (seeing 
> song status is the main reason I wanted to add this).
> 
> Sample output (you'll notice I borrowed from ogg123 heavily):
> 
> ./sox monkey.wav -t ossdsp /dev/dsp
> 
> Input Filename : monkey.wav
> Sample Size    : 8-bits
> Sample Encoding: u-law
> Channels       : 1
> Sample Rate    : 8012
> 
> Time: 00:00.21 [00:00.00] of 00:00.21 ( 100.0%) Output Buffer:     1K
> 
> Done.

Looks great to me....

 
--
Kevin

-------------------------------------------------------
(Continue reading)

Jimen Ching | 15 Sep 2005 08:24
Favicon

Re: SoX progress indication

On Wed, 14 Sep 2005, Chris Bagwell wrote:
>./sox monkey.wav -t ossdsp /dev/dsp
>
>Input Filename : monkey.wav
>Sample Size    : 8-bits
>Sample Encoding: u-law
>Channels       : 1
>Sample Rate    : 8012
>
>Time: 00:00.21 [00:00.00] of 00:00.21 ( 100.0%) Output Buffer:     1K

Nice...

--jc
--

-- 
Jimen Ching (WH6BRR)      jching <at> flex.com     wh6brr <at> uhm.ampr.org

-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download
it for free - -and be entered to win a 42" plasma tv or your very own
Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
Tommi Viitanen | 17 Sep 2005 02:58
Picon
Picon

noise

I'v done recording with the same microphone and sound card with !)Audacity 
2)Sox. With Audacity there is no noise but with sox there is noise. Probably 
there is some option or effect to take the noise off. I have found  the 
system: noiseprof [profile-file] and noisered profile-file [threshold]. Any 
idea if this kind of filter is automatically in the Audacity.

Is the noisefilter based on the idea:
sample rate conversion:
http://leute.server.de/wilde/resample.html 
?

Or is the idea somehow increase the sound  level, so the co-product is of 
course the increased background noise.

Tommi

--

-- 
Tommi Viitanen
Rehtorinpellonkatu 4 C 701
20500 Turku
p. 0440437191

-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download
it for free - -and be entered to win a 42" plasma tv or your very own
Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php

Gmane