Re: [ecasound] capture from two delta 1010LTs at once

From: Bery Rinaldo <ecasound@email-addr-hidden>
Date: Thu Dec 01 2005 - 20:02:54 EET

Kai Vehmanen wrote:
> On Thu, 17 Nov 2005, Bery Rinaldo wrote:
>
>> ecasound -t:10 \
>> -a:1,2,3,4,5,6,7,8 -f:16,8,44100 -i:alsa,analog8_1 \
>> -a:A,B,C,D,E,F,G,H -f:16,8,44100 -i:alsa,analog8_2 \
>
> [...]
>
>> As for the syncing of the two cards, it seems that S/PDIF is the way
>> to go for the Delta 1010LT. I used the envy24control GUI to select
>> S/PDIF In for the Master Clock for card 2 and set the "Locked" Rate
>> State and connected the S/PDIF output from card 1 to the S/PDIF input
>> on card 2. I ran the above capture command with the same analog
>> signal (via a Y-cable) going to one input on each card. I then
>> compared the signals in Audacity -- they were _very_ close -- I
>> believe that the differences may be due to ADC differences between
>> channels. I tried the same thing with two channels on the same card
>
>
> The clock-sync is important to avoid clock-drift. This will avoid buffer
> overruns that would otherwise happen sooner or later if the clocks were
> not synced.
>
> But it's important to note that clock-sync won't guarantee that the
> devices are started at the same precise instant. As ecasound has to
> start the devices separately, the device started first will be a few
> samples ahead. ALSA provides mechanisms for triggering multiple devices
> at once, but you need to use the ALSA "multi" (and possibly others, I
> don't have experience with these) plugins to combine the devices, so
> that ecasound will only see one device which it will trigger.
>
> For many uses the small errors in trigger time will not be a problem
> (clock-sync against drift is _much_ more important), but it's good to be
> aware of the issue.
>

OK, so just trying to go back to this and get all 16 channels in a
single ALSA "multi" setup, but I just cannot find the right combination.
  If I define it as follows in /etc/asound.conf:

#Combine all 16 analog channels from both cards
pcm.all16 {
         type multi;
         slaves.a.pcm analog8_1;
         slaves.a.channels 8;
         slaves.b.pcm analog8_2;
         slaves.b.channels 8;
         bindings.0.slave a;
         bindings.0.channel 0;
         bindings.1.slave a;
         bindings.1.channel 1;
         bindings.2.slave a;
         bindings.2.channel 2;
         bindings.3.slave a;
         bindings.3.channel 3;
         bindings.4.slave a;
         bindings.4.channel 4;
         bindings.5.slave a;
         bindings.5.channel 5;
         bindings.6.slave a;
         bindings.6.channel 6;
         bindings.7.slave a;
         bindings.7.channel 7;
         bindings.8.slave b;
         bindings.8.channel 0;
         bindings.9.slave b;
         bindings.9.channel 1;
         bindings.10.slave b;
         bindings.10.channel 2;
         bindings.11.slave b;
         bindings.11.channel 3;
         bindings.12.slave b;
         bindings.12.channel 4;
         bindings.13.slave b;
         bindings.13.channel 5;
         bindings.14.slave b;
         bindings.14.channel 6;
         bindings.15.slave b;
         bindings.15.channel 7;
}

ctl.all16 {
         type hw
         card 1
         device 0
}

pcm.ttable {
         type route;
         slave.pcm "all16";
         ttable.0.0 1;
         ttable.1.1 1;
         ttable.2.2 1;
         ttable.3.3 1;
         ttable.4.4 1;
         ttable.5.5 1;
         ttable.6.6 1;
         ttable.7.7 1;
         ttable.8.8 1;
         ttable.9.9 1;
         ttable.10.10 1;
         ttable.11.11 1;
         ttable.12.12 1;
         ttable.13.13 1;
         ttable.14.14 1;
         ttable.15.15 1;
}

ctl.ttable {
         type hw
         card 1
         device 0
}

Then try the ecasound command:

ecasound -t:10 -a:1 -f:16,16,44100 -i:alsa,all16 -o:t16.wav
(or)
ecasound -t:10 -a:1 -f:16,16,44100 -i:alsa,ttable -o:t16.wav

I get output like this:

********************************************************************************
* ecasound v2.4.3 (C) 1997-2005 Kai Vehmanen and others
********************************************************************************
- [ Session created ]
----------------------------------------------------------
- [ Chainsetup created (cmdline) ]
---------------------------------------------
(eca-chainsetup-parser) Set processing time to 10.00.
- [ Connecting chainsetup ]
----------------------------------------------------
(eca-chainsetup) 'rt' buffering mode selected.
(eca-chainsetup) Audio object "alsa", mode "read".
(audio-io) Format: s16_le, channels 16, srate 44100, interleaved.
(eca-chainsetup) Audio object
... "t16.wav", mode
... "read/write".
(audio-io) Format: s16_le, channels 16, srate 44100, interleaved.
- [ Chainsetup connected ]
-----------------------------------------------------
(eca-control-objects) Connected chainsetup: "command-line-setup".
- [ Controller/Starting batch processing ]
-------------------------------------
- [ Engine init - Driver start ]
-----------------------------------------------
(eca-engine) Using realtime-scheduling (SCHED_FIFO:50).
(audioio-db-client) WARNING: Overrun in writing to "t16.wav". Trying to
recover.
warning! playback overrun - samples lost! Break was at least 410.69 ms
long.
Unknown device state '3'
Unknown device state '3'
Unknown device state '3'
Unknown device state '3'
Unknown device state '3'
Unknown device state '3'
Unknown device state '3'
Unknown device state '3'
Unknown device state '3'
Unknown device state '3'
Unknown device state '3'
Unknown device state '3'
Unknown device state '3'
...
Unknown device state '3'
warning! playback overrun - samples lost! Break was at least 0.24 ms long.
Unknown device state '3'
...

I've tried using the "alsaplugin" input device, but that only seems to
be able to handle numbers, not named devices, so I cannot get something
like this to work...I just get silence:

ecasound -t:10 -a:1 -f:16,16,44100 -i:alsaplugin,all16 -o:t16.wav
(or)
ecasound -t:10 -a:1 -f:16,16,44100 -i:alsaplugin,ttable -o:t16.wav

I have the second card setup to get it's clock from the first via the
envy24control utility..using S/PDIF or Wordclock yields the same sorts
of messages (Unknown device state '3') but slightly different "Break"
times. Not sure if there are any clues there.

All goes well when I go back to this method:

ecasound -t:10 \
   -a:1 -f:16,8,44100 -i:alsa,analog8_1 -o:t18.wav \
   -a:2 -f:16,8,44100 -i:alsa,analog8_2 -o:t28.wav

I guess the waveforms are a sample or two off, but I think it will not
be very noticeable.

I am still curious if there is some way to get ALSA configured so that
ecasound can grab all 16 channels at once completely in sync...anyone?

Thanks,
-Bery

-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
Ecasound-list mailing list
Ecasound-list@email-addr-hidden
https://lists.sourceforge.net/lists/listinfo/ecasound-list
Received on Thu Dec 1 20:15:05 2005

This archive was generated by hypermail 2.1.8 : Thu Dec 01 2005 - 20:15:05 EET