Edirol UA-25EX amb Linux II
Contingut
Introducció
http://alsa.opensrc.org/index.php/Edirol_UA-25EX
Objectiu: familiaritzar-se amb la targeta de so i comprovar el correcte funcionament de la tarja de so Edirol UA-25EX
La idea d'aquest document és anar resseguint pas per pas tot allò que es proposa, per tal de comprovar el correcte funcionament de la tarja i anar-se familiaritzant sobre el seu ús. Existia una primera versió d'aquest document, de l'octubre de 2008 (1a fase), però en aquell moment el Ubuntu Studio 7.10 o 8.04 no reconeixien la targeta de so. Ara (abril 2009, 2a fase), treballo amb un Ubuntu 9.04 (beta), i un kernel 2.6.28 que sí que reconeixen la tarja, i per tant tots els resultats que obtinc i comentaris són amb aquesta configuració.
Understanding the Edirol UA-25EX logic
Advance button
On the back pane of the UA-25EX, there is a switch button called "ADVANCE", which controls the USB mode of the device. The switch has two values: ON and OFF:
- In advance mode (ADVANCE button ON), the UA-25EX can record or play sound in native 24 bits, in either 44.100 Hz, 48.000 Hz or 96.000 Hz sample rates. You can choose sample rates using a button. At 96 Khz, the device is either capture or playback only. MIDI is enabled. Advance mode is recognised since Alsa 1.0.7.
- In normal mode (ADVANCE button OFF), the UA-25EX is fully USB sound compliant. It records at the rate of 44.100 Hz, in 16 bits, and is full-duplex. MIDI is disabled.
Sample rates switch
On the back pane of the UA-25EX, there is a switch button called "SAMPLE RATE". The switch has three values: 44.1 Khz, 48 Khz and 96 Khz:
- In Advance mode OFF, the device will always record/play natively at the rate of 44.1 Khz using 16 bits.
- In Advance mode ON, the device will be able to record using 24 bits. Choose the sample rate using the SAMPLE RATE switch:
- 44.1 Khz: play and record at the same time,
- 48 Khz: play and record at the same time,
- 96 Khz: play OR record. Press the REC/PLAY button to choose.
On està el botó de REC/PLAY? Doncs si ens fixem bé en el botó se Sample Rate, existeix la posició 96P i 96R.
Cold/Hot reboot
Whenever you switch from ADVANCE ON to ADVANCE OFF, or change sample rates, you will either need to :
- cold reboot: Unplug the USB cord, plug it again. The hotplug mechanism will remove all snd modules and will reload them. Be warned : frequent plug/unplug may harm the device physical contacts.
- shutdown/reboot your computer: it is the recommended way, as it will not harm your device (or the USB cord). Your computer might not turn off the USB power unless you shut down completely. A good place to switch the Advance button is during the grub menu, if you are using grub, and if that fails, shut the computer off completely to switch the Advance button.
Lost?
To understand advance mode, sample rates and REC/PLAY, it is recommended to use aplay and arecord in verbose (option -v) mode. This is what we will do during the howto. This will clearly show you how the audio devices plays and records sound.
NAME
arecord, aplay - command-line sound recorder and player for ALSA sound‐card driver
Basic Alsa configuration
alsaconf is not required to use the Edirol UA-25EX. Hotplug is able to recognise the audio device. Just plug and play.
Assigning audio system rights
GNU/Linux is a secure system. To play sound, you need audio system rights. To query your systems rights:
$groups
my_username adm disk dialout fax cdrom floppy tape dip video plugdev powerdev scanner
In this example, I don't have enough rights to play/record sound. To assign rights:
Become root (system administrator):
$su Password:
Enter the administrator password and then:
$ adduser my_username audio
Will add the user my_username (replace with your username) to the audio group. You should be able to play music.
Naming the Edirol UA-25EX device
If the UA-25EX is the only device of your computer, you can address the device using the plughw:0,0, but it is not very conveniant. We recommand using the alphanumeric name of the device. To query the name of your device, type:
$cat /proc/asound/cards
0 [ICH6 ]: ICH4 - Intel ICH6
Intel ICH6 with STAC9752,53 at irq 16
1 [UA25EX ]: USB-Audio - UA-25EX
EDIROL UA-25EX at usb-0000:00:1d.2-1, full speed
Here, you should use plughw:UA25EX rather than plughw:1,0
ICH6 (plughw:0,0) representa la tarja de so interna del meu portàtil
També puc mirar el que tinc connectat al port USB amb lsusb:
$ lsusb Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 005 Device 002: ID 045e:0084 Microsoft Corp. Basic Optical Mouse Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 004 Device 009: ID 0582:00e6 Roland Corp. Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Testing sound output
Test the card output. This command plays a woman voice on 2 channels ("Front Right", "Front Left"):
$ speaker-test -c2 -D plughw:UA25EX -twav Playback device is plughw:UA25EX Stream parameters are 48000Hz, S16_LE, 2 channels WAV file(s) Rate set to 48000Hz (requested 48000Hz) Buffer size range from 97 to 190217 Period size range from 48 to 95109 Using max buffer size 190216 Periods = 4 was set period_size = 38043 was set buffer_size = 190216 0 - Front Left 1 - Front Right Time per period = 3,529396
Playing sound
In the following example, Advance button is set to ON, and sample rate is 48 Khz. Do not forget to cold/hot reboot whenever you change settings.
To play a sound:
$ aplay -D plughw:UA25EX /usr/share/sounds/question.wav $ aplay -D plughw:UA25EX /usr/share/sounds/card_shuffle.wav
For a better understanding, it is recommended to play in verbose mode:
$ aplay -v -D plughw:UA25EX /usr/share/sounds/question.wav
The following message is displayed:
Playing WAVE '/usr/share/sounds/question.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Mono
Plug PCM: Route conversion PCM (sformat=S24_3LE)
Transformation table:
0 <- 0
1 <- 0
Its setup is:
stream : PLAYBACK
access : RW_INTERLEAVED
format : S16_LE
subformat : STD
channels : 1
rate : 44100
exact rate : 44100 (44100/1)
msbits : 16
buffer_size : 22050
period_size : 5513
period_time : 125011
tstamp_mode : NONE
period_step : 1
avail_min : 5513
period_event : 0
start_threshold : 22050
stop_threshold : 22050
silence_threshold: 0
silence_size : 0
boundary : 1445068800
Slave: Hardware PCM card 1 'UA-25EX' device 0 subdevice 0
Its setup is:
stream : PLAYBACK
access : MMAP_INTERLEAVED
format : S24_3LE
subformat : STD
channels : 2
rate : 44100
exact rate : 44100 (44100/1)
msbits : 24
buffer_size : 22050
period_size : 5513
period_time : 125011
tstamp_mode : NONE
period_step : 1
avail_min : 5513
period_event : 0
start_threshold : 22050
stop_threshold : 22050
silence_threshold: 0
silence_size : 0
boundary : 1445068800
Primer fa referència a les característiques del fitxer (44100 Hz de sample rate amb 16 bits), i després fa referència al playback (slave) en la tarja de so (44100Hz sobre 24 bits). El qui s'encarrega de fer la conversió i fer sonar és Alsa.
When playing two sounds at the same time, an error message is displayed:
aplay: main:550: audio open error: Device or resource busy
Remember, in advance mode, the UA-25EX is only half-duplex.
Recording sound
In this example, the UA-25EX device is set to Advance ON and 96 Khz recording. REC button is pressed (aquest document és bàsicament una traducció del mateix document per al UA-25. En aquest cas era un botó, però en la UA-25EX hem de seleccionar la posició 96R)
You can use arecord utility, which is part of Alsa package, to record any sound from the microphone:
$ arecord -r 96000 -f cd -t wav -D plughw:UA25EX foobar.wav
For a better understanding, try the same command in verbose mode:
$ arecord -v -r 96000 -f cd -t wav -D plughw:UA25EX foobar.wav Recording WAVE 'foobar.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo Plug PCM: Rate conversion PCM (96000, sformat=S24_3LE) Its setup is: stream : CAPTURE access : RW_INTERLEAVED format : S16_LE subformat : STD channels : 2 rate : 44100 exact rate : 44100 (44100/1) msbits : 16 buffer_size : 22050 period_size : 5512 period_time : 125000 tstamp_mode : NONE period_step : 1 avail_min : 5512 period_event : 0 start_threshold : 1 stop_threshold : 22050 silence_threshold: 0 silence_size : 0 boundary : 722534400 Slave: Hardware PCM card 1 'UA-25EX' device 0 subdevice 0 Its setup is: stream : CAPTURE access : MMAP_INTERLEAVED format : S24_3LE subformat : STD channels : 2 rate : 96000 exact rate : 96000 (96000/1) msbits : 24 buffer_size : 48002 period_size : 12000 period_time : 125000 tstamp_mode : NONE period_step : 1 avail_min : 12000 period_event : 0 start_threshold : 2 stop_threshold : 48002 silence_threshold: 0 silence_size : 0 boundary : 1572929536 ^CAborted by signal Interrupt...
Com es pot veure en aquesta sortida, The Edirol UA-25EX is able to record in 24 bits, at the sample rate of 96 Khz.
Now, try to play the recorded sound at 96 Khz (important! he de canviar la posició a 96P) (i potser desconnectar i tornar a connectar...)
$ aplay -v -D plughw:UA25EX foobar.wav $ aplay: main:550: audio open error: No such file or directory
At 96.000 Hz, the audio device can play OR record, but not both. Now, switch the PLAY button (posició 96P). Unplug the USB cord and plug it again. This should initialize Alsa if you are using Udev and hotplug.
Re-try to play the sound:
$ aplay -v -D plughw:UA25EX foobar.wav Playing WAVE 'foobar.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo Plug PCM: Rate conversion PCM (96000, sformat=S24_3LE) Its setup is: stream : PLAYBACK access : RW_INTERLEAVED format : S16_LE subformat : STD channels : 2 rate : 44100 exact rate : 44100 (44100/1) msbits : 16 buffer_size : 22050 period_size : 5512 period_time : 125000 tstamp_mode : NONE period_step : 1 avail_min : 5512 period_event : 0 start_threshold : 22050 stop_threshold : 22050 silence_threshold: 0 silence_size : 0 boundary : 722534400 Slave: Hardware PCM card 1 'UA-25EX' device 0 subdevice 0 Its setup is: stream : PLAYBACK access : MMAP_INTERLEAVED format : S24_3LE subformat : STD channels : 2 rate : 96000 exact rate : 96000 (96000/1) msbits : 24 buffer_size : 48002 period_size : 12000 period_time : 125000 tstamp_mode : NONE period_step : 1 avail_min : 12000 period_event : 0 start_threshold : 48000 stop_threshold : 48002 silence_threshold: 0 silence_size : 0 boundary : 1572929536
It works! Remember, at 96.000 Khz, you can either play OR record, but not both.
Nota: se'm sent bastant fluix. Quan grabo, tinc la sensibilitat del micròfon (botó SENS) quasi al màxim, i el OUTPUT quasi al màxim, i tot i així se sent fluixet. Ja sé perquè es sent fluix: gravo pel micròfon esquerre, però en l'entrada dreta no hi fico cap senyal. Internament, les dues senyals es barregen en una senyal estereo. Si pel canal dret no hi ha res, s'està ficant soroll. Tot això s'arregla amb el dsnoop (explicat més avall).
Advanced Alsa configuration
The recommended settings in this HOWTO are now:
- Advance mode : ON
- Sample rate : 44,1 Khz
This will record/play sound in 24 bits, at the frequency of 44.100 Hz.
Full-duplex mode
The Edirol UA-25EX is a half-duplex device, which means that it cannot play several sounds simultaneously. Fortunately, Alsa is able to play and record in full-duplex over a half-duplex device. This Alsa feature is provided by the asym (i.e. full-duplex) plugin, which is able to combine the dmix (i.e. play) and dsnoop (i.e. record) plug-ins.
The dmix and dsnoop interfaces are already provided by Alsa.
Add the following text to you .asoundrc file:
$ cd ~ $ joe .asoundrc (si no existeix, es crea. .asoundrc, explicat més avall, es crea en el HOME)
Sempre que es fan canvis en el fitxer .asoundrc, s'ha de reiniciar el servei de alsa-utils. Compte! és important ficar la <card>:
$ sudo ./alsa-utils restart 1
#This PCM combining the dmix and dsnoop slaves
pcm.asymed {
type asym
playback.pcm "dmix"
capture.pcm "dsnoop"
slave {
pcm "hw:1,0"
channels 2
}
}
#This PCM should be able to convert recording rates automatically
pcm.pasymed {
type plug
slave {
pcm "hw:1,0"
channels 2
}
}
Per gravr un so en full-duplex mode:
$ arecord -f cd -t wav -D pasymed foobar.wav
Per escoltar un so en full-duplex mode:
$ aplay -D pasymed foobar.wav
(comprovat)
Custom softvol PCM
Aquesta part m'ha costat una mica, però al final m'ha sortit. Recordem que sempre que modifiquem el fitxer .asoundrc:
$ sudo ./alsa-utils restart 1
on '1' és la meva targeta Edirol.
$ alsamixer -c 0
m'apareix un mesclador gràfic, per controlar els controls de mescla i volum de la targeta interna ICH6 (tarja 0).
En canvi, això no és possible per a la tarja externa midi. No puc controlar per software els botons físics.
to use mixer settings on card 1 (Edirol UA25-EX) will return:
$ alsamixer -c 1 no mixer elems found
Unfortunately there is no software control over the hardware mixers on the device (like in any USB device), nothing will show up in mixer programs.
Fortunately, Alsa offers the softvol plugin to create a software volume control. We will also define this control as the default mixer.
Here is my first try (ho poso en el fitxer .asoundrc):
pcm.!default {
type plug
slave.pcm "softvol"
}
pcm.softvol {
type softvol
slave {
pcm "pasymed"
}
control {
name "SoftMaster"
card 1
}
}
(Compte! que la meva targeta és la 1: card 1)
Let us have a look at our software mixer:
$ amixer ... Simple mixer control 'SoftMaster',0 Capabilities: volume Playback channels: Front Left - Front Right Capture channels: Front Left - Front Right Limits: 0 - 255 Front Left: 255 [100%] Front Right: 255 [100%] ...
Ara sí que puc accedir al control de volum per software:
$ alsamixer -c 1
i puc jugar i comprovar el seu funcionament, controlant tant el nivell de volum de la gravació com del playback.
$ arecord -v -r 44100 -f cd -t wav -D softvol foobar.wav $ aplay -v -D softvol foobar.wav o bé $ aplay -v foobar.wav doncs és el dispositiu per defecte (pcm.!default)
i efectivament ara el aplay el sentiré més o menys fort en funció de com hagi ficat el fader en el amixer -c 1
Recording left and right input channels seperately
Aquesta part és important. M'ha costat una mica, però al final m'ha sortit.
When recording from two mono inputs (Input 1/L and Input 2/R), the sound is mixed into a stereo stream at hardware level. Again, there is no software control over this audio device.
This is a problem when you only record from one mono microphone. The resulting stereo sound includes a muted channel with noise. At software level, you may downmix this sound to mono, but this degrades quality because of the muted channel with noise.
A simple solution is to record from left and right input channels seperately, as explained in the dsnoop howto.
Let us define two virtual dsnoop interfaces, for left and right channel:
pcm.record_left {
type dsnoop
ipc_key 234884
slave {
pcm "hw:1,0"
channels 2
}
bindings.0 0
}
pcm.record_right {
type dsnoop
ipc_key 2241234
slave {
pcm "hw:1,0"
channels 2
}
bindings.0 1
}
Now, you can record from the left channel using the following command (hi ha una errada en la documentació oficial):
$ arecord -f cd -c 1 -D record_left foobar.wav ALSA lib pcm_dsnoop.c:598:(snd_pcm_dsnoop_open) dsnoop plugin can be only connected to hw plugin Segmentation fault (core dumped)
La cosa correcta és:
$ arecord -f cd -c 1 -Dplug:record_left foobar.wav
Your sound is now pure mono, not fake mono downmixed from a stereo sound.
Per escoltar:
$ aplay -v -D plughw:UA25EX foobar.wav $ aplay -v -D plughw:1,0 foobar.wav
I ara puc veure com el soroll és mono pur, és a dir, se sent per igual en els dos altaveus.
si en el fitxer .asoundrc fico plughw en comptes de hw, protesta:
$ arecord -f cd -c 1 -Dplug:record_left foobar.wav ALSA lib pcm_dsnoop.c:598:(snd_pcm_dsnoop_open) dsnoop plugin can be only connected to hw plugin Fallo de segmentación
Amb el tema aquest m'hi havia barallat bastant, però per sort ara ja funciona:
No funciona perquè el dispositiu dsnoop no està disponible. Ara estic treballant amb Ubuntu 9.04, no pas UStudio, i de moment no he tocat res d'ALSA. Es pot veure que no tinc instal.lat dsnoop perquè:
$ arecord -L
Normally, dsnoop should be part of the available devices, and you should read a line including the following information:
dsnoop 'cards.pcm.dsnoop'
El problema suposo que és que no està instal.lat el plugin dsnoop. (Thanks to the dsnoop plugin, it is possible to overcome this problem. ). Tot i que es diu que per defecte dsnoop ve instal.lat.
Si vull saber la versió que tinc instal.lada de Alsa, faig
$ cat /proc/asound/version Advanced Linux Sound Architecture Driver Version 1.0.18rc3.
Tinc la versió 1.0.18, i ara van per la 1.0.19.
El problema no és tant fer el upgrade, sinó que jo no ho sé com han compilat ALSA per al Ubuntu 9.04. Si vull actualitzar ALSA a 1.0.19, està explicat a : http://monespaceperso.org/blog-en/2009/02/10/acer-aspire-6920-no-sound-on-ubuntu-810-upgrade-of-alsa/comment-page-1/
Digital signals
The same rules apply here. Alsa has very little control over the UA-25EX hardware. Digital control is done using buttons on the front pane.
Digital In
To record from digital source, press the "DIGITAL IN" button on the front pane of the UA-25EX. This is simple as that! You can then record using any Alsa tool, on the pasymed or SoftMaster PCMs.
Digital Out
Here, the Edirol UA-25EX is in Advance mode off. It provides 16 bits, 44.100 Hz digital output.
Let us try Alsa utility speaker-test:
$ speaker-test -c 2 -D softvol0 -twav
An optical cable is connected:
* from Edirol UA-25EX Digital out * to a Terratec USB Aureon MK-2 digital in.
In the mixer of the Terratec Aureon, I select Input 2 and check IEC958 In.
I can record the digital stream using the following command:
$ arecord -v -f S16_LE -c 2 -D plughw:1,0 foobar.wav
I can record the digital out stream of the Edirol UA-25EX without problem.
Això jo no ho puc fer perquè no tinc aquest dispositiu Terratec o similar.
Low latency (to be written)
investigating. To be written.
4 MIDI configuration
For MIDI to work, the device has to be in advance mode.
If MIDI is working, you should see a "raw midi" device for the UA-25EX in /proc/asound/devices:
$ grep midi /proc/asound/devices 4: [ 1- 0]: raw midi
Also, /proc/asound/card0/midi0 should exist (assuming the UA-25EX is the audio device #1):
$ cat /proc/asound/card1/midi0 UA-25EX Output 0 Tx bytes : 0 Input 0 Rx bytes : 0
MIDI ports
If the UA-25EX is running in advance mode, aconnect should show one MIDI input and one MIDI output port:
$ aconnect -il # list readable MIDI ports
cliente 0: 'System' [tipo=kernel]
0 'Timer '
1 'Announce '
Conectando con: 15:0
cliente 14: 'Midi Through' [tipo=kernel]
0 'Midi Through Port-0'
cliente 20: 'UA-25EX' [tipo=kernel]
0 'UA-25EX MIDI 1'
$ aconnect -ol # list writable MIDI ports
cliente 14: 'Midi Through' [tipo=kernel]
0 'Midi Through Port-0'
cliente 20: 'UA-25EX' [tipo=kernel]
0 'UA-25EX MIDI 1 '
wiki.empresalibre.org
If you prefer a graphical interface, check out aconnectgui. The relevant information can also be found in /proc/asound/seq/clients.
$ sudo apt-get install aconnectgui
Connecting an external MIDI controller
To connect an external MIDI controller (e.g. keyboard, faderbox, stompbox, etc.), just plug its MIDI output into the "MIDI IN" socket on the back of the UA-25EX, and use aconnect to connect it to whatever software synth you want to interpret the MIDI data.
To connect my MIDI foot controller (keyboard Casio o WX5 wind controller) to PureData (fluidsynth), aconnect shows me the following (among other things):
$ aconnect -il
cliente 20: 'UA-25EX' [tipo=kernel]
0 'UA-25EX MIDI 1 '
$ aconnect -ol
cliente 129: 'FLUID Synth (5312)' [tipo=usuario]
0 'Synth input port (5312:0)'
To get MIDI data flowing from my Casio CTK-731 into fluidsynth, the incantation I need is:
$ aconnect 20:0 129:0
Connecting an external MIDI synthesizer
Ho fem amb el Casio CTK-731, però ara ho hem de fer al revés, connectar la sortida MIDI OUT del Edirol UA-25EX al MIDI IN del sintetitzador. El qui envia els missatges midi pot ser el virtual keyboard (o el mateix WX5):
$ aconnect -i -o
cliente 20: 'UA-25EX' [tipo=kernel]
0 'UA-25EX MIDI 1 '
cliente 130: 'Virtual Keyboard' [tipo=usuario]
0 'Virtual Keyboard'
$ aconnect 130:0 20:0
Toco amb el virtual keyboard, sona el sintetitzador Casio. (no s'aprecia gens de latència)
En el cas del WX5, ara fem servir tant el connector MIDI IN com el MIDI OUT del Edirol.
$ aconnct -x -> per treure totes les connexions que hi puguin haver
$ aconnect 20:0 20:0
$ aconnect -i -o -l
...
cliente 20: 'UA-25EX' [tipo=kernel]
0 'UA-25EX MIDI 1 '
Conectando con: 20:0
Conectado desde: 20:0
Toco el WX5 i sona el Casio (no s'aprecia gens de latència). Per tal que soni, he de ficar el Casio en mode EXTERNAL SOLO. I escollir l'instrument que vull fer sonar. Per exemple, si estem en el canal 1 (CH1), apretar Enter i aleshores, amb el + i el -, puc canviar de programa (instrument) i també puc ajustar coses com el volum, el pan i els efectes. (important això del volum, que no estigui a 0. Utilitzar els cursors per poder editar el volum).
Ara trec el cable midi del WX5 i el connecto al MIDI OUT del Casio. El resultat que tinc és un bucle CASIO MIDI OUT - EDIROL - CASIO MIDI IN. Ara, per tal que soni, no he de ficar el mode EXTERNAL SOLO sinó EXTERNAL PLAY. Puc comprovar que funciona (és a dir, que el senyal passa a través del EDIROL) perquè a INTERNAL puc tenir per exemple un piano i a EXTERNAL PLAY un saxo. Tot això sense latència!
Fem una altra prova: toco amb el CASIO (o el WX5), i vull que soni pel CASIO i pel fluidsynth:
joan@UStudio904:~$ aconnect 20:0 129:0
$ aconnect -i -o -l
cliente 20: 'UA-25EX' [tipo=kernel]
0 'UA-25EX MIDI 1 '
Conectando con: 20:0, 129:0
Conectado desde: 20:0
cliente 129: 'FLUID Synth (5637)' [tipo=usuario]
0 'Synth input port (5637:0)'
Conectado desde: 20:0
I efectivament funciona. Toco el CASIO, i pel CASIO sona immediatament, i pel fluidsynth amb un delay. L'únic que m'introdueix delay és el fluidsynth.
De moment la única latència que he observat és tocant amb el Casio (o el WX5) i escoltant amb el fluidsynth. Amb el tema de la latència encara no m'hi he ficat, però és un tema una mica complicat que entra en joc molts factors, des del hardware, fins la configuració del JACK i tenir un kernel RT (aquestes proves les he fet amb Ubuntu Jaunty beta, no pas Ubuntu Studio). Més endavant tindré instal.lat el Ubuntu Studio Jaunty (9.04), que tindrà habilitat el kernel rt (el US 8.10 no l'ha tingut).
Allò important és que ara tinc una configuració hardware que em funciona: controlador MIDI (CASIO o WX5), EDIROL i sintetitzador MIDI (CASIO), que és una solució hardware que no m'introdueix latència.
Resulting .asoundrc file
http://alsa.opensrc.org/index.php/.asoundrc
Fins ara, el fitxer resultant final és: (compte, que jo l'he modificat, no és l'original de la wiki d'alsa):
pcm.!default {
type plug
slave.pcm "softvol"
}
pcm.softvol {
type softvol
slave {
pcm "pasymed"
}
control {
name "SoftMaster"
card 1
}
}
#This PCM combining the dmix and dsnoop slaves
pcm.asymed {
type asym
playback.pcm "dmix"
capture.pcm "dsnoop"
slave {
pcm "hw:1,0"
channels 2
}
}
#This PCM should be able to convert recording rates automatically
pcm.pasymed {
type plug
slave {
pcm "hw:1,0"
channels 2
}
}
pcm.record_left {
type dsnoop
ipc_key 234884
slave {
pcm "hw:1,0"
channels 2
}
bindings.0 0
}
pcm.record_right {
type dsnoop
ipc_key 2241234
slave {
pcm "hw:1,0"
channels 2
}
bindings.0 1
}
The .asoundrc file is typically installed in a user's home directory ($HOME/.asoundrc) and is called from /usr/share/alsa/alsa.conf. It is also possible to install a system-wide configuration file as /etc/asound.conf. When an ALSA application starts both configuration files are read but the settings in the .asoundrc file override the settings in the /etc/asound.conf settings.
The .asoundrc file (in your home directory) and /etc/asound.conf (for system-wide settings) are the configuration files for ALSA drivers. Neither file is required for ALSA to work properly. Most applications will work without them. The main use of these two configuration files is to add functionality such as routing and sample-rate conversion. It allows you to create "virtual devices" that pre or post-process audio streams. Any properly written ALSA program can use these virtual devices as though they were normal devices.
Before ALSA 1.0.9 you often needed one to make things work at all, and before ALSA 1.0.11 you generally needed one if you wanted to have more than one ALSA application output sound at the same time via the DmixPlugin, but current ALSA versions shouldn't need one.
There are several uses for a .asoundrc. One is to create a personalized configuration for a soundcard. This is useful if you have a 32-channel soundcard and want to reserve 5 channels permanently for recording the drums. For example, you could create a new PCM called "drumrec" that is always mapped to the same five inputs. The .asoundrc file is quite complicated. You may find it simpler to use the dmix plugin. Also see the page Dmix Plugin.
Lastly similar .asoundrc files are used internally by ALSA to "map" standard things, for example, to connect "default" to "plughw:0" (this too could be overridden). The configuration is in the file /usr/share/alsa/alsa.conf
If you're happy with how your card is working, there's no need to use an .asoundrc. There is also not much use in taking an .asoundrc for a 10-channel soundcard and hoping to get more out of a 2-channel (stereo) soundcard. But if you want or have to customize the behaviour of a soundcard to be different from the standard setting, an .asoundrc is essential.
In the discussion that follows, remember that anything mentioned for the .asoundrc file applies equally to /etc/asound.conf except in the latter case the virtual devices you define can be used by all users on a system.
Resultat final
A efectes pràctics, m'oblido del tema del halfduplex i de l'equalitzador, i vull que quan grabi amb el micròfon es grabi en els dos canals (i així aconsegueixo un senyal bo, sense afegir soroll). El fitxer .asoundrc resultant serà:
pcm.!default {
type plug
slave.pcm "record_left"
}
pcm.record_left {
type dsnoop
ipc_key 234884
slave {
pcm "hw:1,0"
channels 2
}
bindings.0 0
}
pcm.record_right {
type dsnoop
ipc_key 2241234
slave {
pcm "hw:1,0"
channels 2
}
bindings.0 1
}
Considero que el Input1/L és el per defecte. Si fico el micro a Input1:
$ arecord -f cd -c 1 foobar.wav $ aplay -v -D plughw:UA25EX foobar.wav $ aplay -v -D plughw:1,0 foobar.wav
Si fico el micro a Input2/R:
$ arecord -f cd -c 1 -Dplug:record_right foobar.wav $ aplay -v -D plughw:UA25EX foobar.wav $ aplay -v -D plughw:1,0 foobar.wav
Tot això no és perque sí, sinó que té els seus efectes pràctics. Per exemple, quan amb el Ardour grabo una entrada de micro, fent-ho d'aquesta manera aconsegueixo un bon senyal sense que es fiqui soroll per l'altre canal.
No cal dir, però, que els controls que més afecten són els botons SENS de les entrades (INPUT1 I INPUT2).
Device information
The following section may help Alsa hackers (ICH6 és la meva targeta interna del portàtil):
cat /proc/bus/usb/devices
Fent cat /proc/bus/usb/devices jo no obtinc res. He de montar el sistema usb:
$ sudo mount -t usbfs none /proc/bus/usb
... T: Bus=05 Lev=01 Prnt=01 Port=01 Cnt=01 Dev#= 2 Spd=1.5 MxCh= 0 D: Ver= 1.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 8 #Cfgs= 1 P: Vendor=045e ProdID=0084 Rev= 3.90 S: Manufacturer=Microsoft S: Product=Microsoft Basic Optical Mouse C:* #Ifs= 1 Cfg#= 1 Atr=a0 MxPwr=100mA I:* If#= 0 Alt= 0 #EPs= 1 Cls=03(HID ) Sub=01 Prot=02 Driver=usbhid E: Ad=81(I) Atr=03(Int.) MxPS= 4 Ivl=10ms ... T: Bus=04 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 2 Spd=12 MxCh= 0 D: Ver= 1.10 Cls=ff(vend.) Sub=00 Prot=ff MxPS= 8 #Cfgs= 1 P: Vendor=0582 ProdID=00e6 Rev= 1.00 S: Manufacturer=Roland S: Product=EDIROL UA-25EX C:* #Ifs= 3 Cfg#= 1 Atr=80 MxPwr=480mA I:* If#= 0 Alt= 0 #EPs= 0 Cls=ff(vend.) Sub=02 Prot=00 Driver=snd-usb-audio I: If#= 0 Alt= 1 #EPs= 1 Cls=ff(vend.) Sub=02 Prot=00 Driver=snd-usb-audio E: Ad=01(O) Atr=09(Isoc) MxPS= 288 Ivl=1ms I:* If#= 1 Alt= 0 #EPs= 0 Cls=ff(vend.) Sub=02 Prot=00 Driver=snd-usb-audio I: If#= 1 Alt= 1 #EPs= 1 Cls=ff(vend.) Sub=02 Prot=00 Driver=snd-usb-audio E: Ad=82(I) Atr=05(Isoc) MxPS= 288 Ivl=1ms I: If#= 2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=03 Prot=00 Driver=snd-usb-audio E: Ad=03(O) Atr=02(Bulk) MxPS= 32 Ivl=0ms E: Ad=84(I) Atr=02(Bulk) MxPS= 32 Ivl=0ms I:* If#= 2 Alt= 1 #EPs= 2 Cls=ff(vend.) Sub=03 Prot=00 Driver=snd-usb-audio E: Ad=03(O) Atr=02(Bulk) MxPS= 32 Ivl=0ms E: Ad=84(I) Atr=03(Int.) MxPS= 32 Ivl=1ms ...
però puc veure els dispositius usb febt lsusb:
$ cat /proc/bus/usb/devices cat: /proc/bus/usb/devices: No existe el fichero ó directorio $ lsusb Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 005 Device 002: ID 045e:0084 Microsoft Corp. Basic Optical Mouse Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 004 Device 002: ID 0582:00e6 Roland Corp. Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
cat /proc/asound/devices
2: : timer 3: : sequencer 4: [ 1- 0]: raw midi 5: [ 1- 0]: digital audio playback 6: [ 1- 0]: digital audio capture 7: [ 1] : control 8: [ 0- 4]: digital audio playback 9: [ 0- 3]: digital audio capture 10: [ 0- 2]: digital audio capture 11: [ 0- 1]: digital audio capture 12: [ 0- 0]: digital audio playback 13: [ 0- 0]: digital audio capture 14: [ 0] : control
cat /proc/asound/cards
<pre>
0 [ICH6 ]: ICH4 - Intel ICH6
Intel ICH6 with STAC9752,53 at irq 16
1 [UA25EX ]: USB-Audio - UA-25EX
EDIROL UA-25EX at usb-0000:00:1d.2-1, full speed
aplay -l
<pre> **** Lista de PLAYBACK Dispositivos Hardware **** tarjeta 0: ICH6 [Intel ICH6], dispositivo 0: Intel ICH [Intel ICH6] Subdispositivos: 1/1 Subdispositivo #0: subdevice #0 tarjeta 0: ICH6 [Intel ICH6], dispositivo 4: Intel ICH - IEC958 [Intel ICH6 - IEC958] Subdispositivos: 1/1 Subdispositivo #0: subdevice #0 tarjeta 1: UA25EX [UA-25EX], dispositivo 0: USB Audio [USB Audio] Subdispositivos: 1/1 Subdispositivo #0: subdevice #0
$ aplay -L
front:CARD=ICH6,DEV=0
Intel ICH6, Intel ICH6
Front speakers
surround40:CARD=ICH6,DEV=0
Intel ICH6, Intel ICH6
4.0 Surround output to Front and Rear speakers
surround41:CARD=ICH6,DEV=0
Intel ICH6, Intel ICH6
4.1 Surround output to Front, Rear and Subwoofer speakers
surround50:CARD=ICH6,DEV=0
Intel ICH6, Intel ICH6
5.0 Surround output to Front, Center and Rear speakers
surround51:CARD=ICH6,DEV=0
Intel ICH6, Intel ICH6
5.1 Surround output to Front, Center, Rear and Subwoofer speakers
iec958:CARD=ICH6,DEV=0
Intel ICH6, Intel ICH6 - IEC958
IEC958 (S/PDIF) Digital Audio Output
null
Discard all samples (playback) or generate zero samples (capture)
front:CARD=UA25EX,DEV=0
UA-25EX, USB Audio
Front speakers
surround40:CARD=UA25EX,DEV=0
UA-25EX, USB Audio
4.0 Surround output to Front and Rear speakers
surround41:CARD=UA25EX,DEV=0
UA-25EX, USB Audio
4.1 Surround output to Front, Rear and Subwoofer speakers
surround50:CARD=UA25EX,DEV=0
UA-25EX, USB Audio
5.0 Surround output to Front, Center and Rear speakers
surround51:CARD=UA25EX,DEV=0
UA-25EX, USB Audio
5.1 Surround output to Front, Center, Rear and Subwoofer speakers
surround71:CARD=UA25EX,DEV=0
UA-25EX, USB Audio
7.1 Surround output to Front, Center, Side, Rear and Woofer speakers
iec958:CARD=UA25EX,DEV=0
UA-25EX, USB Audio
IEC958 (S/PDIF) Digital Audio Output
Getting Advanced mode to work
Nota: ara ha estic amb el kernel 2.6.28, i ara aquest patch ja no cal aplicar-lo.
Basing my work on the patch for the Edirol UA-4FX, I created the following patch for the Edirol UA-25EX, tested on linux-2.6.25:
Add Alsa support for Roland Edirol UA-25EX in Advanced mode (for MIDI support and sample rates of 48 kHz and 96 kHz) usbquirks.h
diff -u sound/usb/usbquirks.h.00 sound/usb/usbquirks.h
--- sound/usb/usbquirks.h.00 2007-11-28 02:15:11.000000000 -0700
+++ sound/usb/usbquirks.h 2007-11-28 02:17:51.000000000 -0700
@@ -1311,6 +1311,37 @@
}
},
/* TODO: add Edirol MD-P1 support */
+{ /*
+ * This quirk is for the "Advanced" modes of the Edirol UA-25EX.
+ * If the switch is not in an advanced setting, the UA-25EX has
+ * ID 0x0582/0x00a4 and is standard compliant (no quirks), but
+ * offers only 16-bit PCM at 44.1 kHz and no MIDI.
+ */
+ USB_DEVICE_VENDOR_SPEC(0x0582, 0x00e6),
+ .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) {
+ .vendor_name = "EDIROL",
+ .product_name = "UA-25EX",
+ .ifnum = QUIRK_ANY_INTERFACE,
+ .type = QUIRK_COMPOSITE,
+ .data = (const struct snd_usb_audio_quirk[]) {
+ {
+ .ifnum = 0,
+ .type = QUIRK_AUDIO_EDIROL_UA700_UA25
+ },
+ {
+ .ifnum = 1,
+ .type = QUIRK_AUDIO_EDIROL_UA700_UA25
+ },
+ {
+ .ifnum = 2,
+ .type = QUIRK_AUDIO_EDIROL_UA700_UA25
+ },
+ {
+ .ifnum = -1
+ }
+ }
+ }
+},
{
/* Roland SH-201 */
USB_DEVICE(0x0582, 0x00ad),
See also
endor link: http://www.edirol.net/products/en/UA-25EX/
creat per Joan Quintana Compte, abril 2009
