2021/10/24 at 09:41 #1919
So I think I am close to getting this thing working, and am already pretty excited. However, I get an error message when running SamplerBox that the ‘preset’ is not defined. I am also using a soundcard that is connected to the GPIO pins and might be causing some issues? Would these simply have to be changed in the samplerbox.py? Where and how do I define the preset?
This is the message I get:
Opened audio device #1
/home/pi/SamplerBox/samplerbox.py:374: RuntimeWarning: This channel is already in use, continuing anyway. Use GPIO.setwarnings(False) to disable warnings.
GPIO.setup(20, GPIO.IN, pull_up_down=GPIO.PUD_UP)
/home/pi/SamplerBox/samplerbox.py:375: RuntimeWarning: This channel is already in use, continuing anyway. Use GPIO.setwarnings(False) to disable warnings.
GPIO.setup(21, GPIO.IN, pull_up_down=GPIO.PUD_UP)
Exception in thread Thread-1:
Traceback (most recent call last):
File “/usr/lib/python3.7/threading.py”, line 917, in _bootstrap_inner
File “/usr/lib/python3.7/threading.py”, line 865, in run
File “/home/pi/SamplerBox/samplerbox.py”, line 388, in Buttons
preset += 1
NameError: name ‘preset’ is not defined
Preset empty: 0
Thanks a lot in advance!
2021/10/26 at 09:35 #1920
Due to my soundcard already using GPIO 20,21 I could circumvent the error message by simply wiring the two switches to GPIO 16, 26. However, I still get an error message, now saying that the sound device is invalid.
Expression ‘parameters->channelCount <= maxChans’ failed in ‘src/hostapi/alsa/pa _linux_alsa.c’, line: 1514
Expression ‘ValidateParameters( outputParameters, hostApi, StreamDirection_Out ) ‘ failed in ‘src/hostapi/alsa/pa_linux_alsa.c’, line: 2825
Invalid audio device #1
Any clue on this?
2021/10/26 at 09:52 #1921
Update for anyone interested:
I added a line in /etc/asound.conf to reduce the sample rate to 16000hz:
No more error messages for now at least. Only two out of the six buttons work, and I still have to find a way how to get my first sample played but will see how that works out.
2021/10/26 at 10:14 #1922
48000 should also work
2021/11/11 at 23:26 #1923
Everything is working now, after realising I actually needed to load some presets – hence the empty presets earlier.
I still only use two out of the six tact switches, but will probably discover their function sooner or later. Thanks for publishing such a nice project!
2021/11/28 at 21:46 #1930Johan von KonowKeymaster
Hi, sry for not beeing able to help, but im glad that you figured it out anyway ;)
“Winners never quit and quitters never win”
I added the other switches for future use, like menu navigation, volume etc. If you miss a function, modify the python code. Check the BUTTONS THREAD (RASPBERRY PI GPIO), row362
2022/02/20 at 19:35 #2027
thanks for your reply! Indeed, the GPIO error came from the soundcard I have installed as a pi-hat, changed the code, wiring and all good now.
What you mention about GPIO buttons for volume and menu navigation sounds really interesting! Any info/details I can find on that? Controlling the volume by buttons would be awesome
- You must be logged in to reply to this topic.