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 (cpgrs-help.pd) is shown in Fig.19. 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.18.

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 6, and in the planetccrma-menus at ``Applications / Planet CCRMA / MIDI / Vkeybd''). Figure 20 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 20: The Virtual Keyboard (MIDI source).

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

Figure 21: JACK MIDI connections routing MIDI from the Virtual Keyboard (vkeybd) to pd's first MIDI input port.

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 © 2017-07-21 by Julius O. Smith III
Center for Computer Research in Music and Acoustics (CCRMA),   Stanford University