arduino-midi-sound-module
arduino-midi-sound-module copied to clipboard
Many instruments appear the same in instruments_generated.h
A lot of instruments share this definition:
/* 102: FX 7 (echoes) */ { /* waveOffset: */ &Waveforms[4480], /* ampMod: */ 1, /* freqMod: */ 255, /* waveMod: */ 0, /* xor: */ 0, /* flags: */ static_cast<InstrumentFlags>(0)
Are the real wavetables for these instruments somewhere in the Waveforms array? Could they be found, or is it difficult/impossible?
The short answer is that these instruments are unfinished.
The longer answer is that the Arduino Uno only has 32K of flash RAM, which is shared between program code and constant data like the wavetable. There isn't enough space for each instrument to have its own 256B wavetable section. To work around this, instruments often partially or fully share wavetable entries and other features of the synth engine (like ADSR) are used to create the distinct sounds.
The process of creating these instruments was experimental and time consuming, so I started by setting all of the instruments to some generic defaults and then tweaking the ones that "sounded wrong" when listening to MIDI files. Instruments commonly used in solos (like pianos) got the most attention while there are some that are still generic defaults.
Issue #13 talks a bit more about how the instruments were generated, if you're interested.
Understand the tightness of PROGMEM (perhaps Mega2560 is your friend here) and appreciate the tricks you've done to share wave table entries. Since I'm recycling an old electronic piano, the piano sounds are the most important anyway. Will determine which are OK by experiment.
Is it possible to get a classification of the instruments into finished/needs work/not started? Or even just a rough list of which ones you consider finished, that you're happy with?
You have the right idea. The instruments with &Waveforms[4480] are all the generic instrument (visualized below). These are the instruments that never got any attention.
There are also a few places where the same instrument is copy/pasted for several similar instruments (e.g., stringed bass and saxophones). They are passable but could use some tweaking.