Expand description
This crate enables the construction of synthesizers with live MIDI input and sound synthesis using fundsp.
It is organized as follows:
- The crate root contains functions and data structures useful for constucting fundsp
sounds.
- MIDI input messages are
converted into
SharedMidiStateobjects that translate the sounds represented by those messages into fundspSharedatomic variables. SynthFuncfunctions translateSharedMidiStateobjects into specific fundsp audio graphs.
- MIDI input messages are
converted into
- The
iomodule contains functions and data types for obtaining messages from MIDI devices and playing
fundsp audio graphs through the computer’s speakers. - The
sound_buildersmodule contains functions that wrap fundsp audio graphs intoSynthFuncfunctions with a variety of properties. - The
soundsmodule containsSynthFuncfunctions that produce a variety of live sounds.
The following example programs show how these components interact to produce a working synthesizer:
basic_demo.rsopens the first MIDI device it finds and plays a simple triangle waveform sound in response to MIDI events.stereo_demo.rsalso opens the first MIDI device it finds. It plays notes below middle C through the left speaker using a Moog Pulse sound, and notes at Middle C or higher through the right speaker using a Moog Triangle sound.choice_demo.rsallows the user to choose one from among all connected MIDI devices. The user can then choose any sound from thesoundsmodule for the program’s response to MIDI events.
Modules§
Macros§
- program_
table - Convenience macro to build a
ProgramTable. Given a sequence of tuples of&strobjects andSynthFuncobjects, it returns a properProgramTable.
Structs§
- Shared
Midi State SharedMidiStateobjects represent as fundspSharedatomic variables the following MIDI events:- Sound
Test Result - When designing sounds, it can be useful to understand their typical output levels.
SoundTestResultobjects track the minimum, maximum, and mean output levels.
Constants§
- CONTROL_
OFF - Control value in response to
Note Offevent. - CONTROL_
ON - Control value in response to
Note Onevent. - DURATION
- Duration of test for
SoundTestResult. - MAX_
MIDI_ VALUE - MIDI values for pitch and velocity range from 0 to 127.
- NUM_
MIDI_ VALUES - Total quantity of distinct MIDI values.
- SAMPLE_
RATE - Sample rate of 44.1 kHz for use in
SoundTestResult.
Functions§
- pitch_
bend_ factor - Converts MIDI pitch-bend message to frequency multiplier over +/- 1 semitone using this algorithm.
- semitone_
from - Converts MIDI pitch-bend message to +/- 1 semitone using this algorithm.