This Synth Plays The Only Scale Everybody Knows

[randomprojectlab] is building a synthesizer around the pentatonic scale for the Hackaday Prize. It’s the Pentasynth, and it’s basically just a keyboard with five notes per scale.

There’s something common to every form of music. Nearly every musical tradition, from western art music, to Indonesian folk music makes use of a pentatonic scale. This is just a major scale without fourth and seventh scale degrees, or just playing the black keys on a piano.  It’s the one scale everybody knows, and forms the basis of every school of thought for music education. Noodling over the pentatonic scale is what all the cool guys do in Guitar Center. It’s absolutely the foundation of all music.

The hardware for this build is an Adafruit Metro Mini, or basically an Arduino with an ATMega328. This generates three channels of audio, two square waves — one each for the keyboard and bass accompaniment — and a pseudo-random noise drum beat. The keys are 3D printed, and the enclosure is CNC’s acrylic.

Most educational music toys out there have a few additional bits to make composing music easier. The Pentasynth is no exception, with a button that adds a drum beat, a button that adds a bassline, and a switch that makes the keyboard major or minor. It’s a great idea, and you can check out a video of the Pentasynth in action below.

19 thoughts on “This Synth Plays The Only Scale Everybody Knows

  1. “THIS SYNTH PLAYS THE ONLY SCALE EVERYBODY KNOWS” the titled resonated pretty hard with me as it describes my guitar playing to a T but I do have a bit of dorian and mixolydian in my playing but not much.

    1. Try the celtic scale sometime. It’s kind of a like a re-arrangement of penatonic that feels very natural when your familiar with penatonic scale. Yet it sounds so refined in comparison.

  2. Perhaps the real point of the pentatonic scale is that it can be played by anyone without sounding horrible.

    The demo makes it look like it only has one key voice which perhaps not that surprising because it’s the Arduino environment and uses a counter timer for the notes. Multiple (square) voices can still be done though using a single timer and a single pin but the code has to be tight enough. Just calculate which note has the closest transition point, put that in the timer and then on interrupt toggle the pin, rinse, repeat. It shouldn’t clash with a pentatonic scale but I haven’t done the math. If timing clashes become a problem then soften the edges with a scheme similar to Bit Angle Modulation (BAM) so that the timing clash becomes indiscernible.

    What like the most are –
    It’s done on a 8 bitter – that in itself is a challenge
    He has used cheesy 8 bit colors for the keys
    The way he used the volume pot as the series bias resistor for the one transistor amp and sent the signal to the wiper

    In all, well done!

    1. You can’t DDS at audio frequencies on an 8 bit AVR like the ATmega328p used in this project. DDS is more the relms of high speed processors or FPGA.

      I can’t see anyone doing R2R DAC at even an 8 bit width using the Arduino IDE either. You might “just” get there with ASM.

      For the chosen hardware platform this project does well. I wouldn’t ever expect a great deal more from an 8 bit AVR.

      Sure with more processing power like a teensy or a STM32 you could achieve analogue out instead of square but that a whole step up in hardware and the associated IDE.

      1. sure you can, outputting 8 bits on a port at a few dozen kHz or so is no problem, and DDS with a 24 bit accumulator should take up no time at all, and there’s plenty of room for full look-up tables too.

      2. @ RÖB: DDS is just fine on the AVRs for audio rate stuff. And there’s no real difference between (hardware peripheral) PWM and a parallel DAC: both are just making sure a number gets into a register once per sample period. With the DAC, you write it directly out to GPIO pins, with the PWM you store it in the duty-cycle register.

        Run the AVR at 16 MHz, say, and the sample clock at 22.05 kHz. That gives you something like 700 clocks of CPU time per sample, allowing for interrupt overhead. DDS is just looking up numbers and adding them, with maybe a divide at the end for scaling.

        I think I got 4 voices out of this code at the AVR’s stock 8 MHz, with code that’s meant for readability/accessibility instead of optimization.

        All said, this project doesn’t seem to me to be about making something sophisticated. Rather, it’s about making something nonetheless refined and awesome, but still keeping it simple. So meh.

        1. I forgot these AVr’s are pipe-lined. So was thinking of it as a 4 MIPS CPU. And with your 22.5kHz above would mean 90 CPU cycles per pin toggle and that’s a tall order for the Arduino environment (Sketch) if your doing to do anything else meaningful apart from toggling a pin.

          Granted it’s actually about 360 CPU cycles per update (nyquist rate) and that is doable in some tight C like you linked to.

          I still have some reservations about how doable it is using the native Arduino IDE (Sketch) without resorting to direct port writes.

          And yes, a port wide write to a R2R DAC is going to be faster than a pin toggle. I was more referring to the extra CPU cycles needed to work out what value to write.

          I might have a play with this in the Arduino IDE instead of AVR Studio.

  3. “This is just a major scale without fourth and seventh scale degrees, or just playing the black keys on a piano.”
    Really? A C major pentatonic scale has black keys in it? That’s totally new to me.

  4. A minor point, but guitarists (particularly the rubbishier ones like myself) tend to use more the minor pentatonic scale, which omits the 2nd and 6th (and flattens the third and seventh), and not the major pentatonic

    1. but aren’t the notes actually the same? I thought major or minor just depends on which ‘chord’ or base you are associating the scale to? (same notes for C major and A minor?).

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.