arduino_midi_library icon indicating copy to clipboard operation
arduino_midi_library copied to clipboard

Simple Synth pitches are incorrect

Open franky47 opened this issue 4 years ago • 4 comments

See #203.

Correct values of pitches: https://www.inspiredacoustics.com/en/MIDI_note_numbers_and_center_frequencies

Values must be rounded to the nearest integer, as the tone function does not accept floating point values.

franky47 avatar Feb 22 '21 07:02 franky47

@franky47 i would like to work on this

akshay4n avatar Feb 23 '21 02:02 akshay4n

@akshay4n, awesome, go ahead !

Ping me here if there's anything you need help with.

franky47 avatar Feb 23 '21 08:02 franky47

@franky47 I took a look at #203 and went through https://www.inspiredacoustics.com/en/MIDI_note_numbers_and_center_frequencies and https://www.arduino.cc/reference/en/language/functions/advanced-io/tone/ The problem isn't quite clear to me

akshay4n avatar Feb 23 '21 08:02 akshay4n

I initially thought that the frequency values were off in the pitch list, but the problem is in reading the table.

It starts at B0, which should map to MIDI note number 23. So the index at which we read the pitch should be noteNumber - 23 to map to the correct note (while taking care not to output negative indices): https://github.com/FortySevenEffects/arduino_midi_library/blob/master/examples/SimpleSynth/SimpleSynth.ino#L54

franky47 avatar Feb 23 '21 09:02 franky47