Having issues setting up Beat Box

Messing around with my Pi Beat Box setup.


I noticed when I ran the drums.py example I couldn’t hit the same pad twice in a row?
I could go back to it after hitting another pad but twice in a row wouldn’t work?
I changed

def handle_release():


def handle_release():

To fix it. You have to hold your finger on the pad for a split second but you can now click a single pad multiple times in a row.

And why does the simple-piano.py example not default to “piano sounds”?
I changed patch_index = 0 to patch_index = 1 to default to piano sounds.

Last issue that is baffling me is my beat.sh script works when run from terminal.
bash beat.sh
But fails to work when launched from crontab with
@reboot bash /home/pi/beat.sh &
The drum never works and the piano just blinks the LED’s? About 1 in 3 tries I’ll get sounds from the piano, and no drums (no leds light up and no sounds).

im just running the setup from the learn section and i can hit the same pad as many time as i want .only issue for me is some time i have to reboot because the piano only works a couple of keys ,but it fixes it’s self after a reboot, only real issue i have is the #4 pad just make a knock sound ,and its volume isnt the same as other pads ,maybe thats what it suppose to be ,i not sure …

@reboot bash /home/pi/itty-bitty-beat-box.sh & ,

its suppose to be this isn’t it

I named my file just beat.sh. I found my issue. I had
python /home/pi/Pimoroni/pianohat/examples/simple-piano.py > /dev/null 2 >&1 &
when it should have been
python /home/pi/Pimoroni/pianohat/examples/simple-piano.py > /dev/null 2>&1 &
I had a space where there didn’t need to be one between the 2 and the >& 1&.
Why it worked from command line with the error, but not from crontab I have no idea?

I don’t know what to tell you. For me when I ran drums.py and touched a pad.
It made the sound and turned on the LED.The LED stayed on though and hitting that pad again did nothing. Touch another pad and the LED went out, and that pad worked again. Anyway, my drums.py edit fixed it for me. I saved my modified drums.py, modified simple-piano.py and my working beat.sh file for next time.
I was thinking of getting an on off shim but there are pin conflicts. =(

I wired a switch to GPIO 26, physical pin 37. Pin 39 is ground so all I needed was a 2 pin right angle male header. Then plugged a normally open momentary push button into it.
Then did a config.txt edit,
Then set it to boot to command line and done deal, headless setup now.

yeah, i usually just followed pimoroni or you ,:) lol
mine boots to command line, i just shut mine down with a wire with a button switch on it that i got from adafruit , and have never had a shutdown issue https://www.adafruit.com/product/1125

I try to do a proper shutdown, when ever possible, especially with my motion eye setups.
I have accidentally hit the switch on my power bar once or twice and turned off a couple of running Pi’s. Raspberry Pi OS seems to handle it OK. If it’s just sitting there doing nothing, usually no harm done. If it’s reading or writing to the SD card it could be a different story.
Motion Eye doesn’t seem to handle it so well. It’s getting better and more stable though.

Anyway Ivey had a ball playing with it, it was just in a awkward spot. Now that I can run it headless she can play with it anywhere there is a wall plug.
Next step is to play around with the wave files. I can see having two SD cards setup for this. One for her with funny sounds and one for me with true drum beats, no whistles or cow bells etc.