Skip to content

api.playBeat() / api.playNote() produce no audible output despite isReadyForPlayback === true #2699

@Buronn

Description

@Buronn

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

Calling api.playBeat(beat) or api.playNote(note) silently fails to produce audio, even though:

  • api.isReadyForPlayback is true
  • api.playerState is Paused (0)
  • The SoundFont has loaded (soundFontLoaded fired)
  • Transport playback via api.play() / api.playPause() works correctly on the same API instance with the same SoundFont
    and score
  • No exception is thrown by playBeat/playNote
  • The alphaSynth.playOneTimeMidiFile message reaches the synth worker (verified via the postMessage path)

The worker output emits no samples. Reproduces on both player.outputMode = WebAudioAudioWorklets (default) and
WebAudioScriptProcessor.

Additional bug found while debugging: AlphaSynthWebWorkerApi.loadedMidiInfo getter is self-referential:

  get loadedMidiInfo() {
      return this.loadedMidiInfo; // infinite recursion
  }

This causes RangeError: Maximum call stack size exceeded whenever the API-side midiLoaded EventEmitterOfT is subscribed after a midi has been loaded — because its fireOnRegister callback reads this._player.loadedMidiInfo. The getter should return this._loadedMidiInfo`.

Expected Behavior

  • api.playBeat(beat) reproduces the beat's notes through the active SoundFont preset for the track that owns the beat, identical to what transport playback would emit if the cursor were positioned at that beat.
  • api.loadedMidiInfo returns the cached PositionChangedEventArgs without recursion, so midiLoaded.on(...)
    registrations succeed after the first midi load.

Steps To Reproduce

  1. Create AlphaTabApi instance with player.enablePlayer = true and a valid SoundFont URL.
  2. Load a score (any .gp/.gp5 import, or a manually built Score).
  3. Wait for readyForPlayback event.
  4. Confirm transport: api.play() — audio is audible. Pause/stop.
  5. Call api.playBeat(api.score.tracks[0].staves[0].bars[0].voices[0].beats[0]).
  6. Observed: no audio output. Expected: audio of the beat.

Link to jsFiddle, CodePen, Project

No response

Version and Environment

- @coderline/alphatab 1.8.2 (npm)
- Bundled via Vite 5 in a React 18.3 app, ESM build (alphaTab.core.mjs)
- Self-hosted SoundFonts (tested with GeneralUser-GS.sf2, FluidR3Mono_GM.sf3, MS_Basic.sf3, and the alphaTab CDN
  Sonivox)
- Same-origin asset serving (no CORS issues)
- Player settings: enablePlayer: true, enableCursor: true, enableUserInteraction: true, scrollMode: 'Continuous'

Platform

Web

Anything else?

No response

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions