Next  |  Prev  |  Top  |  JOS Index  |  JOS Pubs  |  JOS Home  |  Search

MIDI Synthesizer Test Patch

The example synth is loaded into pd like any plugin-wrapper. A manually written test patch (cpgrshelp.pd) is shown in Fig.16. Note that the standard MIDI-synth control parameters (freq, gain, gate) are handled behind the scenes and do not appear among the plugin GUI controls.

Figure: Test patch for the pd synth plugin cpgrs.pd generated by faust2pd based on cpgrs.dsp in Fig.15.
\includegraphics[width=\twidth]{eps/cpgrshelp}

To drive our MIDI synth, we need a source of MIDI data. Perhaps the simplest resource for this purpose is the Virtual Keyboard (vkeybd), which is standard in Red Hat Fedora, and in the planetccrma-menus at ``Applications / Planet CCRMA / MIDI / Vkeybd''). Figure 17 shows a screen shot of the Virtual Keyboard with its key-range and velocity controllers displayed (menu item ``View / Key/Velocity''). The velocity controller sets the gain parameter, mapping MIDI velocity (0-127) to the unit interval (0-1). The key-range controller transposes the keyboard by octaves. Pressing a key determines, together with the key-range, the freq parameter in our synth. Pressing a key also sets the gate parameter to 1, and releasing it sets gate to 0. The ADSR envelope is triggered when gate transitions to 1, and it begins its ``release'' phase when gate transitions to 0, as is standard for ADSR envelopes triggered by a keyboard. Note that the bottom two rows of ASCII keyboard keys are mapped to virtual-keyboard keys, enabling the playing of chords in real time on the regular computer keyboard.

Figure 17: The Virtual Keyboard (MIDI source).
\includegraphics[width=4in]{eps/vkeybd}

Figure 18 illustrates the MIDI tab of qjackctl's Connect window after connecting the Virtual Keyboard MIDI output to pd's MIDI input.23

Figure 18: JACK MIDI connections routing MIDI from the Virtual Keyboard (vkeybd) to pd's first MIDI input port.
\includegraphics[width=4in]{eps/jackmidiconnect}

To play back a MIDI file (extension .mid), a nice way is to open it in Rosegarden (``Applications / Planet CCRMA / Sequencers / Rosegarden'') and connect Rosegarden's MIDI output to pd's MIDI input as above. (You can still play along on the Virtual Keyboard.)


Next  |  Prev  |  Top  |  JOS Index  |  JOS Pubs  |  JOS Home  |  Search

Download aspf.pdf
[Comment on this page via email]

``Audio Signal Processing in Faust'', by Julius O. Smith III
Copyright © 2024-05-01 by Julius O. Smith III
Center for Computer Research in Music and Acoustics (CCRMA),   Stanford University
CCRMA