Ecasound DSP startup difficulties

Status
This old topic is closed. If you want to reopen this topic, contact a moderator using the "Report Post" button.
In your ecasound commands, you put the format command (-f) AFTER the input specifier command. You might want to move the format command BEFORE the input specifier. I think ecasound's "engine" only does 1 pass thru the command set, so it would not have "known" about the format specifier when it is connecting to the input.

The command "aplay" is for listing playback cards and devices. If you want to know about input (record) controls on your audio card, use "arecord -L" instead.

In alsamixer, you can press F4 to view only the capture (e.g. recording) controls for the card. Since you have both an input and output spdif connection, this will prevent a mistake where you change the output spdif control when you wanted to change the input spdif control. Otherwise, you can look for the word "CAPTURE" below the control.

The control "PCM CAPT" might be a selector for WHICH input is selected. Can this be set to something other than "MIC"? I would set it to the input that you are trying to record from.

Also, you have more serious mistakes in your ecasound commands. You use the format command once at the beginning. Unless you use it again, that format is the one that continues to be used. What you specified was -f:16,2,44100. This is 2 channels of 16 bit audio at 44.1kHz. But later on the woofer and tweeter lines, you use chorder and specify FOUR channels. The man pages do not say if chorder will create a channel, so I think the third and fourth channels on the tweeter may be lost. Instead, you should put the format command BEFORE the chorder command. You can do this either just before -o:loop,1 on the pre line, or you can do it separately for the woofer and tweeter lines, right after the -pf: command. This will create the additional channels (ch3 and ch4) in the stream so that they already exist when you move the audio to them using chmove. Also, for the woofer, you don't need to use chorder. Channel 1 is already the first one and channel 2 is already the second one, so chorder:1,2,0,0 does nothing.
 
Just look at the picture - what is your PCM Capture value and what value did I write in my previous post?

In your ecasound commands, you put the format command (-f) AFTER the input specifier command. You might want to move the format command BEFORE the input specifier. I think ecasound's "engine" only does 1 pass thru the command set, so it would not have "known" about the format specifier when it is connecting to the input.

The command "aplay" is for listing playback cards and devices. If you want to know about input (record) controls on your audio card, use "arecord -L" instead.

In alsamixer, you can press F4 to view only the capture (e.g. recording) controls for the card. Since you have both an input and output spdif connection, this will prevent a mistake where you change the output spdif control when you wanted to change the input spdif control. Otherwise, you can look for the word "CAPTURE" below the control.

The control "PCM CAPT" might be a selector for WHICH input is selected. Can this be set to something other than "MIC"? I would set it to the input that you are trying to record from.

Also, you have more serious mistakes in your ecasound commands. You use the format command once at the beginning. Unless you use it again, that format is the one that continues to be used. What you specified was -f:16,2,44100. This is 2 channels of 16 bit audio at 44.1kHz. But later on the woofer and tweeter lines, you use chorder and specify FOUR channels. The man pages do not say if chorder will create a channel, so I think the third and fourth channels on the tweeter may be lost. Instead, you should put the format command BEFORE the chorder command. You can do this either just before -o:loop,1 on the pre line, or you can do it separately for the woofer and tweeter lines, right after the -pf: command. This will create the additional channels (ch3 and ch4) in the stream so that they already exist when you move the audio to them using chmove. Also, for the woofer, you don't need to use chorder. Channel 1 is already the first one and channel 2 is already the second one, so chorder:1,2,0,0 does nothing.

The help of you both is highly appreciated. I've got many good suggestions that helped me to get insight. I think I can optimize the filterscript, although I have a working version. But for now my priority is to get the inputs to work. I've really spend some hours trying to get the input right.

I think the last picture was not so clear as both the Mic and spdif were red. Below the picture of the Alsamixer of the situation I test to get spdif in to work

full.jpg


Unfortunately no sound. Are these the right settings in Alsamixer?
As I told I also tried line in (togling this to capture with space) but this doesn't give sound either. I tried arecord -L to find the line in but for the USB card the output makes no difference compared to aplay -L
 
Your "PCM Capture" selector on the first picture is still at Mic, right? Then your input is microphone. You have to change the selector using arrow keys to "IEC958 In" (IEC958 = SPDIF), as I told you a few posts before.
I was glad to hear that you have the same soundcard as I do. I really spelled your instruction 'alsamixer must be switched to PCM Capture = IEC958 In'. Unfortunately the first picture didn't show the right situation in alsamixer. So I made a new picture that showed the tested situation yesterday. Both PCM and Spdif are on capture and no other sources do. I have read the manual of alsamixer and know that I can change the input by using te arrow keys and shift to put it on capture or not (more options are not available). This is what you want to tell me or do I have to change the settings of the picture of yesterday?

Then the command I have to use to make this work: I use
Code:
-i:alsa,iec958:CARD=Device,DEV=0
I removed the space and I don't use the -f command any more behind this. Despite these settings I don't get any sound from this. No error messages either. My source is a secondary RPI with Max2play and squeezeserver installed and the Toslink is playing well with a DAC.

The second problem is that I can't use the Line in either. The line in is important for me because I want to use analogue test signals to measure the DSP-amplifier-speaker combination. When I test this I put both PCM and line in on capture. I still don't know for sure which input command I should use for Line in. I tried different things but no sound as well.

If you say your inputs are working with this soundcard I believe you. You haven't installed any drivers and like me only hooked the soundcard to your RPI? If the settings I use are errouneous than this is not bad reading, its just misunderstanding. I politely ask you to provide me with additional, specific instructions to change things.
 
Last edited:
Maximize your terminal to see complete strings.

Honestly, I do not know what you are trying to achieve with that soundcard. Please specify in detail all your requirements.

What I try to achieve is what this topic is about: making a software based DSP (in this case a digital crossover filter for loudspeakers) using linux, ecasound and digitial filters on a RPI. I need the soundcard to capture input (the current problem) and change the digital signal to analogue 5.1 signal (no problem). The 5.1 channels are used to drive different speakers (woofers, mid and tweaters). More background you can find at Digital Crossover/EQ with Open-Source Software: HOWTO | Richard's Stuff What is your use case with this soundcard?

Your picture with the circle makes clear to me what you meant in your post. I was focused on the red capture remarks on the channels PCM and SPDIF. To be honest I have no idea how I made the channel PCM capt and set Mic in it. The second picture I made later doesn't show this channel. Can you please clarify this?
 
I need the soundcard to capture input (the current problem)

The spdif signal into your toslink input comes from a different machine?

change the digital signal to analogue 5.1 signal (no problem). The 5.1 channels are used to drive different speakers (woofers, mid and tweaters).

Check if the soundcard supports 6ch out and 2ch in simultaneously (I checked only 8ch out and 2ch in - not working, 8ch out and 0ch in working). For testing you can use arecord and speaker-test utils + their documentation. It is always good to test with simple utils first before running complicated chains in ecasound.

What is your use case with this soundcard?
Just for testing, no other use for this. As I said the spdif input works acceptably just for 48kHz which is a big limitation.

To be honest I have no idea how I made the channel PCM capt and set Mic in it.

Default value?

The second picture I made later doesn't show this channel. Can you please clarify this?

Very simple - your first picture shows the first alsamixer "tab", your second picture the second "tab".
 
The spdif signal into your toslink input comes from a different machine?

Check if the soundcard supports 6ch out and 2ch in simultaneously (I checked only 8ch out and 2ch in - not working, 8ch out and 0ch in working). For testing you can use arecord and speaker-test utils + their documentation. It is always good to test with simple utils first before running complicated chains in ecasound.

Just for testing, no other use for this. As I said the spdif input works acceptably just for 48kHz which is a big limitation.

Default value?

Very simple - your first picture shows the first alsamixer "tab", your second picture the second "tab".

I thought it would be simple and now I understand the capture in, thanks for your patience. Analogue input using the line in was succesful and the filter is doing its task. Unfortunately the SPDIF in still doesn't give any sound. So I am afraid that spdif in combined with audio out is not working (apparently other soundcards have the same problem).

I have some additional questions:
- This is a 5.1 soundcard with 6 channels out. You said 8 ch out is possible. How is this possible with only 3 jacks for outgoing channels?
- You said spdif in using 48 khz is working acceptable. How do you test this? What channels do you use to listen to?
 
Last edited:
Unfortunately the SPDIF in still doesn't give any sound. So I am afraid that spdif in combined with audio out is not working (apparently other soundcards have the same problem).

Where do you get your spdif signal from?

- This is a 5.1 soundcard with 6 channels out. You said 8 ch out is possible. How is this possible with only 3 jacks for outgoing channels?

Check file /proc/asound/cardX/stream0 , where X is your card index. The CM106 chip (see lsusb) defines 5 playback altsets - 2, 4, 6, 8ch /44.1 or48kHz, 2ch/96kHz. I do not know if the 7th + 8th channels are hooked internally to any connector, probably not.

You said spdif in using 48 khz is working acceptable. How do you test this? What channels do you use to listen to?

I do not have another spdif source available right now, so simple loopback with toslink cable:

Code:
speaker-test -t sine -c 2 -r 48000 -D iec958:CARD=2
arecord -v -D plug:hw:2 -c 2 -r 48000 -f S16_LE  recorded.wav

Again, the PCM Capture Source must be changed to "IEC958 In" to record from the SPDIF input.
 
I thought it would be simple and now I understand the capture in, thanks for your patience. Analogue input using the line in was succesful and the filter is doing its task. Unfortunately the SPDIF in still doesn't give any sound. So I am afraid that spdif in combined with audio out is not working (apparently other soundcards have the same problem).

I have some additional questions:
- This is a 5.1 soundcard with 6 channels out. You said 8 ch out is possible. How is this possible with only 3 jacks for outgoing channels?
- You said spdif in using 48 khz is working acceptable. How do you test this? What channels do you use to listen to?

There are six analog output channels, AND two more channels via the SPDIF out. That makes 8 total output channels. Lots of audio interfaces use this type of channel counting.

To test 48kHz SPDIF input you will need an external 48kHz SPDIF SOURCE, so a CD player will not work. Also, usually all the I/O of an audio interface runs at the same sample rate, meaning 48kHz digital input requires 48kHz samples returned to the analog outputs (the DAC). You could not, for example, connect your CD player to the SPDIF input, upsample to 96kHz, and send that data back to the SPDIF or analog outputs. This seems to be the case for all audio interfaces that I have come across.

To be honest, this is a very, very cheap audio interface. I had one once... it's not all that good. I currently use "pro audio" interfaces that are intended for home recording studios. They can do simultaneous recording and playback, and the quality (THD, S/N ratio, etc) will be much better. See if you can get a used one on Ebay, etc. If you want some suggestions, send me a PM.
 
There are six analog output channels, AND two more channels via the SPDIF out. That makes 8 total output channels. Lots of audio interfaces use this type of channel counting.

To test 48kHz SPDIF input you will need an external 48kHz SPDIF SOURCE, so a CD player will not work. Also, usually all the I/O of an audio interface runs at the same sample rate, meaning 48kHz digital input requires 48kHz samples returned to the analog outputs (the DAC). You could not, for example, connect your CD player to the SPDIF input, upsample to 96kHz, and send that data back to the SPDIF or analog outputs. This seems to be the case for all audio interfaces that I have come across.

To be honest, this is a very, very cheap audio interface. I had one once... it's not all that good. I currently use "pro audio" interfaces that are intended for home recording studios. They can do simultaneous recording and playback, and the quality (THD, S/N ratio, etc) will be much better. See if you can get a used one on Ebay, etc. If you want some suggestions, send me a PM.


Where do you get your spdif signal from?
.

Your comments clear some things up for me. My spdif signal comes from a secondary RPI. This RPI has a Digiberry digi+ pro with a coax and Toslink output. On the RPI max2play and squeezebox are installed. I can play (flac) files from my network or from Spotify (ogg 320K). I am not completely sure what the output of this is. The squeezebox puts the original source through and I found this SqueezePlay Audio Playback - SqueezeboxWiki
I think the Spotify/ogg signal is resampled to 16/44,1 khz else my DAC wouldn't play it correct. Anyway, I don't use 24/48 sources, but I have some files with high samplerates 24/88, 24/96 that play well.

I will test spdif by using the input/output spdif signal like phofman suggested. But for my purpose this is not useful. I think the best solution for me is to install a musicplayer on the RPI that does the filtering. I saw some suggestions to use MPD and squeezelite. But for testing I can do with the line in channel.

I am aware this is a cheap and probably poor sounding soundcard. But I first wanted to sort things out and see if I understand the setup before I spend more money.
 
Last edited:
Just keep everything at 48/16 (RPi output as well as your DSP chain) and you should be set for playing and testing using this toy soundcard. A few years ago I tested it with a separate SPDIF source (soundcard in a different machine) and it did work OK for 48/16 for the limited time of testing.

Usually, PCI(e) cards use the recovered incoming SPDIF clock for clocking the playback part too (running synchronously). This card (my only USB card with SPDIF input, I do not know how other USB models are implemented) has the capture in async mode and playback in adaptive mode. Therefore it suggests the capture part is clocked by the incoming SPDIF and playback part by the USB controller, making the card run asynchronously. The CM106 datasheet http://www.steila.com/USB4IO/CMedia/CM106--L_F-Datasheet-1.3.pdf does not provide any details about clock source in SPDIF capture mode, the block diagram therein shows only single clock block.
 
Just keep everything at 48/16 (RPi output as well as your DSP chain) and you should be set for playing and testing using this toy soundcard. A few years ago I tested it with a separate SPDIF source (soundcard in a different machine) and it did work OK for 48/16 for the limited time of testing.

Usually, PCI(e) cards use the recovered incoming SPDIF clock for clocking the playback part too (running synchronously). This card (my only USB card with SPDIF input, I do not know how other USB models are implemented) has the capture in async mode and playback in adaptive mode. Therefore it suggests the capture part is clocked by the incoming SPDIF and playback part by the USB controller, making the card run asynchronously. The CM106 datasheet http://www.steila.com/USB4IO/CMedia/CM106--L_F-Datasheet-1.3.pdf does not provide any details about clock source in SPDIF capture mode, the block diagram therein shows only single clock block.
Unfortunately I don't have any sources with 48/16 so this mode is not usefull for my DSP. When I look into the datasheet I see that spdif in is capable of capturing 44,1 as well. There seems to be a setting for this (SPDFI_FREQ).

I tried to capture some high bitrate sources. But when capturing this I got errors. Playing 44,1K doesn't give errors. So my inference for now is that the card is capturing 44,1K but is not capable of doing DA conversion at the same time and play analogue output via the jacks. Might loopback give a solution for this limitation?

Probably the card is capable of recording the 44,1K spdif in but for a DSP this is not useful.
 
Unfortunately I don't have any sources with 48/16 so this mode is not usefull for my DSP. When I look into the datasheet I see that spdif in is capable of capturing 44,1 as well. There seems to be a setting for this (SPDFI_FREQ).

Just look at that stream0 file with altsets - 44.1kHz is listed in the capture altset. But in my case I was getting ugly cracks in captured SPDIF 44.1 stream. I assume problem with clock.

I tried to capture some high bitrate sources. But when capturing this I got errors.

What do you call "high bitrate"? The card works only with 16bit samples - again look at the altsets. What errors?

Playing 44,1K doesn't give errors. So my inference for now is that the card is capturing 44,1K but is not capable of doing DA conversion at the same time and play analogue output via the jacks.

Have you actually captured anything via SPDIF successfully? I am afraid you still have not configured your card properly.

Might loopback give a solution for this limitation?

How could loopback help you with that? Why would you want to record what you have just DSP'd and put it through DSP again.

Probably the card is capable of recording the 44,1K spdif in but for a DSP this is not useful.

It is simple. If you need 44.1kHz, get a decent soundcard, not this toy.
 
Just look at that stream0 file with altsets - 44.1kHz is listed in the capture altset. But in my case I was getting ugly cracks in captured SPDIF 44.1 stream. I assume problem with clock.
What do you call "high bitrate"? The card works only with 16bit samples - again look at the altsets. What errors?
I believe you so why should I spend time on spdif input. But in case I want to check things myself: where can I find 'stream0 file with altsets'

Have you actually captured anything via SPDIF successfully? I am afraid you still have not configured your card properly.
No, what else must I configure besides alsamixer?

How could loopback help you with that? Why would you want to record what you have just DSP'd and put it through DSP again.
Lets leave this.

It is simple. If you need 44.1kHz, get a decent soundcard, not this toy.
I like to play with toys. I already learned a lot. But I understand what you said. I'm open for suggestions for good soundcards.
 
But in case I want to check things myself: where can I find 'stream0 file with altsets'

I already talked about that http://www.diyaudio.com/forums/pc-based/316737-ecasound-dsp-startup-difficulties-5.html#post5312193


No, what else must I configure besides alsamixer?

Nothing else. Reconfigure your alsamixer accordingly and post here output of the following command so that we can check the settings.

Code:
amixer -c YOUR_CARD_INDEX contents



I like to play with toys. I already learned a lot. But I understand what you said. I'm open for suggestions for good soundcards.

I like toys too. But if you have no 48kHz music, no point in playing with this device.

Sorry, I do not have any suggestion for a USB device. I still live stuck in PCI history. I guess you have no PCI slot in your PC any more :)
 
I already talked about that http://www.diyaudio.com/forums/pc-based/316737-ecasound-dsp-startup-difficulties-5.html#post5312193




Nothing else. Reconfigure your alsamixer accordingly and post here output of the following command so that we can check the settings.

Code:
amixer -c YOUR_CARD_INDEX contents
I like toys too. But if you have no 48kHz music, no point in playing with this device.

Sorry, I do not have any suggestion for a USB device. I still live stuck in PCI history. I guess you have no PCI slot in your PC any more :)
Here we go again. I solved my Firefox issues on Ubuntu mate so now its easier to copy results

The relevant part of /proc/asound/card1
Code:
Capture:
  Status: Stop
  Interface 2
    Altset 1
    Format: S16_LE
    Channels: 2
    Endpoint: 5 IN (ASYNC)
    Rates: 44100, 48000
So 44,1khz is supported

This code is playing the Line in and distributes the filtered signal to the first and second jack. alsamixer set on Line in.
Code:
ecasound -z:mixmode,sum -x \
         -a:pre -i:alsa,hw:Device,DEV=0 -pf:pre.ecp -o:loop,1 \
         -a:woofer,tweeter -i:loop,1 \
         -a:woofer -pf:woofer.ecp -chorder:1,2,0,0 \
         -a:tweeter -pf:tweeter.ecp -chorder:0,0,1,2 \
         -a:woofer,tweeter -f:16,4,44100 -o:alsa,surround51:CARD=Device,DEV=0
I try to do the same for spdif. Of course I set alsamixer to pcm capture to IEC958 I equal to way I did this for the line in. This is the code:
Code:
ecasound -z:mixmode,sum -x \
         -a:pre -i:alsa,iec958:CARD=Device,DEV=0 -pf:pre.ecp -o:loop,1 \
         -a:woofer,tweeter -i:loop,1 \
         -a:woofer -pf:woofer.ecp -chorder:1,2,0,0 \
         -a:tweeter -pf:tweeter.ecp -chorder:0,0,1,2 \
         -a:woofer,tweeter -f:16,4,4410 -o:alsa,surround51:CARD=Device,DEV=0
The command is the same with the exception of the -i part. When I do this I get this:
Code:
**************************************************************************
*        ecasound v2.9.1 (C) 1997-2014 Kai Vehmanen and others    
**************************************************************************
(eca-chainsetup-parser) Enabling 'sum' mixmode.
(eca-chainsetup-parser) Truncating outputs (overwrite-mode).
Warning: type DBC_REQUIRE soft-assert 'formatted_string.empty() == false' failed at
 -> preset.cpp:155 [void PRESET::parse(const string&)]
Warning: type DBC_REQUIRE soft-assert 'formatted_string.empty() == false' failed at
 -> preset.cpp:155 [void PRESET::parse(const string&)]
Warning: type DBC_REQUIRE soft-assert 'formatted_string.empty() == false' failed at
 -> preset.cpp:155 [void PRESET::parse(const string&)]
(eca-chainsetup) Chainsetup "untitled-chainsetup"
(eca-chainsetup) Multitrack-mode enabled.
(eca-chainsetup) "rt" buffering mode selected.
(eca-chainsetup) WARNING: Couldn't lock all memory!
(eca-chainsetup) Opened input "alsa", mode "read". Format: s16_le, channels
... 2, srate 44100, interleaved.
(eca-chainsetup) NOTE: using existing audio parameters -f:f32_le,2,44100
... for object 'loop' (tried to open with -f:s16_le,2,44100).
(eca-chainsetup) Opened input "loop", mode "read". Format: f32_le, channels
... 2, srate 44100, interleaved (locked params).
(eca-chainsetup) Opened input "loop", mode "read". Format: f32_le, channels
... 2, srate 44100, interleaved (locked params).
(eca-chainsetup) Opened output "alsa", mode "write". Format: s16_le,
... channels 4, srate 44100, interleaved.
- [ Connected chainsetup: "untitled-chainsetup" ] ------------------------
- [ Controller/Starting batch processing ] -------------------------------
- [ Engine - Driver start ] ----------------------------------------------
No errors, everything seems to be fine. The warnings I get for the line in too. I hear some slight hiss, but no music, not distorted, no glitches nothing. The process is continuiing without errors and without music so I have to interrupt this. Is it just that this card like other cards can't support spdif in and analogue out together or do I overlook something?

I asked the supplier of the soundcard for advice and got the reply: 'You need to install the drivers'. There is a small CDROM with the card. PCI cards and CDROMS are scarce these days but I will give it a try.
 
Last edited:
Since you do not show your ecp files and there could be something wrong with them, why don't we try to simplify things and just try to pass the audio thru the device, input via spdif and output via channels 1 and 2 (these are used for the woofers).

What happens if you run this:
Code:
ecasound -B:rt -f:16,2,44100 \
   -i:alsa,iec958:CARD=Device,DEV=0 \
   -o:alsa,front:CARD=Device,DEV=0
 
Status
This old topic is closed. If you want to reopen this topic, contact a moderator using the "Report Post" button.