class Haematite::Synthesizer
- Haematite::Synthesizer
- Reference
- Object
Overview
A SoundFont synthesizer.
Note that this class does not provide thread safety. If you wish to send notes and render the waveform in separate threads, you must ensure that the related methods/functions will not be called simultaneously.
Included Modules
Defined in:
haematite/synthesizer.crConstant Summary
-
CHANNEL_COUNT =
16
-
The number of MIDI channels.
-
PERCUSSION_CHANNEL =
9
-
The default channel for percussion.
Constructors
-
.new(sf : String | Path, settings : SynthesizerSettings)
Creates a new
Synthesizer
instance by loading a SoundFont from the given path. -
.new(soundFont : SoundFont, sampleRate : Int32)
Creates a new
Synthesizer
instance that will use the givenSoundFont
. -
.new(soundFont : SoundFont, settings : SynthesizerSettings)
Creates a new
Synthesizer
instance that will use the givenSoundFont
.
Instance Method Summary
- #activeChannels : BitArray
-
#activeVoiceCount : Int32
The number of active voices.
-
#applySettings(settings : SynthesizerSettings)
Applies a new set of settings to this
Synthesizer
instance. -
#blockSize : Int32
The size of rendered blocks of audio, in bytes.
-
#bypassChorus : Bool
When both this is false and
#enableChorus
is true, a chorus effect will be mixed into the output audio. -
#bypassChorus=(bypassChorus : Bool)
When both this is false and
#enableChorus
is true, a chorus effect will be mixed into the output audio. -
#bypassReverb : Bool
When both this is false and
#enableReverb
is true, a reverb effect will be mixed into the output audio. -
#bypassReverb=(bypassReverb : Bool)
When both this is false and
#enableReverb
is true, a reverb effect will be mixed into the output audio. -
#chanFilterMode : FilterMode
The type of lowpass filter to use.
-
#channels : Array(AudChannel)
The set of MIDI channels.
- #chorus : RemiAudio::DSP::HeraChorus
-
#chorusInterpolation : RemiAudio::Interpolate::Mode
The interpolation mode to use for the chorus.
-
#chorusSend : UInt8
Overrides the initial chorus level on all channels.
-
#enableChorus : Bool
When true, a chorus effect will be mixed into the output audio.
-
#enablePresetRemapping : Bool
When enabled, presets that are not found are re-mapped to a preset with the same number in the default bank (0).
-
#enableReverb : Bool
When true, a reverb effect will be mixed into the output audio.
-
#enableSoftClipping : Bool
When true, output from the synthesizer will have soft clipping applied to it.
-
#enableStereoEnhancer : Bool
When true, a stereo enhancement effect will be applied to the output audio.
-
#instrumentChorus : Int16 | Nil
Overrides the chorus level on all instruments/presets by setting the appropriate generator parameter.
-
#instrumentReverb : Int16 | Nil
Overrides the reverb level on all instruments/presets by setting the appropriate generator parameter.
-
#mainVolume : Float64
The output volume.
-
#mainVolume=(mainVolume : Float64)
The output volume.
-
#maximumPolyphony : Int32
The maximum number of concurrently playing voices.
-
#minimumVoiceDuration : Int32
The minimum length for a voice.
-
#noteOff(channel : Int32, key : Int32)
Releases the given note on a given channel.
-
#noteOffAll(channel : Int32, immediate : Bool)
Releases all notes on the given channel.
-
#noteOffAll(immediate : Bool)
Releases all notes on all channels.
-
#noteOn(channel : Int32, key : Int32, velocity : Int32)
Starts playing a note with the given velocity on the given channel.
-
#processMidiMessage(channel : Int32, command : Int32, data1 : Int32, data2 : Int32)
Processes a single MIDI message.
-
#render(left : Slice(Float64), right : Slice(Float64)) : Bool
Renders audio to
left
andright
. -
#reset
Resets the synthesizer.
-
#resetAllControllers(channel : Int32)
Resets all MIDI controller values on the given channel.
-
#resetAllControllers
Resets all MIDI controller values on all channels.
- #reverb : RemiAudio::DSP::Reverb
-
#reverbSend : UInt8
Overrides the initial reverb level on all channels.
-
#sampleRate : Int32
The output sample rate.
-
#settings : SynthesizerSettings | Nil
The last set of settings loaded into this synthesizer, or
nil
if no settings have been applied. -
#soundFont : SoundFont | Nil
The SoundFont loaded into the synthesizer.
-
#soundFont? : SoundFont | Nil | Nil
The SoundFont loaded into the synthesizer.
-
#stereoEnhancement : Float64
The amount of stereo enhancement to apply when the stereo enhancer effect is enabled.
-
#voiceFilterMode : FilterMode
The type of lowpass filter to use for voices.
Instance methods inherited from module Haematite::AudioRenderer
render(dest : Array(Float64) | Slice(Float64), pool : RemiLib::ArrayPool(Float64)) : Boolrender(dest : Array(Float32) | Slice(Float32), pool : RemiLib::ArrayPool(Float64)) : Bool
render(left : Slice(Float64), right : Slice(Float64)) : Bool
render(dest : Array(Float64) | Slice(Float64) | Array(Float32) | Slice(Float32)) : Bool render
Constructor Detail
Creates a new Synthesizer
instance by loading a SoundFont from the given
path.
Instance Method Detail
Applies a new set of settings to this Synthesizer
instance.
The size of rendered blocks of audio, in bytes.
This is set when the instance is created via a SynthesizerSettings
instance.
When both this is false and #enableChorus
is true, a chorus effect will
be mixed into the output audio.
Unlike #enableChorus
, this one is meant as a temporary switch. The
chorus unit will continue to process information even when this is turned
off, but will simply not be mixed into the output.
When both this is false and #enableChorus
is true, a chorus effect will
be mixed into the output audio.
Unlike #enableChorus
, this one is meant as a temporary switch. The
chorus unit will continue to process information even when this is turned
off, but will simply not be mixed into the output.
When both this is false and #enableReverb
is true, a reverb effect will
be mixed into the output audio.
Unlike #enableReverb
, this one is meant as a temporary switch. The
reverb unit will continue to process information even when this is turned
off, but will simply not be mixed into the output.
When both this is false and #enableReverb
is true, a reverb effect will
be mixed into the output audio.
Unlike #enableReverb
, this one is meant as a temporary switch. The
reverb unit will continue to process information even when this is turned
off, but will simply not be mixed into the output.
The type of lowpass filter to use. That is, the filter that gets applied according to MIDI controller 74/71 when outputting a voice.
This is set when the instance is created via a SynthesizerSettings
instance.
The interpolation mode to use for the chorus.
This is set when the instance is created via a SynthesizerSettings
instance.
Overrides the initial chorus level on all channels. Later MIDI events may still change the chorus. This does not affect the reverb settings for the instruments themselves.
This is set when the instance is created via a SynthesizerSettings
instance.
When true, a chorus effect will be mixed into the output audio.
This is set when the instance is created via a SynthesizerSettings
instance.
When enabled, presets that are not found are re-mapped to a preset with the same number in the default bank (0).
This is mainly intended for MIDI files that use non-standard bank numbers for General MIDI instruments. For example, the Roland JV-1010 uses bank 10371 for General MIDI patches.
This is set when the instance is created via a SynthesizerSettings
instance.
When true, a reverb effect will be mixed into the output audio.
This is set when the instance is created via a SynthesizerSettings
instance.
When true, output from the synthesizer will have soft clipping applied to it.
This is set when the instance is created via a SynthesizerSettings
instance.
When true, a stereo enhancement effect will be applied to the output audio.
This is set when the instance is created via a SynthesizerSettings
instance.
Overrides the chorus level on all instruments/presets by setting the appropriate generator parameter.
This is set when the instance is created via a SynthesizerSettings
instance.
Overrides the reverb level on all instruments/presets by setting the appropriate generator parameter.
This is set when the instance is created via a SynthesizerSettings
instance.
The maximum number of concurrently playing voices.
This is set when the instance is created via a SynthesizerSettings
instance.
Releases all notes on the given channel. If immediate
is true
, then
they are immediately stopped. Otherwise, the voices are allowed to go
through their release cycles.
Releases all notes on all channels. If immediate
is true
, then they
are immediately stopped. Otherwise, the voices are allowed to go through
their release cycles.
Starts playing a note with the given velocity on the given channel.
Processes a single MIDI message.
Renders audio to left
and right
. This returns true
if the song is
not finished, or if the sequencer is set to loop. Otherwise this returns
false
when the song is finished and there is nothing left to render.
Overrides the initial reverb level on all channels. Later MIDI events may still change the reverb. This does not affect the reverb settings for the instruments themselves.
This is set when the instance is created via a SynthesizerSettings
instance.
The output sample rate.
This is set when the instance is created via a SynthesizerSettings
instance.
The last set of settings loaded into this synthesizer, or nil
if no
settings have been applied.
The amount of stereo enhancement to apply when the stereo enhancer effect is enabled.
This is set when the instance is created via a SynthesizerSettings
instance.
The type of lowpass filter to use for voices. That is, the filter that gets applied according to the SoundFont specification when rendering a voice.
This is set when the instance is created via a SynthesizerSettings
instance.