@@ -478,11 +478,11 @@ pub const File = struct {
for (0..waveform_image_width) |cluster_index| {
// This cluster_index is meant to represent cluster_size samples,
// however our data is in groups of `Channel.cluster_len`, which is
// smaller than cluster_size except in the case of very short audio
// streams.
// smaller than cluster_size except for in short audio streams.
const group_start = cluster_index * cluster_size / Channel.cluster_len;
const group_end = (cluster_index + 1) * cluster_size / Channel.cluster_len;
const twi_sample = HiResSampleCluster.toTwiSample(channels[0].clusters.items[group_start..group_end]);
const group_len = @max(cluster_size / Channel.cluster_len, 1);
const group = channels[0].clusters.items[group_start..][0..group_len];
const twi_sample = HiResSampleCluster.toTwiSample(group);
twi_encoder.add(twi_sample);
}