[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Writing to /dev/dsp in Perl



Try $ret = open (AUDIO, "|/dev/dsp");

On Wed, 2 Jul 1997, Shlomi Fish wrote:

> 
> I am trying to write a perl script that will play digital audio, so I want
> to open /dev/dsp (one of the digital audio character-devices in Linux) for
> output.
> However, both the
> $ret = open(AUDIO, '>/dev/dsp');
> and the
> $ret = sysopen(AUDIO, '/dev/dsp', O_WRONLY);       (*)
> calls return undef, which indicates that it failed. The '$!' error variable
> contains the string "Operation not permitted." after the function call.
> 
> The equivalent C code appears in the s3mod MOD tracker (available on
> sunsite) which runs fine with the same permissions as the perl script.
> 
> Is it possible that such calls fail if perl is running in debug mode (perl
> -d)?
> Is using PerlXS the only solution to perform this procedure?
> 
> 	Shlomi Fish
> 
> 
> 
> ----------------------------------------------------------
> Shlomi Fish                                Smart Link Ltd.
> Home: shlomif@ibm.net
> Work: shlomi@slink.co.il
> 
> The Bible dictates that "Thou shalt not seethe [=cook] a kid [= young goat]
> in his mother's milk." To avoid possibility of breaking that regulation,
> the Jewish tradition ruled that it also applies to female goats, to mature
> goats, and to the meat and milk of two completely unrelated goats. It is
> also forbidden to eat the meat with fresh milk, and it applies to beef and
> mutten as well (including mixing the milk and meat of two different
> beasts). Finally, chicken, which are incapable of milk production, may not
> be eaten along with any mammal's milk either. 
> 
> We are fortunate that most mathematicians were not Jewish. Otherwise, it
> would have been forbidden to divide by all numbers between -1 and 1.
> ----------------------------------------------------------
> 


Follow-Ups: References: