Closed insomniacUNDERSCORElemon closed 6 months ago
I think you're onto something. I received my v6 kit today, built it up and after booting a fresh image and running the install script, the display was sitting at the version number (v6/0.8.5
) with no light on the led. Also, the switch and rotary were non-functioning. I found the troubleshooting doc here and running ./squishbox.py
produced the same error message:
squishbox:~ $ ./squishbox.py
Traceback (most recent call last):
File "/home/mu_user/./squishbox.py", line 1071, in <module>
sb = SquishBox()
^^^^^^^^^^^
File "/home/my_user/./squishbox.py", line 122, in __init__
GPIO.add_event_detect(btn, GPIO.BOTH, callback=self._button_event)
RuntimeError: Failed to add edge detection
I'm using the Pi4 on Raspberry Pi OS Lite 64bit per the official imager and sndrpihifiberry
per the installation documentation.
On a hunch, I reloaded a fresh image of the prior Raspberry Pi OS (bullseye) and I didn't get this error. The led works as well as the button and rotary. However, no sound output yet.
NOTE: I should mention that my first attempt I tried to install to a different folder. This broke file references. I reinstalled with the default /home/USER path and that was resolved.
I can't test myself, but this might be something to try on the current Raspberry Pi OS image: https://rpi-lgpio.readthedocs.io/en/latest/install.html
A small note: I'm just using the Raspberry Pi on its own (no kit) and am thus not even using the GPIO. I mean maybe whatever that is could make a difference, but I feel like it shouldn't in my case (and even for the kit it should probably point this issue out during the install script).
Unfortunately, I've spent several days without success trying to replicate this error. I just did a small update that will prevent use of the GPIO when doing a "Naked Raspberry Pi" install, so that may at least solve @insomniacUNDERSCORElemon's issue.
@unRARed - I can tell by the line number that is producing the error that you're installing the "legacy" version of the software, which might be what is causing your error. To install the current version, hosted in this repository, use the command
curl -sL geekfunklabs.com/squishbox | bash
@albedozero yes, I tried both versions of the installer script. I originally tried the latest RPI OS image and that's where I got the same error as OP and I shared the output. I should probably mention I used the "lite" images as I have never had any need for the desktop images on the PI. Retrying with the older, legacy Bullseye made it past this error, but I wasn't able to get audio working. I was able to get MIDI messages and the rotary, button and led all functioning though. Maybe I just wired the jacks wrong as I haven't tried any of the other audio output options to compare.
Can you try a fresh setup and confirm the specific image and settings you use to get to a working setup? I feel like the docs are a bit out of date; referring to legacy repos. Or maybe you could create an image of a working build? Would be great to rule out the physical build being the culprit.
Ah, I've tried it with a Pi 4 running Bookworm and now I can reproduce the error. The culprit seems to be a recent change in the underlying way GPIO pins are accessed, as described in this very detailed article by Dave Jones. Seems like the change is slowly being integrated into different versions of the OS for different Pi's? I will have to do some more investigating to figure out the "right" way to fix this in the install script, but for now you can follow the suggestion from the lpgio library that you referenced:
sudo apt-get remove python3-rpi.gpio
sudo apt-get install python3-rpi-lgpio
This fixed the issue for me. Working on a general fix in #3. Also, you are correct that the documentation is a bit out of date #2 - this is WIP as well
so that may at least solve your issue
Nope.
Fresh install (not sure if needed, but it failed with just an update too):
Traceback (most recent call last):
File "/home/anyusername/./squishbox.py", line 1109, in <module>
mainapp.load_bank(fp.currentbank)
File "/home/anyusername/./squishbox.py", line 915, in load_bank
sb.lcd_write(bank.name, 0, mode='scroll', now=True)
File "/home/anyusername/./squishbox.py", line 249, in lcd_write
if now: self.update(idle=0)
File "/home/anyusername/./squishbox.py", line 175, in update
if GPIO.input(b) == ACTIVE:
RuntimeError: You must setup() the GPIO channel first
Error in sys.excepthook:
Traceback (most recent call last):
File "/home/anyusername/./squishbox.py", line 124, in <lambda>
sys.excepthook = lambda etype, err, tb: self.display_error(err, etype=etype, tb=tb)
File "/home/anyusername/./squishbox.py", line 537, in display_error
self.waitfortap()
File "/home/anyusername/./squishbox.py", line 308, in waitfortap
if self.update(callback=False) != NULL:
File "/home/anyusername/./squishbox.py", line 175, in update
if GPIO.input(b) == ACTIVE:
RuntimeError: You must setup() the GPIO channel first
Original exception was:
Traceback (most recent call last):
File "/home/anyusername/./squishbox.py", line 1109, in <module>
mainapp.load_bank(fp.currentbank)
File "/home/anyusername/./squishbox.py", line 915, in load_bank
sb.lcd_write(bank.name, 0, mode='scroll', now=True)
File "/home/anyusername/./squishbox.py", line 249, in lcd_write
if now: self.update(idle=0)
File "/home/anyusername/./squishbox.py", line 175, in update
if GPIO.input(b) == ACTIVE:
RuntimeError: You must setup() the GPIO channel first
EDIT: Also maybe wishful thinking to try the lgpio thing now, but the package does not seem to exist for the version I have
Oops, I missed a GPIO.input. Try updating again now (you shouldn't need to do a fresh install).
It seems that the python3-rpi-lgpio package is only available in Raspberry Pi OS bookworm, and it's not needed for bullseye. You can check what Raspberry Pi OS version you have with cat /etc/os-release
.
Try updating again now (you shouldn't need to do a fresh install)
I'm not sure what happened, I ran it again and it didn't take. I manually edited the change in and now it works, thank you.
Not sure my Pi fast enough for it, though... it didn't take long to crash, and sound is choppy most of the time.
@insomniacUNDERSCORElemon if I understand correctly that you're using a Raspberry Pi 2B, that would explain your audio issues. I consider the Pi 3B+ to be the baseline model for the synth to work smoothly. I notice some latency on a Pi 3B. I used to have a Pi 2 available, and sound was pretty choppy. You can improve this by increasing audio.period-size and audio.periods in the SquishBox/fluidpatcherconf.yaml file, but at the cost of audio latency.
you can improve this by increasing audio.period-size and audio.periods in the SquishBox/fluidpatcherconf.yaml file, but at the cost of audio latency
I'm not sure this is the issue. A single note can play just fine. Playing at a moderate pace or multiple notes is where it gets choppy, like the CPU is not fast enough to process it (and keeping at it causes it to crash). Probably depends on the sound font too.
I realize there are multiple issues in this thread, so maybe this should be its own issue, but my latest attempt was installing on my older Pi 3B on the "recommended" 32bit image. The OS and script installed without issue and booted directly to the interface. Both the Rotary, Button and LED also seem to function flawlessly, but there's still no sound out of the 1/4" jacks. I tried disabling all the other sound devices, too.
Is it possible the script is assuming the user is pi
? In all cases, I've preconfigured the Pi image with a custom username and password, but I've confirmed my user is in the audio group.
The closest thing I've achieved sound-wise is plugging in a little pocket guitar amp. There's a noise on the line until I run ./squishbox.py
. At this point the noise is gone. When I terminate the process, the noise returns. Is it possible the wiring diagram is wrong in the installation PDF for the 1/4" jacks?
fixed by #3
Raspberry Pi Model B Rev 2, as reported by software (revision 000e, some websites say this is revision 2.1, note: 2 USB ports and 512MB RAM)
OS: 2024-03-12-raspios-bullseye-armhf.img.xz (32-bit)
Audio output: headphone jack
Keyboard: Same as video (AKM322, uses midi channel 0 as expected though for some reason the codes are not the same)
This is after multiple attempts at installs (2nd clean install too, believe I had the same error the first time)