Closed campidelli closed 2 months ago
That looks great! The oscillator and voice thing messed me up for a while too. What I figured out is that voices only apply if using load_patch. If you are using a patch, you need to set it up in the following way(this has worked for me at least):
to set each voice separately for each keypress:
for(uint8_t i=0;i<NUM_VOICES;i++) { e = amy.default_event(); e.velocity=0.5; sprintf(e.voices, "%d", i); e.midi_note = note; amy.add_event(e); }
in the noteOn function. You seem to have a different way of doing this that may also work just as well, Im not really that familiar with C and have and had a hell of a time understanding how to do this! But the above works for me when using the patch system. From what I can figure out, a patch has oscillator information built in, so if you try to set the oscillator value, it messes everything up. Polyphony is tricky, and I need to implement voice stealing next, which I see you are further along on! Nice. I have figured out a bunch of stuff over the last week or so, let me know if you have any other questions! Id love to chat about some of this stuff with someone. Im using midi input, so that is a little different than what you have going, but I would like to have the next iteration with a built in keyboard as well. I struggle to understand what is going on with the keyboard code, other than that it is a key matrix. Mine has essentially a midi controller running on a nano that is connected via RX0 on the esp32, and uses a matrix on the nano. Nice work!
Hey Jonathan,
Thanks for replying to my message!
I am not a C++, I am a Java developer, so I am struggling just like you. For example, instead of doing
sprintf(e.voices, "%d", i);
I was doing
strcpy(e.voices, String(voiceIndex).c_str());
Much more complex! Haha, I have just updated the code to use sprintf
instead.
As far as the keyboard is concerned, it is not a big deal what is happening in that class, as you said, it reads a matrix to determine which key is pressed or released. I am now using a shift register to read the keyboard, as it is physically more feasible to do than a matrix (the keys are spread in one row only).
Check this out https://hackaday.io/project/197399-arduino-esp32-standalone-accordion/log/232675-proof-of-concept-a-wooden-peg-piano I made a PoC to test if it would work and the result is amazing! Haha. This is my first Arduino project, it is so nice to work with this.
Anyway, if you want to talk more about it, you can reach out to me at https://www.linkedin.com/in/campidelli/
Cheers!
I am using Amy as well, it is amazing. I have combined some of your ideas with mine and came up with this
https://github.com/campidelli/arduino-accordion
I still need to fix the polyphony, I keep mixing their concepts of oscillator and voices.
Cheers!