zentara has asked for the wisdom of the Perl Monks concerning the following question:
Does anyone know if this type of capture is possible?
#!/usr/bin/perl use warnings; use strict; use Audio::DSP; $|++; my ($buf, $chan, $fmt, $rate) = (4096, 1, 16, 22050); my $dsp = new Audio::DSP(buffer => $buf, channels => $chan, format => $fmt, rate => $rate); $dsp->init() || die $dsp->errstr(); #this method dosn't work #close STDOUT; #my $ogg_out = ''; #open STDOUT, '>', \$ogg_out, or die "Couldn't redirect STDOUT to $ogg +_out: $!"; #this will dump the encoded ogg to STDOUT my $pid = open(OGGIN, "| oggenc -Q -r -R 22050 --resample 8000 -C 1 -q + 2 - ") or warn "No oggenc $!\n"; #this will dump it to a file #my $pid = open(OGGIN, "| oggenc -Q -r -R 22050 --resample #8000 -C 1 +-q 2 - | cat > $0.ogg ") # or warn "No oggenc $!\n"; while (my $buffer = $dsp->dread(4096) ) { syswrite( OGGIN, $buffer, length($buffer) ); } # of course, cntrl-c out of the while loop never lets this print # but I include it to show what I'm after #print $ogg_out;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: capturing stdout from a piped open
by davidrw (Prior) on Aug 29, 2005 at 19:45 UTC | |
|
Re: capturing stdout from a piped open
by Joost (Canon) on Aug 29, 2005 at 20:22 UTC | |
|
Re: capturing stdout from a piped open
by izut (Chaplain) on Aug 30, 2005 at 11:35 UTC | |
by zentara (Cardinal) on Aug 30, 2005 at 14:01 UTC | |
|
Re: capturing stdout from a piped open
by zentara (Cardinal) on Aug 30, 2005 at 10:27 UTC |