At urging of those who feel pear.dev is the wrong place to propose PECL
packages, I'm repeating my proposal here:
I'd like to propose two PECL extensions:
Description: Bindings for the Linux Open Sound System API.
Functions:
linux_oss_buffer() : Setup DSP buffer on /dev/dsp or similar device
linux_oss_channels() : Set DSP to process number of channels (mono vs.
stereo)
linux_oss_rate() : Set sampling rate on DSP device
linux_oss_format() : Set sample encoding 8/16 bit, signed/unsigned,
big/little endian
linux_oss_mixer_query() : Probe capabilities of mixer
linux_oss_mixer_vol() : Get/Set volume on mixer channel
linux_oss_mixer_source() : Get/Set recording source
Purpose: Control sound I/O on linux systems. Yes, this is platform
specific, but sound is a platform specific thing. I'll propose Windows
sound system bindings later, and ultimately bindings for Solaris and BSD as
I research them.
Requirements: PHP >= 4.3.0, Linux w/ OSS kernel module and headers
Description: OGG/Vorbis fopen wrapper.
ogg:// write - Encode PCM audio to OGG/Vorbis compressed audio.
ogg:// read - Decode OGG/Vorbis compressed audio to PCM.
Example Usage: .ogg player
<?php
dl('linux_oss.so');
dl('oggvorbis.so');
$input = fopen('ogg://mymusic.ogg', 'r');
$oggdata = stream_get_meta_data($input);
/* Chained OGGs will be added as subsequent numericly indexed subarrays of
wrapper_data */
$songdata = $oggdata['wrapper_data'][0];
$output = fopen('/dev/dsp', 'w');
linux_oss_buffer($output, 8192);
linux_oss_channels($output, $songdata['channels']);
/* AFMT_S16_LE is the default output mode of ogg:// wrapper.
It can also be set to encodings listed above via a context option. */
linux_oss_format($output, AFMT_S16_LE);
linux_oss_rate($output, $songdata['rate']);
$mixer = fopen('/dev/mixer', 'w');
/* Master Volume L / R */
linux_oss_mixer_vol($mixer, MIXER_VOLUME, 100, 100);
/* DSP Output Volume L / R */
linux_oss_mixer_vol($mixer, MIXER_PCM, 100, 100);
stream_copy_to_stream($input, $output);
fclose($mixer);
fclose($output);
fclose($intput);
?>
Requirements: PHP >= 4.3.0, libogg, libvorbis (both governed by BSD style
licenses)
As mentioned on irc.. - the linux_oss are mostly ioctl calls, which
might be worth adding as a generic routine to ext/dio like dio_fctl...
however.. - it may be a rather large switch statement to deal with all
the various type of inputs... that ioctl accepts...
Anyone else want to add thoughts on that..
Regards
Alan
pollita@php.net wrote:
At urging of those who feel pear.dev is the wrong place to propose PECL
packages, I'm repeating my proposal here:
I'd like to propose two PECL extensions:
Description: Bindings for the Linux Open Sound System API.
Functions:
linux_oss_buffer() : Setup DSP buffer on /dev/dsp or similar device
linux_oss_channels() : Set DSP to process number of channels (mono vs.
stereo)
linux_oss_rate() : Set sampling rate on DSP device
linux_oss_format() : Set sample encoding 8/16 bit, signed/unsigned,
big/little endian
linux_oss_mixer_query() : Probe capabilities of mixer
linux_oss_mixer_vol() : Get/Set volume on mixer channel
linux_oss_mixer_source() : Get/Set recording sourcePurpose: Control sound I/O on linux systems. Yes, this is platform
specific, but sound is a platform specific thing. I'll propose Windows
sound system bindings later, and ultimately bindings for Solaris and BSD as
I research them.Requirements: PHP >= 4.3.0, Linux w/ OSS kernel module and headers
Description: OGG/Vorbis fopen wrapper.
ogg:// write - Encode PCM audio to OGG/Vorbis compressed audio.
ogg:// read - Decode OGG/Vorbis compressed audio to PCM.
Example Usage: .ogg player
<?php
dl('linux_oss.so');
dl('oggvorbis.so');$input = fopen('ogg://mymusic.ogg', 'r');
$oggdata = stream_get_meta_data($input);/* Chained OGGs will be added as subsequent numericly indexed subarrays of
wrapper_data */
$songdata = $oggdata['wrapper_data'][0];$output = fopen('/dev/dsp', 'w');
linux_oss_buffer($output, 8192);
linux_oss_channels($output, $songdata['channels']);
/* AFMT_S16_LE is the default output mode of ogg:// wrapper.
It can also be set to encodings listed above via a context option. */
linux_oss_format($output, AFMT_S16_LE);
linux_oss_rate($output, $songdata['rate']);$mixer = fopen('/dev/mixer', 'w');
/* Master Volume L / R */
linux_oss_mixer_vol($mixer, MIXER_VOLUME, 100, 100);/* DSP Output Volume L / R */
linux_oss_mixer_vol($mixer, MIXER_PCM, 100, 100);stream_copy_to_stream($input, $output);
fclose($mixer);
fclose($output);
fclose($intput);
?>Requirements: PHP >= 4.3.0, libogg, libvorbis (both governed by BSD style
licenses)
--
Can you help out?
Need Consulting Services or Know of a Job?
http://www.akbkhome.com
At urging of those who feel pear.dev is the wrong place to propose PECL
packages, I'm repeating my proposal here:
should i remove safely my pecl.dev newsgroup node ;)?
anyway +1 for both (mean, i'll make use both extensions; there is no
claiming here that my voice realy considerable).
--
moshe