Here's a start on how it's done
#!/usr/bin/perl use Audio::DSP; #alsamixer must be setup right, just turn everything up :-) $|++; ($buf, $chan, $fmt, $rate) = (4096, 1, 16, 22050); #($buf, $chan, $fmt, $rate) = (4096, 1, AFMT_U16_LE, 44100); #use the formats from soundcard.h, plain 16 wont work with sblive $dsp = new Audio::DSP(buffer => $buf, channels => $chan, format => $fmt, rate => $rate); $dsp->init() || die $dsp->errstr(); # this buffers print to file so that you need ~ 10 secs of audio or t +he file is 0 # like when you hit control-c after a couple of seconds # open(OUT, "| speexenc -n --rate 22050 - test.spx "); ##this works for small low Q ogg open(OUT, "| oggenc -r -R 8000 -B 8 -C 1 -q 0 - | cat > zztest.ogg ") + or warn "No oggenc $!\n"; while ( $buffer = $dsp->dread(4096) ) { syswrite( OUT, $buffer, length($buffer) ); } $dsp->close(); # If you don't set the output of the dsp with arecord, or this # module, the dsp will go to it's lowest setting # speexenc --rate 8000 --le --8bit /dev/dsp - | cat > 1.spx # it works but it sounds lousy. # to convert to wave # sox -r 44100 -u -w -c 1 out1.raw out1.wav # arecord -f S16_LE -c1 -r 22050 -t wav -d 3600 -D hw:0,0 # | speexenc -n --rate 22.05 - - > /home/zentara/`date +%d%b%y%H +%M%S`.spx

I'm not really a human, but I play one on earth.
Old Perl Programmer Haiku

In reply to Re: reading sound input by zentara
in thread reading sound input by Baphi

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.