• WANTED: Happy members who like to discuss audio and other topics related to our interest. Desire to learn and share knowledge of science required. There are many reviews of audio hardware and expert members to help answer your questions. Click here to have your audio equipment measured for free!

Budget Standalone "Toslink > DSP > Toslink" with Camilladsp. Set up instructions for newbies.

OP
M

MCH

Major Contributor
Joined
Apr 10, 2021
Messages
2,581
Likes
2,197
Hi k3v1, unfortunately i don't have this setup anymore, but let's see if someone chimes in!
 

mdsimon2

Major Contributor
Forum Donor
Joined
Oct 20, 2020
Messages
2,477
Likes
3,315
Location
Detroit, MI
A lot of these SPDIF input devices seem to have issues with CamillaDSP if the stream is stopped (see Hifiberry Digi+ I/O).

What is the CamillaDSP status when you are getting the noise? Does it go to "Stalled"? Or stay "Running" (or maybe "Paused")? Is there anything in the log that suggests there is an issue? If you turn the TV on after hearing static does it work correctly without restarting CamillaDSP?

I believe @phofman had mentioned that CamillaDSP 1.1 may handle some of these issues better. You could try compiling it and see if it helps.

Michael
 
  • Like
Reactions: MCH

HenrikEnquist

Member
Joined
Jul 1, 2021
Messages
80
Likes
109
It seems like nearly all spdif input devices misbehave in some way when the signal stops, or the sample rate changes. Unfortunately they all behave differently, so it's not possible to make a general solution for all of them.
 

K3v1

New Member
Joined
Feb 9, 2020
Messages
2
Likes
0
So I've tested this again to give a few specifics:
The moment I turn the TV off it seems to stay in the state "RUNNING" (in the Web-GUI) and volume levels stay consistently high for a while (like around a minute or so I'd say) and it produces pretty much constant white noise. After that it calms down a little and switches between "RUNNING" and "STALLED" (also maybe some "PAUSED" occasionally but I had a hard time to reproduce those) every few seconds with Capture samplerate sometimes being cleared of the number and more sporadic white noise. This is with 2048 chunksize and 48000khz sample rate (but it didn't seem to be very different with 1024 or 4096 chunksize or 44,1khz sample rate). I tried to include a representative section of the log below. There doesn't seem to be any other messages than the ones I included below.

2022-08-25 15:44:12.821568 INFO [src/bin.rs:711] CamillaDSP version 1.0.1
2022-08-25 15:44:12.821931 INFO [src/bin.rs:712] Running on linux, aarch64
2022-08-25 15:44:12.822269 DEBUG [src/bin.rs:754] Read config file Some("/home/kevi/camilladsp/active_config.yml")
2022-08-25 15:44:12.824682 DEBUG [src/bin.rs:773] Config is valid
2022-08-25 15:44:12.824975 DEBUG [src/socketserver.rs:260] Start websocket server on 127.0.0.1:1234
2022-08-25 15:44:12.825662 DEBUG [src/bin.rs:857] Wait for config
2022-08-25 15:44:12.825877 DEBUG [src/bin.rs:890] Config ready
2022-08-25 15:44:12.826857 DEBUG [src/filters.rs:450] Build new pipeline
2022-08-25 15:44:12.826863 DEBUG [src/bin.rs:213] Using channels [true, true]
2022-08-25 15:44:12.827224 DEBUG [src/alsadevice.rs:909] Buffer frames 4096
2022-08-25 15:44:12.827254 DEBUG [src/processing.rs:19] build filters, waiting to start processing loop
2022-08-25 15:44:12.845574 DEBUG [src/alsadevice.rs:412] Playback: supported channels, min: 1, max: 10000, list: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32]
2022-08-25 15:44:12.845753 DEBUG [src/alsadevice.rs:413] Playback: setting channels to 2
2022-08-25 15:44:12.846746 DEBUG [src/alsadevice.rs:417] Playback: supported samplerates: Range(4000, 4294967295)
2022-08-25 15:44:12.846854 DEBUG [src/alsadevice.rs:418] Playback: setting rate to 48000
2022-08-25 15:44:12.847305 DEBUG [src/alsadevice.rs:422] Playback: supported sample formats: [S16LE, S24LE, S24LE3, S32LE, FLOAT32LE, FLOAT64LE]
2022-08-25 15:44:12.847416 DEBUG [src/alsadevice.rs:423] Playback: setting format to S16LE
2022-08-25 15:44:12.849860 DEBUG [src/alsadevice.rs:454] Opening audio device "plughw:ICUSBAUDIO7D,0" with parameters: HwParams { channels: Ok(2), rate: "Ok(48000) Hz", format: Ok(S16LE), access: Ok(RWInterleaved), period_size: "Ok(512) frames", buffer_size: "Ok(4096) frames" }, SwParams(avail_min: Ok(2048) frames, start_threshold: Ok(1536) frames, stop_threshold: Ok(4096) frames)
2022-08-25 15:44:12.850095 DEBUG [src/alsadevice.rs:459] Audio device "plughw:ICUSBAUDIO7D,0" successfully opened
2022-08-25 15:44:12.850418 DEBUG [src/bin.rs:323] Playback thread ready to start
2022-08-25 15:44:12.863249 DEBUG [src/alsadevice.rs:412] Capture: supported channels, min: 1, max: 10000, list: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32]
2022-08-25 15:44:12.863404 DEBUG [src/alsadevice.rs:413] Capture: setting channels to 2
2022-08-25 15:44:12.864203 DEBUG [src/alsadevice.rs:417] Capture: supported samplerates: Range(4000, 4294967295)
2022-08-25 15:44:12.864311 DEBUG [src/alsadevice.rs:418] Capture: setting rate to 48000
2022-08-25 15:44:12.864741 DEBUG [src/alsadevice.rs:422] Capture: supported sample formats: [S16LE, S24LE, S24LE3, S32LE, FLOAT32LE, FLOAT64LE]
2022-08-25 15:44:12.864884 DEBUG [src/alsadevice.rs:423] Capture: setting format to S16LE
2022-08-25 15:44:12.867309 DEBUG [src/alsadevice.rs:454] Opening audio device "plughw:ICUSBAUDIO7D,0" with parameters: HwParams { channels: Ok(2), rate: "Ok(48000) Hz", format: Ok(S16LE), access: Ok(RWInterleaved), period_size: "Ok(1024) frames", buffer_size: "Ok(8192) frames" }, SwParams(avail_min: Ok(2048) frames, start_threshold: Ok(0) frames, stop_threshold: Ok(8192) frames)
2022-08-25 15:44:12.867517 DEBUG [src/alsadevice.rs:459] Audio device "plughw:ICUSBAUDIO7D,0" successfully opened
2022-08-25 15:44:12.867688 DEBUG [src/bin.rs:333] Capture thread ready to start
2022-08-25 15:44:12.867807 DEBUG [src/bin.rs:336] Both capture and playback ready, release barrier
2022-08-25 15:44:12.867933 DEBUG [src/bin.rs:338] Supervisor loop starts now!
2022-08-25 15:44:12.867973 DEBUG [src/alsadevice.rs:856] Starting playback loop
2022-08-25 15:44:12.867981 DEBUG [src/processing.rs:21] Processing loop starts now!
2022-08-25 15:44:12.868059 DEBUG [src/alsadevice.rs:950] Starting captureloop
2022-08-25 15:44:12.868661 DEBUG [src/alsadevice.rs:248] Starting capture from state: SND_PCM_STATE_PREPARED, Ready to start
2022-08-25 15:44:12.914378 INFO [src/alsadevice.rs:160] Starting playback from Prepared state
2022-08-25 15:44:12.950110 DEBUG [/cargo/registry/src/github.com-1ecc6299db9ec823/tungstenite-0.16.0/src/handshake/server.rs:282] Server handshake done.
2022-08-25 15:44:12.953578 DEBUG [src/socketserver.rs:340] parsed command: Ok(GetVersion)
2022-08-25 15:44:12.989374 DEBUG [src/socketserver.rs:340] parsed command: Ok(GetState)
2022-08-25 15:44:12.991101 DEBUG [src/socketserver.rs:340] parsed command: Ok(GetCaptureSignalRms)
2022-08-25 15:44:12.992891 DEBUG [src/socketserver.rs:340] parsed command: Ok(GetCaptureSignalPeak)
2022-08-25 15:44:12.994648 DEBUG [src/socketserver.rs:340] parsed command: Ok(GetPlaybackSignalRms)
2022-08-25 15:44:12.996428 DEBUG [src/socketserver.rs:340] parsed command: Ok(GetPlaybackSignalPeak)
2022-08-25 15:44:12.998386 DEBUG [src/socketserver.rs:340] parsed command: Ok(GetCaptureRate)
2022-08-25 15:44:12.999908 DEBUG [src/socketserver.rs:340] parsed command: Ok(GetRateAdjust)
2022-08-25 15:44:13.001506 DEBUG [src/socketserver.rs:340] parsed command: Ok(GetBufferLevel)
2022-08-25 15:44:13.003142 DEBUG [src/socketserver.rs:340] parsed command: Ok(GetClippedSamples)
...
2022-08-25 15:46:42.726766 WARN [src/alsadevice.rs:236] Prepare capture device
2022-08-25 15:46:42.818809 DEBUG [src/socketserver.rs:340] parsed command: Ok(GetState)
2022-08-25 15:46:42.820981 DEBUG [src/socketserver.rs:340] parsed command: Ok(GetCaptureSignalRms)
2022-08-25 15:46:42.823287 DEBUG [src/socketserver.rs:340] parsed command: Ok(GetCaptureSignalPeak)
2022-08-25 15:46:42.825525 DEBUG [src/socketserver.rs:340] parsed command: Ok(GetPlaybackSignalRms)
2022-08-25 15:46:42.827826 DEBUG [src/socketserver.rs:340] parsed command: Ok(GetPlaybackSignalPeak)
2022-08-25 15:46:42.895326 WARN [src/alsadevice.rs:261] Wait timed out, capture device takes too long to capture frames
2022-08-25 15:46:42.895557 DEBUG [src/alsadevice.rs:728] Capture device is inactive, processing is stalled
2022-08-25 15:46:42.896552 DEBUG [src/alsadevice.rs:248] Starting capture from state: SND_PCM_STATE_PREPARED, Ready to start
2022-08-25 15:46:42.943325 DEBUG [src/socketserver.rs:340] parsed command: Ok(GetState)
2022-08-25 15:46:42.945662 DEBUG [src/socketserver.rs:340] parsed command: Ok(GetCaptureSignalRms)
2022-08-25 15:46:42.947956 DEBUG [src/socketserver.rs:340] parsed command: Ok(GetCaptureSignalPeak)
2022-08-25 15:46:42.950277 DEBUG [src/socketserver.rs:340] parsed command: Ok(GetPlaybackSignalRms)
2022-08-25 15:46:42.952673 DEBUG [src/socketserver.rs:340] parsed command: Ok(GetPlaybackSignalPeak)
2022-08-25 15:46:43.070042 DEBUG [src/socketserver.rs:340] parsed command: Ok(GetState)
2022-08-25 15:46:43.072443 DEBUG [src/socketserver.rs:340] parsed command: Ok(GetCaptureSignalRms)
2022-08-25 15:46:43.074950 DEBUG [src/socketserver.rs:340] parsed command: Ok(GetCaptureSignalPeak)
2022-08-25 15:46:43.077424 DEBUG [src/socketserver.rs:340] parsed command: Ok(GetPlaybackSignalRms)
2022-08-25 15:46:43.079780 DEBUG [src/socketserver.rs:340] parsed command: Ok(GetPlaybackSignalPeak)
2022-08-25 15:46:43.195296 DEBUG [src/socketserver.rs:340] parsed command: Ok(GetState)
2022-08-25 15:46:43.197758 DEBUG [src/socketserver.rs:340] parsed command: Ok(GetCaptureSignalRms)
2022-08-25 15:46:43.200242 DEBUG [src/socketserver.rs:340] parsed command: Ok(GetCaptureSignalPeak)
2022-08-25 15:46:43.202734 DEBUG [src/socketserver.rs:340] parsed command: Ok(GetPlaybackSignalRms)
2022-08-25 15:46:43.205149 DEBUG [src/socketserver.rs:340] parsed command: Ok(GetPlaybackSignalPeak)
2022-08-25 15:46:43.207845 DEBUG [src/socketserver.rs:340] parsed command: Ok(GetCaptureRate)
2022-08-25 15:46:43.210280 DEBUG [src/socketserver.rs:340] parsed command: Ok(GetRateAdjust)
2022-08-25 15:46:43.212439 DEBUG [src/socketserver.rs:340] parsed command: Ok(GetBufferLevel)
2022-08-25 15:46:43.214696 DEBUG [src/socketserver.rs:340] parsed command: Ok(GetClippedSamples)
2022-08-25 15:46:43.281066 DEBUG [src/alsadevice.rs:509] Playback buffer level: 4801.7, signal rms: [-8.93988, -7.0649915]
...
2022-08-25 15:48:16.135350 WARN [src/alsadevice.rs:236] Prepare capture device
2022-08-25 15:48:16.160220 DEBUG [src/socketserver.rs:340] parsed command: Ok(GetState)
2022-08-25 15:48:16.162321 DEBUG [src/socketserver.rs:340] parsed command: Ok(GetCaptureSignalRms)
2022-08-25 15:48:16.164242 DEBUG [src/socketserver.rs:340] parsed command: Ok(GetCaptureSignalPeak)
2022-08-25 15:48:16.166158 DEBUG [src/socketserver.rs:340] parsed command: Ok(GetPlaybackSignalRms)
2022-08-25 15:48:16.168150 DEBUG [src/socketserver.rs:340] parsed command: Ok(GetPlaybackSignalPeak)
2022-08-25 15:48:16.285083 DEBUG [src/socketserver.rs:340] parsed command: Ok(GetState)
2022-08-25 15:48:16.287385 DEBUG [src/socketserver.rs:340] parsed command: Ok(GetCaptureSignalRms)
2022-08-25 15:48:16.289639 DEBUG [src/socketserver.rs:340] parsed command: Ok(GetCaptureSignalPeak)
2022-08-25 15:48:16.291718 DEBUG [src/socketserver.rs:340] parsed command: Ok(GetPlaybackSignalRms)
2022-08-25 15:48:16.293900 DEBUG [src/socketserver.rs:340] parsed command: Ok(GetPlaybackSignalPeak)
2022-08-25 15:48:16.303928 WARN [src/alsadevice.rs:261] Wait timed out, capture device takes too long to capture frames
2022-08-25 15:48:16.304175 DEBUG [src/alsadevice.rs:728] Capture device is inactive, processing is stalled
2022-08-25 15:48:16.305179 DEBUG [src/alsadevice.rs:248] Starting capture from state: SND_PCM_STATE_PREPARED, Ready to start
2022-08-25 15:48:16.411441 DEBUG [src/socketserver.rs:340] parsed command: Ok(GetState)
2022-08-25 15:48:16.414046 DEBUG [src/socketserver.rs:340] parsed command: Ok(GetCaptureSignalRms)
2022-08-25 15:48:16.416796 DEBUG [src/socketserver.rs:340] parsed command: Ok(GetCaptureSignalPeak)
2022-08-25 15:48:16.419522 DEBUG [src/socketserver.rs:340] parsed command: Ok(GetPlaybackSignalRms)
2022-08-25 15:48:16.422191 DEBUG [src/socketserver.rs:340] parsed command: Ok(GetPlaybackSignalPeak)
2022-08-25 15:48:16.547975 DEBUG [src/socketserver.rs:340] parsed command: Ok(GetState)
2022-08-25 15:48:16.550419 DEBUG [src/socketserver.rs:340] parsed command: Ok(GetCaptureSignalRms)
2022-08-25 15:48:16.552776 DEBUG [src/socketserver.rs:340] parsed command: Ok(GetCaptureSignalPeak)
2022-08-25 15:48:16.555286 DEBUG [src/socketserver.rs:340] parsed command: Ok(GetPlaybackSignalRms)
2022-08-25 15:48:16.557759 DEBUG [src/socketserver.rs:340] parsed command: Ok(GetPlaybackSignalPeak)
 

mdsimon2

Major Contributor
Forum Donor
Joined
Oct 20, 2020
Messages
2,477
Likes
3,315
Location
Detroit, MI
As Henrik said a lot of these SPDIF input devices are problematic (and I also wonder how many SPDIF sources are problematic). One thing I've noticed on the TOSLINK to USB cards I've tried is that if they go from the RUNNING state to PAUSED state before going to STALLED state they behave better so you want to make sure you have silence threshold / silence timeout setup.

Right now I am using a macbook pro as a TOSLINK source in to a TOSLINK to USB card. If I am playing something and I pull the TOSLINK cable CamillaDSP immediately goes in to the STALLED state and I get a constant high pitch noise. However, if I stop playing CamillaDSP will go in to the PAUSED state, if I then pull the cable CamillaDSP will go in STALLED state (it also goes in to STALLED after a few seconds of being in PAUSED state) but I get no noise.

Michael
 
OP
M

MCH

Major Contributor
Joined
Apr 10, 2021
Messages
2,581
Likes
2,197
I am sorry i can only test with the minidsp 2x4hd, that is the only toslink to usb card i have now.

But in case it helps: When pulling the cable or switching off the tv while music is playing, camilladsp stays on running until it reaches the silence timeout, then changes to paused and stays there.
When the music (and camilladsp) is paused and i switch off the tv, nothing happens (=stays in pause).
No noise in any of the cases.

btw: playing with the silence threshold i realised that if i set it at -100db or lower, it never goes into pause. Is this an indication that the noise floor of the card is around there or is it programmed to be like this?
 
Last edited:

HenrikEnquist

Member
Joined
Jul 1, 2021
Messages
80
Likes
109
So I've tested this again to give a few specifics:
The moment I turn the TV off it seems to stay in the state "RUNNING" (in the Web-GUI) and volume levels stay consistently high for a while (like around a minute or so I'd say) and it produces pretty much constant white noise.
So it seems this device continues to provide nonsense data when the signal disappears. Unfortunately there is really nothing camilladsp can do to detect that.
btw: playing with the silence threshold i realised that if i set it at -100db or lower, it never goes into pause. Is this an indication that the noise floor of the card is around there or is it programmed to be like this?
You simply have something that gives a little noise around -100dB. Camilladsp just uses the level you give it, there is no logic checking if the given level is below a certain value or such.
 
  • Like
Reactions: MCH

Jeromeof

Addicted to Fun and Learning
Forum Donor
Joined
Jul 25, 2021
Messages
616
Likes
965
Location
Ireland
Interested in trying this - was thinking of putting it between my Wiim Mini steamer and my DAC which then feeds my A07.

Basically, I am thinking what is the cheapest possible audio path to some level of 'room correction' and this seems like an ideal option.

So I have a RPI3, so my first question is would that be powerful enough? I imagine it would but just checking if anyone tried.

Was looking at the options on amazon.de and this is slightly cheaper


- so anyone try this model its a 5.1 (though obviously I am only interested in it providing SPDIF input into the RPI3 - the RPI3 already connects over USB to the DAC so I imagine I only need to worry about the input ??

I would be grateful for any advise as I love the idea of adding some DSP magic using the RPI3.
 
OP
M

MCH

Major Contributor
Joined
Apr 10, 2021
Messages
2,581
Likes
2,197
Hi @Jeromeof,
I never tried a rpi3, nor the card that you linked, but if you already have the pi and you have a return window for the card.... why not trying? - just remember that these cards only accept up to 48khz, that is enough for a tv, but your wiim can output up to 192khz

Other than that, yes, you can use the card as both toslink input and output or, as you intend, use the card only as input and then output to your dac via USB.

I believe @mdsimon has tried a card that only has toslink input (sufficient for you) and accepts higher sample rates. A bit more expensive though:


Edit: The same company also sells a cheaper version (29eur) that goes up to 96khz. For 11 eur difference might be worth to use with the wiim:

 
Last edited:

Jeromeof

Addicted to Fun and Learning
Forum Donor
Joined
Jul 25, 2021
Messages
616
Likes
965
Location
Ireland
Hi @Jeromeof,
I never tried a rpi3, nor the card that you linked, but if you already have the pi and you have a return window for the card.... why not trying? - just remember that these cards only accept up to 48khz, that is enough for a tv, but your wiim can output up to 192khz

Other than that, yes, you can use the card as both toslink input and output or, as you intend, use the card only as input and then output to your dac via USB.

I believe @mdsimon has tried a card that only has toslink input (sufficient for you) and accepts higher sample rates. A bit more expensive though:


Edit: The same company also sells a cheaper version (29eur) that goes up to 96khz. For 11 eur difference might be worth to use with the wiim:

Thanks those options look very interesting - yes I have the wiim set to 192khz currently outputting directly to the same DAC that I have the RPI3 currently connected, my idea was to connect the Wiim into the RPI and mainly use it CamillaDSP.

Also, I was looking at this earlier https://www.audiophonics.fr/en/diy-...ard-for-rasberry-pi-24bit-192khz-p-16604.html Any opinions? Seems like the ideal HAT to allow a RPI to act like a DSP.
 
OP
M

MCH

Major Contributor
Joined
Apr 10, 2021
Messages
2,581
Likes
2,197
Thanks those options look very interesting - yes I have the wiim set to 192khz currently outputting directly to the same DAC that I have the RPI3 currently connected, my idea was to connect the Wiim into the RPI and mainly use it CamillaDSP.

Also, I was looking at this earlier https://www.audiophonics.fr/en/diy-...ard-for-rasberry-pi-24bit-192khz-p-16604.html Any opinions? Seems like the ideal HAT to allow a RPI to act like a DSP.
If your wiim outputs 192khz and you go the hifime route, then you will need the s2.

Regarding the hifiberry, i have no experience with it, i only know it cannot input and output simultaneously, but if you are thinking to use only for the input task, it should work (?) see below Michael's answer
 

mdsimon2

Major Contributor
Forum Donor
Joined
Oct 20, 2020
Messages
2,477
Likes
3,315
Location
Detroit, MI
Thanks those options look very interesting - yes I have the wiim set to 192khz currently outputting directly to the same DAC that I have the RPI3 currently connected, my idea was to connect the Wiim into the RPI and mainly use it CamillaDSP.

Also, I was looking at this earlier https://www.audiophonics.fr/en/diy-...ard-for-rasberry-pi-24bit-192khz-p-16604.html Any opinions? Seems like the ideal HAT to allow a RPI to act like a DSP.

The hifiberry does not work well with CamillaDSP if the input signal is interrupted, it will cause CamillaDSP to stall and it will not automatically restart when the signal is restored.

The hifime options seem more robust in this regard although if you get the S2 digi I would not use the TOSLINK input and output at the same time as that seems to have issues. However it works fine if you use the TOSLINK input as capture device and another USB DAC as playback device.

Michael
 
  • Like
Reactions: MCH
OP
M

MCH

Major Contributor
Joined
Apr 10, 2021
Messages
2,581
Likes
2,197
Whilst I've seen the hifiberry digi-io dismissed, am I right in thinking the hifiberry dac dsp should suffice? (https://www.hifiberry.com/shop/boards/hifiberry-dac-dsp/)

The datasheet states 'Stereo digital input and output (input up to 96kHz, output up to 192kHz)'.
Hi maxp
I have no experience with the hifiberry dac+dsp board nor hifiberry dsp in general. It does have toslink input and output, but in any case, I would check out and ask the hifiberry forum if it is possible to use the toslink input and output simultaneously.
 

RogerM

Member
Joined
Jul 11, 2020
Messages
11
Likes
5
Hifiberry Digi IO card can certainly do input and output together. I have one capturing 48KHz PCM from TV, processing it with Camilladsp and outputting 48KHz out to an amplifier.
Not tried other rates, or mixing input and output rates.
As Hifiberry mention on their website, it does seem to have some issues if the input stream changes. Switching off and on TV in my setup, sometimes, not always, seems to put the input in a stalled state. Currently I get around this by restarting Camilladsp by dedicating an extra remote control button to trigger this restart if needed. Plan to look into writing a simple "self reset" script which checks every second if interface is stalled and reset it if it is.
 
  • Like
Reactions: MCH

Hainnes

New Member
Joined
Nov 7, 2022
Messages
3
Likes
0
Is this build also capable of working with ac3 audio from toslink ? I'm trying to build a fairly cheap roomcorection dsp for my home theater.
 

ehabheikal

Senior Member
Joined
May 22, 2020
Messages
435
Likes
160
Hello team,

I wanted to share with anyone interested these easy to follow noob-proof instructions to build something that i think can be a very handy device for very little money.

The motivation:

Not long ago, and thanks to folks here, i decided to go ahead and do some room correction in my livingroom. I bought a umik-1, downloaded REW... and i must say that the results were very noticeable. I don't have, not even by far, one of these super flat responses that some people post here, but i do have a couple of very annoying resonances/room modes at around 50 Hz that needed correction badly, and it worked very well.

My setup looks like this:

2 channel streamed music > raspberry pi w/moode/camilladsp room correction > USB > topping D30pro > power amp > speakers

Additionally:

CD/DVD player > coax > tv (+spotify/films) > stereo toslink > same topping D30pro > power amp > speakers

The thing is, when I got used to the room correction, the sound coming from my tv directly to the D30pro, obviously with no correction, became difficult to accept. Even if only for casual background spotfy listening or for movies, those ugly resonances are again there.... grrrrr!!!

So what can be done to apply the same correction to the signal coming from the tv? I definitely dont want to spend a lot of money nor i am willing to have to install a big AVR or similar.

I just want to take the toslink from my tv, apply eq, and send it to my dac via spdif (the USB is occupied with the main music streamer)...

So easy, and so difficult apparently... the fact is that there are not many detailed instructions at newbie level on how to build such a thing, or at least i could not find them, so i thought this could be helpful for others in my situation. I hope you find them useful.



First, let me explain you a couple of apparently obvious solutions that i decided not to try, and why:

- Hifiberry digi+ I/O hat: Looks like the ideal solution. It has toslink in and out. But the only information i could get online was users complaining because they could not make the input and output work simultaneously and hifiberry looking somewhere else... so it did not seem to be a newbie friendly solution.

https://support.hifiberry.com/hc/en...igi-I-O-support-simultaneous-input-and-output-

- Input a spdif signal to my already existing moodeaudio streamer: moodeaudio has indeed the possibility to chose input from spdif, but unfortunately it only works with two cards, and i think none of them has toslink input. Tim Curtis himself explains it in the links below. Again does not look like a thing a newbie can do easily...:

https://moodeaudio.org/forum/showthread.php?tid=3981&highlight=input

https://moodeaudio.org/forum/showthread.php?tid=3377&highlight=input+selection



The inspiration came from people reporting to have had interfaces sending and receiving simultaneously signal to a raspberry pi running camilladsp.... Great! but can this be done with something very small that i can hide behind the tv, toslink in and out, and most importantly, on the ultra cheap?? there we go!

The first i did was to try a Sound Blaster X-fi HD USB card that has toslink input and output, and after some initial issues, i could make it work! But i need the X-fi for something else, so i decided to go for something that i could buy as cheap as possible in amazon, and i found this:

https://www.amazon.de/gp/product/B07W21PGJQ/ref=ppx_yo_dt_b_asin_title_o00_s00?ie=UTF8&psc=1

Toslink in and out, 25 euros.... i am sure it wont be as good as SOTA DACs, not even as the X-fi HD, but not needing any DAC tasks, is it even relevant?i decided to give it a try.



Detailed newbie-proof instructions:

Most of this is an adaptation of @mdsimon2 tutorial on multichannel raspberry pi camiladsp mentioned below. In that tutorial there is information enough to build something like what we are trying to do here if you have a bit of knowledge, but does not address this use case with step by step instructions. Here i try to focus on what is specific for my use case and on describing some things at the newbie level that might be not so evident for the absolute dummy like me when following Michael's tutorial.

NOTE: I will be using a raspberry pi 4b 2 Mb and doing the setup in a Windows pc via wifi.



1. The first step is to follow mdsimon2's tutorial and install camilladsp in a raspberry pi. It is very easy and even someone without any experience can get it done in a coouple of hours:

https://www.audiosciencereview.com/forum/index.php?threads/rpi4-camilladsp-tutorial.29656/

The only thing that can be confusing for the newbie is point "6) Create CamillaDSP yml configuration file". There you need to input the configuration details for any of the 3 DACs Michael uses and you wish you had, but you don't. But dont worry, just chose the one you like best and move forward, we will change it later on. In my case i chose ultralitemk5_toslink.txt.

Stop in step 12), that is, you don't need to create a loopback (step 13) nor any of the following steps for this particular project.



2. Find out the information you need from the soundcard to create its camilladsp profile:

Open ubuntu in your pc and connect via ssh to your pi running camilladsp that you have just created. In my case:

ssh marcosch@raspcamilla

once you are in, lets find out the name of the card, with, for instance, aplay -l

View attachment 186040

We see here the name of the card 1, our USB card, is ICUSBAUDIO7D

Let’s see now what this 25 euros wonder can do with this instruction:

cat /proc/asound/ICUSBAUDIO7D/stream0

View attachment 186041

Ok, the first part of the outcome is the playback capabilities, we see that the only format it supports is S16LE (this is when you remember you paid only 25 euros), sample rates are 44100, 48000 (perfect for my tv toslink) and even 96000. (worth noting here that the X-fi HD, that can be found used for very little money too, supports 24 bits and up to 192 kHz).

In the lower part we see the capture capabilities:

View attachment 186042

Same S16LE and sample rates limited to 44100 and 48000.

I dont even know if all this is very relevant as we don't aim to do any AD nor DA conversion and the sound from a regular tv comes at 48 kHz...

Maybe someone can chime in and indicate if it is worth trying to find a better card or if on the other hand it would be a waste of resources.



3. Select the input in alsamixer

There is probably a better way to do this, but I have found that with these cards with several inputs (this one has toslink, line and mic), one way to select which input you want to use is alsamixer. Just type in the command prompt:

alsamixer

And a window like this will open:

View attachment 186043

What you see here is the alsamixer control for headphone of the pi. To change to your USB card, press F6 and a window will appear where you can select it by its name, in this case ICUSBAUDIO7D. Then you will see more of these bars. Then press F5 and you will see all the inputs and outputs of the card together:

View attachment 186044

The important action to do here, is to move sideways with the cursor and when on "PCM Capture", in between the options (Line, mic...) select "IEC958 In". Here you can also adjust the gains etc. I did not experiment with that and don't really know what effect it has in camilladsp. If, like me, you don't know what you are doing, just leave it like it is.

Exit alsamixer pressing ESC

Now, and this is very important, to make the changes in alsamixer permanent, enter the following instruction:

sudo alsactl store

If you don’t do this, next time you reboot the pi the card will go back to the previous setting and you will not get the sound from the toslink.



4. Create the camilladsp configuration

Open your browser and open your camilladsp gui

http://yourcamilladspdomain:5000/gui/index.html

In my case http://raspcamilla:5000/gui/index.html

When you set up camilladsp following mdsimon2 tutorial, you selected one of the example configuration files he provided, that will be what is loaded now in camilladsp. In my case, it was the ultralitemk5_toslink. And this is what we get on the screen:

View attachment 186045

This is actually pretty close to what we will need in our case, just need to change a few things, i.e., obviously, the number of channels from 16 and 18 to 2 both in the capture and the playback device. When you do this, you will get some error messages as the rest of the configuration is not compatible with only 2 channels in and 2 channels out. But don't worry, we will address that in the following steps.

Of course, you also need to change the name of the input and output device, see how it looks like. There are other changes to be done, I left mine like this to start with:

View attachment 186046

See that i did not play with sample rates or resampling. I am sure there are settings that could improve the results but i am not knowledgeable enough to indicate the best settings possible. If someone has suggestions, feel free to comment.



5. Upload and set your room correction filters and rest of the pipeline:

In the "Files" tab, under the "Filters" section below "Configs" section, you can upload your room correction convolution filters you created with REW and saved as a .wav file for each channel. To upload your filters, press the "upload arrow". In the picture below you can see mine already uploaded, for both 44k and 48k rates. In this case i will only use the 48k rates that is what my tv toslink outputs. You can also see that i have other configurations there i played with before. If this is your first attempt, you will only see "camilladsp.yml" conf. This is normal and more than enough.

View attachment 186047



Then, to be able to add the filters to your pipeline later on, you need to set them first in the filters tab: go to the filters tab and press the green "+" to add a new filter. In type select "Conv", in subtype "Wav".

View attachment 186048

Note that in my case I also created a "gain" filter to play with, but that’s a different story, just ignore it. I left it in the picture just as an example to indicate that you can create as many filters as you want.

Mixerst tab:

What we are building here is straight stereo in, stereo out.Then, of course, you need to delete all the additional channels that the configuration for the Ultralite has and keep only 2 channels input (0 and 1) linked to 2 channels output (0 and 1). It should look like this:

View attachment 186049




Pipeline tab:

And finally, in pipeline, you add your room correction filters to each channel pressing the green "+" in each channel and selecting from the drop down list from the filters you set up before. Channel 0 for L and 1 for R in my case (I don't know if it is always the same). It should look like this:

View attachment 186050

Pressing the "Plot the pipeline" button besides the green "+" at the bottom, you get an overview of the, in this case very simple, pipeline:

View attachment 186051

And you are done, as soon as you apply and save all the changes, pressing "apply to DSP" at the left of the screen, the magic happens and your "Standalone Toslink in – Toslink out DSP Room Correction" device is up and running. Place in between your source, whatever that is, and DAC, and enjoy your EQed music!
And you might be wonder, what about the latency? In my setup, with such a simple configuration, low sample rates and my REW made convolution filters, the delay is barely noticeable. I don't have the means to measure, but if i add the sound coming directly from the tv on top of the sound from the speakers there is no significant delay. Yes, you can notice there are two overlaping sound sources, but it is completely irrelevant for lip sync. I would imagine as well that if you want to do some complex processing using a pi zero 2w, it might be a different story...

View attachment 186052

And here it is how it looks like:

View attachment 186053

Now you are all set, and this is the beauty of it for me, you dont need to do any other changes and you can switch it off and on and if everything is well in place it should start to work without the need to press any button or activate anything. Just hide it somewhere behind the telly (yes, that blue led is very annoying and screams cheap) and forget it exists!
Is it possible to make the install into a downloadable iso we can burn on sdcard. That will simplify things a lot for users even if you have to set a particular soundcard.
 
OP
M

MCH

Major Contributor
Joined
Apr 10, 2021
Messages
2,581
Likes
2,197
Is it possible to make the install into a downloadable iso we can burn on sdcard. That will simplify things a lot for users even if you have to set a particular soundcard.
Hi ehabheikal,
It can probably be done, and i believe it has been discussed in the camilladsp tutorial thread. But I don't remember if someone provided one (for a camilladsp install). I would recommend you to go there and search for it:

 

PGH

New Member
Joined
Jan 10, 2023
Messages
3
Likes
1
I tried to built a camilladsp on a Raspberry Pi 4 with the ESI U24XL, but Im not getting any digital SPDIF input through ALSA into Camilla.
It worked with my Motu ultralite MK5 before with no problem.

maybe somebody got this thing to work?

i can select the U24XL card in alsamixer and chose IEC958 In as capture source.
camilla input is configured as hw:U24XL , sample format S24LE3 , 48000 for TV signal

any ideas?
 

Attachments

  • arecordL.png
    arecordL.png
    48.1 KB · Views: 87
  • camilla.png
    camilla.png
    90.2 KB · Views: 92
  • alsamixer.png
    alsamixer.png
    40.3 KB · Views: 84
  • stream0.png
    stream0.png
    94.3 KB · Views: 76
OP
M

MCH

Major Contributor
Joined
Apr 10, 2021
Messages
2,581
Likes
2,197
I tried to built a camilladsp on a Raspberry Pi 4 with the ESI U24XL, but Im not getting any digital SPDIF input through ALSA into Camilla.
It worked with my Motu ultralite MK5 before with no problem.

maybe somebody got this thing to work?

i can select the U24XL card in alsamixer and chose IEC958 In as capture source.
camilla input is configured as hw:U24XL , sample format S24LE3 , 48000 for TV signal

any ideas?2"
i see this card has analog input. In your alsamixer screenshot, i see the control at the right, capture is set to "line", does it allow you to set to "IEC958" or "toslink" or something like that?
Another suggestion. I am no expert, but from the screenshot it seems that camilladsp is just not receiving any signal. As it is now, do you get any sound if you plug a source to the analog inputs? just to troubleshoot...
 
Top Bottom