Reading file markers

Hi guys,
I have a question about reading audio files in SuperCollider.

Formats such as AIFF and WAV have a Marker or Cue chunk, which can be used to store cue points in the file.

How can I access and use these markers in SC?
For example to create a synth with PlayBuf and use a marker as starting position for playback.

I don’t find anything in the documentation, and Google wasn’t helpful at all.

For context I’m trying to make a generative music video where SC controls video playback via OSC, and I figured that the easiest way to sync between sound and video files would be to use markers in the sound and video files.
The source material is enormous, tens of hours of video and sound, and I want to be able to use large parts of it in an efficient way. If someone has a better idea than using markers, I’m open to suggestions!

Thanks a lot, and great forum by the way!

1 Like

Sounds like a really interesting project.

If the cue point idea really is the only way to go, one solution would be to run shell commands, as you’ll find documented in the String methods. This way you could write a Python script that extracts each sound file’s cue point data, associates it with that file’s name, and then stores all of this data and returns it to SC. You could then time the playback of each sound and fire functions according to when playback time hits the associated cue point data.


Or you might not even have to return the Python scripts output straight to SC. You could just extract the cue point data and save it to JSON, then read from there in SC using the JSON quark.

That sounds like a good idea!
I will look into it, thanks!

Honestly, I’m not 100% sure markers is the best way to do what I want to do, but at least I haven’t come up with a better one :slight_smile:

1 Like

We currently don’t way to access cue info. However, the library we rely on for processing sound files (libsndfile) makes it easy to get and set cue information. It wouldn’t be a difficult task to add a few primitives to do so. If anyone is interested in helping out with that I can point you to the right files and documentation.


This addition to SoundFile can extract markers from WAV, AIFF, or any file type that contains embedded XMP.

IIRC you can’t get range markers in all cases, because they’re stored in a very strange way in the RIFF chunk.

Additionally: it should be easy to modify the XMP marker extraction to work on arbitrary files, including video files, that have markers.

@scztt Thanks, I will try that, seems like exactly what I was hoping for! I don’t think it’s critical with range markers, as long as I can get the name of the marker it should be fine.

@VIRTUALDOG I’m not there yet in my programming skills that I would be able to contribute I don’t think, but for sure one of my goals is to become a contributor to the SC project sooner rather than later.

Thanks all!