Csound Csound-dev Csound-tekno Search About

[CSOUND-DEV:4482] Portaudio Device Number Issue

Date2004-04-18 05:24
Fromstevenyi
Subject[CSOUND-DEV:4482] Portaudio Device Number Issue
Hi All,

I think I found where the issue is regarding PortAudio device numbers
not being set.  It looks like lines 441-446 of InOut/libsnd.c has an
ifdef that needs to be updated:

#if defined(WIN32) || defined(HAVE_ALSA)
      if (strncmp(O.outfilename,"devaudio", 8) == 0)
        sscanf(O.outfilename+8, "%d", &rtout_dev);
      else if (strncmp(O.outfilename,"dac", 3) == 0)
        sscanf(O.outfilename+3, "%d", &rtout_dev);
#endif

so on linux since there's no more definition of HAVE_ALSA with
portaudio, rtout_dev is never set.  Should this then simply be changed
to LINUX?  Also, does the line checking for "/dev/dsp" need to also be
changed?

Thanks,
steven

Date2004-04-18 14:43
Fromjpff@codemist.co.uk
Subject[CSOUND-DEV:4484] Re: Portaudio Device Number Issue
Yes; twice HAVE_ALSA => LINUX
I have made that change; however I cannot test as I have only 1 sound
card, and even worse the binary does not create .wav files that can be
played 
aplay -Dice1712_analog test.wav 
aplay: test_wavefile:681: can't play not PCM-coded WAVE-files

Clearly something else is wrong -- in libsndfile?  Does anyone else
get WAv files and/or audio that work?
==John ffitch

Date2004-04-18 15:35
Fromjpff@codemist.co.uk
Subject[CSOUND-DEV:4485] Re: Portaudio Device Number Issue
Following up my own post....

The problem was that the canned trapped.csd was writing floats which
aplay will not touch (OK it should but...).

The other problem I have is more serious, in two parts:

1) If I write to dac0 i get a VERY LOUD NOISE with a small audio
signal -- I was really concerned that the speakers would have been
damaged, and i am glad I did not have headphones on.  My wife
screeched from the other end of the house.  I cannot understand this
dac0, but it seems to be a mistake.  Can be (safely) switch out
/dev/dsp0 ?

2) My real sound card is /dev/dsp1
PortAudio device 0
  /dev/dsp
  Maximum channels in:     16
  Maximum channels out:    16
  Default sample rate:  44100.000
PortAudio device 1
  M Audio Delta DiO 2496
  Maximum channels in:     12
  Maximum channels out:    10
  Default sample rate:  44100.000

but if i select it I get
Using Portaudio Device 1
csound: pcm.c:927: snd_pcm_prepare: Assertion `pcm->setup' failed.
Abort (core dumped)

which is inside alsa library I think.

Could be related to point 3

3) My sound card has 2 stereo outs, one analog (channels 0 and 1) and
one digital (9 and 10).  As it stands I cannot select the digital
outputs.  The other ALSA implementation we had used a csound device in
.asoundrc which gave complete flexibility, but this numeric scheme is
way too rigid.
  So can we get a better design or can someone tell me how to get
input from or output to the digital channels?

==John ffitch

Date2004-04-19 01:39
Fromstevenyi
Subject[CSOUND-DEV:4487] Re: Portaudio Device Number Issue
Hi John,

Thanks for the device number fix!

In regards to number 1 on your list, how would this work as portaudio
uses device numbers and not physical device names?  I too get horrible
noise with device 0 which is why I put in the default to device 1. 
However, I realize now that that doesn't work for people with multiple
hardware devices as port audio seems to put in dummy devices for every
hardware device.  (Anyone know why these dummy devices are created and
what is their purpose?)

As for the rest, I don't know portaudio well enough to comment.  

Thanks,
steven


On Sun, 2004-04-18 at 07:35, jpff@codemist.co.uk wrote:
> Following up my own post....
> 
> The problem was that the canned trapped.csd was writing floats which
> aplay will not touch (OK it should but...).
> 
> The other problem I have is more serious, in two parts:
> 
> 1) If I write to dac0 i get a VERY LOUD NOISE with a small audio
> signal -- I was really concerned that the speakers would have been
> damaged, and i am glad I did not have headphones on.  My wife
> screeched from the other end of the house.  I cannot understand this
> dac0, but it seems to be a mistake.  Can be (safely) switch out
> /dev/dsp0 ?
> 
> 2) My real sound card is /dev/dsp1
> PortAudio device 0
>   /dev/dsp
>   Maximum channels in:     16
>   Maximum channels out:    16
>   Default sample rate:  44100.000
> PortAudio device 1
>   M Audio Delta DiO 2496
>   Maximum channels in:     12
>   Maximum channels out:    10
>   Default sample rate:  44100.000
> 
> but if i select it I get
> Using Portaudio Device 1
> csound: pcm.c:927: snd_pcm_prepare: Assertion `pcm->setup' failed.
> Abort (core dumped)
> 
> which is inside alsa library I think.
> 
> Could be related to point 3
> 
> 3) My sound card has 2 stereo outs, one analog (channels 0 and 1) and
> one digital (9 and 10).  As it stands I cannot select the digital
> outputs.  The other ALSA implementation we had used a csound device in
> .asoundrc which gave complete flexibility, but this numeric scheme is
> way too rigid.
>   So can we get a better design or can someone tell me how to get
> input from or output to the digital channels?
> 
> ==John ffitch
> 
>