AlgoCompSynth / CLAMS

Command Line Algorithmic Music System
https://algocompsynth.github.io/CLAMS
MIT License
17 stars 0 forks source link

Reverse-engineer Pimoroni "synth" example with GDB #34

Closed znmeb closed 1 year ago

znmeb commented 1 year ago

Goal is to translate this to zeptoforth

znmeb commented 1 year ago

Happening in https://github.com/AlgoCompSynth/rp2040-forth-builder/issues/4

znmeb commented 1 year ago

Official Windows toolchain build is working. I've forked the pimoroni-pico repo to https://github.com/AlgoCompSynth/pimoroni-pico so I can add print statements and other stuff I want in the Forth version. VSCode debugger works with the debug probe on the serial "Hello world" and I don't care whether the LEDs blink or not! Next step - see what the Pico sounds like.

znmeb commented 1 year ago

Demo works - kind of a chiptune groovebox sound

znmeb commented 1 year ago

The core C++ code is in repository https://github.com/raspberrypi/pico-extras/tree/master/src/rp2_common/pico_audio_i2s. This is what the Pimoroni Audio Pack demo uses. It's in C, manages buffers, uses a PIO and is frightfully complicated. As near as I can tell it's hard-coded to 16 bits. It's probably too much for a proof of concept.

The DAC on the Pimoroni Pico Audio Pack can go up to 384 kHz and 32 bits, although it's not clear there's any gain in audio quality over 24 bits. I think I need to build something simpler than pico_audio_i2s.

znmeb commented 1 year ago

The Cornell lab code appears to be 3-clause BSD licensed! So we need the I2S code from pico_extras but we can use the DDS code from Cornell, for example https://github.com/vha3/Hunter-Adams-RP2040-Demos/blob/master/Lab_1_Incremental/b_Timer_Interrupt_DDS_Demo/dactest.c

znmeb commented 1 year ago

The demos as written are very complex. I don't believe all that complexity is necessary given that we have a real-time OS!