Arduino Tone One Year On!

One year ago I posted the following two articles:

Shortly followed by an associated video on YouTube and so the Simple DIY Electronic Music Projects blog was born!  They were then followed by the Arduino MIDI Tone Module and many others since.

So in honour of my one-year anniversary, after more than 180 posts, including the launch of the Lo-Fi Orchestra, I wanted to return to those “tone” roots and do something slightly different.

Here are twelve Arduino Nanos, each with a speaker and armed with nothing more than the MIDI library and the tone() function bringing you my favourite selection of music from the whole of the Star Wars saga – the fanfare from the last scenes of Star Wars Episode IV A New Hope.

Watch it in full below.

Warning! I strongly recommend using old or second hand equipment for your experiments.  I am not responsible for any damage to expensive instruments!

These are the key Arduino tutorials for the main concepts used in this project:

If you are new to Arduino, see the Getting Started pages.

Parts list

The Circuit

ArduinoToneOrchestra_bb

The circuit is largely just a “helper” board to make it easy to power 12 Arduino Nanos, allow them to share the same MIDI in signal, and have them all connected to their own speaker.

Things to note about this build:

  • Only four pins of the Arduino Nano are connected:
    • VIN
    • GND
    • RX for the MIDI in signal
    • D2 for the audio output
  • This is using VIN to simplify the track layout on the board.  You could use 5V if you wished, but that is on the same “track” as one of the GND pins, and the other GND pin is on the same “track” as RX.  By using VIN, GND and RX it is possible to have all three tracks span the whole board unbroken.
  • Using VIN means it requires a power supply of 6-12V.  You can’t put 5V in VIN and have it work (reliably).
  • The MIDI interface requires 5V power (usually), so one of the Arduino Nanos does have its 5V connected – but it is use as a “5V out” for the MIDI module.  This means in that one place, the GND track needs cutting and “routing around” the 5V pin.
  • Ideally you’d be using 12 speakers that are all very similar.  I had two a bit quieter than the rest and one too loud.  The louder one was relatively easy to sort out – I added an extra resistor – but I couldn’t really do anything about the two quieter ones as I didn’t want to limit any of the others.

IMG_5099

The Code

The idea is to create 12 of the Arduino MIDI Tone Modules, with each one on a different MIDI channel, and play them like a single 12-note polyphonic tone module.

Note it should be noted that there are many other ways to achieve this, in fact as part of the 180+ projects posted during this last year, I could have looked at:

  • Arduino Multi MIDI Tone Module – a similar project to this one, essentially stacking up four of the Arduino MIDI Tone Modules with a common MIDI In.
  • Arduino MIDI Multi-Tone Module – a project showing how a single Arduino can be made to make up to three tones itself.
  • Arduino Tone Polyphony – the first in a series of posts showing how to get even more tone() like notes from a single Arduino.  At the end of the series, I managed full 12-note polyphony (with a few limitations!)

Not to mention a whole host of synthesis approaches and alternative microcontrollers.  But the idea was to return to those first two projects and do something with those.

Consequently the code used here is almost completely unchanged from the Arduino MIDI Tone Module code. The only changes are minor:

  • The output pin is D2 to make using the stripboard easier.
  • The MIDI channel is changed for each board.  Note that I’ve not used channel 10 as this is typically used for a drum track, so I’m using MIDI channels 1-9 and 11-13.
  • I added a “note on indicator” in the shape of LED_BUILTIN.  This gets turned on when a noteOn is received and turned off when noteOff is received.  This was useful to let me know when things are happening on which boards!

Find it on GitHub here.

The Music

As with all my Lo-Fi Orchestra performances the music score is programmed in by me using MuseScore3.  There are twelve parts, each set to a different MIDI channel (1-9,11-13) with a loose “six part high, six part low” kind of structure.  The score is part my own listening, part extracts from different MIDI files (which unfortunately don’t tend to come with attribution or credits!), where appropriate, and part glue by me to join it together.

Once complete, the score is changed to remove all expression(!), saved as a MIDI file and then tweaked using MidiEditor to remove any Program Change messages from the start, which tend to overload the MIDI handling when all sent at once!

It is “conducted” from an old laptop using MidiBar – which is part of MidiOx via my Roland UM-ONE MK2 MIDI interface.

Closing Thoughts

The blog has come a long way this last year.  I certainly never anticipated the creation of the Lo-Fi Orchestra.  But even after some 180 posts, my ideas list is still pretty long, so there is still plenty more to do if I feel so inclined.

If you like what you see do pop over and follow me on social media.  You can find me on:

And I have accounts on Github, Hackaday.io, Electromaker.io and if all else fails you can buy me a Ko-Fi if you are so inclined.

Kevin

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s