---
title: "Read WAV cue markers and labels in C#"
url: https://recursiveai.org/onemedia/cookbook/read-wav-cue-points/
description: "Read WAV cue markers and labels in C# with OneMedia. Get each cue ID, sample frame offset, and LIST adtl label, then convert PCM offsets to seconds."
version: "1.0.2"
---

# Read WAV cue markers and labels in C#

**OneMedia** is a free, open-source media library for .NET from Recursive AI. MIT or Apache-2.0, no native dependencies.

[NuGet](https://www.nuget.org/packages/RecursiveAI.OneMedia) · [GitHub](https://github.com/recursive-ai-oss/onemedia-csharp) · [Docs](https://recursiveai.org/onemedia/docs/) · [Download example (.zip)](https://recursiveai.org/onemedia/cookbook/read-wav-cue-points/read-wav-cue-points.zip)

The zip’s `markers.wav` has two labeled audio positions, called cues.

```shell
dotnet add package RecursiveAI.OneMedia
```

Requires [.NET 10](https://dotnet.microsoft.com/download/dotnet/10.0) (net10.0); .NET 9 and earlier aren’t supported.

```csharp
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](https://recursiveai.org/onemedia/cookbook/read-wav-cue-points/read-wav-cue-points.zip), then `dotnet run`.

Prints the frame offsets and labels:

```text
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.

```csharp
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:

```text
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:

```csharp
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}");
```

```text
10: Start of passage
```

## Related recipes

[Write Broadcast WAV metadata](https://recursiveai.org/onemedia/cookbook/write-broadcast-wave-bext-metadata/) · [Read MP4 chapter markers](https://recursiveai.org/onemedia/cookbook/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](https://github.com/recursive-ai-oss/onemedia-csharp/blob/ec3528e692cf5a9c532f023a15c5b4e1f2ff76d1/src/OneMedia/Riff/WavDemuxer.cs#L72-L80) 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](https://github.com/recursive-ai-oss/onemedia-csharp/blob/ec3528e692cf5a9c532f023a15c5b4e1f2ff76d1/src/OneMedia/Riff/WaveChunks.cs#L5-L14) 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.
