Skip to main content

alphaTab.synth.IAlphaSynth

Description

The public API interface for interacting with the synthesizer.

 interface IAlphaSynth

Properties

countInVolume

Gets or sets volume of the metronome during count-in. (range: 0.0-3.0, default 0.0 - no count in)

isLooping

Gets or sets whether the playback should automatically restart after it finished.

isReady

Gets or sets whether the synthesizer is ready for interaction. (output and worker are initialized)

isReadyForPlayback

Gets or sets whether the synthesizer is ready for playback. (output, worker are initialized, soundfont and midi are loaded)

logLevel

Gets or sets the loging level.

masterVolume

Gets or sets the current master volume as percentage. (range: 0.0-3.0, default 1.0)

metronomeVolume

Gets or sets the metronome volume. (range: 0.0-3.0, default 0.0)

midiEventsPlayedFilter

Gets or sets the midi events which will trigger the midiEventsPlayed event.

output

Gets the output used by alphaSynth.

playbackRange

Gets or sets the range of the song that should be played. Set this to null

playbackSpeed

Gets or sets the current playback speed as percentage. (range: 0.125-8.0, default: 1.0)

ready

This event is fired when the player is ready to be interacted with.

readyForPlayback

This event is fired when all required data for playback is loaded and ready.

state

Gets the current player state.

tickPosition

Gets or sets the position within the song in midi ticks.

timePosition

Gets or sets the position within the song in milliseconds.

Methods

applyTranspositionPitches(Map<number, number>)

Applies the given transposition pitches to be used during playback.

destroy()

Destroys the synthesizer and all related components

loadMidiFile(MidiFile)

Loads the given midi file structure.

loadSoundFont(Uint8Array, boolean)

Loads a soundfont from the given data

pause()

Pauses the playback if was running

play()

Starts the playback if possible

playOneTimeMidiFile(MidiFile)

Stops any ongoing playback and plays the given midi file instead.

playPause()

Starts the playback if possible, pauses the playback if was running

resetChannelStates()

Resets the mute/solo state of all channels

resetSoundFonts()

Resets all loaded soundfonts as if they were not loaded.

setChannelMute(number, boolean)

Sets the mute state of a channel.

setChannelSolo(number, boolean)

Gets the solo state of a channel.

setChannelTranspositionPitch(number, number)

Sets the transposition pitch of a given channel. This pitch is additionally applied beside the

setChannelVolume(number, number)

Gets or sets the current and initial volume of the given channel.

stop()

Stopps the playback

Events

finished

This event is fired when the playback of the whole song finished.

midiEventsPlayed

The event is fired when certain midi events were sent to the audio output device for playback.

midiLoaded

This event is fired when the Midi file needed for playback was loaded.

midiLoadFailed

This event is fired when the loading of the Midi file failed.

playbackRangeChanged

The event is fired when the playback range within the player was updated.

positionChanged

This event is fired when the current playback position of/ the song changed.

soundFontLoaded

This event is fired when the SoundFont needed for playback was loaded.

soundFontLoadFailed

This event is fired when the loading of the SoundFont failed.

stateChanged

This event is fired when the playback state changed.