Synths
Jird can use Fluidsynth, Surge XT, and ZynAddSubFX to render music directly from the command line.
Specifying a synth
The –synth flag selects a synth to use (with a default patch). The possible choices are fluidsynth, zynaddsubfx, and surge_xt. For example running
$ jird --synth surge_xt
starts the interpreter using Surge XT for playback, and running
$ jird --synth zynaddsubfx music.txt
plays the music in music.txt with ZynAddSubFX.
Specifying an instrument
We can specify a patch with the -i flag. The corresponding synth is inferred from the patch filename. For example running
$ jird -i ~/surge/resources/data/patches_factory/Polysynths/Oiro.fxp
will start the interpreter using Surge XT with the Oiro patch for playback. To play music in music.txt with this patch we can run
$ jird -i ~/surge/resources/data/patches_factory/Polysynths/Oiro.fxp music.txt
The Surge repo containing the patches can be found on github.
To use Zyn, we can run for example
$ jird -i /usr/share/zynaddsubfx/banks/the_mysterious_bank/0031-wah_sine.xiz
The Zyn patches may be found in /usr/share/zynaddsubfx/banks if you have ZynAddSubFX installed. If not they can be found in the ZynAddSubFX instruments repo.
Using a config
More detailed synth configuration is done with a config file described below. Given a config in config.json and music in music.txt, the music can be played by running
$ jird -c config.json music.txt
The config allows specifying a different instrument for each jird part, as well as setting overall parameters like the basic time and frequency. For example, here is an example config with two parts:
{
"t": 0.63,
"f": 440.0,
"synth": "surge_xt",
"parts": [
{
"instrument": "~/surge/resources/data/patches_factory/Polysynths/Oiro.fxp",
"volume": -8.25,
"panning": 0.5
},
{
"instrument": "~/surge/resources/data/patches_factory/Polysynths/Boss.fxp",
"volume": -7.0,
"panning": -0.5
}
]
}
With this config, one beat lasts 0.63 seconds, the frequency ratio 1/1 sounds at 440Hz, and Surge XT is used for playback. The parts list contains patches, volume, and panning to use for the two parts (semicolon separated jird music).
Config fields
All config fields are described below.
- class Config[source]
Overall config controlling jird.
- t
Basic time in seconds. Real note durations are the jird duration multiplied by this basic time. For example the note 1:1 will have duration t when played back.
- Type:
float
- f
Basic frequency in Hz. Real note frequencies are the jird note frequency multiplied by this basic frequency. For example the note 1:1 will have frequency f when played back.
- Type:
float
- tuning_method
Method to use for tuning midi notes to the desired frequency. Choices are PITCH_BEND, which sends a pitch bend before each midi note to adjust its frequency, and SCALA, which uses Scala scl and kbm files to map each midi note onto its frequency.
- Type:
TuningMethod
- synth
Synth to use for playback. Choices are FLUIDSYNTH, ZYNADDSUBFX, and SURGE_XT.
- Type:
Synth
- volume
Overall volume for playback. Interpretation varies by synth; typical values are given in the example configs for each synth.
- Type:
float
- pitch_bend_range
Midi pitch bend range, in semitones, to assume when calculating bends. Defaults to two.
- Type:
int
- edo
If specified, music is tempered using edo equal divisions of the octave.
- Type:
int, optional
- sample_rate
Sample rate to use when rendering audio. Defaults to 44100
- Type:
int
- soundfont
Path of soundfont to use when using fluidsynth.
- Type:
Path, optional
- verbose
Whether to show logs and subprocess output. Defaults to False.
- Type:
bool
- parts
Part-specific config for each jird part. See PartConfig for details.
- Type:
list of PartConfig
- class PartConfig[source]
Config for each jird part.
- volume
Volume for this part.
- Type:
float
- panning
Pan (position left/right in stereo image) for this part.
- Type:
int
- instrument
Path to instrument patch to use for this part. For ZynAddSubFX this is an xiz file. For Surge XT this is an fxp file. Not used by fluidsynth.
- Type:
Path, optional
- program
Midi program to use for this part. Used with fluidsynth to specify which instrument in the soundfont to use.
- Type:
int, optional