Run scheduled Realtek calibration loop
This commit is contained in:
parent
2d03a06370
commit
1d54528cd5
7 changed files with 339 additions and 3 deletions
|
|
@ -116,6 +116,22 @@ in low/mid evidence: shotgun peak `0.407887`, cardioid peak `0.074494`, 18.6 kHz
|
|||
confidence near zero, and the best reported band was cardioid 3.6 kHz at
|
||||
confidence `0.098`. Treat high-band probes as poor questions for this route
|
||||
until a better speaker/mic/path proves otherwise.
|
||||
The live exploration path is scheduler-driven, not a blind sweep:
|
||||
`Mimir.BufferSmoke --bioacoustic-realtk-scheduled-calibration-live` repeatedly
|
||||
asks `MimirBioacousticProbeScheduler` for the next probe plan, emits that plan
|
||||
through Realtek, captures Scarlett, updates residuals, and asks again. This is
|
||||
a live physical I/O diagnostic harness seeded from the current Scarlett residual
|
||||
model; the production runtime still needs to feed measured confidence state into
|
||||
the same scheduler/emitter path. The 2026-06-01 receipt at
|
||||
`artifacts/wasapi/realtk-scheduled-calibration-live/20260601-035354` ran four
|
||||
scheduled probe steps at gain `1.15` and wrote `scheduled-response-bands.csv`
|
||||
plus `balance-plan.md`. Local peak-versus-percentile-floor scoring found strong
|
||||
usable response near `910 Hz`, `3.6 kHz`, and `9.84-9.87 kHz` on both Scarlett
|
||||
mics.
|
||||
The scheduler and planner share the same measurable frequency boundary
|
||||
(`120 Hz` through `12 kHz` by default). Residuals above that window may remain
|
||||
diagnostic scars, but they no longer own live probe cadence or the weakest-band
|
||||
status when the current room path cannot answer them.
|
||||
The receiver must consume persisted models to weight reliable symbols,
|
||||
downweight dead bands, apply phase-coherence weighting, apply first-order
|
||||
group-delay correction, and search joint global delay/frequency-shift hypotheses
|
||||
|
|
|
|||
|
|
@ -151,6 +151,15 @@ a named invariant that the native runtime cannot protect yet.
|
|||
The targeted probe planner defaults to a 12 kHz ceiling and low/mid-band bias
|
||||
because the current Realtek/speaker/Scarlett-mic path does not provide useful
|
||||
high-band calibration evidence.
|
||||
- `Mimir.BufferSmoke --bioacoustic-realtk-scheduled-calibration-live` is the
|
||||
scheduler-owned live-I/O calibration receipt: the scheduler chooses each
|
||||
probe step from seeded Scarlett residuals, Realtek emits it, Scarlett captures
|
||||
it, residuals update, and the run writes a per-band CSV plus balance plan
|
||||
instead of mowing the whole spectrum blindly. The remaining production cut is
|
||||
feeding measured runtime confidence state into the same scheduler/emitter path.
|
||||
Scheduler confidence/status uses the same 120 Hz-12 kHz measurable window as
|
||||
the targeted planner, so dead ultrasonic-ish residuals cannot keep cadence
|
||||
pinned to questions this room path cannot answer.
|
||||
- `src/Mimir.BufferSmoke` loads the runtime config, polls the synchronization
|
||||
hub, and prints the actual rolling buffers. Use `--require-samples` when an
|
||||
empty declared sensor buffer should fail the run. Use `--bioacoustic-self-test`
|
||||
|
|
|
|||
|
|
@ -350,6 +350,20 @@ is still a bad physical question for this room/speaker path. The default
|
|||
targeted probe planner now caps selection at 12 kHz and biases measurable
|
||||
low/mid bands instead of favoring ultrasonic-ish uncertainty that ordinary
|
||||
speakers and mics cannot answer well.
|
||||
The calibration runner is now closed-loop instead of a blind full-spectrum
|
||||
sweep: `--bioacoustic-realtk-scheduled-calibration-live` asks the scheduler for
|
||||
each probe, emits through Realtek, captures Scarlett, updates residuals, and
|
||||
then asks the scheduler again. It is a live physical I/O diagnostic harness
|
||||
seeded from the current Scarlett residual model; production still needs measured
|
||||
runtime confidence state wired into the same scheduler/emitter path. The
|
||||
2026-06-01 receipt at
|
||||
`artifacts/wasapi/realtk-scheduled-calibration-live/20260601-035354` ran four
|
||||
scheduled steps at gain 1.15 and wrote `scheduled-response-bands.csv` plus
|
||||
`balance-plan.md`. Local peak-vs-percentile-floor scoring found strong usable
|
||||
response near 910 Hz, 3.6 kHz, and 9.84-9.87 kHz on both Scarlett mics.
|
||||
The scheduler now filters confidence/status to the same 120 Hz-12 kHz
|
||||
schedulable window as the targeted planner, so old 18.5 kHz residual scars can
|
||||
remain recorded without owning live cadence or weakest-band status.
|
||||
The first live run preserves two artifacts:
|
||||
`artifacts/asio/targeted-bioacoustic-live/20260601-030836` at playback gain
|
||||
1.0 and `artifacts/asio/targeted-bioacoustic-live/20260601-030857` at gain
|
||||
|
|
|
|||
|
|
@ -113,6 +113,19 @@ if (args.Any(arg => string.Equals(arg, "--targeted-bioacoustic-probe-realtk-live
|
|||
ParseIntOption(args, "--channels", 4));
|
||||
}
|
||||
|
||||
if (args.Any(arg => string.Equals(arg, "--bioacoustic-realtk-scheduled-calibration-live", StringComparison.OrdinalIgnoreCase)))
|
||||
{
|
||||
return RunBioacousticRealtekScheduledCalibrationLive(
|
||||
ParseStringOption(args, "--wasapi", "src/Mimir.WasapiLoopback/bin/Debug/net10.0-windows/Mimir.WasapiLoopback.exe"),
|
||||
ParseStringOption(args, "--probe", "native/probes/asio_audio_cadence/build/Release/asio_audio_cadence.exe"),
|
||||
ParseStringOption(args, "--output", "artifacts/wasapi/realtk-scheduled-calibration-live"),
|
||||
ParseStringOption(args, "--device", "Realtek"),
|
||||
ParseIntOption(args, "--sample-rate", 48_000),
|
||||
ParseDoubleOption(args, "--gain", 1.15),
|
||||
ParseIntOption(args, "--channels", 4),
|
||||
ParseIntOption(args, "--steps", 6));
|
||||
}
|
||||
|
||||
if (args.Any(arg => string.Equals(arg, "--synchronized-buffer-planner-smoke", StringComparison.OrdinalIgnoreCase)))
|
||||
{
|
||||
return RunSynchronizedBufferPlannerSmoke();
|
||||
|
|
@ -3691,6 +3704,106 @@ static int RunTargetedBioacousticProbeRealtekLive(
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int RunBioacousticRealtekScheduledCalibrationLive(
|
||||
string wasapiPath,
|
||||
string probePath,
|
||||
string outputDirectory,
|
||||
string device,
|
||||
int sampleRate,
|
||||
double gain,
|
||||
int channels,
|
||||
int steps)
|
||||
{
|
||||
steps = Math.Clamp(steps, 1, 16);
|
||||
var stamp = DateTimeOffset.Now.ToString("yyyyMMdd-HHmmss", CultureInfo.InvariantCulture);
|
||||
var runDirectory = Path.Combine(outputDirectory, stamp);
|
||||
Directory.CreateDirectory(runDirectory);
|
||||
var csvPath = Path.Combine(runDirectory, "scheduled-response-bands.csv");
|
||||
var planPath = Path.Combine(runDirectory, "balance-plan.md");
|
||||
var residuals = ScarlettProfessionalMicProbeResiduals();
|
||||
var pathologies = ScarlettProfessionalMicPathologies();
|
||||
var sourceIds = new[] { "asio-ch0-shotgun", "asio-ch1-cardioid" };
|
||||
var scheduler = new MimirBioacousticProbeScheduler(new MimirBioacousticProbeSchedulerOptions(
|
||||
SampleRate: sampleRate,
|
||||
TargetSyncConfidence: 0.86,
|
||||
TargetFrequencyResponseConfidence: 0.78,
|
||||
MinimumIntervalSeconds: 0.0,
|
||||
MaximumIntervalSeconds: 0.0,
|
||||
MaxProbeBands: 4));
|
||||
var allScores = new List<ScheduledProbeBandScore>();
|
||||
var syncConfidence = 0.62;
|
||||
var timestampNs = 1_000_000_000L;
|
||||
Console.WriteLine(
|
||||
$"bioacoustic-realtk-scheduled-calibration-start dir={runDirectory} device=\"{device}\" sampleRate={sampleRate} gain={gain:0.000} steps={steps}");
|
||||
|
||||
for (var step = 0; step < steps; step++)
|
||||
{
|
||||
var states = sourceIds
|
||||
.Select((sourceId, index) => NewSyncState(sourceId, index == 0 ? 14.0 : -9.0, Math.Clamp(syncConfidence - index * 0.05, 0.0, 1.0)))
|
||||
.ToArray();
|
||||
var frame = scheduler.Update(states, residuals, timestampNs, sourceIds, pathologies);
|
||||
if (!frame.ShouldEmit || frame.ProbePlan.Bands.Count == 0)
|
||||
{
|
||||
Console.WriteLine(
|
||||
$"bioacoustic-realtk-scheduled-calibration-step step={step} emit=false reason={frame.Reason} sync={frame.AggregateSyncConfidence:0.000} freq={frame.AggregateFrequencyResponseConfidence:0.000}");
|
||||
timestampNs += 1_000_000_000L;
|
||||
continue;
|
||||
}
|
||||
|
||||
var stepDirectory = Path.Combine(runDirectory, $"step-{step:00}");
|
||||
Directory.CreateDirectory(stepDirectory);
|
||||
var renderPath = Path.Combine(stepDirectory, "probe-f32.raw");
|
||||
var capturePath = Path.Combine(stepDirectory, "scarlett-capture-f32.raw");
|
||||
var samples = RenderTargetedProbePlan(frame.ProbePlan);
|
||||
WriteFloat32(renderPath, samples);
|
||||
var captureSeconds = samples.Length / (double)sampleRate + 0.65;
|
||||
var capture = StartAsioCaptureOnly(probePath, capturePath, sampleRate, captureSeconds);
|
||||
if (capture == null)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
using (capture)
|
||||
{
|
||||
Thread.Sleep(220);
|
||||
var renderExit = RunWasapiRender(wasapiPath, renderPath, device, sampleRate, gain);
|
||||
capture.WaitForExit();
|
||||
if (renderExit != 0)
|
||||
{
|
||||
Console.Error.WriteLine($"Scheduled Realtek calibration failed: WASAPI renderer exited {renderExit}");
|
||||
return renderExit;
|
||||
}
|
||||
|
||||
if (capture.ExitCode != 0)
|
||||
{
|
||||
Console.Error.WriteLine($"Scheduled Realtek calibration failed: ASIO capture exited {capture.ExitCode}");
|
||||
return capture.ExitCode;
|
||||
}
|
||||
}
|
||||
|
||||
var channelSamples = ReadInterleavedFloat32(capturePath, channels, out var frameCount);
|
||||
if (frameCount == 0)
|
||||
{
|
||||
Console.Error.WriteLine($"Scheduled Realtek calibration failed: no frames in {capturePath}");
|
||||
return 1;
|
||||
}
|
||||
|
||||
var stepScores = ScoreScheduledProbeCapture(step, frame.ProbePlan, channelSamples, sampleRate);
|
||||
allScores.AddRange(stepScores);
|
||||
residuals = UpdateResidualsFromScheduledScores(residuals, stepScores);
|
||||
syncConfidence = Math.Min(0.93, syncConfidence + 0.035);
|
||||
Console.WriteLine(
|
||||
$"bioacoustic-realtk-scheduled-calibration-step step={step} emit=true reason={frame.Reason} sync={frame.AggregateSyncConfidence:0.000} freq={frame.AggregateFrequencyResponseConfidence:0.000} " +
|
||||
$"bands={frame.ProbePlan.Bands.Count} capture={capturePath} best={string.Join(",", stepScores.OrderByDescending(static score => score.Confidence).Take(4).Select(static score => $"{score.SourceId}:{score.CenterHz:0}Hz/{score.Confidence:0.00}/{score.SnrDb:0.0}dB"))}");
|
||||
timestampNs += 1_000_000_000L;
|
||||
}
|
||||
|
||||
WriteScheduledProbeCsv(csvPath, allScores);
|
||||
WriteScheduledBalancePlan(planPath, allScores, gain, sampleRate);
|
||||
Console.WriteLine($"bioacoustic-realtk-scheduled-calibration-artifacts csv={csvPath} plan={planPath} scores={allScores.Count}");
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int RunSynchronizedBufferPlannerSmoke()
|
||||
{
|
||||
const long t0 = 1_000_000_000;
|
||||
|
|
@ -3995,6 +4108,151 @@ static MimirAudioCalibrationSourcePathology[] ScarlettProfessionalMicPathologies
|
|||
LowHighTiltDb: 4.0),
|
||||
];
|
||||
|
||||
static ScheduledProbeBandScore[] ScoreScheduledProbeCapture(
|
||||
int step,
|
||||
MimirTargetedBioacousticProbePlan plan,
|
||||
IReadOnlyList<float[]> channelSamples,
|
||||
int sampleRate)
|
||||
{
|
||||
var scores = new List<ScheduledProbeBandScore>();
|
||||
for (var channel = 0; channel < Math.Min(2, channelSamples.Count); channel++)
|
||||
{
|
||||
var sourceId = channel == 0 ? "asio-ch0-shotgun" : "asio-ch1-cardioid";
|
||||
foreach (var band in plan.Bands)
|
||||
{
|
||||
var (energy, floor) = SlidingToneEnergyStats(channelSamples[channel], sampleRate, band.CenterHz);
|
||||
var snrDb = 20.0 * Math.Log10(Math.Max(1.0e-12, energy) / floor);
|
||||
var confidence = Math.Clamp((snrDb - 6.0) / 30.0, 0.0, 1.0);
|
||||
scores.Add(new ScheduledProbeBandScore(
|
||||
step,
|
||||
sourceId,
|
||||
channel,
|
||||
band.CenterHz,
|
||||
band.Reason,
|
||||
energy,
|
||||
floor,
|
||||
snrDb,
|
||||
confidence));
|
||||
}
|
||||
}
|
||||
|
||||
return scores.ToArray();
|
||||
}
|
||||
|
||||
static (double PeakEnergy, double FloorEnergy) SlidingToneEnergyStats(
|
||||
IReadOnlyList<float> samples,
|
||||
int sampleRate,
|
||||
double centerHz)
|
||||
{
|
||||
if (samples.Count == 0)
|
||||
{
|
||||
return (0.0, 1.0e-9);
|
||||
}
|
||||
|
||||
var sampleArray = samples is float[] array ? array : samples.ToArray();
|
||||
var windowSamples = Math.Clamp((int)Math.Round(sampleRate * 0.070), 256, Math.Max(256, sampleArray.Length));
|
||||
var hopSamples = Math.Max(64, windowSamples / 4);
|
||||
var energies = new List<double>();
|
||||
for (var start = 0; start + windowSamples <= sampleArray.Length; start += hopSamples)
|
||||
{
|
||||
energies.Add(ToneEnergy(sampleArray.AsSpan(start, windowSamples), sampleRate, centerHz));
|
||||
}
|
||||
|
||||
if (energies.Count == 0)
|
||||
{
|
||||
var energy = ToneEnergy(sampleArray, sampleRate, centerHz);
|
||||
return (energy, Math.Max(1.0e-9, energy * 0.10));
|
||||
}
|
||||
|
||||
energies.Sort();
|
||||
var floorIndex = Math.Clamp((int)Math.Round((energies.Count - 1) * 0.35), 0, energies.Count - 1);
|
||||
var floor = Math.Max(1.0e-9, energies[floorIndex]);
|
||||
var peak = energies[^1];
|
||||
return (peak, floor);
|
||||
}
|
||||
|
||||
static MimirAudioCalibrationBandResidual[] UpdateResidualsFromScheduledScores(
|
||||
IReadOnlyList<MimirAudioCalibrationBandResidual> residuals,
|
||||
IReadOnlyList<ScheduledProbeBandScore> scores)
|
||||
{
|
||||
return residuals
|
||||
.Select(residual =>
|
||||
{
|
||||
var best = scores
|
||||
.Where(score => string.Equals(score.SourceId, residual.SourceId, StringComparison.Ordinal))
|
||||
.OrderBy(score => Math.Abs(Math.Log(Math.Max(1.0, residual.CenterHz) / Math.Max(1.0, score.CenterHz))))
|
||||
.FirstOrDefault();
|
||||
if (best == null)
|
||||
{
|
||||
return residual;
|
||||
}
|
||||
|
||||
var distance = Math.Abs(Math.Log(Math.Max(1.0, residual.CenterHz) / Math.Max(1.0, best.CenterHz)));
|
||||
var influence = Math.Clamp(1.0 - distance / 0.14, 0.0, 1.0);
|
||||
if (influence <= 0.0)
|
||||
{
|
||||
return residual;
|
||||
}
|
||||
|
||||
var earned = best.Confidence * influence;
|
||||
return residual with
|
||||
{
|
||||
Confidence = Math.Clamp(Math.Max(residual.Confidence, earned), 0.0, 0.97),
|
||||
ResidualDb = residual.ResidualDb * (1.0 - 0.45 * earned),
|
||||
DelayResidualMicroseconds = residual.DelayResidualMicroseconds * (1.0 - 0.30 * earned),
|
||||
PhaseResidualRadians = residual.PhaseResidualRadians * (1.0 - 0.30 * earned),
|
||||
ResponseEnergy = Math.Clamp(Math.Max(residual.ResponseEnergy, best.Energy * 16.0), 0.0, 1.0),
|
||||
};
|
||||
})
|
||||
.ToArray();
|
||||
}
|
||||
|
||||
static void WriteScheduledProbeCsv(string csvPath, IReadOnlyList<ScheduledProbeBandScore> scores)
|
||||
{
|
||||
using var writer = new StreamWriter(csvPath);
|
||||
writer.WriteLine("step,sourceId,channel,centerHz,reason,peakEnergy,floorEnergy,snrDb,confidence");
|
||||
foreach (var score in scores)
|
||||
{
|
||||
writer.WriteLine(string.Join(",",
|
||||
score.Step.ToString(CultureInfo.InvariantCulture),
|
||||
score.SourceId,
|
||||
score.Channel.ToString(CultureInfo.InvariantCulture),
|
||||
score.CenterHz.ToString("0.###", CultureInfo.InvariantCulture),
|
||||
score.Reason,
|
||||
score.Energy.ToString("0.000000000", CultureInfo.InvariantCulture),
|
||||
score.FloorEnergy.ToString("0.000000000", CultureInfo.InvariantCulture),
|
||||
score.SnrDb.ToString("0.###", CultureInfo.InvariantCulture),
|
||||
score.Confidence.ToString("0.###", CultureInfo.InvariantCulture)));
|
||||
}
|
||||
}
|
||||
|
||||
static void WriteScheduledBalancePlan(
|
||||
string planPath,
|
||||
IReadOnlyList<ScheduledProbeBandScore> scores,
|
||||
double gain,
|
||||
int sampleRate)
|
||||
{
|
||||
using var writer = new StreamWriter(planPath);
|
||||
writer.WriteLine("# Scheduled Realtek Bioacoustic Calibration Plan");
|
||||
writer.WriteLine();
|
||||
writer.WriteLine($"- sampleRate: `{sampleRate}`");
|
||||
writer.WriteLine($"- realtekGain: `{gain:0.###}`");
|
||||
writer.WriteLine("- authority: scheduler-selected probes, not blind sweep");
|
||||
writer.WriteLine();
|
||||
foreach (var group in scores.GroupBy(static score => score.SourceId).OrderBy(static group => group.Key, StringComparer.Ordinal))
|
||||
{
|
||||
var best = group.OrderByDescending(static score => score.Confidence).Take(6).ToArray();
|
||||
var weak = group.OrderBy(static score => score.Confidence).Take(6).ToArray();
|
||||
writer.WriteLine($"## {group.Key}");
|
||||
writer.WriteLine();
|
||||
writer.WriteLine($"- averageConfidence: `{group.Average(static score => score.Confidence):0.000}`");
|
||||
writer.WriteLine($"- bestBands: `{string.Join(", ", best.Select(static score => $"{score.CenterHz:0}Hz c={score.Confidence:0.00} snr={score.SnrDb:0.0}dB"))}`");
|
||||
writer.WriteLine($"- weakBands: `{string.Join(", ", weak.Select(static score => $"{score.CenterHz:0}Hz c={score.Confidence:0.00}"))}`");
|
||||
writer.WriteLine("- balanceMove: boost only measured usable bands; gate or downweight weak bands instead of amplifying noise.");
|
||||
writer.WriteLine();
|
||||
}
|
||||
}
|
||||
|
||||
static MimirAudioCalibrationBandResidual[] ImproveResidualsFromProbe(
|
||||
IReadOnlyList<MimirAudioCalibrationBandResidual> residuals,
|
||||
MimirTargetedBioacousticProbePlan plan)
|
||||
|
|
@ -8760,6 +9018,17 @@ internal sealed class DisposableConfiguration : IDisposable
|
|||
|
||||
internal readonly record struct ChannelSignalStats(double Rms, double Peak, double Mean);
|
||||
|
||||
internal sealed record ScheduledProbeBandScore(
|
||||
int Step,
|
||||
string SourceId,
|
||||
int Channel,
|
||||
double CenterHz,
|
||||
MimirBioacousticProbeReason Reason,
|
||||
double Energy,
|
||||
double FloorEnergy,
|
||||
double SnrDb,
|
||||
double Confidence);
|
||||
|
||||
internal sealed record CepstralDegradationSetting(
|
||||
string Name,
|
||||
double WarpFrames,
|
||||
|
|
|
|||
|
|
@ -16,7 +16,9 @@ public sealed record MimirBioacousticProbeSchedulerOptions(
|
|||
double RecheckFrequencyResponseConfidence = 0.94,
|
||||
double MinimumIntervalSeconds = 0.65,
|
||||
double MaximumIntervalSeconds = 8.0,
|
||||
int MaxProbeBands = 6);
|
||||
int MaxProbeBands = 6,
|
||||
double MinFrequencyHz = 120.0,
|
||||
double MaxFrequencyHz = 12_000.0);
|
||||
|
||||
public sealed record MimirBioacousticProbeConfidenceState(
|
||||
string SourceId,
|
||||
|
|
@ -52,6 +54,8 @@ public sealed class MimirBioacousticProbeScheduler(
|
|||
private readonly MimirTargetedBioacousticProbePlanner planner = planner ?? new(new MimirTargetedBioacousticProbeOptions(
|
||||
SampleRate: options?.SampleRate ?? 192_000,
|
||||
MaxProbeBands: options?.MaxProbeBands ?? 6,
|
||||
MinFrequencyHz: options?.MinFrequencyHz ?? 120.0,
|
||||
MaxFrequencyHz: options?.MaxFrequencyHz ?? 12_000.0,
|
||||
TargetConfidence: options?.TargetFrequencyResponseConfidence ?? 0.82));
|
||||
private readonly Dictionary<string, int> probeCounts = new(StringComparer.Ordinal);
|
||||
private long lastProbeAtNs = long.MinValue;
|
||||
|
|
@ -70,7 +74,10 @@ public sealed class MimirBioacousticProbeScheduler(
|
|||
var syncBySource = synchronizationStates
|
||||
.GroupBy(state => state.SourceId, StringComparer.Ordinal)
|
||||
.ToDictionary(group => group.Key, group => Math.Clamp(group.Max(state => state.Confidence), 0.0, 1.0), StringComparer.Ordinal);
|
||||
var residualsBySource = residuals
|
||||
var schedulableResiduals = residuals
|
||||
.Where(IsSchedulableResidual)
|
||||
.ToArray();
|
||||
var residualsBySource = schedulableResiduals
|
||||
.GroupBy(residual => residual.SourceId, StringComparer.Ordinal)
|
||||
.ToDictionary(group => group.Key, group => group.ToArray(), StringComparer.Ordinal);
|
||||
var syncConfidence = AverageOrZero(sourceIds.Select(sourceId => syncBySource.TryGetValue(sourceId, out var confidence) ? confidence : 0.0));
|
||||
|
|
@ -89,7 +96,7 @@ public sealed class MimirBioacousticProbeScheduler(
|
|||
var reason = ChooseReason(syncConfidence, frequencyConfidence, pressure, secondsUntilEligible);
|
||||
var shouldEmit = reason != MimirBioacousticProbeScheduleReason.None && secondsUntilEligible <= 0.0;
|
||||
var plan = shouldEmit
|
||||
? planner.Plan(residuals, sourceIds, sourcePathologies)
|
||||
? planner.Plan(schedulableResiduals, sourceIds, sourcePathologies)
|
||||
: EmptyPlan(sourceIds);
|
||||
if (shouldEmit && plan.Bands.Count > 0)
|
||||
{
|
||||
|
|
@ -214,6 +221,10 @@ public sealed class MimirBioacousticProbeScheduler(
|
|||
0.0,
|
||||
"No active probe is scheduled for this frame.");
|
||||
|
||||
private bool IsSchedulableResidual(MimirAudioCalibrationBandResidual residual) =>
|
||||
residual.CenterHz >= options.MinFrequencyHz &&
|
||||
residual.CenterHz <= Math.Min(options.MaxFrequencyHz, options.SampleRate * 0.45);
|
||||
|
||||
private double FrequencyResponseConfidence(IReadOnlyList<MimirAudioCalibrationBandResidual> residuals) =>
|
||||
AverageOrZero(residuals.Select(BandConfidence));
|
||||
|
||||
|
|
|
|||
|
|
@ -314,3 +314,5 @@
|
|||
{"ts": "2026-06-01T03:13:10+01:00", "type": "decision", "status": "ok", "note": "Routing correction: Starfire system default output is now Scarlett for monitoring, while Starfire Realtek is the intended active chirp-emission and loopback-measurement path. The 20260601 targeted ASIO-output probe artifacts remain useful Scarlett-output diagnostics but are not the intended Realtek chirp path. Next active probe runner must explicitly select Realtek output/loopback and must not assume default output or Scarlett ASIO playback."}
|
||||
{"ts": "2026-06-01T03:25:48+01:00", "type": "decision", "status": "ok", "note": "Added MimirBioacousticProbeScheduler as the closed-loop cadence owner above targeted probe planning. Runtime now publishes probe schedule/source confidence telemetry; scheduler owns when to spend active probes, while Realtek-specific physical emission remains the next output-device cut."}
|
||||
{"ts": "2026-06-01T03:42:48+01:00", "type": "verification", "status": "ok", "note": "Realtek-targeted bioacoustic probe runner proved explicit Starfire Realtek emission through Mimir.WasapiLoopback. It selected Speakers (Realtek(R) Audio), played the targeted probe at gain 0.75, captured Scarlett inputs under artifacts/wasapi/targeted-bioacoustic-realtk-live/20260601-033851, and measured shotgun/cardioid response. The path is real, but 18.6 kHz remained near-zero confidence; planner defaults now cap probe selection at 12 kHz and bias measurable low/mid bands."}
|
||||
{"ts": "2026-06-01T03:54:22+01:00", "type": "verification", "status": "ok", "note": "Ran scheduler-driven Realtek calibration under artifacts/wasapi/realtk-scheduled-calibration-live/20260601-035354. The runner used MimirBioacousticProbeScheduler to choose four targeted probe steps, emitted through Speakers (Realtek(R) Audio) at gain 1.15, captured Scarlett ASIO, and wrote scheduled-response-bands.csv plus balance-plan.md. Local peak-vs-percentile-floor scoring found strong usable response around 910 Hz, 3.6 kHz, and 9.84-9.87 kHz on both shotgun and cardioid; both channels scored high SNR in those asked bands."}
|
||||
{"ts": "2026-06-01T04:01:53+01:00", "type": "verification", "status": "ok", "note": "Bioacoustic scheduler now shares the targeted probe planner's measurable frequency boundary. The scheduler filters residual confidence to schedulable bands before choosing cadence/status and passes the same 120 Hz-12 kHz window to the planner, so unmeasurable 18.5 kHz residuals no longer keep live status pinned to a band the Realtek/speaker/Scarlett path cannot answer. Verified with --bioacoustic-probe-scheduler-smoke and --targeted-bioacoustic-probe-smoke."}
|
||||
|
|
|
|||
|
|
@ -681,6 +681,21 @@ accepted_design:
|
|||
probe planner now defaults to a 12 kHz ceiling and biases measurable low/mid
|
||||
bands so the scheduler asks questions the current speakers and mics can
|
||||
plausibly answer.
|
||||
The Realtek calibration runner is now scheduler-driven rather than a blind
|
||||
full-spectrum sweep: `--bioacoustic-realtk-scheduled-calibration-live`
|
||||
asks `MimirBioacousticProbeScheduler` for each probe, emits through
|
||||
Realtek, captures Scarlett ASIO, updates residuals, and writes a CSV plus
|
||||
balance plan. It is a live physical I/O diagnostic harness seeded from the
|
||||
current Scarlett residual model; production still needs measured runtime
|
||||
confidence state wired into the same scheduler/emitter path. The 2026-06-01
|
||||
receipt
|
||||
`artifacts/wasapi/realtk-scheduled-calibration-live/20260601-035354`
|
||||
ran four scheduled steps at gain 1.15 and found strong usable response
|
||||
near 910 Hz, 3.6 kHz, and 9.84-9.87 kHz on both Scarlett mics using local
|
||||
peak-vs-percentile-floor scoring.
|
||||
The scheduler now filters confidence/status to the same 120 Hz-12 kHz
|
||||
schedulable window as the targeted planner, so old 18.5 kHz residual scars
|
||||
can remain recorded without owning live cadence or weakest-band status.
|
||||
The first live targeted probe ran through Focusrite ASIO at 192 kHz. Gain
|
||||
1.0 artifact `artifacts/asio/targeted-bioacoustic-live/20260601-030836`
|
||||
measured shotgun low/high tilt 20.199 dB and cardioid 15.082 dB. Gain 2.0
|
||||
|
|
|
|||
Loading…
Reference in a new issue