Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

How to record audio file?

by redss (Monk)
on Jan 19, 2013 at 20:05 UTC ( #1014232=perlquestion: print w/ replies, xml ) Need Help??
redss has asked for the wisdom of the Perl Monks concerning the following question:

What perl library can I use to record an audio file from the microphone input in perl?

Comment on How to record audio file?
Re: How to record audio file?
by roboticus (Canon) on Jan 19, 2013 at 20:42 UTC

    redss:

    One compatible with your computer, operating system, microphone input device and version of perl.

    Try looking on http://cpan.org for one.

    ...roboticus

    When your only tool is a hammer, all problems look like your thumb.

      Sorry, I forgot to mention that this is for Windows. I had already looked on CPAN but couldn't find a library. I'm sure what I need is there but would like a recommendation

      I'd like to be able to initiate and terminate the recording of an audio file from within perl. thanks!

        redss:

        I see what you mean. I just looked, and while I found Win32::Sound, it was only for playing sounds. You may have to use Win32::API and connect directly to the Windows sound API to do your recording.

        ...roboticus

        When your only tool is a hammer, all problems look like your thumb.

Re: How to record audio file?
by Lotus1 (Chaplain) on Jan 19, 2013 at 21:54 UTC

    I did a google search for 'perl win32 record audio' and the first hit was to Win32::SoundRec which looks like it is what you want.

      This is pretty much what I was looking for, thanks for the tip. It has very high level api calls but unfortunately, the MCI library seems limited as for how much I can configure the soundcard I'm recording from (audio is recorded too low with too much noise), so I guess I have to keep looking for a more robust customizable audio library API. I found that audacity uses the portaudio api, but the perl module to access that is too low level for me at this point.

        How will the recording level affect the amount of noise?

        I was going to test this module but found it won't install due to missing dependancies on CPAN.

        ress, i didn't use Win32::SoundRec yet.

        But from the manual:

        record([$bitspersample, $samplespersec, $channels])
        ...The three parameters are optional. $bitspersample defaults to 8, $samplespersec defaults to 11025, $channels defaults to 1.

        Even cheaper cards have up to 24Bit/96kHz. Did you try?

        And perhaps using a preamp/mixer?

        Regards, Karl

        «The Crux of the Biscuit is the Apostrophe»

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1014232]
Approved by ww
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (9)
As of 2014-08-21 05:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (127 votes), past polls