Skip to content

Latest commit

 

History

History
246 lines (185 loc) · 8.6 KB

README.org

File metadata and controls

246 lines (185 loc) · 8.6 KB

thi.ng/ws-ldn-12

ARM / STM32F7 DIY synth workshop (STM32F746-DISCO)

./assets/ws-ldn-12-minigorille.jpg

Photo by Lysandre Follet

Check out demo tracks on Soundcloud

Project setup

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:

# clone with submodules
git clone https://github.com/thi-ng/ws-ldn-12 --recursive

Other 3rd party dependecies

Building

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

Examples

ex01 - blinky

Source

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

Source

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

Source

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

Source

Simple oscillator & frequency modulation experiment. The following oscillator types are supported for both main osc & modulator:

IDType
0Sine
1Saw
2Square
3Triangle
4Saw + Sin
5Noise (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.

ex05 - USB stick WAV file streaming playback

Source

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.

ex06 - thi.ng/synstack basics

Source | Soundcloud

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.).

assets/ex06-dag.png

ex07 - thi.ng/synstack & custom SDRAM delay

Source | Soundcloud

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…

assets/ex07-dag.png

ex08 - Synstack & MIDI

Source

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…

Resources

  • http://asm.thi.ng/ - links to all required SDK & build tools, references, learning resources…

Contributors

NameRoleWebsite
Karsten Schmidtinitiator & principal developerthi.ng

License

This project is open source and licensed under the Apache Software License 2.0.