using System; namespace NeuroSync { /// /// Port of the tail of audio_processing.py process_audio_features(). Frames are row-major [n, 68]. /// public static class NeuroSyncPostProcess { const int O = NeuroSyncConstants.NumOutputs; /// In place: /100 on channels 0..60, 0.1 s linear ease-in, zero_columns(). Returns . public static float[] Apply(float[] frames, int n) { for (int f = 0; f < n; f++) for (int c = 0; c < NeuroSyncConstants.NumScaledChannels; c++) frames[f * O + c] /= 100f; // np.linspace(0, 1, ease)[:, None] int ease = Math.Min(NeuroSyncConstants.EaseInFrames, n); for (int f = 0; f < ease; f++) { float k = ease > 1 ? f / (float)(ease - 1) : 0f; for (int c = 0; c < O; c++) frames[f * O + c] *= k; } for (int f = 0; f < n; f++) foreach (int c in NeuroSyncConstants.ZeroColumns) frames[f * O + c] = 0f; return frames; } } }