Guitar Amplifier project

Here’s my first completed project. This demo video was made as an attempt to show the effects provided by the Daisy Seed.


That sounds pretty good to me!
A couple of questions:
Is the entire signal chain coming from the Daisy, other than the power amp? -as in, is the Daisy providing the distortion/overdrive or is it after an, I don’t know, standard Marshall style preamp that uses the Daisy post-pre before a power amp section like an effects loop?
And would you be willing to share the code? Definitely aiming for a “EZ amp in the box” as one option for my Daisy Petal.

Hi, I wrote a pretty detailed post and upon saving it something went bonkers and left me with about half a paragraph so only wrote 2 sentences above. I’m sorry for that. In a couple of days when my frustration has departed I will detail the signal and effect chains as well as the interface for selecting effects. For now I’ll just say that the signal goes through some analog processing then through the Daisy for bypassing and effects then to an active tone stack and finally to the power amplifier. I will make the code available as soon as I get some time to post it. I’m very happy to hear that you like it and thanks for inquiring.

1 Like

They say that there’s no better time than the present, so here’s a link to the source code. I would also like to extend an invitation to everyone for their comments, constructive criticism, and suggestions.

1 Like

Bravo! A few style comments:

void loop()
{ // Poll knobs and switches. Poll period is 100 ms and can be adjusted with var: interval 
    currentMillis = millis();
    if (currentMillis - previousMillis >= interval)
        // save the last poll time
        previousMillis = currentMillis;

Daisy has a very fast CPU, but I still dislike wasted cycles. So, rather than keep a previousMillis variable, and do a subtraction every time through the loop, I prefer to use a nextMilis variable, and add the interval only once:

if (currentMillis > nextMillis)
nextMillis = currentMillis + interval;

Compares for == or != against a float can be tricky, so instead of:

              // No Echo if depth is turned all the way down
                if (feedback_adj != 0)

I’d use:

              // No Echo if depth is turned all the way down
                if (feedback_adj < 0.001f)

But even that might not matter, as there is probably no difference if you skip the Echo code, or run it with a very small depth value.

1 Like

@tele_player, that function call is performed in a loop that runs when audio isn’t processed, your optimization would make no difference, because this code makes multiple idle calls until timeout is reached. Moreover, millis() function would just return results of HAL_GetTick() which will likely end up inlined by compiler to return tick counter variable.

Any sort of noticeable optimization should be done in per-sample processing code in first place - probably starting with using LUT for exponential.

Other than that, congratulation to @TGargasz for making a finished project! If you’re into guitar effects, I think that an interesting direction could be porting some of the Faust patches made for Guitarix. You should be able to run emulation of various cabinets or pedals, but it won’t work with Arduino.

1 Like

Understood about it being in the loop and not when audio is being processed, but to me, aside from saving a cycle or two, it also seems clearer.

1 Like

Thank you for the comments. They are well received.

The reason that I used previousMillis instead of the nextMillis approach is because the way the clock tick register works. After about 50 hours or so of uptime the tick register (16bit?) overflows and rolls over to 0 and continues from there and there is a small chance of setting nextMillis to a value that could never reached. Anyway, that was my thinking at the time. Pretty old school, huh?

Good catch on (float) != 0. I should know better. After a few adjustments there’s bound to be a couple of loose LSB’s in the value by way of approximation and chances of it being exactly 0 are slim to none. I’ll make a branch and pull tomorrow.

1 Like

It’s been years since I thought about clock rollover like this… now I’ll have to think about it until I convince myself that you don’t get the same problem around rollover either way.:slight_smile:
Are you sure that millis() rolls over at 50 hours? That doesn’t make sense to me.
An unsigned 16 bit millisecond counter would roll over at about 65 seconds. That’s not it.
32 bits would roll over at about 49.7 days.

You understood the (float) != 0 issue. Not a beginner, I guess :slight_smile:
(just kidding, your code didn’t look beginner at all)

1 Like

Pretty old school, but HAL tick is a 32 bit value, looks like it would overflow in something like 50 days. And result of that overflow looks like it would just do one update twice in a row.


Thanks for the congratulations and for your comments.

I chose to use the exponential function for the nonlinear equation requirement of my distortion effect solely because of the small code footprint that it had (and it sounded killer also). I never gave it any thought to how expensive it was. It’s adequate for this project but it may become a problem in a future endeavor where time becomes critical. I’m going to educate myself on LUT’s and polynomials for exp functionality when I have the time.

I am very interested in the Faust patches and will be looking at those when I change over to Visual Studio.

I have one more Arduino project before I change IDEs. I just got SPI working between the Daisy and ESP8266 NodeMcu. I’m creating a wireless link to a cellphone app (Javascript) to be able to select effects and adjust settings for this amplifier.

Hopefully someone will have come up with some instructions on how to get VS working by then.

SPI to ESP8266 - also excellent! Daisy is the master?

Oops, we’re not supposed to call it master anymore.

Yup. And I’m using SPISlave library on the ESP8266. I’m not using the CS line and they are not connected on both devices. I’m also not using the ESP Status registers or code so I deleted it.

Hey, I didn’t name that library!

I actually didn’t mean this as suggestion that optimization are required. I just wanted to point out that changes to infrequent UI update code would not change performance at all. And generally good performance on ARM is achieved either by precomputing data (every MI module is full of examples) or by using something like CMSIS math functions to run block-level optimized computation.

Regarding Faust, you don’t really have to wait till you solve whatever IDE issues you have. The big challenge would be getting used to writing in a functional language. With VScode plugin you can get syntax highlighting/completion, but that helps very little with learning to think in a different way about code you write. Also, Faust can be compiled to run as desktop software or even in browser. So there’s no reason to delay if you’re considering learning it.

The wireless upgrade for the amplifier is complete. As I mentioned earlier SPI is used to communicate between the Daisy (master) and ESP8266 (slave). I don’t use the CS pins but I do use gpio to notify Daisy that new data is ready to be received. The ESP8266 is running in Access Point mode so there’s no need to be connected to someone’s WiFi network. I wrote the phone app using DroidScript (Javascript based IDE available on Google Play). I kept the tethered button box with another proposed upgrade to supply effect selection, bypass functionality, and a tap in/out (think looper when DRAM support becomes available for Arduino) all in a single pedal. If anyone has any interest in the code for this project please let me know and I’ll post it on my GitHub page. By the feedback (pun intended) that I have received locally the amplifier is big hit. I’ve been approached by 2 separate people who want to commission a build. I don’t have a clue what to charge for one of these so I’m backing up, making an as built schematic and a BOM so I can get a handle on actual cost. In the immediate future I’m going to attempt to switch from the Arduino environment to Visual Studio 2013 professional and VisualGDB.


@Manysounds I ended up describing the audio chain here. I think that’s what what you wanted to know. If not, I’ll try to give it another shot.

1 Like

Upgrade #2 adds Reverb and Flanger, 3 button footswitch, more cell phone app settings. Prototype is complete and upgrade is scheduled for tomorrow. The cell phone app has been well received. Things are trending toward complete remote configuration.

I’m considering the creation of a user manual to explain lesser intuitive actions like:

  • You must touch the ‘Send To Amp’ button to realize a setting change.
  • Why doesn’t a footswitch led light up when I configure it to control an effect?

I’m interested in your comments and suggestions.
Here’s a short video with the amplifiers owner.