Csound Csound-dev Csound-tekno Search About

[Csnd] Getting around a (sound) device assignment problem in SoaS

Date2009-09-22 04:03
From"Art Hunkins"
Subject[Csnd] Getting around a (sound) device assignment problem in SoaS
For SoaS (Fedora Linux), there remains a problem of device assignment
involving audio out and MIDI in.

Basically, if you boot SoaS *then* plug in a MIDI controller, audio is
assigned C0D0; and MIDI, C1D0 (this is as expected). If you plug in a MIDI
controller and then boot SoaS, MIDI gets C0D0 and audio C1D0 (this is *not*
as expected!)

The latter arrangement generates the following error message (in its Log) 
when
a script is run:
Can't open device 'plughw' for audio output.

It will be necessary to either do something either in Sugar, its Csound
module, or in the python script that runs Csound to work with this issue.
So far, I've tried making manual changes to the file names (reflecting the 
"proper"
device numbers, but the error remains.

Suggestions? Especially from the Sugar side?

It would seem that Sugar needs to
look for and assign *audio* device numbers before *MIDI* device numbers. 
(Please
note that this issue does *not* exist for the native XO-1. Perhaps snooping 
around
in that code would be enlightening.) I'd appreciate the help; I'm absolutely 
lost here.

Art Hunkins



Send bugs reports to this list.
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"

Date2009-09-22 05:08
FromJoshua N Pritikin
SubjectRe: Getting around a (sound) device assignment problem in SoaS
AttachmentsNone  

Date2009-09-22 05:23
FromFelipe Sateler
Subject[Csnd] Re: Getting around a (sound) device assignment problem in SoaS
I _think_ I have a possible solution, but it would be specific to your
machine. Your suggestion seems more reasonable to me, but I fear it is
not easy to implement: a driver does not know when it is loading that
another driver is about to be loaded.

My proposed solution is to:
1. Find out which drivers your soundcard and MIDI device use. This can
be done with the lsmod utility. Run the following command before and
after plugging the MIDI device:
lsmod | grep snd
2. Force index 1 on the MIDI device (and 0 on the soundcard). For this
you have to create a file in /etc/modprobe.d (sound.conf would be
appropriate), and add the following lines:
options snd- index=0
options snd- index=1

Another option that might work, and this one on the Fedora level, but I
do not have the expertise to work on, is to force USB audio devices to
start at some other index via udev rules. I know Debian creates
persistent device names for network devices and CD devices, I would
figure Fedora does something similar, but I don't know if it is possible
for sound devices. The problem is that then your assumption (audio
device is number 0) would break on machines where there is no internal
or PCI sound card.

The general problem here is that at the OS level you can't really make
too many assumptions about what kind of hardware the user has.


On Mon, 2009-09-21 at 23:03 -0400, Art Hunkins wrote:
> For SoaS (Fedora Linux), there remains a problem of device assignment
> involving audio out and MIDI in.
> 
> Basically, if you boot SoaS *then* plug in a MIDI controller, audio is
> assigned C0D0; and MIDI, C1D0 (this is as expected). If you plug in a MIDI
> controller and then boot SoaS, MIDI gets C0D0 and audio C1D0 (this is *not*
> as expected!)
> 
> The latter arrangement generates the following error message (in its Log) 
> when
> a script is run:
> Can't open device 'plughw' for audio output.
> 
> It will be necessary to either do something either in Sugar, its Csound
> module, or in the python script that runs Csound to work with this issue.
> So far, I've tried making manual changes to the file names (reflecting the 
> "proper"
> device numbers, but the error remains.
> 
> Suggestions? Especially from the Sugar side?
> 
> It would seem that Sugar needs to
> look for and assign *audio* device numbers before *MIDI* device numbers. 
> (Please
> note that this issue does *not* exist for the native XO-1. Perhaps snooping 
> around
> in that code would be enlightening.) I'd appreciate the help; I'm absolutely 
> lost here.
> 
> Art Hunkins
> 
> 
> 
> Send bugs reports to this list.
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"
-- 
Saludos,
Felipe Sateler

Date2009-09-22 08:52
Fromvictor
Subject[Csnd] Re: Getting around a (sound) device assignment problem in SoaS
The compile() function in the API (and in the csndsugui module) returns
0 if successful and non-zero if not. You can check for this and recompile
with different options (etc) until it works.

Victor


----- Original Message ----- 
From: "Art Hunkins" 
To: 
Cc: 
Sent: Tuesday, September 22, 2009 4:03 AM
Subject: [Csnd] Getting around a (sound) device assignment problem in SoaS


> For SoaS (Fedora Linux), there remains a problem of device assignment
> involving audio out and MIDI in.
>
> Basically, if you boot SoaS *then* plug in a MIDI controller, audio is
> assigned C0D0; and MIDI, C1D0 (this is as expected). If you plug in a MIDI
> controller and then boot SoaS, MIDI gets C0D0 and audio C1D0 (this is 
> *not*
> as expected!)
>
> The latter arrangement generates the following error message (in its Log) 
> when
> a script is run:
> Can't open device 'plughw' for audio output.
>
> It will be necessary to either do something either in Sugar, its Csound
> module, or in the python script that runs Csound to work with this issue.
> So far, I've tried making manual changes to the file names (reflecting the 
> "proper"
> device numbers, but the error remains.
>
> Suggestions? Especially from the Sugar side?
>
> It would seem that Sugar needs to
> look for and assign *audio* device numbers before *MIDI* device numbers. 
> (Please
> note that this issue does *not* exist for the native XO-1. Perhaps 
> snooping around
> in that code would be enlightening.) I'd appreciate the help; I'm 
> absolutely lost here.
>
> Art Hunkins
>
>
>
> Send bugs reports to this list.
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe 
> csound" 



Send bugs reports to this list.
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"