This version (03 Oct 2018 19:24) was approved by Chad Wentworth.The Previously approved version (02 Oct 2018 21:28) is available.Diff

MIDI Controlled Volume on Core 1

A first example to demonstrate the workflow is a simple MIDI controlled stereo volume control that runs on Core 1.

The Faust Code for the MIDI Controlled Volume

Here is the Faust code for the MIDI controlled stereo volume. Note that the metadata string “[midi:ctrl 2]” is used to map MIDI continuous controller 2 (CC-2) to control the gain slider.

// Volume control in dB with MIDI control (CC-1, modWheel)
gain		=  vslider("Volume[midi:ctrl 2] [tooltip CC-1]", 0, -70, +4, 0.1) : ba.db2linear : si.smoo;
process		= _,_: *(gain), *(gain);

Building a Test GUI for the MIDI Controlled Volume

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

Looking at the Block Diagram for the MIDI Controlled Volume

The block diagram button can be used to generate a hierarchical block diagram for an algorithm.

You may need to allow pop-ups in your browser to view the block diagram

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

Expected Effect

When you run the project through the debugger, you will be able to control the volume by turning the POT labeled HADC0.

Navigation - SHARC Audio Module

resources/tools-software/sharc-audio-module/faust/ex-work-volume.txt · Last modified: 03 Oct 2018 19:18 by Chad Wentworth