diff --git a/src/AquaSynth.Faust/AquaSynthDaemonService.cs b/src/AquaSynth.Faust/AquaSynthDaemonService.cs index 0021895..16897f6 100644 --- a/src/AquaSynth.Faust/AquaSynthDaemonService.cs +++ b/src/AquaSynth.Faust/AquaSynthDaemonService.cs @@ -906,7 +906,7 @@ public sealed class AquaSynthDaemonService : IDisposable try { var faustName = AquaSynthNativeCompiler.SafeFaustName(identity.FaustName); - var source = FaustEmitter.EmitScript(identity.Script, new FaustExportOptions(faustName)).Source; + var source = FaustEmitter.EmitScript(identity.Script, new FaustExportOptions(faustName, SampleRate: options.SampleRate)).Source; return compiler.TryCompileSource(identity, source, durationSeconds, out patch, out error); } catch (Exception ex) diff --git a/src/AquaSynth.Faust/IpaTrialOrchestrator.cs b/src/AquaSynth.Faust/IpaTrialOrchestrator.cs index ef37d3d..5f6e2fe 100644 --- a/src/AquaSynth.Faust/IpaTrialOrchestrator.cs +++ b/src/AquaSynth.Faust/IpaTrialOrchestrator.cs @@ -156,12 +156,13 @@ public static class IpaTrialOrchestrator var candidateDir = Path.Combine(round.RoundDirectory, "audio", candidate.Id); Directory.CreateDirectory(candidateDir); var script = await File.ReadAllTextAsync(candidate.ScriptPath, cancellationToken).ConfigureAwait(false); - var source = FaustEmitter.EmitScript(script, new FaustExportOptions(candidate.Id)).Source; + var referenceFixture = PinkTromboneParityFixtures.ById(target.ReferenceFixtureId); + var reference = referenceRenderer.Render(referenceFixture.Controls, target.Target.DurationSeconds + .18f); + // The vocal ladder's cell length is tied to the rate the DSP runs at, which is the reference's rate. + var source = FaustEmitter.EmitScript(script, new FaustExportOptions(candidate.Id, SampleRate: reference.SampleRate)).Source; var dspPath = Path.Combine(candidateDir, "candidate.dsp"); await File.WriteAllTextAsync(dspPath, source, cancellationToken).ConfigureAwait(false); - var referenceFixture = PinkTromboneParityFixtures.ById(target.ReferenceFixtureId); - var reference = referenceRenderer.Render(referenceFixture.Controls, target.Target.DurationSeconds + .18f); var candidateRender = await FaustCompiler.RenderAsync( source, new FaustRenderOptions(reference.SampleRate, reference.Samples.Length / (float)reference.SampleRate), @@ -311,12 +312,12 @@ public static class IpaTrialOrchestrator var timelinePath = Path.Combine(timelineRoot, $"{safeCandidateId}.csv"); await File.WriteAllTextAsync(timelinePath, ProbeTimelineReport.ToCsv(timeline), cancellationToken).ConfigureAwait(false); - var source = FaustEmitter.EmitScript(script, new FaustExportOptions(safeCandidateId)).Source; + var referenceFixture = PinkTromboneParityFixtures.ById(mapped.target.ReferenceFixtureId); + var reference = referenceRenderer.Render(referenceFixture.Controls, mapped.target.Target.DurationSeconds + .18f); + var source = FaustEmitter.EmitScript(script, new FaustExportOptions(safeCandidateId, SampleRate: reference.SampleRate)).Source; var dspPath = Path.Combine(candidateDir, "candidate.dsp"); await File.WriteAllTextAsync(dspPath, source, cancellationToken).ConfigureAwait(false); - var referenceFixture = PinkTromboneParityFixtures.ById(mapped.target.ReferenceFixtureId); - var reference = referenceRenderer.Render(referenceFixture.Controls, mapped.target.Target.DurationSeconds + .18f); var candidateRender = await FaustCompiler.RenderAsync( source, new FaustRenderOptions(reference.SampleRate, reference.Samples.Length / (float)reference.SampleRate), diff --git a/tools/IpaTrialWorker/Program.cs b/tools/IpaTrialWorker/Program.cs index f7089d1..1e7cbbc 100644 --- a/tools/IpaTrialWorker/Program.cs +++ b/tools/IpaTrialWorker/Program.cs @@ -267,7 +267,7 @@ static async Task SongScoreAsync(Dictionary options) : ProbeTimelineReport.Build(patch, timelineNetwork.Name, 12); await File.WriteAllTextAsync(timelinePath, ProbeTimelineReport.ToCsv(timeline), Encoding.UTF8); timelineFacts = PrimitiveTimelineFactExtractor.Extract(timeline).ToArray(); - var source = FaustEmitter.EmitScript(script, new FaustExportOptions(safeCandidateId)).Source; + var source = FaustEmitter.EmitScript(script, new FaustExportOptions(safeCandidateId, SampleRate: challenge.SampleRate)).Source; await File.WriteAllTextAsync(dspPath, source, Encoding.UTF8); artifacts.Add(Artifact("candidate-dsp", dspPath)); diff --git a/tools/TractGraphRenderer/Program.cs b/tools/TractGraphRenderer/Program.cs index c872da3..4a492cf 100644 --- a/tools/TractGraphRenderer/Program.cs +++ b/tools/TractGraphRenderer/Program.cs @@ -21,7 +21,7 @@ if (FaustCompiler.FindFaust() is null) } var script = Script(request); -var export = FaustEmitter.EmitScript(script, new FaustExportOptions("aqua_tract_graph_audition")); +var export = FaustEmitter.EmitScript(script, new FaustExportOptions("aqua_tract_graph_audition", SampleRate: request.SampleRate)); var render = await FaustCompiler.RenderAsync( export.Source, new FaustRenderOptions(request.SampleRate, request.DurationSeconds));