Mailing List Archive

www.netbsd.se

Plan9


List view - Thread view


Subject: [inferno-list] devaudio for Linux

From: Salva Peiró

Date: 2006-10-16 10:49:44


hi,
i've began to think how to implement an audio device for Linux,
i've taken a look at both Nt and Solaris implementations and was
going to do something similar: the alternatives afaik are OSS or ALSA;
after taking a look at ALSA i've thought that it would be easier
and enougth for my needs, to use OSS (probably through the ALSA emulation layer)

Has anyone tried this before? or there are any considerations
or suggestions before i start?

thanks in advance.

-- 
gualteri (at) rootshell.be/~gualteri

From: Russ Cox

Date: 2006-10-16 13:10:06


Using the audio device on Linux is pretty straightforward.
You should be able to use something like
http://cvs.pdos.csail.mit.edu/cvs/drawt … xt%2Fplain

Russ

From: Salva Peiró

Date: 2006-10-16 17:24:02


Thanks, once i have something presentable, i'll report back.

On 10/16/06, Russ Cox  wrote:
> Using the audio device on Linux is pretty straightforward.
> You should be able to use something like
> \ 
http://cvs.pdos.csail.mit.edu/cvs/drawt … xt%2Fplain
>
> Russ
>

-- 
gualteri (at) rootshell.be/~gualteri

From: Salva Peiró

Date: 2006-10-23 21:58:17


Attachments:
That's my first working attempt to use devaudio under Linux.
I've been using it with Linux and the Linux-fb port made by Alexander Sychev.

On 10/16/06, Salva Peiró  wrote:
> Thanks, once i have something presentable, i'll report back.
>
> On 10/16/06, Russ Cox  wrote:
> > Using the audio device on Linux is pretty straightforward.
> > You should be able to use something like
> > \ 
http://cvs.pdos.csail.mit.edu/cvs/drawt … xt%2Fplain
> >
> > Russ
> >
>
> --
> gualteri (at) rootshell.be/~gualteri
>


-- 
gualteri (at) rootshell.be/~gualteri

From: Alexander Sychev

Date: 2006-10-24 14:05:56


Hi!

I have compiled audio.c in emu.
I have tried a couple of wav-files (after converting them via wav2iaf),  
but it hasn't worked for me  - I have heard a short cacophony only.

On Mon, 23 Oct 2006 23:58:17 +0400, Salva Peiró   
wrote:

> That's my first working attempt to use devaudio under Linux.
> I've been using it with Linux and the Linux-fb port made by Alexander  
> Sychev.
>
> On 10/16/06, Salva Peiró  wrote:
>> Thanks, once i have something presentable, i'll report back.
>>
>> On 10/16/06, Russ Cox  wrote:
>> > Using the audio device on Linux is pretty straightforward.
>> > You should be able to use something like
>> >  
>> \ 
http://cvs.pdos.csail.mit.edu/cvs/drawt … xt%2Fplain
>> >
>> > Russ
>> >
>>
>> --
>> gualteri (at) rootshell.be/~gualteri
>>
>
>

-- 
Best regards,
   santucco

From: Charles Forsyth

Date: 2006-10-24 17:08:34


> but it hasn't worked for me  - I have heard a short cacophony only.

the format might not match the device, or it could simply be that the resulting \ 
speed was wrong.
if the wav is 8k mono and the device is set for 44k stereo, a short noise is \ 
what i'd expect.
wav2iaf copies the settings from the file, and auplay will write them to \ 
audioctl, but
if you just copy the file and don't set the ctl you'll get noise.
if audioctl doesn't change the real device's settings for some reason, then again
you'll get noise.


From: Alexander Sychev

Date: 2006-10-26 11:24:22


On Tue, 24 Oct 2006 19:08:34 +0400, Charles Forsyth  
 wrote:

>> but it hasn't worked for me  - I have heard a short cacophony only.
>
> the format might not match the device, or it could simply be that the  
> resulting speed was wrong.
> if the wav is 8k mono and the device is set for 44k stereo, a short  
> noise is what i'd expect.
> wav2iaf copies the settings from the file, and auplay will write them to  
> audioctl, but
> if you just copy the file and don't set the ctl you'll get noise.
> if audioctl doesn't change the real device's settings for some reason,  
> then again
> you'll get noise.

Files with next characteristics have been played right.
1)	rate    11025
	chans   1
	bits    16
	enc     pcm
2)	rate    44100
	chans   1
	bits    16
	enc     pcm
Files with next characteristics haven't been played, only a short  
cacophony has been heard.
1)	rate    11025
	chans   1
	bits    8
	enc     pcm
2)	rate    22050
	chans   1
	bits    8
	enc     pcm

Best regards,
   santucco

From: Salva Peiró

Date: 2006-10-26 22:23:54


Attachments:
; head 4 taxim.iaf (mono) noise
rate    44100
chans   1
bits    16
enc     pcm

; head 4 taxis.iaf (stereo) correctly played
rate    44100
chans   2
bits    16
enc     pcm

The results of the two plays above made me check the code
and i've found that it was using SNDCTL_DSP_STEREO instead
of SNDCTL_DSP_CHANNELS, and after changing that the
mono file which was incorrectly played sounded fine.
And there was also a typo in the definition of Audio_Headphone_Val.
I've corrected both.
Maybe that is the reason of your problems too.

Regards,
On 10/26/06, Alexander Sychev  wrote:
> On Tue, 24 Oct 2006 19:08:34 +0400, Charles Forsyth
>  wrote:
>
> >> but it hasn't worked for me  - I have heard a short cacophony only.
> >
> > the format might not match the device, or it could simply be that the
> > resulting speed was wrong.
> > if the wav is 8k mono and the device is set for 44k stereo, a short
> > noise is what i'd expect.
> > wav2iaf copies the settings from the file, and auplay will write them to
> > audioctl, but
> > if you just copy the file and don't set the ctl you'll get noise.
> > if audioctl doesn't change the real device's settings for some reason,
> > then again
> > you'll get noise.
>
> Files with next characteristics have been played right.
> 1)      rate    11025
>         chans   1
>         bits    16
>         enc     pcm
> 2)      rate    44100
>         chans   1
>         bits    16
>         enc     pcm
> Files with next characteristics haven't been played, only a short
> cacophony has been heard.
> 1)      rate    11025
>         chans   1
>         bits    8
>         enc     pcm
> 2)      rate    22050
>         chans   1
>         bits    8
>         enc     pcm
>
> Best regards,
>    santucco
>


-- 
gualteri (at) rootshell.be/~gualteri

From: Salva Peiró

Date: 2006-10-26 22:33:14


On 10/26/06, Salva Peiró  wrote:
> The results of the two plays above made me check the code
> and i've found that it was using SNDCTL_DSP_STEREO instead
> of SNDCTL_DSP_CHANNELS, and after changing that the
> mono file which was incorrectly played sounded fine.
> And there was also a typo in the definition of Audio_Headphone_Val.
> I've corrected both.
And introduced an new error by the way :-),
there's a misplaced  'return 0;' at the beginning of the function
audio_file_read so it's imposible to record anything.

> Maybe that is the reason of your problems too.
>