• 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.

MCH

Major Contributor
Joined
Apr 10, 2021
Messages
2,580
Likes
2,197
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

pic 1.jpg


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

pic 2.jpg


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:

pic 3.jpg


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:

pic 4.jpg


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:

pic 5.jpg


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:

pic 6.jpg


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:

pic 7.jpg


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.

pic 8.jpg




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".

pic 9.jpg


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:

pic 10.jpg





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:

pic 11.jpg


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

pic 12.jpg


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...

pic 13.jpg


And here it is how it looks like:

pic 14.jpg


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!
 
Last edited:
OP
M

MCH

Major Contributor
Joined
Apr 10, 2021
Messages
2,580
Likes
2,197
Short updates:

- Seems that the 96 kHz capability of the card refers to the toslink output and the card can indeed output 96kHz. Note that if you change the sample rate to 96 kHz, you need to change the convolution filter to one at 96 kHz as well, otherwise it won't sound good.

- A fast Google search shows that most, if not all these very cheap 7.1 USB cards are based on the same CM6206 chip, so forget about finding one that supports anything else than 16 bits... If this is true, I start to think that the Creative X-fi HD, with toslink in and out and 24 bit 192 kHz is a sort of rare cheap gem. I am probably missing others, I hope...

- Other USB cards with toslink in & out that might work that i know about are some of the Creative family:
Sound Blaster X E5; G3; G5; G6 (probably the one with higher specs of the bunch); the newer X4 (not the X3 though)
Terratec Aureaon xfire8.0 hd
ESI U24 XL
 
Last edited:

TheBatsEar

Major Contributor
Forum Donor
Joined
Jun 16, 2020
Messages
3,084
Likes
4,962
Location
Germany
Even the RPi Zero should have enough brunt to do it. Web interface might be slow, but Camilla itself should work. Could be the frugal mans MiniDSP 2x2 for less than 40€ or so :cool:
 
OP
M

MCH

Major Contributor
Joined
Apr 10, 2021
Messages
2,580
Likes
2,197
Hm i am not sure that the regular pi zero can run camilladsp, but i think the new zero 2w should do this sort of simple things, and it is only 5 euros more ;)
 
OP
M

MCH

Major Contributor
Joined
Apr 10, 2021
Messages
2,580
Likes
2,197
Hello again, wanted to answer to @TheBatsEar idea and add a few specific instructions for those really on a budget that would like to do their toslink DSP with the much cheaper raspberry pi zero 2w, as the instructions above don't work if you try to follow them with the 2w.

I find the pi zero 2w an unbelievable value device, i really can't think on anything else that offers so much for so little. Ok, maybe a walk at sunset in the countryside, if you don't need to drive too long and you don't stop for a beer... Sometimes i don't understand why people only consider the pi 4 for even the simplest task that something like a zero can do. Unfortunately the regular pi zero cannot run camilladsp, but for only 5 euros more, the newest zero 2w can perfectly do it!

pi 4 2Gb vs pi zero 2w (were i live):

pi 4 2 Gb: 53 euros + cheap case: 6 euros + 3A USB C PSU: 10 euros = 69 euros

pi zero 2w: 17 euros + cheap case: 2.5 euros + old micro USB charger that everybody has at home unused: 0 euros = 19,5 euros.

Add to this the 25 euros Amazon cheapo USB card and you have a fully functional DSP setup for 44,5 euros. + SD card, and you are still below 50 euros!!

So what do you need to do differently from the instructions in post #1? not much really, the process is very similar, this is what worked for me with a new zero 2w out of the box. Like before, i will explain it noob to noob:

Follow steps 1) and 2) of @mdsimon2 tutorial:

1) Write Ubuntu Server 21.10 64 bit to micro SD card using Raspberry Pi Imager

2) Setup SSH

When you are using a pi 3 or 4, you can continue with the next steps of the instructions, however, with the zero 2w, those don't work out of the box. To make it work, you need to do the following, using a pi 3 or pi 4. (If you don't have one, you can also follow the instructions in this link: https://waldorf.waveform.org.uk/2021/the-pi-zero-2.html . Scroll down to where it says "What if you don’t have a spare non-Zero 2 Raspberry Pi?")

If you do have a pi3 or 4, insert your sd card in it, and switch the pi on.

You need to find out the IP address of the pi (3 or 4) you are using. There are several ways of doing this, i personally use an app called "Advanced IP Scanner".

Once you know the IP address (xxx.xxx.xxx.xx in our example), open the ubuntu terminal you have setup in step 2) of the tutorial and access to your pi:
ssh [email protected]
It will ask you for a password. The password is ubuntu. Then it will ask you to change the password. Once you change the password log in again (ssh [email protected]) with your new password. Once in, you need to update and upgrade your system. Note that each of these steps is going to take a few minutes. Type:

sudo apt update

when done, type:

sudo apt full-upgrade

When done, switch off the pi, take the SD card, and insert it in the pi zero 2w. Switch the zero 2w on.

Now, the IP address will be a different one. You need to find out the IP address of the zero 2w like you did before. You can use the same app. Lets say the IP address of the zero 2w is yyy.yyy.yyy.yy. Log to your ubuntu in your zero 2w exactly the same way as you did before, but with the new IP address:

ssh [email protected]

then you can continue with mdsimon2 instructions points 3) 4) and in point 5), skip the first lines (the update and upgrade that you already did).

And basically that's it, from now on you can follow the instructions in post #1 as if it was a pi 4. The only differences i have found were:

When trying to access alsamixer, it does not suffice to call it with "alsamixer", you need to use "alsamixer -c 1", where 1 is the number of the card (thanks again @mdsimon2).

What I have also noticed with the zero vs the 4 is a slightly longer delay. It is still a very short one in my case (the same configuration that i showed above in post #1) and good enough to watch films without lip sync issues, but longer than the almost imperceivable delay when using the pi 4.

zero 2w.jpg

And here it is, the 50 euros standalone toslink dsp. glue the pi to the card, hide it behind the tv, and enjoy your room correction :)
 

monkeyboy

Active Member
Joined
Jan 8, 2019
Messages
239
Likes
214
Awesome, I have been looking for this type of a solution....thank you
 
  • Like
Reactions: MCH
OP
M

MCH

Major Contributor
Joined
Apr 10, 2021
Messages
2,580
Likes
2,197
I am also trying to make it work with a sound blasterx G6, that also has toslink in and out and is 32 bit capable, but it is not being that easy...
 
OP
M

MCH

Major Contributor
Joined
Apr 10, 2021
Messages
2,580
Likes
2,197
Forgot to comment on the connection details, that might not be evident for people like me... at least it wasn't until a few weeks ago that I came across the following thread of this forum:


The pi zero 2w has a micro USB socket, while the USB soundcard in the example, and many others, has a USB B socket. It could be tempting to use any of the adapters we have at home, but you must make sure that the pi is acting as a host.

For instance, the following combination will not work because it assumes the soundcard is the host:

wrong2.jpg


On the contrary, the following connection, provided that the micro USB to USB A cable is OTG, is assuming, correctly, that the pi is the host, and should work:
correct.jpg

I am not an expert on the subject, but the rule that I use, and often works, is that if there is a female USB A in the chain, it should be to the side of the host (in this case the pi).

Direct USB B to micro USB cables are rare, but do exist. I would expect that they are unidirectional so I am not sure if they would work, I guess it depends on the cable:
question mark.png
 

TheBatsEar

Major Contributor
Forum Donor
Joined
Jun 16, 2020
Messages
3,084
Likes
4,962
Location
Germany
That i didn't know. Thought connection is enough, the devices then broadcast their capabilities to all members of the bus segment, leading to a negotiation.
 
OP
M

MCH

Major Contributor
Joined
Apr 10, 2021
Messages
2,580
Likes
2,197
That i didn't know. Thought connection is enough, the devices then broadcast their capabilities to all members of the bus segment, leading to a negotiation.
To be honest, I have no idea, but I think the "reversible" one is USB C. As I understand it, it used to be the USB A socket was in the host and then a USB B termination (be it micro, mini, whatever) was plugged to the other device. But then you have the pi zeros that have a micro USB socket and are the hosts, and there it is when it becomes confusing for me with the cable combinations... But I could check the two schematics above and this is how they worked (or not) with these two devices.
 

TheBatsEar

Major Contributor
Forum Donor
Joined
Jun 16, 2020
Messages
3,084
Likes
4,962
Location
Germany

Rednaxela

Major Contributor
Joined
Mar 30, 2022
Messages
2,051
Likes
2,673
Location
NL
Out of interest, how would one add SPDIF inputs to this setup? With a second sound card?
 
OP
M

MCH

Major Contributor
Joined
Apr 10, 2021
Messages
2,580
Likes
2,197
The card i used has both spdif input and output, so i didn't need a second card.
But you could indeed use two usb cards, one with a spdif input and a second one with a spdif output. You just need to specify in camilladsp which does what.
Is this what you wanted to know?
 

Rednaxela

Major Contributor
Joined
Mar 30, 2022
Messages
2,051
Likes
2,673
Location
NL
Reading my question back I see I could have added the word extra. But you answered it either way, thank you!
 
OP
M

MCH

Major Contributor
Joined
Apr 10, 2021
Messages
2,580
Likes
2,197
I see that this card has both coaxial and optical in and out. Interesting...

View attachment 197552
Yep, the question is always how it behaves under linux and what it is capable of. I would invest some time trying to find out some info in the internet or buying from a shop that you can return it easily if it doesn't work.
I have been trying to make work a sound blaster G6 for a month now with no success....
 
Top Bottom