Does anyone know of an easy way to get the correct audiodev # for a specific soundcard? I am using an embedded environment and I need to start pd with the correct device in a situation where different devices may/may not be used. In this case, the audiodev # may change.
It's annoying that I can't run -alsa -listdev and parse the stdout since I can't seem to pipe it anywhere. Too bad -listdev doesn't print and exit, because I could then search for the line containing the name of my sound card and grab the number from it. This is what I do with aconnect to wait until pd's midi is ready before connecting midi to it. (it's a slow machine)
I read on some old posts about the "-alsadev" switch, but this was taken out? At least in jack I can use the alsa name to avoid this issue ala "-d hw:UA25". Of course with the update to Jaunty, now jack seems to be flakier then before, so I'm trying to use pd -rt directly.
Dan Wilcox danomatika.com robotcowboy.com
It's been a while since I screwed around with this stuff, but I believe that an .asoundrc file in your home directory might be what you need:
http://alsa.opensrc.org/index.php/.asoundrc
best, D.
danomatika wrote:
Does anyone know of an easy way to get the correct audiodev # for a specific soundcard? I am using an embedded environment and I need to start pd with the correct device in a situation where different devices may/may not be used. In this case, the audiodev # may change.
From same page:
% cat /usr/bin/asoundrc #!/bin/bash # asoundrc v0.1.0 20090101 markc@renta.net GPLv3 # asoundrc v0.2.0 20090320 quatro_por_quatro@yahoo.es GPLv3 # # A simple script to create a particular default audio device regardless # of what cards are loaded or in what order. It could be used anytime or # placed in a ~/.bashrc script for a persistent setup every login. # # Usage: asoundrc [DEFAULT_CARD] > ~/.asoundrc
# use the first parameter as the card name, or else
# look for the sound card, discarding those that are only microphones
# when there are multiple cards, use the first one
if default_card="${1:-$(cat "$(for f in $(ls -1
/proc/asound/card[0-9]*/{midi,codec}* 2>/dev/null); do echo "${f%/*}";
done
| sed -e '|^[[:blank:]]$|d' -e 'q')/id" 2>/dev/null)}"; then
echo "Using sound card: ${default_card}" >&2
cat /proc/asound/card[0-9]*/id |
gawk --assign default_card="${default_card}"
'{print "pcm."$1" { type hw; card "$1"; }\nctl."$1" { type hw; card
"$1"; }" }
END {print "pcm.!default pcm."default_card"\nctl.!default
ctl."default_card}'
else
echo "Warning: No sound cards found." >&2
fi
Derek Holzer wrote:
It's been a while since I screwed around with this stuff, but I believe that an .asoundrc file in your home directory might be what you need:
http://alsa.opensrc.org/index.php/.asoundrc
best, D.
danomatika wrote:
Does anyone know of an easy way to get the correct audiodev # for a specific soundcard? I am using an embedded environment and I need to start pd with the correct device in a situation where different devices may/may not be used. In this case, the audiodev # may change.
On Fri, 2009-06-12 at 02:18 +0200, Derek Holzer wrote:
From same page:
% cat /usr/bin/asoundrc #!/bin/bash # asoundrc v0.1.0 20090101 markc@renta.net GPLv3 # asoundrc v0.2.0 20090320 quatro_por_quatro@yahoo.es GPLv3 # ...
As far as I know, an asoundrc dosen't help in this case. Ubuntu already has a default asoundrc which automatically creates an alias named after the device. I can't use this with pd since pd only takes the alsa hw or plug indexes which can change depending on what gear I'm using.
I've also read on the list that you can use -alsaadd to add a device to the list from a custom asoundrc, but this only adds the device to the gui menu which I would need to access via a fudi startup message ala "audio-dialog 0 0 0 0 2 ...". Even in this case, I still have to have a damned index to the menu item!
Dan Wilcox danomatika.com robotcowboy.com
Hallo, danomatika hat gesagt: // danomatika wrote:
As far as I know, an asoundrc dosen't help in this case. Ubuntu already has a default asoundrc which automatically creates an alias named after the device. I can't use this with pd since pd only takes the alsa hw or plug indexes which can change depending on what gear I'm using.
I've also read on the list that you can use -alsaadd to add a device to the list from a custom asoundrc, but this only adds the device to the gui menu which I would need to access via a fudi startup message ala "audio-dialog 0 0 0 0 2 ...". Even in this case, I still have to have a damned index to the menu item!
If you use -alsaadd, you can also use the -audiodev flag to select the card added, no need to use the FUDI message. The added device appears after the predefined devices, one hw, one plughw for each card. So with two cards in the system, the first -alsaadded card will be at index 5.
Anyway, I think, even then you still need a damned index.
But cards don't magically enter or leave your computer: Why don't you prepare some startup scripts depending on how many cards are in the box?
Frank