On Tue, 21 Apr 2009, Tzafrir Cohen wrote:

> WAV is a pretty simple container format. The length is written in a very
> expected place in the header:
>
>  http://en.wikipedia.org/wiki/.wav
>  http://ccrma.stanford.edu/courses/422/projects/WaveFormat/
>
> E.g. the following:
>
> wav_size() {
>       LANG=C cut -b 41-44 "$1" | head -n 1 | hexdump -e "\"$1:"'$1: %u\n"' | 
> head -n 1
> }

Or:

        wav_size()
                {
                dd bs=1 count=4 if="$1" skip=40 2>/dev/null\
                        | hexdump -e "\"$1:"'$1: %u\n"'
                }

Or, if hexdump's "-s" did what the man page says it did:

        wav_size()
                {
                dd count=1 if="$1" 2>/dev/null\
                        | hexdump -s 40 -n 4 -e "\"$1:"'$1: %u\n"'
                }

but "-s" does a "seek" not a "skip" as documented thus seeking on stdin 
fails.

I always learn something new from Tzafrir's postings :)

I still haven't figured out the format string...

Thanks in advance,
------------------------------------------------------------------------
Steve Edwards      [email protected]      Voice: +1-760-468-3867 PST
Newline                                             Fax: +1-760-731-3000

_______________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users

Reply via email to