Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

I'm wanting to split one .wav file into several 10 second ones... Any one know the proper module(s) I should use? Many thanks in advance.

Replies are listed 'Best First'.
Re: Splitting Wave Files
by Zaxo (Archbishop) on Apr 26, 2004 at 04:02 UTC

    A CPAN search coughed up Audio::Wav right away, but it failed its test suite for me.

    Encoding and decoding wav files is a splendid way to learn pack/unpack, however. You will have difficulty if you hit exotic or proprietary compression formats.

    After Compline,
    Zaxo

Re: Splitting Wave Files
by toma (Vicar) on Apr 26, 2004 at 07:29 UTC
    You should use sox. There is no CPAN sox module as far as I can tell, but it wouldn't be too hard to write one.

    Sox is a command line tool for manipulating audio files. It has a trim function that can be used to split audio files.

    Sox is fast. The fastest perl module for audio that I know of is Audio::Data, but it works on .au files not .wav. You can convert between these formats with sox. But once you have sox you won't need Audio::Data anyway.

    It should work perfectly the first time! - toma
Re: Splitting Wave Files
by cyocum (Curate) on Apr 26, 2004 at 10:16 UTC

    This is a non-perl solution but you could use Audacity, which is a free open source sound file editor. It seems pretty nifty to me.

Re: Splitting Wave Files
by zentara (Cardinal) on Apr 26, 2004 at 14:12 UTC
    A few apps to do this have been popping up on freshmeat.net. This one seems nice WavBreaker

    And there is a commandline wavsplit


    I'm not really a human, but I play one on earth. flash japh