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:
#!/usr/bin/perl use Audio::DSP; #alsamixer must be setup right, just turn everything up :-) ($buf, $chan, $fmt, $rate) = (4096, 1, 16 , 8000); $dsp = new Audio::DSP(buffer => $buf, channels => $chan, format => $fmt, rate => $rate); $seconds = 5; $length = ($chan * $fmt * $rate * $seconds) / 8; $dsp->init() || die $dsp->errstr(); open(OUT, ">out.raw") or warn $!; # Record x seconds of sound for (my $i = 0; $i < $length; $i += $buf) { $dsp->read() || die $dsp->errstr(); print OUT $dsp->data(); } $dsp->close();
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. :-)
In reply to Re: Process Sound
by zentara
in thread Process Sound
by Cheater
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |