Files
bsncubed 122e46e862 Pink noise as a source (mode "pink")
Core: aes67_tx_pink_noise(), a ready-made TX source: xorshift32 white noise
through Paul Kellet's pink filter, -18 dBFS RMS (peaks about -6 dBFS), same
on L and R. The player uses it like the tone (straight to TX, no volume or
gain). Checked on the board: -18 dBFS RMS, octave bands 63 Hz-4 kHz flat
within +-0.4 dB, L = R.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-25 23:37:05 +10:00

25 lines
1.2 KiB
C

// aes67_tx: RTP sender task, PTP-paced, pull callback; optional mono sum.
// Core component: must not depend on main/ (project code).
#pragma once
#include <stddef.h>
#include <stdint.h>
#include "esp_err.h"
// Audio source: fill buf with frames x AES67_TX_SRC_CHANNELS interleaved samples (stereo, full scale =
// INT32_MAX), whatever the stream's channel count: TX maps it (mono stream: L, or (L+R)/2 with mono_sum).
// Return the number of frames delivered; fewer than asked counts as an underrun (padded with silence).
#define AES67_TX_SRC_CHANNELS 2
typedef size_t (*aes67_tx_read_cb_t)(int32_t *buf, size_t frames);
// Registers the "aes67" config group and the TX status fields.
esp_err_t aes67_tx_init(void);
// Start the sender task. Sends while PTP is locked and aes67.enabled is set.
esp_err_t aes67_tx_start(void);
// Set the audio source. NULL = built-in 1 kHz test tone at -18 dBFS, phase-locked to PTP time.
void aes67_tx_set_source(aes67_tx_read_cb_t read);
// Ready-made source: pink noise at -18 dBFS RMS (peaks about -6 dBFS), same on L and R.
// Pass it to aes67_tx_set_source(). Keeps state: use for one stream only.
size_t aes67_tx_pink_noise(int32_t *buf, size_t frames);