• Arduino MIDI Poly Synth - MiniSy (Musical Instrument)

QC

Arduino MIDI Poly Synth - MiniSy (Musical Instrument)

3 oscillator polyphonic synth with MIDI using the Arduino Nano.

Devices and components

Arduino-Nano

10k ohm resistance

OPTOCOUPLER 4N25

1N4148 – General purpose fast switching

DIN audio/video connector, 5 contacts

Resistance 221 ohms

Breadboard (generic)

Resistance 1k ohm

Resistance 2.21k ohms

Software and tools

Arduino IDE

Project description

About MIDI Keyboard Controller:

Wiring diagram (diagrams):

This video shows the Synth MiniSy in operation:

SYMPLE 3 OSC POLYSYNTH WITH MIDI

Download to Arduino, using the IDE.

1/*********************************************************************************************
2 JCR SYMPLE 3 OSC POLYSYNTH WITH MIDI - REV.1 - By Julio Cesar - CesarSound Dec/2020
3 NOTE 23 1 B0 Note On NOTE 23 1 B0 Note Off
4 NOTE 108 1 C8 Note On NOTE 108 1 C8 Note Off
5 -----------------------------------------------------------
6 NOTES:
7 -Connect to MIDI OUT of your MIDI controller via 5 pin DIN MIDI connector (not USB MIDI).
8 -For Arduino Uno / Nano / Pro Mini - See Schematics for wiring details.
9 -The number of tones that can be generated at the same time is limited by the number of
10 hardware timers available on the hardware (e.g. ATmega328 has 3 available timers, and the
11 ATmega1280 has 6 timers).
12**********************************************************************************************/
13#include <MIDI.h> //MIDI I/Os for Arduino https://github.com/FortySevenEffects/arduino_midi_library
14#include <Tone.h> //Bhagman Tone Library https://github.com/bhagman/Tone
15
16byte i = 0, j = 1, k = 1;
17
18static const uint16_t note[89] = { //MIDI NOTES TO FREQUENCY ARRAY
19 NOTE_B0, NOTE_C1, NOTE_CS1, NOTE_D1, NOTE_DS1, NOTE_E1, NOTE_F1, NOTE_FS1,
20 NOTE_G1, NOTE_GS1, NOTE_A1, NOTE_AS1, NOTE_B1, NOTE_C2, NOTE_CS2, NOTE_D2,
21 NOTE_DS2, NOTE_E2, NOTE_F2, NOTE_FS2, NOTE_G2, NOTE_GS2, NOTE_A2, NOTE_AS2,
22 NOTE_B2, NOTE_C3, NOTE_CS3, NOTE_D3, NOTE_DS3, NOTE_E3, NOTE_F3, NOTE_FS3,
23 NOTE_G3, NOTE_GS3, NOTE_A3, NOTE_AS3, NOTE_B3, NOTE_C4, NOTE_CS4, NOTE_D4,
24 NOTE_DS4, NOTE_E4, NOTE_F4, NOTE_FS4, NOTE_G4, NOTE_GS4, NOTE_A4, NOTE_AS4,
25 NOTE_B4, NOTE_C5, NOTE_CS5, NOTE_D5, NOTE_DS5, NOTE_E5, NOTE_F5, NOTE_FS5,
26 NOTE_G5, NOTE_GS5, NOTE_A5, NOTE_AS5, NOTE_B5, NOTE_C6, NOTE_CS6, NOTE_D6,
27 NOTE_DS6, NOTE_E6, NOTE_F6, NOTE_FS6, NOTE_G6, NOTE_GS6, NOTE_A6, NOTE_AS6,
28 NOTE_B6, NOTE_C7, NOTE_CS7, NOTE_D7, NOTE_DS7, NOTE_E7, NOTE_F7, NOTE_FS7,
29 NOTE_G7, NOTE_GS7, NOTE_A7, NOTE_AS7, NOTE_B7, NOTE_C8, NOTE_CS8, NOTE_D8, NOTE_DS8,
30};
31
32MIDI_CREATE_DEFAULT_INSTANCE();
33
34Tone notePlayer[3]; //[3] = 3 OSC (MAX)
35
36void setup(void) {
37
38 MIDI.begin(MIDI_CHANNEL_OMNI);
39
40 notePlayer[0].begin(3); //OSC 1 - OSC 1 OUTPUT PIN 3
41 notePlayer[1].begin(5); //OSC 2 - OSC 2 OUTPUT PIN 5
42 notePlayer[2].begin(11); //OSC 3 - OSC 3 OUTPUT PIN 11
43
44 MIDI.setHandleNoteOn(MyHandleNoteOn);
45 MIDI.setHandleNoteOff(MyHandleNoteOff);
46}
47
48void loop(void) {
49 MIDI.read();
50}
51
52void MyHandleNoteOn(byte channel, byte pitch, byte velocity) {
53 i = pitch - 23;
54
55 j = j + 1;
56 if (j > 3) j = 1;
57
58 switch (j) {
59 case 1:
60 notePlayer[0].play(note[i]);
61 break;
62 case 2:
63 notePlayer[1].play(note[i]);
64 break;
65 case 3:
66 notePlayer[2].play(note[i]);
67 break;
68 }
69}
70
71void MyHandleNoteOff(byte channel, byte pitch, byte velocity) {
72
73 k = k + 1;
74 if (k > 3) k = 1;
75
76 switch (k) {
77 case 1:
78 notePlayer[0].stop();
79 break;
80 case 2:
81 notePlayer[1].stop();
82 break;
83 case 3:
84 notePlayer[2].stop();
85 break;
86 }
87}

SYMPLE 3 OSC POLYSYNTH WITH MIDI

Download to Arduino, using the IDE.

1/*********************************************************************************************
2 JCR SYMPLE 3 OSC POLYSYNTH WITH MIDI - REV.1 - By Julio Cesar - CesarSound Dec/2020
3 NOTE 23 1 B0 Note On NOTE 23 1 B0 Note Off
4 NOTE 108 1 C8 Note On NOTE 108 1 C8 Note Off
5 -----------------------------------------------------------
6 NOTES:
7 -Connect to MIDI OUT of your MIDI controller via 5 pin DIN MIDI connector (not USB MIDI).
8 -For Arduino Uno / Nano / Pro Mini - See Schematics for wiring details.
9 -The number of tones that can be generated at the same time is limited by the number of
10 hardware timers available on the hardware (e.g. ATmega328 has 3 available timers, and the
11 ATmega1280 has 6 timers).
12**********************************************************************************************/
13#include <MIDI.h> //MIDI I/Os for Arduino https://github.com/FortySevenEffects/arduino_midi_library
14#include <Tone.h> //Bhagman Tone Library https://github.com/bhagman/Tone
15
16byte i = 0, j = 1, k = 1;
17
18static const uint16_t note[89] = { //MIDI NOTES TO FREQUENCY ARRAY
19 NOTE_B0, NOTE_C1, NOTE_CS1, NOTE_D1, NOTE_DS1, NOTE_E1, NOTE_F1, NOTE_FS1,
20 NOTE_G1, NOTE_GS1, NOTE_A1, NOTE_AS1, NOTE_B1, NOTE_C2, NOTE_CS2, NOTE_D2,
21 NOTE_DS2, NOTE_E2, NOTE_F2, NOTE_FS2, NOTE_G2, NOTE_GS2, NOTE_A2, NOTE_AS2,
22 NOTE_B2, NOTE_C3, NOTE_CS3, NOTE_D3, NOTE_DS3, NOTE_E3, NOTE_F3, NOTE_FS3,
23 NOTE_G3, NOTE_GS3, NOTE_A3, NOTE_AS3, NOTE_B3, NOTE_C4, NOTE_CS4, NOTE_D4,
24 NOTE_DS4, NOTE_E4, NOTE_F4, NOTE_FS4, NOTE_G4, NOTE_GS4, NOTE_A4, NOTE_AS4,
25 NOTE_B4, NOTE_C5, NOTE_CS5, NOTE_D5, NOTE_DS5, NOTE_E5, NOTE_F5, NOTE_FS5,
26 NOTE_G5, NOTE_GS5, NOTE_A5, NOTE_AS5, NOTE_B5, NOTE_C6, NOTE_CS6, NOTE_D6,
27 NOTE_DS6, NOTE_E6, NOTE_F6, NOTE_FS6, NOTE_G6, NOTE_GS6, NOTE_A6, NOTE_AS6,
28 NOTE_B6, NOTE_C7, NOTE_CS7, NOTE_D7, NOTE_DS7, NOTE_E7, NOTE_F7, NOTE_FS7,
29 NOTE_G7, NOTE_GS7, NOTE_A7, NOTE_AS7, NOTE_B7, NOTE_C8, NOTE_CS8, NOTE_D8, NOTE_DS8,
30};
31
32MIDI_CREATE_DEFAULT_INSTANCE();
33
34Tone notePlayer[3]; //[3] = 3 OSC (MAX)
35
36void setup(void) {
37
38 MIDI.begin(MIDI_CHANNEL_OMNI);
39
40 notePlayer[0].begin(3); //OSC 1 - OSC 1 OUTPUT PIN 3
41 notePlayer[1].begin(5); //OSC 2 - OSC 2 OUTPUT PIN 5
42 notePlayer[2].begin(11); //OSC 3 - OSC 3 OUTPUT PIN 11
43
44 MIDI.setHandleNoteOn(MyHandleNoteOn);
45 MIDI.setHandleNoteOff(MyHandleNoteOff);
46}
47
48void loop(void) {
49 MIDI.read();
50}
51
52void MyHandleNoteOn(byte channel, byte pitch, byte velocity) {
53 i = pitch - 23;
54
55 j = j + 1;
56 if (j > 3) j = 1;
57
58 switch (j) {
59 case 1:
60 notePlayer[0].play(note[i]);
61 break;
62 case 2:
63 notePlayer[1].play(note[i]);
64 break;
65 case 3:
66 notePlayer[2].play(note[i]);
67 break;
68 }
69}
70
71void MyHandleNoteOff(byte channel, byte pitch, byte velocity) {
72
73 k = k + 1;
74 if (k > 3) k = 1;
75
76 switch (k) {
77 case 1:
78 notePlayer[0].stop();
79 break;
80 case 2:
81 notePlayer[1].stop();
82 break;
83 case 3:
84 notePlayer[2].stop();
85 break;
86 }
87}




Note: Content and images are from: https://projecthub.arduino.cc/, with some modifications.
If you want it removed due to copyright reasons, please leave a comment. Thank you.
I want to share this article more widely so that everyone knows about Arduino and your project.

Arduino Tutorial: Mini Piano

In this video I show you how to make a mini piano with Arduino. Devices and components Arduino Uno Rev3 Jumper wires (generic) Buzzer Breadb...