alphaTab.synth.IAlphaSynth
The public API interface for interacting with the synthesizer.
interface IAlphaSynthProperties​
countInVolume​
Gets or sets volume of the metronome during count-in. (range: 0.0-3.0, default 0.0 - no count in)
- JavaScript
- C#
- Kotlin
countInVolume: number;double CountInVolume { get; set; }var countInVolume: DoublecurrentPosition​
The latest time information of the played song.
- JavaScript
- C#
- Kotlin
readonly currentPosition: PositionChangedEventArgs;PositionChangedEventArgs CurrentPosition { get; }val currentPosition: PositionChangedEventArgsisLooping​
Gets or sets whether the playback should automatically restart after it finished.
- JavaScript
- C#
- Kotlin
isLooping: boolean;bool IsLooping { get; set; }var isLooping: BooleanisReady​
Gets or sets whether the synthesizer is ready for interaction. (output and worker are initialized)
- JavaScript
- C#
- Kotlin
readonly isReady: boolean;bool IsReady { get; }val isReady: BooleanisReadyForPlayback​
Gets or sets whether the synthesizer is ready for playback. (output, worker are initialized, soundfont and midi are loaded)
- JavaScript
- C#
- Kotlin
readonly isReadyForPlayback: boolean;bool IsReadyForPlayback { get; }val isReadyForPlayback: BooleanloadedMidiInfo​
The information about the main song loaded (does not account for "one time midis" or "count in").
- JavaScript
- C#
- Kotlin
readonly loadedMidiInfo?: PositionChangedEventArgs;PositionChangedEventArgs LoadedMidiInfo { get; }val loadedMidiInfo: PositionChangedEventArgslogLevel​
Gets or sets the loging level.
masterVolume​
Gets or sets the current master volume as percentage. (range: 0.0-3.0, default 1.0)
- JavaScript
- C#
- Kotlin
masterVolume: number;double MasterVolume { get; set; }var masterVolume: DoublemetronomeVolume​
Gets or sets the metronome volume. (range: 0.0-3.0, default 0.0)
- JavaScript
- C#
- Kotlin
metronomeVolume: number;double MetronomeVolume { get; set; }var metronomeVolume: DoublemidiEventsPlayedFilter​
Gets or sets the midi events which will trigger the midiEventsPlayed event.
- JavaScript
- C#
- Kotlin
midiEventsPlayedFilter: MidiEventType[];IList<MidiEventType> MidiEventsPlayedFilter { get; set; }var midiEventsPlayedFilter: alphaTab.collections.List<MidiEventType>output​
Gets the output used by alphaSynth.
- JavaScript
- C#
- Kotlin
playbackRange​
Gets or sets the range of the song that should be played. Set this to null to play the whole song.
- JavaScript
- C#
- Kotlin
playbackRange: PlaybackRange | null;PlaybackRange? PlaybackRange { get; set; }var playbackRange: PlaybackRange?playbackSpeed​
Gets or sets the current playback speed as percentage. (range: 0.125-8.0, default: 1.0)
- JavaScript
- C#
- Kotlin
playbackSpeed: number;double PlaybackSpeed { get; set; }var playbackSpeed: Doubleready​
This event is fired when the player is ready to be interacted with.
- JavaScript
- C#
- Kotlin
readyForPlayback​
This event is fired when all required data for playback is loaded and ready.
- JavaScript
- C#
- Kotlin
readonly readyForPlayback: IEventEmitter;IEventEmitter ReadyForPlayback { get; }val readyForPlayback: IEventEmitterstate​
Gets the current player state.
- JavaScript
- C#
- Kotlin
tickPosition​
Gets or sets the position within the song in midi ticks.
- JavaScript
- C#
- Kotlin
tickPosition: number;double TickPosition { get; set; }var tickPosition: DoubletimePosition​
Gets or sets the position within the song in milliseconds.
- JavaScript
- C#
- Kotlin
timePosition: number;double TimePosition { get; set; }var timePosition: DoubleMethods​
applyTranspositionPitches​
Applies the given transposition pitches to be used during playback.
- JavaScript
- C#
- Kotlin
applyTranspositionPitches(transpositionPitches: Map<number, number>): voidvoid ApplyTranspositionPitches(Map<double, double> transpositionPitches)fun applyTranspositionPitches(transpositionPitches: alphaTab.collections.DoubleDoubleMap<Double, Double>): Unit| Parameter | Summary |
|---|---|
transpositionPitchesAll | a map defining the transposition pitches for midi channel. |
destroy​
Destroys the synthesizer and all related components
- JavaScript
- C#
- Kotlin
destroy(): voidvoid Destroy()fun destroy(): UnitloadBackingTrack​
Loads the synchronization information from the given score (used for backing tracks and external media).
| Parameter | Summary |
|---|---|
scoreAll | (no description) |
loadMidiFile​
Loads the given midi file structure.
| Parameter | Summary |
|---|---|
midiAll | (no description) |
loadSoundFont​
Loads a soundfont from the given data
- JavaScript
- C#
- Kotlin
loadSoundFont(data: Uint8Array, append: boolean): voidvoid LoadSoundFont(Uint8Array data, bool append)fun loadSoundFont(data: Uint8Array, append: Boolean): Unit| Parameter | Summary |
|---|---|
dataAll | a byte array to load the data from |
appendAll | Whether to fully replace or append the data from the given soundfont. |
pause​
Pauses the playback if was running
- JavaScript
- C#
- Kotlin
pause(): voidvoid Pause()fun pause(): Unitplay​
Starts the playback if possible
- JavaScript
- C#
- Kotlin
play(): booleanbool Play()fun play(): BooleanReturns​
true if the playback was started, otherwise false. Reasons for not starting can be that the player is not ready or already playing.
playOneTimeMidiFile​
Stops any ongoing playback and plays the given midi file instead.
| Parameter | Summary |
|---|---|
midiAll | The midi file to play |
playPause​
Starts the playback if possible, pauses the playback if was running
- JavaScript
- C#
- Kotlin
playPause(): voidvoid PlayPause()fun playPause(): UnitresetChannelStates​
Resets the mute/solo state of all channels
- JavaScript
- C#
- Kotlin
resetChannelStates(): voidvoid ResetChannelStates()fun resetChannelStates(): UnitresetSoundFonts​
Resets all loaded soundfonts as if they were not loaded.
- JavaScript
- C#
- Kotlin
resetSoundFonts(): voidvoid ResetSoundFonts()fun resetSoundFonts(): UnitsetChannelMute​
Sets the mute state of a channel.
- JavaScript
- C#
- Kotlin
setChannelMute(channel: number, mute: boolean): voidvoid SetChannelMute(double channel, bool mute)fun setChannelMute(channel: Double, mute: Boolean): Unit| Parameter | Summary |
|---|---|
channelAll | The channel number |
muteAll | true if the channel should be muted, otherwise false. |
setChannelSolo​
Gets the solo state of a channel.
- JavaScript
- C#
- Kotlin
setChannelSolo(channel: number, solo: boolean): voidvoid SetChannelSolo(double channel, bool solo)fun setChannelSolo(channel: Double, solo: Boolean): Unit| Parameter | Summary |
|---|---|
channelAll | The channel number |
soloAll | true if the channel should be played solo, otherwise false. |
setChannelTranspositionPitch​
Sets the transposition pitch of a given channel. This pitch is additionally applied beside the
ones applied already via applyTranspositionPitches .
- JavaScript
- C#
- Kotlin
setChannelTranspositionPitch(channel: number, semitones: number): voidvoid SetChannelTranspositionPitch(double channel, double semitones)fun setChannelTranspositionPitch(channel: Double, semitones: Double): Unit| Parameter | Summary |
|---|---|
channelAll | The channel number |
semitonesAll | The number of semitones to apply as pitch offset. |
setChannelVolume​
Gets or sets the current and initial volume of the given channel.
- JavaScript
- C#
- Kotlin
setChannelVolume(channel: number, volume: number): voidvoid SetChannelVolume(double channel, double volume)fun setChannelVolume(channel: Double, volume: Double): Unit| Parameter | Summary |
|---|---|
channelAll | The channel number. |
volumeAll | The volume of of the channel (0.0-1.0) |
stop​
Stopps the playback
- JavaScript
- C#
- Kotlin
stop(): voidvoid Stop()fun stop(): UnitupdateSyncPoints​
Updates the points used to synchronize the backing track with the synthesized audio for correct cursor placement.
- JavaScript
- C#
- Kotlin
updateSyncPoints(syncPoints: BackingTrackSyncPoint[]): voidvoid UpdateSyncPoints(IList<BackingTrackSyncPoint> syncPoints)fun updateSyncPoints(syncPoints: alphaTab.collections.List<BackingTrackSyncPoint>): Unit| Parameter | Summary |
|---|---|
syncPointsAll | (no description) |
Events​
finished​
This event is fired when the playback of the whole song finished.
This event is fired when the playback of the whole song finished.
- JavaScript
- C#
- Kotlin
midiEventsPlayed​
The event is fired when certain midi events were sent to the audio output device for playback.
The event is fired when certain midi events were sent to the audio output device for playback.
- JavaScript
- C#
- Kotlin
readonly midiEventsPlayed: IEventEmitterOfT<MidiEventsPlayedEventArgs>;IEventEmitterOfT<MidiEventsPlayedEventArgs> MidiEventsPlayed { get; }val midiEventsPlayed: IEventEmitterOfT<MidiEventsPlayedEventArgs>midiLoaded​
This event is fired when the Midi file needed for playback was loaded.
This event is fired when the Midi file needed for playback was loaded.
- JavaScript
- C#
- Kotlin
readonly midiLoaded: IEventEmitterOfT<PositionChangedEventArgs>;IEventEmitterOfT<PositionChangedEventArgs> MidiLoaded { get; }val midiLoaded: IEventEmitterOfT<PositionChangedEventArgs>midiLoadFailed​
This event is fired when the loading of the Midi file failed.
This event is fired when the loading of the Midi file failed.
- JavaScript
- C#
- Kotlin
readonly midiLoadFailed: IEventEmitterOfT<Error>;IEventEmitterOfT<System.Exception> MidiLoadFailed { get; }val midiLoadFailed: IEventEmitterOfT<kotlin.Throwable>playbackRangeChanged​
The event is fired when the playback range within the player was updated.
The event is fired when the playback range within the player was updated.
- JavaScript
- C#
- Kotlin
readonly playbackRangeChanged: IEventEmitterOfT<PlaybackRangeChangedEventArgs>;IEventEmitterOfT<PlaybackRangeChangedEventArgs> PlaybackRangeChanged { get; }val playbackRangeChanged: IEventEmitterOfT<PlaybackRangeChangedEventArgs>positionChanged​
This event is fired when the current playback position of/ the song changed.
This event is fired when the current playback position of/ the song changed.
- JavaScript
- C#
- Kotlin
readonly positionChanged: IEventEmitterOfT<PositionChangedEventArgs>;IEventEmitterOfT<PositionChangedEventArgs> PositionChanged { get; }val positionChanged: IEventEmitterOfT<PositionChangedEventArgs>soundFontLoaded​
This event is fired when the SoundFont needed for playback was loaded.
This event is fired when the SoundFont needed for playback was loaded.
- JavaScript
- C#
- Kotlin
readonly soundFontLoaded: IEventEmitter;IEventEmitter SoundFontLoaded { get; }val soundFontLoaded: IEventEmittersoundFontLoadFailed​
This event is fired when the loading of the SoundFont failed.
This event is fired when the loading of the SoundFont failed.
- JavaScript
- C#
- Kotlin
readonly soundFontLoadFailed: IEventEmitterOfT<Error>;IEventEmitterOfT<System.Exception> SoundFontLoadFailed { get; }val soundFontLoadFailed: IEventEmitterOfT<kotlin.Throwable>stateChanged​
This event is fired when the playback state changed.
This event is fired when the playback state changed.
- JavaScript
- C#
- Kotlin
readonly stateChanged: IEventEmitterOfT<PlayerStateChangedEventArgs>;IEventEmitterOfT<PlayerStateChangedEventArgs> StateChanged { get; }val stateChanged: IEventEmitterOfT<PlayerStateChangedEventArgs>