early draft version, Stefan Nitschke 18.06.1999
 

RTSynth  v1.6.2

A midi event triggered real time software synthesizer.
 

Index

News
Midi Events
Main Panel
String Synth
Flute Synth
Audio Effects
 

RTSynth supports a polyphonic string synth, a monophonic flute synth and a set of audio effects. It should run on any machine with a CPU/FPU performance comparable to a pentium 90 or higher. Any faster machine is welcome and will allow more complex sounds, audio effects and/or a higher number of independent voices. I hopefully did a good job in runtime optimization of the code but anyway, as with all real time applications, there is never a too fast machine. Internally all sound operations use 32 bit floating point numbers to give lowest distortion and highest possible dynamic range. RTSynth is currently developed on a Cyrix 6x86-166 (seems to be comparable to a pentium 90!) based machine running Linux v2.0.33, egcs 1.1 and glibc2.
 

To perform well, RTSynth should be set to userid root with `chown root RTSynth; chmod +s  RTSynth`. This will allow RTSynth to use the real time scheduler for best run time behaviour. After getting the scheduler RTSynth is setting back its root priority to the normal users one.
 

To make the choice of the MIDI input source as flexible as possible, RTSynth can read midi events from a input stream. This can be a device, a pipe (stdin) or a named pipe (fifo).

Possible command line invocations:

   RTSynth                                 normal execution. Reading midi events from /dev/midi00.

 output options:

   RTSynth  --output=/dev/mydev
   or
   RTSynth  -o /dev/mydev   use the given audio output device (must be a OSS /dev/dsp compatible device).

 input source:
 

   RTSynth --input=/dev/midi
 
   RTSynth -i /dev/midi
   or
   RTSynth </dev/mymidi    to read from a given midi device
 
   RTSynth <fifo
 
   cat  foo  | RTSynth               to read midi events form a fifo or pipe.
 
 

I have tried to use EsounD as an alternative audio output destination, but the current version of esound does not support real time audio. To be more detailed, the audio stream esound opens for RTSynth to write to does not offer a constant rate of samples per second like the /dev/dsp device. Maybe ALSA will become the future of audio and midi subsystems for Linux, but I did not take a closer look on it so far, maybe when upgrading to linux 2.2 ...

If you don´t have a midi keyboard (like I am) or any other external midi equipment, you can use clavier to put you computer keyboard into a midi one. The necessary command lines to connect clavier with RTSynth would look like:

   mkfifo   /tmp/midififo
   RTSynth </tmp/midififo
   clavier -o /tmp/midififo

or you can use SoftWerk a cool software "analogue" sequencer to trigger RTSynth.
 
 

Known bugs: Overdriving the PM-resonator effect to hard may crash the effect. You have to restart RTSynth to get it work again. The flute synth may also crash when using some extreme settings. Loading of corrupt patch files may break down RTSynth completely.
 
 
 
 

News

Version 1.6.2

            BugFix: eliminated problems with reading from /dev/midi on linux 2.2.x based systems.

            Changed handling of midi NoteOff events -> eliminating possible multiple playing of the same note.

            Added new main-panel. You can now run several synth-/effect-modules and connect them together.

            Improved and scale-able reverb effect.

            Some minor bug fixes and runtime optimizations.
 
 

Version 1.6.0 is the first glibc based version. Advantages over the older 1.5.x versions are:

Midi Events

(back)
Midi events recognized by RTSynth so far:
 
 
 

Main Panel
(back)

With in the main panel you can:


Every Synth- and Effect-modul is represented by a tile:

You can set the midi channel and switch on/off a audio module directly from the tile by using the control elements shown in the picture.
Pressing the left mouse button on the audio output symbol and dropping it over the target tile will build a connection. Doing the same process between already connected modules removes the connection.
Left/right mouse button over the midi channel field decrements/increments the channel value.
Circular connections between modules are not allowed and will be rejected by the program.
Pressing the right mouse button opens a context menu.

Any module with a output that is not explicitly connected to another one is connected to the main output by default.
 

String Synth

(back)
as the name suggests this synth is mainly designed to produce string like sounds. But it is not limited to that. You can also use the string synth for example to produce a sinus wave sound or together with the resonance able low pass filter some cool synthetic sounds. It is a polyphonic synthesizer with up to 24 independent voices based on the so called `physical modelling synthesis´. Because the base algorithm does not have much to do with the physics of a real string instrument (the interaction between the string, the instrument corpus and the players fingers are much to complex to be calculated on a PC in real time), I call it the `energy dissipation model´. The maximum number of playable voices of course depends on the speed of your machine, synthesizer settings like filters and the number and type of activated audio effects.

To become familiar with the synthesizer settings you may try out some of the synth voices included in the archive. A small example starting with a synth produing a sine wave, as mentioned above, and then modifing it to went into a "SynthBass" sound is given here:

1. We want a clean sinus wave -> Wave ampl. = 1, Wave type = sin.
2. The sine wave should have a constant amplitude. This is meet by setting all damping parameters in the Energy dissipation panel to "no damping" -> frequency = 1, freq max = 1, filter follows note = no, feedback = 1, filter attack = 0, off-delay = 0. It is a little bit hard to set the feedback to a value of exact 1.00, soft damp. can help in do it for you by setting it to a value greater zero.
3. Normally a sinus sound needs no output filter but as you can hear on some notes there is some noticeable distortion. To reduce it we use the Output filter with filter follows note = lin, frequency = 1 (filter any frequency higher than the base octave), bessel, 12 dB. You may also use a small resonance value (0.1) to get a even sharper filtering.
4. Now, we want to apply a conventional amplitude envelope to the sinus wave to get a short percussive sound. The Output filter envelope can be used for that -> env mode = normal, env ampl. = 0 (we don't want a filter sweep), env speed = 1 (fastest attack), env sustain = 0 (no sustain at all), env release = 0.2 (short sound). And last but not least in the Output and note control panel the ampl-env must be activated.
5. We modify the sound now a little bit. For the wave type we choose an unfiltered rectangular wave (crect) an apply an output filter envelope by setting env ampl. to 1.4 and to make the sound a bit more interesting we apply a value of 0.3 to the output filter resonance. To apply note velocity to the filter sweep amplitude we switch the env mode to accent., to ampl. if we want the note volume to be independent from the note velocity, and to speed if our intention is to modulate the envelope speed by the note velocity. To have a sustained sound again we can switch the ampl-env off.
6. to produce a more string like sound we switch the output filter to off, the ampl-env to off. Set the Wave ampl. to 0.5, the Random filter frequency to 0.53, its filter follows note mode to "cool" and let Energy dissipation do the decay stuff by setting: frequency = 0.68, freq max = 0.89, filter order = 1, filter follows note = "cool". To have a slowly decayed sound off delay = 30, off-feedb. = 0.998 for example can be set.
7. now we switch the Output filter on again to have a some what different "SynthBass" sound than in Step 5.
 
 
 

The String Synth panels:
The string synth panel is subdivided into smaller panels sorted by functionality.
 
 

Energy dissipation

This together with Random Filter and Additional wave is the "heart" of the synthesizer. Here you can set the parameters for the time dependent behaviour of the oscillator like frequency dependent damping, cut off frequency ...

Random filter

The random filter is used to filter the noise source output and may also be used to filter the output of the additional wave. The filtered random noise together with an additional wave are used to initialize the oscillators starting wave form. The usage of a random noise amount to produce a wave form makes the sounds generated by the string synth quite different form the static sounds generated by sample based synthesizers. Like for a real string instrument the produced sound will never be exact the same even when playing the same note.

Additional wave

In addition to the noise source the output of the additional wave unit can be used to build the starting wave form. This panel includes a mixer for the balance between the random noise and the additional wave amplitude.

Output filter

Here the generated wave can be filtered by a resonance able low pass filter.

Output filter envelope

Settings for an output filter and/or amplitude envelope can be done here. Each String Synth voice has only one envelope generator but it can be used for output filter and amplitude modulation.

Output and note control

Sound volume, amplitude attack, decay, amplitude envelope and more can be set here.

(back)
 
 



Energy dissipation panel

 
frequency Cut off frequency used for frequency dependent energy dissipation (damping by successive low pass filtering). This one together with `feedback` give you basic control over the time dependent character of the generated sound. (short, sustained, ...)
freq. max Highest cut off frequency. A value of 1 is equal to infinite.
filter order Setting the damping rate of the energy dissipation low pass filter. 
order : 1 <=> 6 dB, 2 <=> 12 dB, ...
filter follows note no fixed filter frequency.
yes filter frequency follows note value. Higher note gives higher cut off frequency.
cool,usr1,usr2 filter follows note value non linear.
feedback Frequency independent energy loss. ( 1 = no damping )
soft damp Starting with the value given by `feedback`. Reduce damping until a feedback value of 1 is reached. If ´off delay´ is in use the ´off-feedb.´ value will be used after the ´off delay´ time has been reached. A value of zero means, disable "soft damping".
filter attack Attack time is given in number of periods. (´fixed time´ off). A value of zero means disable ´filter attack´. At the end of ´filter attack´ time the filter frequency value given by ´frequency´ is reached.
fixed time Interpret the number given in ´filter attack´ as a fixed length time, independent of the note value.
start freq The frequency of the energy dissipation filter used by the ´filter attack´ as the starting value.
off delay Time in periods until the ´feedback´ value is replaced by the ´off-feedb.´ value. A value of zero means, disable ´off-feedb.´.
off-feedb. Damping value used after the time given by ´off delay´ has been exceeded.

back
 
 

Random filter / Additional wave panels


 



 

frequency Cut off filter frequency used for the noise source and wave given by the Additional wave panel.
filter follows note For description take a look at Energy dissipation panel.
Wave ampl Mixer for the amplitudes of the wave given by ´Wave type´ and the filtered noise source. A value of zero means only noise and a value of 1 only wave as source.
Wave type The wave type. The choices "crect", "csaw" and "ctri" are the same as their counterparts without the leading "c" but will not go through the Random filter
"piano", "piano2", "metal" and "sawres" are a little bit more complex wave types and functions.

back
 

Output filter panel

 
frequency Cut off frequency of the low pass filter. This value can be altered in real time by the midi pitch bend.
resonance Amount of filter resonance.
filter type critical critical filter characteristics.
bessel filter with Bessel characteristics.
butterw    "        "    Butterworth   "
tscheby    "        "    Tschebyscheff  "
tscheb3 ditto with 3 dB cut off resonance.
NOTE: The filter types are only correct for filters without resonance.
filter order off filter off.
6, 12 , 24 dB Low pass filter with the given damping.
+12, +24 dB Mix of filtered and unfiltered output.
 
filter follows note no filter frequency is fixed.
lin filter frequency follows note. A value of 1 means same octave as the played note, value = 2 one octave higher ... NOTE: This values are only approximate.
usr filter frequency follows note value non linear.
 

back
 
 

Output filter envelope panel

 
env mode off no filler/amplitude envelope. (saves lots of CPU time)
normal envelope speed and amplitude are independent from note velocity.
accent envelope amplitude depends on note velocity.
acc.inv ditto but with inverse dependency.
ampl. like accent but the note velocity only affects the envelope not the volume of the played note itself.
a. inv ditto but with inverse dependency.
speed like ampl. but now the envelope speed depends on the note velocity, note volume is constant.
s. inv ditto but with inverse dependency.
 
env ampl The amplitude of the envelope. Setting this value to zero will disable the filter envelope but has no influence to the amplitude envelope behaviour.
env speed The attack speed of the envelope. A value of 1 means no attack phase.
env sustain The sustain time of the envelope.
env release The release speed of the envelope.

back

Output and note control panel


 



 
 
 
 
 

volume The amplitude of the played sound.
mute  
attack The attack time of the amplitude envelope. A value of zero means no amplitude attack.
release The release time of the sound after receiving the `midi note off` event.
silence The number of "silence" played periods of the sound. Will normally give a more soft attack sound.
LFO freq. The frequency of the amplitude envelope LFO.
LFO ampl. The amplitude of the LFO. A value of zero disables the LFO.
dc-filter A filter to reduce the DC part of the generated sound. Normally not needed.
ampl-env When set, the "Output filter envelope" can also be used as a input for the amplitude envelope.
modulation Some kind of modulation applied to the sound.
bass boost This will boost the amplitude of low frequency notes.

back


 














Flute Synth

(back)
This is a monophonic synth. It implements the ´base clarinet´ and the ´base flute´ algorithms with some small extensions and modifications. At the moment I am not very happy with this synthesizer. The tuning is not perfect and the synth doesn't seem to be 100% stable when using some unconventional settings (for example a very large bore and high feedback values). Anyway it can be used to generate some cool sounds and of course it can be mixed with the String Synth.
 
 

Oscillator settings

Breath

Pressure - tremolo

Output filter

Output control
 
 
 
 
 

Audio Effects

(back)
RTSynth has seven hard wired audio effect units.

Effects in order of their connection:

Distortion

The distortion effect has a soft mode, emulation of a tube like distortion, and a normal mode for a transistor like distortion.

Universal filter

This universal filter can be used as a LP, HP or BP filter. The filter order can be set from 6 dB to 24 dB. It also supports a simple filter sweep function.

PM resonator

The PM resonator effect can also be used as a delay/echo. Very well to produce some electronically effects. With high values of ` feed´ and ´intensity´ the PM resonator may self oscillate. Be aware this effect may add non harmonic components to a sound.

Resonator

A bank of five band pass filters acting like a equalizer. Setting a filter to a value of zero disables this filter and there for saves CPU time.

Chorus

The well known chorus effect.

Reverb

A simple reverb effect. In stereo mode two reverbs, one for each channel, can be mixed to give a more complex effect.

Delay

The delay effect can operate in stereo mode to give a ping-pong like effect.
 
 

(back)