ARM / STM32F7 DIY synth workshop (STM32F746-DISCO)
Photo by Lysandre Follet
This repo contains 8 sub-projects, all described below and each compilable as standalone application. The repo also includes various support libraries of the thi.ng collection as Git submodules, located in the /ext folder:
- ct-gui - tiny GUI library
- ct-head - common headers, macros & utils
- ct-synstack - softsynth / DSP engine
# clone with submodules git clone https://github.com/thi-ng/ws-ldn-12 --recursive
Other 3rd party dependecies
- STM32 CubeF7 SDK
- GCC ARM toolchain
- OpenOCD (optional, using dev version w/ STM32F746 support)
This repo uses a flexible
Makefile to build all included
projects - no IDE required! The setup features:
- easily customizable device config & linker scripts
- no requirement to manually copy STM Cube SDK sources
- catalog file(s) to selectively exclude various SDK source files (see /make/sources.txt, can be overridden per project)
- config flags to include USBH & FatFs middlewares
- support for multiple sub-projects (with & without shared sources)
- individual module (sub-project) configs (e.g. /make/modules/ex08.make)
- separate build & target folders for each module
Currently only the STM32F746-DISCO board is supported, but additional board configurations can be easily added (see /make/devices/ for reference).
Makefile requires the env var
STM_CUBE_HOME to be
set to the root of your STM SDK directory, e.g.
export STM_CUBE_HOME=~/dev/arm/STM32Cube_FW_F7_V1.4.0 make module=ex01 clean make module=ex01 -j4 # flash device (0x800000 is ROM start address) st-flash --reset write bin/ex01/app.bin 0x8000000 # combine for improved usability in terminal make module=ex01 -j4 && st-flash --reset write bin/ex01/app.bin 0x8000000
ex01 - blinky
Simple Hello World LED blink example & demo of using EXTI interrupt to react to user button. Stops/starts blinking each time button is pressed.
ex02 - LCD, touchscreen & GUI basics
Basic demonstration of working with BSP LCD & touchscreen modules, as well as intro to working w/ external libraries (here thi.ng/ct-gui).
Edit the source file to uncomment different demo modes:
demoWelcome()- simple text rendering & random dots, non-interactive
demoScribble()- 5 point multi-touch drawing
demoGUI()- basic GUI usage example (dials control nothing)
ex03 - Timers
Basic timer setup & multi-tasking example. Timer runs @ 10kHz and controls simple LED blinking task. Task can be suspended interactively by pressing user button.
ex04 - Oscillators
Simple oscillator & frequency modulation experiment. The following oscillator types are supported for both main osc & modulator:
|4||Saw + Sin|
|5||Noise (uses Xorshift128 PRNG)|
mod_amp field of the
Oscillator struct is the
modulation amplitude, but since the modulator is acting in the
frequency domain, this amplitude too is in Hz.
ex05 - USB stick WAV file streaming playback
This example uses the STM USB Host library & FatFS to access a USB
memory stick connected to the board. Once USB handshake is complete,
the app will then attempt to read the file
sound.wav located in the
root of the USB filesystem and start streaming to the headphone audio
output (looping playback).
- The WAV file MUST be in 44.1kHz, 16bit stereo format
- The example is currently configured to use the USB FS (fullspeed)
port (not HS (highspeed)). This can be changed via the
ex06 - thi.ng/synstack basics
First example using thi.ng/synstack to implement polyphonic synth with fully configurable node based DSP graph (1 graph per voice). The graph implemented is shown below.
We also define a musical scale to play a randomized, but always harmonic sequence and show how to dynamically modify parameters of the DSP node.
Note: The graph doesn’t show global LFOs, which are used for various modulation purposes (env mod, freq etc.).
ex07 - thi.ng/synstack & custom SDRAM delay
Similar setup to ex06 above, however to enable much longer delay times and not be limited by the <320KB of available on-chip RAM of the STM32F746-DISCO board, this example uses the 8MB “external” SDRAM (still on-board, just not in-chip), a custom memory allocator (targetting SDRAM) and shows how to easily extend Synstack with custom DSP nodes - in this case a noise oscillator and a new delay node, which stores its long delay line in SDRAM, but then has to work with small, windowed sections in main RAM and mirror them back & forth.
We also updated the DSP node graph to add the new oscillator, foldback distortion and replace the old delay with the new one…
ex08 - Synstack & MIDI
Based on ex07 synth setup, but with USB MIDI support to turn synth
into actual instrument (4 voice polyphonic). Via the optional
LOG_MIDI flag (defined in ex08.make), received MIDI message can be
logged to the board’s LCD screen.
Note: Currently the synth only accepts MIDI Note On messages and ignores MIDI Note Off’s, since all voices only use an ADR envelope, without “sustain” phase. This will be added later…
- http://asm.thi.ng/ - links to all required SDK & build tools, references, learning resources…
|Karsten Schmidt||initiator & principal developer||thi.ng|
This project is open source and licensed under the Apache Software License 2.0.