ARM / STM32F7 DIY synth workshop (STM32F746-DISCO)
Photo by Lysandre Follet
Check out demo tracks on Soundcloud
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
- STM32 CubeF7 SDK
- GCC ARM toolchain
- ST-Link
- 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).
IMPORTANT: The Makefile
requires the env var STM_CUBE_HOME
to be
set to the root of your STM SDK directory, e.g.
~/dev/arm/STM32Cube_FW_F7_V1.4.0
.
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
Simple Hello World LED blink example & demo of using EXTI interrupt to react to user button. Stops/starts blinking each time button is pressed.
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-interactivedemoScribble()
- 5 point multi-touch drawingdemoGUI()
- basic GUI usage example (dials control nothing)
Basic timer setup & multi-tasking example. Timer runs @ 10kHz and controls simple LED blinking task. Task can be suspended interactively by pressing user button.
Simple oscillator & frequency modulation experiment. The following oscillator types are supported for both main osc & modulator:
ID | Type |
---|---|
0 | Sine |
1 | Saw |
2 | Square |
3 | Triangle |
4 | Saw + Sin |
5 | Noise (uses Xorshift128 PRNG) |
Important: The 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.
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).
Important:
- 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
ex05/usbh_conf.h
file.
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.).
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…
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…
Name | Role | Website |
Karsten Schmidt | initiator & principal developer | thi.ng |
This project is open source and licensed under the Apache Software License 2.0.