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

On Linux, I'm attempting to process some sound inputed through the line in jack on my computer. The goal is to be able to determine if the first 5 seconds of a song played through this jack match what I specify. I spent some time on cpan, but was unable to find any modules that looked like they could accomplish this.

Replies are listed 'Best First'.
Re: Process Sound
by zentara (Cardinal) on Aug 17, 2007 at 15:27 UTC
    You are asking for a very complicated procedure, to be nicely encapsulated into a simple to use module. Nope..... we are not that advanced yet...... maybe Spock's Tricorder can do it. :-)

    If you want to try, here are the steps you will need to do.

    1. You will need to run alsactl (through system or a piped open) to make sure your input is set to Linein (as opposed to Mic). It would go something like this:

    #setup a shell thru IPC to carry out different # mixer control commands my $pidcon = open3(\*CON,0,0,'/bin/sh'); # ...... ..... snip ...... #set Line as input print CON "amixer sset Line Capture cap\n";

    2. Then you need to record 5 seconds of input:

    3. Then once you have that input, you can compare it with a FFT (Fast Fourier Transform) to the 5 seconds of song. See PDL::Audio and Re: Manipulating Audio Data in Perl

    Finally, you have about 3 months of work to perfect this. If you get it to work, the Dept. of Homeland Security probably would give you a job in it's voice analysis unit. :-)


    I'm not really a human, but I play one on earth. Cogito ergo sum a bum
Re: Process Sound
by archfool (Monk) on Aug 17, 2007 at 15:56 UTC
    Doesn't SDL provide sound input/output access? SDL::Mixer and/or SDL::Sound, no?
      Yes SDL does, but if IIRC, it dosn't record, nor does it do any sort of comparison.... you need Audio::DSP and PDL::FFT for that.

      I'm not really a human, but I play one on earth. Cogito ergo sum a bum
Re: Process Sound
by Anonymous Monk on Aug 18, 2007 at 11:33 UTC
Re: Process Sound
by Anonymous Monk on Aug 18, 2007 at 11:33 UTC
Re: Process Sound
by Anonymous Monk on Aug 18, 2007 at 11:37 UTC
Re: Process Sound
by zentara (Cardinal) on Aug 23, 2007 at 11:57 UTC