feat(waveform): generalize high-res compute to every track (Direction B)
Per-track high-res datum keyed by EntryKey in the renamed track-waveforms vault; computed at upload for all tracks, regenerable per-track via CMS, with a re-runnable backfill. Mix read path repointed so it keeps working.
This commit is contained in:
@@ -42,9 +42,9 @@ public class WaveformProfileService
|
||||
/// <paramref name="entryKey"/> in <paramref name="vaultName"/> (defaults to
|
||||
/// <see cref="VaultConstants.WaveformProfiles"/> when null). Bucket resolution defaults to
|
||||
/// <see cref="WaveformProfileOptions.BucketCount"/> (512) when <paramref name="bucketCount"/> is null;
|
||||
/// callers pass an explicit count for higher-resolution data — e.g. the Mix datum derives its count
|
||||
/// from the audio duration (≈333 samples/sec, see <c>MixWaveformResolution</c>) so long mixes are not
|
||||
/// under-sampled. This service is content-agnostic: it captures however many buckets it is told to and
|
||||
/// callers pass an explicit count for higher-resolution data — e.g. the per-track high-res datum
|
||||
/// derives its count from the audio duration (≈333 samples/sec, see <c>WaveformResolution</c>) so long
|
||||
/// tracks are not under-sampled. This service is content-agnostic: it captures however many buckets it is told to and
|
||||
/// does not itself decide the count. Returns false (and logs) on any
|
||||
/// failure — a missing profile is handled gracefully downstream, so callers on the upload path
|
||||
/// log-and-continue rather than failing the upload. Does not throw for expected failure modes.
|
||||
@@ -99,6 +99,24 @@ public class WaveformProfileService
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Computes a track's high-resolution loudness datum and stores it in the
|
||||
/// <see cref="VaultConstants.TrackWaveforms"/> vault keyed by <paramref name="entryKey"/>. The bucket
|
||||
/// count is duration-derived (≈333 samples/sec, clamped — see <see cref="WaveformResolution"/>) so the
|
||||
/// datum captures at a constant time resolution regardless of track length. This is the single home
|
||||
/// for "the high-res per-track datum" — the upload path, the CMS generate action, and the Mix trigger
|
||||
/// all funnel through it, so every track (Mix, Session, Cut) gets an identical datum keyed the same way.
|
||||
/// Returns false (logged) on any failure, per the content-agnostic contract above.
|
||||
/// </summary>
|
||||
public Task<bool> ComputeAndStoreHighResAsync(
|
||||
ReadOnlyMemory<byte> wavBytes,
|
||||
string entryKey,
|
||||
double durationSeconds)
|
||||
{
|
||||
var bucketCount = WaveformResolution.BucketCountForDuration(durationSeconds);
|
||||
return ComputeAndStoreAsync(wavBytes, entryKey, bucketCount, VaultConstants.TrackWaveforms);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the stored quantized profile bytes for a track from <paramref name="vaultName"/>
|
||||
/// (defaults to <see cref="VaultConstants.WaveformProfiles"/> when null), or null if no profile
|
||||
|
||||
Reference in New Issue
Block a user