Tone()+MIDI=ToneMIDI Synth

I found this on the forum. When verify/compile is run, there is an error:
Any thoughts on how to fix this?

"Arduino: 1.8.19 (Linux), Board: "Arduino Uno"

MIDI_In_Example:61:7: error: 'frequency' does not name a type; did you mean 'freopen'?
const frequency[128] PROGMEM = {8, 9, 9, 10, 10, 11, 12, 12, 13, 14, 15, 15, 16, 17, 18, 19, 21, 22, 23, 24, 26, 28, 29, 31, 33, 35, 37, 39, 41, 44, 46, 49, 52, 55, 58, 62, 65, 69, 73, 78, 82, 87, 92, 98, 104, 110, 117, 123, 131, 139, 147, 156, 165, 175, 185, 196, 208, 220, 233, 247, 262, 277, 294, 311, 330, 349, 370, 392, 415, 440, 466, 494, 523, 554, 587, 622, 659, 698, 740, 784, 831, 880, 932, 988, 1047, 1109, 1175, 1245, 1319, 1397, 1480, 1568, 1661, 1760, 1865, 1976, 2093, 2217, 2349, 2489, 2637, 2794, 2960, 3136, 3322, 3520, 3729, 3951, 4186, 4435, 4699, 4978, 5274, 5588, 5920, 5920, 6645, 7040, 7459, 7902, 8372, 8870, 9397, 9956, 10548, 11175, 11840, 12544};
^~~~~~~~~
freopen
In file included from /home/kenneth/Downloads/arduino-1.8.19/hardware/arduino/avr/cores/arduino/Arduino.h:28:0,
from sketch/MIDI_In_Example.ino.cpp:1:
/home/kenneth/Downloads/ublt midi board/MIDI_BreakoutBoard-014a157ba569e3ff54cb270de8f26388f3d85145/Software/MIDI_In_Example/MIDI_In_Example.ino: In function 'void loop()':
MIDI_In_Example:134:53: error: 'frequency' was not declared in this scope
tone(tonePin,(unsigned int)pgm_read_word(&frequency[note]));
^
/home/kenneth/Downloads/ublt midi board/MIDI_BreakoutBoard-014a157ba569e3ff54cb270de8f26388f3d85145/Software/MIDI_In_Example/MIDI_In_Example.ino:134:53: note: suggested alternative: 'freopen'
exit status 1
'frequency' does not name a type; did you mean 'freopen'?

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

Add the word "int" between const and frequency:

const int frequency[128] PROGMEM = {8, 9, ...}

Can you also post a link to your internet source?

Good luck!

That appears to work, I got it to verify/compile and upload.

It's at Tone() + MIDI = ToneMIDISynth

I originally found it somewhere else, maybe on Github.

Thanks, once I get the Uno hooked up for actual testing I'll let you know.

Tone() + MIDI = ToneMIDISynth --it's on this forum.

Here is the GIthub link:

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.