Project in progress
Arduino MIDI Poly Synth - MiniSy (Musical Instrument)

Arduino MIDI Poly Synth - MiniSy (Musical Instrument) © GPL3+

3 Oscillators Polyphonic Synth with MIDI using the Arduino Nano.

  • 12,658 views
  • 6 comments
  • 24 respects

Components and supplies

Apps and online services

About this project

My simple project of a Polyphonic Synthetizer using the Arduino Nano. It is simple but it is possible to play music with it. Up to 3 musical notes can be played simultaneously, so it is possible to play chords on it.

I wrote this code for fun, it is a polysynth with 3 oscillators (polyphony = 3) and respond to MIDI notes. The keyboard is used here only to send the MIDI notes to the arduino (act as a MIDI controller) and the sound is actually generated by the arduino and comes out of its digital pins.

This Arduino synth uses the Tone function to use the internal timers (Arduino Nano has 3 timers) to generate square wave. MIDI data infomation is sent over the DIN connector (5 pin, not USB) to the RX Pin 1 of Arduino.

It is possible to connect an effects pedal (guitar) to the sound output and make the synth sounds much more interesting and professional, adding delay, chorus, phaser, flanger, reverb distortion, etc. I use the effects pedal Zoom model MS-70CDR, I get wonderful and killer effects in stereo.

About the MIDI keyboard controller:

To play this syntetizer it is necessary to use a MIDI controller with keys with MIDI output via DIN 5 pin connector, for example the Behringer UMX610 or any other keyboard that has this type of MIDI output.

Wiring diagram (schematics):
if (typeof(lightBoxImages) == 'undefined') { lightBoxImages = {}; } lightBoxImages['91a826d700'] = [{ URL: 'https://hackster.imgix.net/uploads/attachments/1230376/arduino_synth_M4KRaQyGJS.jpg?auto=compress%2Cformat&w=1280&h=960&fit=max', caption: '', type: 'image' }];

Here is the link to download the complete project, including themain sketch, libraries and the wiring diagram: click here

This video shows the Synth MiniSy in operation:

Code

SYMPLE 3 OSC POLYSYNTH WITH MIDIC/C++
To be uploaded to Arduino, using the IDE.
/*********************************************************************************************
   JCR SYMPLE 3 OSC POLYSYNTH WITH MIDI - REV.1 - By Julio Cesar - CesarSound Dec/2020
     NOTE   23    1  B0 Note On      NOTE   23    1  B0 Note Off
     NOTE   108   1  C8 Note On      NOTE   108   1  C8 Note Off
     -----------------------------------------------------------
   NOTES:
   -Connect to MIDI OUT of your MIDI controller via 5 pin DIN MIDI connector (not USB MIDI).
   -For Arduino Uno / Nano / Pro Mini - See Schematics for wiring details.
   -The number of tones that can be generated at the same time is limited by the number of
   hardware timers available on the hardware (e.g. ATmega328 has 3 available timers, and the
   ATmega1280 has 6 timers).
**********************************************************************************************/
#include <MIDI.h>  //MIDI I/Os for Arduino https://github.com/FortySevenEffects/arduino_midi_library
#include <Tone.h>  //Bhagman Tone Library https://github.com/bhagman/Tone

byte i = 0, j = 1, k = 1;

static const uint16_t note[89] = {   //MIDI NOTES TO FREQUENCY ARRAY
  NOTE_B0, NOTE_C1, NOTE_CS1, NOTE_D1, NOTE_DS1, NOTE_E1, NOTE_F1, NOTE_FS1,
  NOTE_G1, NOTE_GS1, NOTE_A1, NOTE_AS1, NOTE_B1, NOTE_C2, NOTE_CS2, NOTE_D2,
  NOTE_DS2, NOTE_E2, NOTE_F2, NOTE_FS2, NOTE_G2, NOTE_GS2, NOTE_A2, NOTE_AS2,
  NOTE_B2, NOTE_C3, NOTE_CS3, NOTE_D3, NOTE_DS3, NOTE_E3, NOTE_F3, NOTE_FS3,
  NOTE_G3, NOTE_GS3, NOTE_A3, NOTE_AS3, NOTE_B3, NOTE_C4, NOTE_CS4, NOTE_D4,
  NOTE_DS4, NOTE_E4, NOTE_F4, NOTE_FS4, NOTE_G4, NOTE_GS4, NOTE_A4, NOTE_AS4,
  NOTE_B4, NOTE_C5, NOTE_CS5, NOTE_D5, NOTE_DS5, NOTE_E5, NOTE_F5, NOTE_FS5,
  NOTE_G5, NOTE_GS5, NOTE_A5, NOTE_AS5, NOTE_B5, NOTE_C6, NOTE_CS6, NOTE_D6,
  NOTE_DS6, NOTE_E6, NOTE_F6, NOTE_FS6, NOTE_G6, NOTE_GS6, NOTE_A6, NOTE_AS6,
  NOTE_B6, NOTE_C7, NOTE_CS7, NOTE_D7, NOTE_DS7, NOTE_E7, NOTE_F7, NOTE_FS7,
  NOTE_G7, NOTE_GS7, NOTE_A7, NOTE_AS7, NOTE_B7, NOTE_C8, NOTE_CS8, NOTE_D8, NOTE_DS8,
};

MIDI_CREATE_DEFAULT_INSTANCE();

Tone notePlayer[3];   //[3] = 3 OSC (MAX)

void setup(void) {

  MIDI.begin(MIDI_CHANNEL_OMNI);
  
  notePlayer[0].begin(3);    //OSC 1 - OSC 1 OUTPUT PIN 3
  notePlayer[1].begin(5);    //OSC 2 - OSC 2 OUTPUT PIN 5
  notePlayer[2].begin(11);   //OSC 3 - OSC 3 OUTPUT PIN 11

  MIDI.setHandleNoteOn(MyHandleNoteOn);
  MIDI.setHandleNoteOff(MyHandleNoteOff);
}

void loop(void) {
  MIDI.read();
}

void MyHandleNoteOn(byte channel, byte pitch, byte velocity) {
  i = pitch - 23;

  j = j + 1;
  if (j > 3) j = 1;

  switch (j) {
    case 1:
      notePlayer[0].play(note[i]);
      break;
    case 2:
      notePlayer[1].play(note[i]);
      break;
    case 3:
      notePlayer[2].play(note[i]);
      break;
  }
}

void MyHandleNoteOff(byte channel, byte pitch, byte velocity) {

  k = k + 1;
  if (k > 3) k = 1;

  switch (k) {
    case 1:
      notePlayer[0].stop();
      break;
    case 2:
      notePlayer[1].stop();
      break;
    case 3:
      notePlayer[2].stop();
      break;
  }
}

Schematics

Schematics
To make the arduino electrical connection.

Comments

Similar projects you might like

echoTrek - Digital Delay / Echo - Audio Effects with Arduino

Project in progress by CesarSound

  • 6,170 views
  • 14 comments
  • 23 respects

USB MIDI Adapter

Project tutorial by Dennis V

  • 3,692 views
  • 5 comments
  • 10 respects

Arduino MIDI Arpeggiator

Project tutorial by Dmitry

  • 46,380 views
  • 63 comments
  • 146 respects

Arduino MIDI Stepper Synth

Project tutorial by Jonathan Kayne

  • 43,896 views
  • 46 comments
  • 85 respects

Make Musical Instrument Using Arduino and Flick Large

Project tutorial by LanmiLab

  • 9,971 views
  • 8 comments
  • 24 respects
Add projectSign up / Login