Wiki

This version (15 Nov 2018 14:58) was approved by Chad Wentworth.The Previously approved version (03 Oct 2018 22:25) is available.Diff

MIDI Sawtooth Synth on Core 1

This third example is a MIDI controlled sawtooth synth on Core 1.

The Faust Code for the MIDI Controlled Sawtooth Synth

Here is the Faust code for the MIDI controlled sawtooth synth. Notice the use of the metadata elements:

  • freq – If a MIDI noteOn event is received it’s MIDI keyNumber is mapped to a frequency.
  • bend – if a MIDI pitchBend message is received it is mapped to a bend value.
  • gain – if a MIDI noteOn message is received it’s velocity value is mapped to a gain value which ranges from [0 .. 1.0]
  • gate – if MIDI noteOn/noteOff messages are received they are mapped to a gate value (0/1)
  • [midi:ctrl 1] – A Faust control (slider, etc) can be mapped to listen to a MIDI continuous controller.
import("stdfaust.lib");
 
 
normMIDI(mv)  = mv/127.0; 
vol  = normMIDI(hslider("Ctrl Value IN (Ctrl 1) [midi:ctrl 1]", 60, 0, 127, 1)) ;
 
 
f = nentry("freq",200,40,2000,0.01);
bend = nentry("bend",1,0,10,0.01) : si.polySmooth(t,0.999,1);
g = nentry("gain",1,0,1,0.01);
t = button("gate");
freq = f*bend;
envelope = t*g*vol : si.smoo;
 
process = os.sawtooth(freq)*envelope <: _,_;

Building a Test GUI for the MIDI Controlled Sawtooth Synth

  • Open the Faust online editor.
  • Name the *.dsp file sawtooth_synth.dsp.
  • Copy the algorithm into the online editor.
  • Compile and run the Faust program using the button

Looking at the Block Diagram for the MIDI Controlled Sawtooth

The block diagram button can be used to generate a hierarchical block diagram for an algorithm. This block diagram is hierarchical. Here are a few of the hierarchical levels:

Creating Files for use with the Baremetal Framework

  • Click the Export/compile to a specific platform button
  • In the first dropdown box, choose sam
  • In the second dropdown box, choose sam-source-poly-4 and then Export
faust2sam will generate the following three C++ source files, which is the algorithm.
  • fast_pow2.h
  • samFaustDSP.cpp
  • samFaustDSP.h
  • Click on the QR code that shows to download the files
  • These 3 source files can be copied to the Faust directory in the CCES framework. The framework can then be compiled and downloaded to the SHARC Audio Module.

Navigation - SHARC Audio Module

resources/tools-software/sharc-audio-module/faust/ex-work-saw.txt · Last modified: 03 Oct 2018 22:31 by Chad Wentworth