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

RPi4 + CamillaDSP Tutorial

MCH

Major Contributor
Joined
Apr 10, 2021
Messages
2,641
Likes
2,251
Yes - that is what I do. I use SSH button on my android phone. Was free on the google play store last time I looked, without any adware (and I hope no spyware :)

Since I control everything from my phone (including volume via MPDroid client to MPD on the Pi) , I saw no reason to use a physical button to power down the pi.
AIyoJ15UkbuKjA7-SGm7DuOgmM9L9XcagJpj2sRBnuTIWz5FMZIGpiB-s1xssIcAQepoUKXw59MP2cQOimqE2WNF-On44AXOvVN-9LDKi8J5UxR1rKdieEnI4fKWza65GV_w0AOB5McWujAYDsbEZWsPYT4DaDRvSRZYbS1IVLZ3xUmIwG-DwIv0HXFbMmQjxnLLicRxcAhpcVIPWd7oj83ehna3dLE0DY3H0bQzyhsjk9sgcCVzcm_wmRIrXShwHzkkx5OSuI29bU_kEehRtJqB6bolHE4pDlyANr_HFfctradaHo1KnjzyizeBeoryghuAG1EaoknEKnTg4s_BBSMx81NQef1Wtwa7nKJQtIxooBeKi1uOF7vweJ4OnInh7H1GU0n4U9vR8ULAaPT6LMzJt82Xm5esVz8w3Xjmy_U6w8l0I1WdINkFSxDCAqoQfTxa0xclCbuvAtwrA6gpXlO4tiWcShRSTXYnqo0iTcmBeMNwJlNcRhLEe7uwF0Ryk3mP1hsCPEw7i3g2EbfyWNQS75Q9LsWubMMmxP_lFhxwVAd9Z5WG2i2MsVsXwC3RLtWGJ0VGC3QO8ScPtrNdGuNEConAqdfOkuHzePByocBxl5EhxkmaCgLfTWvjXydg0LUR6P89G-Jgo9NWny0XF9B0ZK5roGRllCvR23yi1PO5d2qx8yR1CbIcETFAq1OpgRb_DtR2cQ_yr-RRICEI0MY1ah8f-I6jWMjCxKsDuzee5FjvBlnECYdmXyRNIfS1aMnjbFohknYWjVUJJuZ1ODx3qQGpEQunDFzrqgizhigtkIBujIfjIObqEscQAYQEcTz4VQNLHJmyJbsPKEMFlwuyCu-twL_ya15Yd85UMrmDHu9iUpjP1BB4oY5n2ZMvH_nh7CnwU5p5Fb6-WvuGX3N9oEigw6SqU45P-RHPvBprMtnujq7_aTOPyWcCoPx7s82wU4tHlToCKQ73UnpDdA=w485-h1077-no
How do you do to switch it on?
 

somebodyelse

Major Contributor
Joined
Dec 5, 2018
Messages
3,745
Likes
3,032
I am not a pcp user so take this with a grain of salt but pcp seems different from Ubuntu. I would not follow this guide but rather follow @chuckt62's suggest from this post -> #928.
pcp IS very different to Ubuntu, and to most other linux distros. It's based on Tiny Core Linux and anyone wanting to modify pcp would do well to read the Tiny Core documentation first, even (especially?) if they have a fair bit of linux experience. The SuperPlayer github repos up thread make it a LOT easier than rolling your own, and have a pretty decent README which includes links to the diyaudio thread where the developers hang out. I heartily third @chuckt62 and @mdsimon2's suggestions.
 

Dave Bullet

Member
Joined
Oct 30, 2022
Messages
62
Likes
91
  • Like
Reactions: MCH

MCH

Major Contributor
Joined
Apr 10, 2021
Messages
2,641
Likes
2,251
answering to @Dave Bullet : Last time i ordered a pi i ordered one of the new pico w together with it, that is still there waiting to be used. I will try to find out something, i think it should be easy. I honestly think that in most cases it doesn't make sense to turn it off at all, but i have my Motu M4 plugged to it and as a result always on and i start to think i prefer it to be powered off the 20 hours a day it is not in use...

by the way, what strange hack did you do to your post that it is not possible to quote it??
 

somebodyelse

Major Contributor
Joined
Dec 5, 2018
Messages
3,745
Likes
3,032
answering to @Dave Bullet : Last time i ordered a pi i ordered one of the new pico w together with it, that is still there waiting to be used. I will try to find out something, i think it should be easy. I honestly think that in most cases it doesn't make sense to turn it off at all, but i have my Motu M4 plugged to it and as a result always on and i start to think i prefer it to be powered off the 20 hours a day it is not in use...
You should be able to power down the USB ports while keeping the Pi running. I looked into it a while back but never actually tried it, and I think there may be some variations depending on which Pi model it is. It's also worth looking into how much power the Pi draws when 'shut down' - again variations depending on model, and on wake mode. IIRC the original Pi would draw more after shutdown than when actually running.
by the way, what strange hack did you do to your post that it is not possible to quote it??
'Toggle BB Code' button then nest the quotes - the normal 'reply' doesn't include quotes, so when the reply is (incorrectly) inside a quote you can't reply normally.
 
  • Like
Reactions: MCH

chuckt62

Active Member
Editor
Joined
Apr 6, 2022
Messages
141
Likes
123
Location
Tejas
Last edited:

MCH

Major Contributor
Joined
Apr 10, 2021
Messages
2,641
Likes
2,251
to the switch on/off people (sorry Michael for contaminating the thread with this)

I will give this a try:


Is a 5V relay controlled with a IR remote control. If i understand it well, it uses, as maximum, and this is only while you are closing the circuit, a similar power than a rpi pico w, that was my initial idea. Anyways, that is not the objective.

The idea is to connect the relay to the 5V pins of the pi (that are always powered even when the pi is off) and have the relay to short GPIO3 and GND once for turn off and once again to turn on. This particular relay can work in "jog" mode (closes the circuit only while you press the button of the remote) so i believe it is ideal for this project: press the remote button once -> rpi shuts down; press the same button again -> rpi turns on. I will follow this instructions for the commands:


As i already use a learning remote control for camilladsp with a flirc dongle as per this tutorial, and the power on/off button of the remote is free, i can use this button to learn the IR code of the relay.
The only problem is that for me, the real objective is not to power off pi, but the cards that are connected to it, and turns out that my pi 4b is revision 1.1, and this particular revision is the only one that does not power off the USB ports on shut down.... so i will have to move all the setup to another spare pi i have.... grrrrr
I also aim to power off a minidsp 2x4HD that i have as input card. For this i am looking for a USB relay that can get triggered somehow when the pi shuts down, or, if possible, when the USB to which it will be connected gets unpowered... but that will be part 2... edit: i am thinking that the simplest option for the minidsp will be to just use a normal 1ch normally open relay wired to the GPIO and a python client that activates the GPIO signal and hence the relay as long as the pi is turn on. As the pi turns off, the relay will go back to the open circuit position and the minidsp will lose power.
Wish me good luck, i will need it!
 
Last edited:

Daverz

Major Contributor
Joined
Mar 17, 2019
Messages
1,309
Likes
1,475
The discussion of powering off the Pi4 inspired me to add support for this to my FLIRC/Harmony remote setup. I wanted to make it hard to accidently power off the Pi4 with the remote, so I made it require a key sequence to power off:

Python:
#!/usr/bin/python3
import os
from collections import deque

# shut down when user presses keys 3, 2, 1 in sequence
SHUTDOWN_SEQUENCE = (Gdk.KEY_3, Gdk.KEY_2, Gdk.KEY_1)

class MyWindow(Gtk.Window):
    def __init__(self):
        # ...
        # keep track of last 3 keypresses
        self.last_keypresses = deque(maxlen=len(SHUTDOWN_SEQUENCE))
        
    def on_key_press_event(self, widget, event):
        # add the last keypress to the deque
        self.last_keypresses.append(event.keyval)
        if tuple(self.last_keypresses) == SHUTDOWN_SEQUENCE:
            self.on_shutdown()
            return
        # ...

    def on_shutdown(self):
        # requires configuring sudo so that it doesn't require a password
        os.system('sudo poweroff')

And then you can unplug the Pi4. Adding a reboot sequence would be similar.

As often as I shut down the Pi4, though, it's not really onerous to log in to the Pi from my laptop and run "sudo poweroff".
 

tinnitus

Active Member
Joined
Jan 26, 2021
Messages
146
Likes
202
Location
Germany
Teardown of my "Blackbox". Hi @MarcosCh you do not need much luck, only some gpio work.
Here is my solution for a controlled boot up and shut down of my audio system.
It consists of only three components: The Render/DSP Unit with a RPI3b+ and two SSRs to power on the two other components, rhe DAC (Topping DM7)
and my power amp (Stage IMG 2000D).
1673010426361.jpg

on the top from right to left:
- power on off switch
- Power in 230V (speakon)
- Power out 230V (speakon) Amp
- Power out 230V (speakon) DAC
- Raspberry with onoff shim for start and stop

on the bottom from left to right
- pushbutton to boot and shutdown
- power supply for RPI
- SSR relay to switch the dac
- SSR relay to switch the amp

you need two gpios ( for example 23, 24) to control the SSRs

Now every dumb iditot can start and stop controlled your sensitive mystical audio equipment o_O. No more plops and clicks.
 
OP
M

mdsimon2

Major Contributor
Forum Donor
Joined
Oct 20, 2020
Messages
2,509
Likes
3,354
Location
Detroit, MI
to the switch on/off people (sorry Michael for contaminating the thread with this)

I do not mind at all and love this sort of discussion! Always exciting to see people finding solutions that work best for them and sharing with others, truly one of my favorite parts about DIY.

Michael
 
  • Like
Reactions: MCH

dwkdnvr

Senior Member
Joined
Nov 2, 2018
Messages
418
Likes
698
FINALLY getting around to playing with CamillaDSP. Just using it on my Mac Studio w/ Motu M4, but am considering other options for long-term/production use.

My question: How does the Pi 4 in 'gadget mode' respond to being moved between source systems? Is it viable to have it connected to a USB KVM and switch it semi-frequently between 2 systems? Or will this require some type of reset/restart?
 
OP
M

mdsimon2

Major Contributor
Forum Donor
Joined
Oct 20, 2020
Messages
2,509
Likes
3,354
Location
Detroit, MI
FINALLY getting around to playing with CamillaDSP. Just using it on my Mac Studio w/ Motu M4, but am considering other options for long-term/production use.

My question: How does the Pi 4 in 'gadget mode' respond to being moved between source systems? Is it viable to have it connected to a USB KVM and switch it semi-frequently between 2 systems? Or will this require some type of reset/restart?

I've been playing around with gadget mode the last few weeks and I have had no issue hot plugging between iphone, Windows PC and macbook. The only issue I've observed is it doesn't like to be unplugged in the middle of playing of something, which results in an a glitch tone. Not sure if this is entirely gadget mode's fault or if it is more related to my DAC. If I pause what I am playing and switch I never have issues. Seems like a USB switch will be a reasonable solution.

Michael
 
OP
M

mdsimon2

Major Contributor
Forum Donor
Joined
Oct 20, 2020
Messages
2,509
Likes
3,354
Location
Detroit, MI
I believe you'll need a udev rule to automate the switch. See "Step 5" on the page below:


FWIW I did not have to do this.

And for clarity I did not use gaudio_ctl as I wanted the ability to easily switch configurations via the GUI and instead ran the gadget at a constant 96 kHz.

Michael
 

dwkdnvr

Senior Member
Joined
Nov 2, 2018
Messages
418
Likes
698
I've been playing around with gadget mode the last few weeks and I have had no issue hot plugging between iphone, Windows PC and macbook. The only issue I've observed is it doesn't like to be unplugged in the middle of playing of something, which results in an a glitch tone. Not sure if this is entirely gadget mode's fault or if it is more related to my DAC. If I pause what I am playing and switch I never have issues. Seems like a USB switch will be a reasonable solution.

Michael
Cool - thanks for the very quick feedback.

I have a Pi 4 that had been running Home Assistant that I'm looking at repurposing. Definitely seems worth taking the time to try - building it into a standalone DSP preamp as others have done here would be more flexible than just running from the Mac.
 
Joined
Jan 9, 2023
Messages
87
Likes
30
The cm4 io board has the same Hat connector (gpios) as the Raspberry Pi. Therefore it should work.
FYI, I have all this working since last year.
There was quite a bit of careful liason with Henryk and what seemed like an endless mess when integrating the bits to go with it.
(integration with a hi end amp in car).
Eg. it took months to iron out bugs with a board that was different from the not very useful official I/O board (too big and frankly not useful for mobile systems).
It now runs automated all services and as an internet router over 4g/LTE with a superb DAC HAT which seems not to have even been mentioned anywhere on here.

The last thing needed was a 3D printed case which we steadily and slowly have got sorted to provide the vital cooling for the CM4 so it can do HD video and Audio all in one hit without falling over.
 

phofman

Addicted to Fun and Learning
Joined
Apr 13, 2021
Messages
501
Likes
323
@PGH: The alsamixer screenshot looks like Line is the current capture source. Did you select SPDIF source with the space key?

It's important to check the capture/playback with arecord/aplay first, before putting the CDSP complexity layer on top of the alsa setup.
 

chuckt62

Active Member
Editor
Joined
Apr 6, 2022
Messages
141
Likes
123
Location
Tejas
Top Bottom