shorepine / amy

AMY - the Additive Music synthesizer librarY

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Arduino library for AMY

bwhitman opened this issue · comments

Great projet!!
i will appreciate a component to develop in Arduino IDE, alles too.
Thank you
Marco

Yes, this is a great thing to do. I am not too familiar with how to build an Arduino library. AMY is pretty standard C and should "just work" packaged up as one, but I assume someone needs to make a C++ .h interface for it? Sounds like something @dpwe would know about

I'm working on this now in the arduino branch, will update the status here as I go.

So far this library "works" for esp32 and rp2040, in that it can be imported into the Arduino IDE as a library, it compiles with a sketch and you can call

AMY amy;
amy.begin();
long now = amy.sysclock();
amy.drums(now);

The details are the harder parts: we should support:

  • Setting pins for I2S output on init
  • A mode switch to render to int16 (where you deal with the samples) or render "live" (where we deal with the audio output)
  • Setting audio output to other formats -- DACs, analog outs, etc? We need to see how more feature-full Arduino synths deal with this
  • Expose the Amyevent struct to Arduino somehow
  • Support for amy_config parameters in init, especially AMY_CORES
  • Test on lots of boards: esp32, esp32-cX, esp32-sX, rp2040, teensy, STMF32, cortex m0s, etc etc
  • an examples folder with example scripts

One weirdness is we can't seem to support multicore rendering on the rp2040 in Arduino natively. It works fine in C, but using the Arduino board support by Earle F P III, the message passing between cores does not work. Worth more investigation, but for now I can leave AMY_CORES to 1 for the RP2040.

* [ ]  Test on lots of boards: esp32, esp32-cX, esp32-sX, rp2040, teensy, STMF32, cortex m0s, etc etc

Electro-Smith Daisy? I've got a few of them lying about and they have an Arduino interface.

A first version of this is committed to main! If you have a Pi Pico or an ESP32 with any i2s DAC, please give it a go and let us know how it works. We provide an example .ino for it so you can see how to use it. Some things still left to do so I'll keep this open until then.

I've tested on the Teensys (4.1 and 3.6) -- 3.2 has some issue with the queue support in their i2s library, but maybe someone can get it to work if people care about that one.

I think for now we'll only support the mode of "AMY generates sample buffers, you do what you want with them" and it's foolish for me to anticipate every I2S / DAC / PWM setup across all these boards. Happy to have my mind changed!

amy_config has #ifdefs for a lot of the board setups I've tried. One big chonker is fm.h -- we may want to eventually create a fm_small.h that has only 64 patches or something.

I think we're good for now on this. I'll field issues with Arduino things as they come in.