Close
0%
0%

Raspberry Pi Guitar Amplifier

Guitar Amplifier and effects made with Raspberry Pi and reused Vox amplifier case

Similar projects worth following
I took a Vox VT20+ amp I had that had stopped working, took out everything but the speaker and wired in a Raspberry pi, power supplies, class D amplifier, potentiometers (to set the effect levels), leds, and even VU lights on the front. I used Python and the pyo audio library to do the effects and the GPIOzero module to read the pots.

I built this amp in partnership with my guitar teacher. I taught him Python and a little bit of the electronics and he picked out the effects and how we adjusted them. He is building his own also. Maybe I can get him to post!

image_50438145.JPG

Ben's build in a box

JPEG Image - 1.69 MB - 08/12/2022 at 20:39

Preview
Download

image_67188993.JPG

MCP3008 wiring

JPEG Image - 1.94 MB - 08/12/2022 at 20:39

Preview
Download

image_67160321.JPG

MCP3008 wiring

JPEG Image - 1.74 MB - 08/12/2022 at 20:39

Preview
Download

IMG_4982.mov

photo of ben's build

quicktime - 31.41 MB - 08/12/2022 at 20:27

Download

IMG_4844.HEIC

photo of ben's build

heic - 1.98 MB - 08/12/2022 at 20:27

Download

View all 14 files

  • 1 × Raspberry Pi 3 Pi 2 should also work or 4
  • 1 × Cabinet I used old Vox cabinet
  • 1 × speaker, 8ohm or 4ohm
  • 1 × fanless power supply 24v I used Meanwell RT50D
  • 1 × fanless power suppy 5v I used Aiposen 5V 25W

View all 19 components

  • Can't Get Audio Looping Working

    dsagman08/23/2022 at 14:15 0 comments

    To catch up, I've figured out how to:

    -Trigger a record, loop, wait states using a button connected to a GPIO pin.

    -Record the audio during the record phase.

    But I cannot play the audio during the loop. I've got it working on my laptop, but on the PI, I get a SIGSEGV error from pyo's SfPlayer method. 

    I tried a bunch of different workarounds, which have not worked. I tried playing the audio via a different program, such as aplay, which does work in isolation. But it fails when trying to play with the main program because the two processes: pyo and aplay both want to lock the audio to them. And only one can win, ala Highlander.

    Sooo, I suspect it may work if I use Jack as the audio backend instead of the default portaudio. But to do that, I have to compile pyo from scratch with Jack support enabled. I've tried twice and am not having luck with python recognizing the rebuilt pyo. I am trying again. Fingers crossed.

  • Ben's Build

    dsagman08/23/2022 at 14:10 0 comments

    Ben is making progress on his build.

  • Setting up ALSA, ugh

    dsagman08/16/2022 at 21:01 0 comments

    So I still can't get the looper working. I tried a workaround where I would start a subprocess to run SOX aplay to play the looping audio. But.....it conflicted with the already running pyo server and could not get access to the audio output at the same time. So, I am now seeing if using pulseaudio or jack server might fix the SIGSEGV I get from pyo's SfPlayer.

    Why? Because I had SfPlayer working on my Arch Linux laptop and not running on the Raspberry Pi and one difference is the laptop uses Jack. I've been trying to avoid this, because it adds another layer into the audio stack and everything feels a bit fragile already.

    So I am recompiling pyo with Jack support. 

    In the meantime, I broke everything when I installed pulseaudio. I almost lost my mind. But I found the problem, it was ALSA had been reset to use the mic input, and not line input. Who knows why?

    So here's a picture of how the ALSA setup should look when you run alsamixer. (Also added this to the google slides doc.)

  • MCP3008 Wiring

    dsagman08/16/2022 at 20:54 0 comments

    Added a photo of the MCP3008 board that Ben built. Much nicer than mine. Good reference.

  • Not so easy

    dsagman08/12/2022 at 15:58 1 comment

    OK, I've got a button working, and recording working, but when I try to do playback I get:  terminated by signal SIGSEGV (Address boundary error)

    I think the problem may be that I am somehow starting the pedalmaster main program at the same time and they are conflicting. So maybe not my code. 

    Here's the code, and I have button wired up to GPIO pin 2.

    # Looper. This is test code that:
    # on GPIO connected button press: starts a recording
    # second press: stops listening and plays a loop of the recording
    # third press: stops looping and returns to initial state
    #!/usr/bin/env python3
    from gpiozero import Button
    from signal import pause
    import pyo
    import os
    
    s = pyo.Server().boot()
    s.start()
    audio = pyo.Input()
    loop_file = os.path.dirname(os.path.abspath(__file__))+'/myloop.wav'
    times_clicked = 0
    
    def looper_func(key):
        global times_clicked, rec, looper, audio, loop_file
        if times_clicked == 0:
            print("Recording")
            rec = pyo.Record(audio, filename=loop_file, fileformat=0, sampletype=1).out()
        if times_clicked == 1:
            print("Looping")
            rec.stop()
            looper = pyo.SfPlayer(loop_file, loop=True).out()
        if times_clicked == 2:
            print("Waiting")
            looper.stop()
        times_clicked = (times_clicked+1)%3
        print(times_clicked)
    
    switch = Button(2)
    switch.when_pressed = looper_func
    
    pause()
    

  • Added Test Files to Github

    dsagman08/12/2022 at 15:32 0 comments

    While trying to make this work, I came up with a lot of ideas and most of them didn't work. I made a lot of test programs and in the event that any of them might help, I've uploaded them all to the github repository.

    https://github.com/dsagman/guitarpedal

  • Working on the Looper

    dsagman08/12/2022 at 01:05 0 comments

    I'm working on the looper. Step one is to try to get a program where I can:

    1. press a key to start recording
    2. press a key to start looping (and stop recording)
    3. press a key to stop the looping and wait to start over again at 1 with next key.

    I've managed to do that here:

    https://github.com/dsagman/guitarpedal/blob/main/keypress.py

    It was trickier than I expected. There's some oddities with the callbacks and pyo objects and the audio player not working if it was outside of the callback function. No idea why. But it works on my linux machine and now I need to get it working on the raspberry pi.


    Next steps are to get it working as part of the existing pedal program and to wire it up to a button attached to a GPIO pin. I'm hoping to get an LED that blinks while recording, steady while looping, and then off when not active.


    Maybe easy. maybe not so easy.

  • New Video

    dsagman08/11/2022 at 22:18 0 comments

    Overly long video on every code line. 

  • Trying to record info on the code

    dsagman08/11/2022 at 19:36 0 comments

    I've downloaded the OBS software for recording my computer screen and audio input. I'm going to try and do a code review video, but, as always, there's another tool to learn and figure out. That said, OBS seems quite good. Fingers crossed. Including the one I electrocuted the other day.

  • Team

    dsagman08/11/2022 at 19:32 0 comments

    I had done a lot of the work here with my guitar teacher, Ben McMunn, who I've now figured out how to add to the project. Ben is building his own version using a raspberry pi 2. I'm going to try and get him to upload his photos here.

View all 12 project logs

View all 3 instructions

Enjoy this project?

Share

Discussions

actionjackson wrote 07/22/2022 at 22:36 point

Does / can your project run guitar amp sims, cabinet impulses, through the class D power amp? 

Great project by the way.

  Are you sure? yes | no

dsagman wrote 08/11/2022 at 22:20 point

I don't have the skills to code up amp sims, but the amp is basically directly connected to the pi, so anything that will run on the pi can be output to through the amp and use the input of the guitar.

  Are you sure? yes | no

dsagman wrote 07/21/2022 at 20:47 point

Super cool!

  Are you sure? yes | no

Ben mcmunn wrote 07/08/2022 at 18:43 point

Guitar teacher here! This thing took on a life of its own...Mine is in the works!

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates