Task: Investigate measurable features of the speech signal before building a new synthesizer

Investigate measurable features of the speech signal before building a new synthesizer

Theoretically investigate what properties of PCM and the speech signal we can reliably measure in time and frequency before designing a new generator.

Context

Right now we are not building a new synthesizer, nor are we trying to immediately recognize letters or phonemes. The goal of this stage is to understand fundamentally what exact features we can reliably measure from a microphone recording, using what methods, and with what temporal and frequency resolution.

Working hypothesis: first, we need to build a good decoder/analyzer as a measuring instrument, find stable features of known sounds, and only then go in the reverse direction—building generators that reproduce these features.


Basic Signal Model

At sampleRate = 48 kHz, one second of mono PCM is 48,000 consecutive samples.

Each sample is a single final instantaneous amplitude value. Once internal sources are mixed down, the information about which specific components combined to create an individual sample is lost.

For example, the same final result can be produced by different internal sums. Therefore, reverse recovery of individual causes from a single sample is impossible.

Useful information appears only when analyzing the trajectory over time.

It is important to distinguish:

  • x[n] — current waveform deviation;
  • Δx[n] = x[n] - x[n-1] — direction and rate of change;
  • Δ²x[n] — change in speed / steepness of the transient;
  • long-term temporal structure;
  • frequency structure.

A single 0 does not mean silence: inside an oscillation, it can be a high-speed zero-crossing. Rest is a prolonged sequence near zero without significant change.


What Can Be Measured Directly in the Time Domain

Even before FFT, features can be reliably computed over short windows:

  • RMS / total energy;
  • peak amplitude;
  • mean absolute amplitude;
  • zero crossing rate;
  • mean(|Δx|) — average rate of waveform change;
  • max(|Δx|) — steepness of the strongest transient;
  • second difference / local "acceleration";
  • variance;
  • crest factor;
  • autocorrelation and its maxima;
  • duration of silence/low-energy segments;
  • onset / sudden energy appearances;
  • decay / drop-off after an event.

These metrics potentially already separate different types of mechanics:

  • sustained voiced sound;
  • sustained noise/fricative segment;
  • short burst/plosive;
  • silence/closure;
  • periodic tremor.

Frequency Analysis

Frequency is not stored in PCM as a separate field. It is calculated from waveform repeatability.

For a window of length N samples, one can use:

  • Fourier/FFT — which periodic components are present;
  • autocorrelation — at what lag the waveform resembles itself;
  • filter bank — energy in predefined bands.

For FFT, the trade-off is important:

  • long window → good frequency resolution, poor temporal localization;
  • short window → good temporal localization, coarser frequency resolution.

Examples:

  • 1 s → approx. 1 Hz;
  • 100 ms → approx. 10 Hz;
  • 20 ms → approx. 50 Hz;
  • 10 ms → approx. 100 Hz.

For speech, multi-scale analysis will likely be required: fast bursts visible at 5–10 ms, pitch/formants at 20–50 ms, long stable structures at 100+ ms.


Frequency Tracks / Auditory Filter Bank

Instead of thousands of FFT bins, it makes sense to build a limited set of perceptual bands, for example, 24–40 bands on a logarithmic/ERB-like scale.

Basic idea:

PCM -> short windows -> FFT/filter bank -> energy of each band over time.

We get a fixed set of tracks:

Band 1 energy(t) Band 2 energy(t) ...

The number of tracks is fixed, while activity within them fluctuates over time.

The first visual layer can be a heatmap:

  • X = time;
  • Y = frequency band;
  • brightness = energy.

There is no need to encode many metrics at once via the thickness or color of a single curve. The basic vertical value of a track can simply be normalized energy 0..1.


Important Distinction: Total Energy vs. Its Distribution

Uint8 0..255 is the format of an instantaneous sample, not an "energy budget" between bands.

For analysis, it is more useful to separate:

  • window totalEnergy;
  • relative energy distribution across bands.

For example:

Frame { totalEnergy, bands[] }

where upon normalization we can have:

sum(bands) ≈ 1.

This allows us to see separately:

  • how loud the signal is overall;
  • where the energy went across the spectrum.

Finding Spectral Groups

One should not rigidly take the top N strongest bins.

A more sensible scheme:

  1. compute all bands;
  2. remove values below the adaptive noise floor/threshold;
  3. find local maxima;
  4. combine neighboring active bands into spectral groups;
  5. link similar groups across adjacent time windows.

This turns fixed sensory tracks into floating spectral objects:

  • center frequency;
  • bandwidth;
  • energy;
  • duration;
  • stability;
  • onset/decay;
  • periodic/noise-like character.

This is closer to how the auditory system groups components into objects than simply picking the ten strongest bins.


Hypothesis on Speech Mechanisms

Instead of dozens of scalar controls for a future synthesizer, it is proposed to think in terms of separate physiologically/acoustically meaningful generators or mechanisms.

Examples:

  • frication/constriction — prolonged noise mechanism;
  • plosive release — very short burst after closure/pressure build-up;
  • voicing — stable periodic source;
  • trill — recurring quasi-periodic interruptions/modulations;
  • nasal coupling — characteristic spectral structure;
  • guttural mechanism — distinct excitation/resonance type.

Key idea: mechanisms should differ not only in amplitude, but in observable features:

  • characteristic duration;
  • frequency range;
  • periodicity;
  • onset/decay;
  • spectral width;
  • stability;
  • temporal repeatability.

Then the decoder will potentially be able to extract them from the general PCM via dynamic signatures.


Experimental Plan

Initially, work only with a microphone and known uttered material.

Order:

  1. Record short fragments of 0.5–1.5 s.
  2. Utter known sounds/syllables/words.
  3. Build temporal and frequency metrics.
  4. Visually search for stable signatures.
  5. Verify the same signatures in other words and neighboring contexts.
  6. Check the distinguishability of close classes (S/Sh, P/T/K, voiced/unvoiced, etc.).
  7. Do not call a pattern a "letter" until it transfers across different contexts.
  8. Achieve high distinguishability first for a single person, a single microphone, and controlled conditions.
  9. Only after this, design the reverse generator.

The decoder must become a measuring instrument and then an automated generator test:

human audio -> decoder -> mechanism signature

synthetic audio -> decoder -> mechanism signature

Comparison is performed in the space of measurable features, not just subjectively "sounds similar / does not sound similar".


Main Criterion for the Current Stage

Not speech recognition, and not speech synthesis.

We need to understand:

what features we can truly stably and reproducibly measure from PCM, at what time scales, and which of them allow us to distinguish stable speech mechanisms.

At this stage, confirming measurability and distinguishability is more important than adding new entities to the generator.

Ворклоги

Interim Summary: Current Experiment Failed

At the current stage, none of the implemented/proposed sensors have yielded any useful, visually stable, or interpretable information for distinguishing speech sounds.

It is important to document this as a negative result rather than trying to "force" the experiment with optimistic heuristics.

What Was Tried

Time-domain sensors were discussed and/or proposed:

  • RMS / average energy;
  • peak amplitude;
  • zero crossing rate;
  • mean |Δx|;
  • max |Δx|;
  • autocorrelation / periodicity;
  • pitch estimate.

Then an attempt was made to build a rough sibilanceSensor for SNR via:

  • high-frequency energy;
  • spectral centroid;
  • energy separation below/above an arbitrary threshold;
  • spectral concentration.

After that, a rough frequency-band sensor with 12 logarithmic bands ranging approximately from 60 Hz to 14 kHz was proposed.

Practical result: none of these approaches has yet shown even an approximately useful picture that would allow us to confidently say the measurements reflect differences between known pronounced sounds.


Main Reasons for Failure

1. The AI Began "Designing a Solution" Too Early Instead of Conducting a Measurement Experiment

The main mistake was the premature transition from the question "what are we actually seeing in the data?" to the question "what sensor should detect the SNR?".

As a result, heuristics appeared, such as an arbitrary threshold of 5.5 kHz, sibilance-presence, a set of pre-selected frequency bands, and expected charts before even a single confirming series of real measurements was obtained.

This repeats a previously observed problem: the code looks plausible, but the foundation beneath it is not proven by experiment.

2. Features Are Measurable on Their Own, but Their Diagnostic Value Is Not Proven

RMS, ZCR, |Δx|, autocorrelation, and spectral metrics are indeed calculated correctly as waveform properties. However, this does not imply they are useful for distinguishing phonemes or speech mechanisms in a specific recording.

For example, two different sounds may have very similar RMS/ZCR, while the exact same sound can drastically change these values depending on loudness, distance to the microphone, and context.

3. Normalization Can Destroy the Exact Information We Are Trying to See

Attempting to normalize band energies in each frame so that their sum equals about 1 makes spectral distribution visualization convenient, but simultaneously removes absolute intensity information.

When comparing sibilants and non-sibilants, the absolute noise energy itself may be an important feature.

We cannot decide in advance which signal components are "interfering scale" until we have tested them experimentally.

4. Time Windows Are Too Coarse

A fixed window of 20–40 ms is technically convenient, but different speech mechanisms operate on different scales:

  • a burst may take just a few milliseconds;
  • pitch requires several periods;
  • formant structures require a different trade-off;
  • sustained fricative noise can last hundreds of milliseconds.

A single window scale inevitably hides some events.

5. Frequency Bands Are Too Coarse

12 bands like 2.5–4 kHz, 4–6.3 kHz, 6.3–10 kHz can be so wide that real local spectral differences within them simply disappear.

At the same time, jumping straight to dozens of bands without proven utility will only create more data, not more understanding.

6. Lack of a Standard Experimental Procedure

There is currently no strict set of comparative recordings:

  • identical microphone;
  • identical distance;
  • identical loudness;
  • multiple repetitions of the same sound;
  • several different sounds;
  • saved raw PCM data;
  • identical processing;
  • ability to overlay/compare metrics across repetitions.

Without this, it is impossible to distinguish a stable phoneme feature from random recording variation.

7. Analyzing "a Single Recording" Rather Than Repetition Statistics So Far

A single chart proves almost nothing.

We need at least a few repetitions of each class and a comparison of feature distributions:

  • intra-class variability;
  • inter-class distance;
  • stability over time;
  • sensitivity to loudness and microphone.

If the scatter of the same sound is greater than the difference between two sounds, the sensor is useless for our task.

8. Premature Binding to Letters

С, Ш, Ф are useful test classes, but a sensor should not start with an assumption about a letter.

It is more correct to first find objective differences between sets of recordings, and only then look at what they correspond to articulation-wise and phonetically.

9. Potential Issues with the Original audioData Itself

Before drawing further conclusions, it is necessary to separately verify:

  • what exactly audioData contains;
  • whether it is truly PCM from the microphone;
  • data type (Uint8, Float32, other);
  • correct center/DC offset;
  • actual sampleRate;
  • whether there is any browser/microphone processing prior to analysis: AGC, noise suppression, echo cancellation;
  • whether audioData is already the result of an AnalyserNode with limited/altered semantics.

If the input signal is already automatically normalized or filtered by the browser, this can completely alter the observed features.

10. Visualization Can Also Hide Differences

If each sensor independently chooses a normalized 0..1 range, visually any small differences might look significant, and large absolute differences might look identical.

For a research tool, raw values with units of measurement must be primary, while visual normalization should be a separate, transparent layer.


What We Consider the Correct Next Step

Do not write another "smart sensor."

First, build a minimal experimental infrastructure:

  1. save several short raw recordings with a known label;
  2. guaranteed knowledge of the PCM format and sampleRate;
  3. ability to render the waveform itself without transformations;
  4. ability to build a standard detailed spectrogram/STFT without attempting classification;
  5. compare several repetitions of the same sound side by side;
  6. only after visually discovering a stable difference, extract it into a separate sensor-helper;
  7. evaluate the sensor based on repetition statistics rather than a single successful chart.

Main conclusion of the current stage:

there is currently no basis to claim that the proposed sensors provide useful information for sound recognition. The experiment needs to be returned to a lower level: first, honestly observe the waveform and spectrum of real recordings, and then extract only those metrics whose usefulness is confirmed by repeatable data.