crates/veilvoice-core/tests/hostile_audio.rs
veilvoice-core · 389 lines · read the source here · or on GitHub
The engine against input that is not well-behaved audio.
A realistic use of VeilVoice is "someone sent me a recording and I want to veil it before passing it on", so the input file is not necessarily friendly. A 32-bit-float WAV can legally contain NaN and infinity, and symphonia decodes those faithfully rather than sanitising them.
That matters more than it might sound, because the engine keeps persistent state: the accent neutraliser's long-term spectrum is an exponential moving average, so a single non-finite sample folded into it never washes out. The audit found exactly that: one NaN, and every output sample for the rest of the session was NaN, silently.
In plain words
Feeds the engine audio designed to break it: silence, deafening noise, values that are not numbers, files that lie about their own length.
The question is not whether it sounds good. It is whether anything can make the engine stop, hang, or quietly produce silence while reporting success. A de-identifier that fails by outputting nothing is one somebody might not notice had failed.
WHAT THIS FILE CONTAINS
389 lines defining 13 functions (0 public), 0 types and 0 constants. Everything below is read out of the source, so it cannot disagree with the code.
WHAT CALLS WHAT
The functions this file defines, and the calls between them. An edge means the callee's name appears, called, inside the caller's body. This is a syntactic reading, not a type-resolved one.
The same graph as Mermaid source
%%{init: {"theme":"base","themeVariables":{"background":"#1a1b26","primaryColor":"#1f2335","primaryTextColor":"#c0caf5","primaryBorderColor":"#7aa2f7","secondaryColor":"#16161e","tertiaryColor":"#16161e","lineColor":"#737aa2","textColor":"#c0caf5","mainBkg":"#1f2335","nodeBorder":"#7aa2f7","clusterBkg":"#16161e","clusterBorder":"#2f3549","fontFamily":"ui-monospace, SFMono-Regular, Consolas, monospace","fontSize":"14px"}}}%%
flowchart TD
n_speech["speech<br/>line 27"]
n_engine["engine<br/>line 40"]
n_a_single_nan_does_not_poison_the_engine_for_ever["a_single_nan_does_not_poison_the_<br/>engine_for_ever<br/>line 46"]
n_every_flavour_of_non_finite_is_survived["every_flavour_of_non_finite_is_<br/>survived<br/>line 73"]
n_an_entirely_non_finite_buffer_is_handled["an_entirely_non_finite_buffer_is_<br/>handled<br/>line 103"]
n_digital_silence_stays_silent_and_leaves_the_state_usable["digital_silence_stays_silent_and_<br/>leaves_the_state_usable<br/>line 115"]
n_pathological_but_legal_audio_is_handled["pathological_but_legal_audio_is_<br/>handled<br/>line 159"]
n_hostile_input_is_survived_with_accent_neutralisation_off["hostile_input_is_survived_with_accent_<br/>neutralisation_off<br/>line 198"]
n_a_non_finite_sample_rate_is_refused_rather_than_built["a_non_finite_sample_rate_is_refused_<br/>rather_than_built<br/>line 236"]
n_an_absurd_sample_rate_is_refused_rather_than_allocated["an_absurd_sample_rate_is_refused_<br/>rather_than_allocated<br/>line 257"]
n_an_absurd_frame_size_is_refused["an_absurd_frame_size_is_refused<br/>line 296"]
n_non_finite_parameters_are_refused_and_wild_ones_are_clamped["non_finite_parameters_are_refused_and_<br/>wild_ones_are_clamped<br/>line 324"]
n_every_configuration_that_builds_produces_finite_audio["every_configuration_that_builds_<br/>produces_finite_audio<br/>line 375"]
n_a_single_nan_does_not_poison_the_engine_for_ever --> n_engine
n_a_single_nan_does_not_poison_the_engine_for_ever --> n_speech
n_an_entirely_non_finite_buffer_is_handled --> n_engine
n_an_entirely_non_finite_buffer_is_handled --> n_speech
n_digital_silence_stays_silent_and_leaves_the_state_usable --> n_engine
n_digital_silence_stays_silent_and_leaves_the_state_usable --> n_speech
n_every_configuration_that_builds_produces_finite_audio --> n_speech
n_every_flavour_of_non_finite_is_survived --> n_engine
n_every_flavour_of_non_finite_is_survived --> n_speech
n_hostile_input_is_survived_with_accent_neutralisation_off --> n_speech
n_pathological_but_legal_audio_is_handled --> n_engine
click n_speech href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-core/tests/hostile_audio.rs#L27" "open the source"
click n_engine href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-core/tests/hostile_audio.rs#L40" "open the source"
click n_a_single_nan_does_not_poison_the_engine_for_ever href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-core/tests/hostile_audio.rs#L46" "open the source"
click n_every_flavour_of_non_finite_is_survived href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-core/tests/hostile_audio.rs#L73" "open the source"
click n_an_entirely_non_finite_buffer_is_handled href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-core/tests/hostile_audio.rs#L103" "open the source"
click n_digital_silence_stays_silent_and_leaves_the_state_usable href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-core/tests/hostile_audio.rs#L115" "open the source"
click n_pathological_but_legal_audio_is_handled href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-core/tests/hostile_audio.rs#L159" "open the source"
click n_hostile_input_is_survived_with_accent_neutralisation_off href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-core/tests/hostile_audio.rs#L198" "open the source"
click n_a_non_finite_sample_rate_is_refused_rather_than_built href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-core/tests/hostile_audio.rs#L236" "open the source"
click n_an_absurd_sample_rate_is_refused_rather_than_allocated href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-core/tests/hostile_audio.rs#L257" "open the source"
click n_an_absurd_frame_size_is_refused href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-core/tests/hostile_audio.rs#L296" "open the source"
click n_non_finite_parameters_are_refused_and_wild_ones_are_clamped href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-core/tests/hostile_audio.rs#L324" "open the source"
click n_every_configuration_that_builds_produces_finite_audio href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-core/tests/hostile_audio.rs#L375" "open the source"
classDef helper fill:#1f2335,stroke:#bb9af7,color:#c0caf5
class n_speech,n_engine,n_a_single_nan_does_not_poison_the_engine_for_ever,n_every_flavour_of_non_finite_is_survived,n_an_entirely_non_finite_buffer_is_handled,n_digital_silence_stays_silent_and_leaves_the_state_usable,n_pathological_but_legal_audio_is_handled,n_hostile_input_is_survived_with_accent_neutralisation_off,n_a_non_finite_sample_rate_is_refused_rather_than_built,n_an_absurd_sample_rate_is_refused_rather_than_allocated,n_an_absurd_frame_size_is_refused,n_non_finite_parameters_are_refused_and_wild_ones_are_clamped,n_every_configuration_that_builds_produces_finite_audio helper
This site loads no third-party script, so it cannot run Mermaid; the diagram above is the same nodes and edges drawn by the generator instead. GitHub renders the source below directly.
ITEMS
| Item | Line | Documentation |
|---|---|---|
speech fn | 27 | |
engine fn | 40 | |
a_single_nan_does_not_poison_the_engine_for_ever fn | 46 | The regression. |
every_flavour_of_non_finite_is_survived fn | 73 | |
an_entirely_non_finite_buffer_is_handled fn | 103 | An input made entirely of poison must not panic, hang, or emit garbage. |
digital_silence_stays_silent_and_leaves_the_state_usable fn | 115 | Silence must not drive the long-term averages anywhere strange, and must not come out as anything but silence. |
pathological_but_legal_audio_is_handled fn | 159 | Full-scale square waves and DC are legal audio and unlike anything the engine was tuned on. |
hostile_input_is_survived_with_accent_neutralisation_off fn | 198 | The same, with accent neutralisation off, since that changes which paths in spectral.rs run. |
a_non_finite_sample_rate_is_refused_rather_than_built fn | 236 | A non-finite sample rate must be refused, not built. |
an_absurd_sample_rate_is_refused_rather_than_allocated fn | 257 | A sample rate a file can legally declare, but no hardware produces, sizes the reverb and chorus delay lines. |
an_absurd_frame_size_is_refused fn | 296 | frame_size had no upper bound at all, and it sizes every internal buffer and the FFT plan. |
non_finite_parameters_are_refused_and_wild_ones_are_clamped fn | 324 | Every other float is either clamped to something meaningful or refused for being NaN. |
every_configuration_that_builds_produces_finite_audio fn | 375 | The whole point, checked end to end: a configuration that survives validation must produce finite audio from finite audio. |