ARMmbed FM Sound Synthesiezer

Simple monophonic FM sound synthesis with carrier, single modulator and low pass filter (wave table sinusoidal oscillators) based on STM32F746G-DISCO board. On board touch screen and additional ADXL345 3-axis accelerometer are used to control the sound synthesis. The synthesised signal is reproduced through the on-board SAI audio codec.

The four controllable parameters in (global variables in main.cpp) are:

float amplitude = 0.5; //numbers between 0.0 and 1.0
float pitch = 400; // numbers between 50 and 5000
float modrate = 0; // numbers between -1000 and 1000
float moddepth = 0; //numbers between -1000 and 1000
float filter = 1.0f; //numbers between 0.0 (full filter) and 1.0 (do not filter)

In the current version the mapping between user input and synthesis are the following (ad hoc scaling coefficients are applied):

  • the amplitude is set to a fixed value equal to 0.5 when a touch on the screen is detected (otherwise 0).
  • the pitch is mapped on the horizontal touch position (discrete onto 12 semitones indicated with the piano-like bars on top and bottom of the LCD display).
  • the filter is mapped to the vertical touch position (continuous).
  • the modulation rate is mapped to the horizontal accelerometer axis (continuous).
  • the modulation depth is mapped to the vertical accelerometer axis.

The source code include functions to ease the modification of the mapping/scaling of the user inputs to parameters of the FM synthesizer. The sound synthesis code is written in plain C so that can be ported to other ARMmbed boards or to other platforms.

The ADXL345 module is connected to the STM32F746G-DISCO as it follows:

  • STM32F746G D10 SS –>ADXL345 CS
  • STM32F746G-DISCO D11 MOSI–>ADXL345 SDA
  • STM32F746G-DISCO D12 MISO–>ADXL345 SDO
  • STM32F746G-DISCO D13 SCK–>ADXL345 SCL
  • STM32F746G-DISCO 3V3 VCC–>ADXL345 VCC
  • STM32F746G-DISCO GND GND–>ADXL345 GND

Download ARMmbedFMsinth

Bookmark the permalink.

Comments are closed.