Skip to content

Preview and Playback

abcls provides a live preview that renders ABC notation as sheet music using the abcjs library. The preview updates in real time as you edit the document.

The preview opens as a side panel in VS Code. Use the command palette or the editor title bar button to toggle it. The panel shows the rendered notation and updates on every keystroke.

The Kakoune preview opens in a web browser. The plugin starts a local preview server and connects to it via WebSocket so that changes are pushed to the browser in real time.

Commands:

  • abc-preview-open — opens the browser preview for the current buffer
  • abc-preview-close — closes the preview for the current buffer
  • abc-preview-shutdown — shuts down the preview server entirely

When the preview is open, cursor position updates are sent to the browser so that the current note is highlighted in the rendered score.

The preview hooks into NormalIdle and InsertIdle so that cursor tracking works in both normal and insert modes. When the buffer is closed, the preview is automatically stopped.

PRE-ALPHA, EXPERIMENTAL, BROKEN, WILL PROBABLY NEVER LAND.

There is an experimental playback solution in the native/ directory that relies on a hack involving abcls impersonating MuseScore to MuseScore’s playback engine (MuseSampler). Because there is no public API for MuseSampler and there likely never will be (see the MuseSampler API discussion), this feature is not part of the standard build and requires building from source. It is intended for experimentally-minded users only.

Both VS Code and Kakoune support MIDI export and import through the LSP:

  • Export: converts the current ABC document to a MIDI file
  • Import: converts a MIDI file to ABC notation

In Kakoune, use m (export) and M (import) in transform mode. In VS Code, use the command palette. From the CLI:

Terminal window
abcls abc2midi myfile.abc -o myfile.mid
abcls midi2abc myfile.mid -o myfile.abc