I have developed an automatic sample rate switcher for CamillaDSP.
Unlike gaudio_ctl, this tool is dedicated to updating the CamillaDSP configuration, so there is no need for external programs.
It also automatically reloads a valid configuration after the USB playback device has been unavailabe for a while (e.g. when you switch the input of your DAC from USB to S/P-DIF and then back to USB).
Details and software are available on github.
https://github.com/marcoevang/camilladsp-setrate
Unlike gaudio_ctl, this tool is dedicated to updating the CamillaDSP configuration, so there is no need for external programs.
It also automatically reloads a valid configuration after the USB playback device has been unavailabe for a while (e.g. when you switch the input of your DAC from USB to S/P-DIF and then back to USB).
Details and software are available on github.
https://github.com/marcoevang/camilladsp-setrate
Last edited:
So, I tried this out and am stymied by the fact that my USB stream doesn't indicate the stream rate as far as I can tell. The only way I could find to get something similar to work was by using the websocket interface to camilladsp and reading the current capture rate then using that information to switch parameters. I'm using a SPDIF->USB converter (UR23).
Would you please briefly describe your setup (music source, computer running camilladsp, capture device, playback device) ?
This might help understanding the problem.
This might help understanding the problem.
Does the measured capture rate match the incoming rate? Most spdif input devices misbehave if they are fed another rate than the one they expect, so if this one records at the actual incoming rate it's very good news.I'm using a SPDIF->USB converter (UR23).
The sample rate switcher that @mevang built (which is really cool btw!) is made for USB gadget mode input. If you are using a spdif->usb converter then it won't help.
Yeah, I was just hoping it would work for me with minor mods. The UR23 works ok but it just passes data through and does an electrical convert more or less. I wrote a simple python app to test querying CamillaDsp via websocket and using the changed capture rate to alter the configuration and it works flawlessly when the rate decreases. When the rate increases CamillaDsp exits and it restarts via the .service call which is momentarily painful.
When the rate isn't changing often the python app is just fine.
When the rate isn't changing often the python app is just fine.
Hey,
as I am new to pi and Linux, I am struggling with the makefile.
Could you kindly explain how to proceed with it?
I used wget on all scripts listed and made the makefile with vi then tried to use make but it doesn't work for me.
as I am new to pi and Linux, I am struggling with the makefile.
Could you kindly explain how to proceed with it?
I used wget on all scripts listed and made the makefile with vi then tried to use make but it doesn't work for me.
First, I would suggest you to install git to download all the required files.Could you kindly explain how to proceed with it?
Bash:
sudo apt install git
Once git is installed, you can download the entire project with the following command:
Bash:
git clone https://github.com/marcoevang/camilladsp-setrate
cd camilladsp-setrate
After that, please follow the instructions I posted on github to install the required libraries and the development environment, and to build and install the executable file.
If you succeed in building the executable file, try to launch it by hand in the shell enabling all logging options.
If everything works as expected, you can proceed with configuring the camilladsp-setrate.service service, as described on github, to get the tool launched at boot time.
Instructions for installing the packages are valid on debian-based Linux distributions. On other Linux flavors (e.g. Fedora) the package manager might differ, and the name of the libraries might also differ slightly.
Hope this helps.
Last edited:
As @HenrikEnquist pointed out, camilladsp-setrate is meant for use with a USB gadget (i.e. peripheral) capture device. For example, the USB-C port of a Raspberry Pi 4 configured as peripheral would do the trick. Your SPDIF->USB converter box is itself a peripheral that requires the computer to which it is connected to act as host. That's why camilladsp-setrate cannot work in your case.The sample rate switcher that @mevang built (which is really cool btw!) is made for USB gadget mode input. If you are using a spdif->usb converter then it won't help.
Yes, in principle the UAC gadget and SPDIF receiver are quite similar, both present a capture alsa device to userspace and both (IF the SPDIF-USB is implemented completely and correctly) provide some alsa control element which informs about current incoming samplerate, which can be tracked externally.
Indeed in camilladsp-setrate the only setting that selects the capture device is the name of the sound card, so in theory it is possible to switch to another type of device just by changing the name. Unfortunately, I have not a capture device with SPDIF input, therefore I am not able to test that use case.
However, I am about to upload a new version of camilladsp-setrate that adds a command option to set the capture card name (in the format returned by arecord -l). This will allow experimenting with SPDIF.
However, I am about to upload a new version of camilladsp-setrate that adds a command option to set the capture card name (in the format returned by arecord -l). This will allow experimenting with SPDIF.
Last edited:
Would you please elaborate a little?Now, I wouldn't do "sudo".... beware... as a general rule whatever...
sudo in this case basically opens up "internet" to your computer as you just gave it total read and write access to the whole computer...
//
//
Yes, I agree. But can you please point out which use case of the sudo command you are referring to?sudo in this case basically opens up "internet" to your computer as you just gave it total read and write access to the whole computer...
Post #7: sudo apt install git
"APT: The commands contained within apt provide the means for installing new software packages, upgrading existing software packages, updating the package list index, and even upgrading the entire Ubuntu system."
//
"APT: The commands contained within apt provide the means for installing new software packages, upgrading existing software packages, updating the package list index, and even upgrading the entire Ubuntu system."
//
Thank you for clarifying.Post #7: sudo apt install git
In the case you refer to, the sudo command is used because the package manager apt requires administrator privileges, and could not be otherwise.
Super-user privileges are only given for installing the required packages; installed packages do not inherit such privileges.
Obviously, it is strongly recommended not to run the camilladsp-setrate tool as super user.
I have just pushed to github version 1.0.0 of my tool camilladsp-setrate.
Please see CHANGELOG.md and README.md on github.
https://github.com/marcoevang/camilladsp-setrate
Please see CHANGELOG.md and README.md on github.
https://github.com/marcoevang/camilladsp-setrate
- Home
- Source & Line
- PC Based
- Sample rate switcher for CamillaDSP