The zip’s markers.wav has two labeled audio positions, called cues.
dotnet add package RecursiveAI.OneMediaRequires .NET 10 (net10.0); .NET 9 and earlier aren’t supported.
using RecursiveAI.OneMedia; using RecursiveAI.OneMedia.Riff; using var wav = WavDemuxer.Open( FileMediaSource.Open("markers.wav")); foreach (var cue in wav.ReadCues()) Console.WriteLine( $"{cue.SampleOffset}: {cue.Label}");
Unzip the example, then dotnet run.
Prints the frame offsets and labels:
2000: Intro 6000: Outro
Full program
The sample is 8,000 Hz mono PCM. Its cue chunk stores IDs 10 and 20 at frames 2000 and 6000. Its LIST adtl chunk supplies Intro for ID 10, Outro for ID 20, and a note for ID 10. The full program also converts the frame offsets to seconds.
using RecursiveAI.OneMedia; using RecursiveAI.OneMedia.Riff; using var wav = WavDemuxer.Open(FileMediaSource.Open("markers.wav")); var cues = wav.ReadCues(); int rate = wav.WaveFormat.SampleRate; Console.WriteLine($"Sample rate: {rate} Hz"); if (cues.Count == 0) Console.WriteLine("No cue points found."); foreach (var cue in cues) { double seconds = (double)cue.SampleOffset / rate; string label = cue.Label ?? "(unlabeled)"; Console.WriteLine(FormattableString.Invariant( $"Cue {cue.Id}: {label} at frame {cue.SampleOffset} ({seconds:F3} s)")); }
dotnet run prints:
Sample rate: 8000 Hz Cue 10: Intro at frame 2000 (0.250 s) Cue 20: Outro at frame 6000 (0.750 s)
If the file has no cue chunk, ReadCues() returns an empty list. A cue without a label still has an ID and a position.
Variations
Read cue notes as well as labels. Note and Label are separate fields, and either can be absent:
using RecursiveAI.OneMedia; using RecursiveAI.OneMedia.Riff; using var wav = WavDemuxer.Open(FileMediaSource.Open("markers.wav")); foreach (var cue in wav.ReadCues().Where(cue => cue.Note is not null)) Console.WriteLine($"{cue.Id}: {cue.Note}");
10: Start of passageRelated recipes
Write Broadcast WAV metadata · Read MP4 chapter markers
The short answer
Use WavDemuxer.ReadCues() to get the markers embedded in a WAV. Each cue gives you an Id, a SampleOffset, and optional Label and Note text. For a plain PCM WAV with one data chunk, divide the offset by wav.WaveFormat.SampleRate to get seconds from the start. Open a local file with FileMediaSource so the reader can find chunks after the audio data as well as before it.
Where are cue points and labels stored in a WAV file?
A cue is a marker, not a copy of the sound at that point. The cue chunk stores entries with positions and IDs. A separate LIST chunk of type adtl, short for associated data list, can carry labl (label) and note records. OneMedia joins them on cue ID, not the order of the text records. The sample deliberately stores the Outro label before Intro, but ReadCues() returns Intro first because the cue entry for ID 10 comes first. If you need timeline order in a different file, don’t assume the writer stored its cues in order of position.
These are the markers stored in the WAV itself. If you see markers in an editor but get an empty list, check whether it exported standard cue points into the WAV or kept them in its project. Use a seekable source for the inspection: the WAV reader’s forward-only overload does not see chunks after the audio data. The sample puts its cue and label chunks there, so a forward-only read would miss them.
How do I convert WAV cue sample offsets to seconds?
In a plain PCM WAV, SampleOffset counts sample frames, not bytes. One frame contains one sample for each channel, so for stereo you still divide by the sample rate, not by twice the sample rate. In the full program, the cast to double keeps the fractional part: frame 2000 at 8,000 frames per second is 0.250 seconds. No waveform decoding is needed to get this value.
For a file with a playlist or a wave list, don’t apply the simple formula blindly. Position is the play-order value, and SampleOffset can be relative to a block rather than the start of the stream. DataChunkId, ChunkStart, and BlockStart tell you what that offset refers to. The cue field definitions distinguish these RIFF fields. For plain PCM like the sample, keep the raw frame offset when you need a sample-accurate reference and use the seconds value for display.