Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister

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?

Replies are listed 'Best First'.
Re: How to record audio file?
by Lotus1 (Curate) 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»

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


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

    Try looking on for one.


    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!


        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.


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

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1014232]
Approved by ww
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (6)
As of 2018-06-21 19:13 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (118 votes). Check out past polls.