8KHz spike!

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Andrew Davie

Only just noticed - and now being mitigated.
Many of the recordings have a spike at 8KHz which disrupts the curves of the fitted line.
These (and sidebands) are related to the clock rate (8K!) of the SpeakJet.
They need to be filtered out of the recordings. Previously the code was trying to fit to this signal, which decreased accuracy.  So, there's that!

The technical document is continually being updated - see the SpeakJet github C-library.


Andrew Davie

**SpeakJet emulation: chasing spikes at 4 and 8 kHz (and what the AtariVox does to its own output)**

While comparing our SpeakJet emulation against recordings of two real AtariVoxes, we kept seeing odd spikes and dips in the spectrum graphs at about 4 kHz and 8 kHz. Some were measurement problems, some were the AtariVox itself, and working out which was which took a few wrong turns. Here's what we found.

**1. The 8 kHz spike: a recording-path problem**

On several sounds the graphs showed a sharp spike at 8 kHz, on both the chip and the emulation. My first reading was that it was real chip output that unit A's recording was too quiet to show. That was wrong. Measured in each recording's silence, unit B's 8 kHz level is the same with the chip idle as with it speaking (233 C3: −31.4 dB during the sound, −30.9 dB in silence). It's the chip's clock (about 8014 Hz on unit B, 8047 Hz on unit A) leaking into the audio path, on all the time. Unit A has it too, about 15 dB weaker.

It appeared on the emulation's curve because the scoring adds each recording's own background to the emulation before comparing, so that background noise doesn't count as an error. That carried unit B's clock line across as well.

The silences also showed a 1 kHz comb (1000, 2000 ... 13000 Hz) and the 60 Hz mains family, on both units.

**2. Getting rid of them properly**

- **First attempt, a narrow notch (7.9-8.15 kHz):** this went wrong in two ways. Bands summed over fewer frequency bins read low, which made false dips, so each band had to be scaled back to full width. And unit B's clock line has wide skirts, so on quiet sounds it still poked through: 192 TU showed a big false spike.
- **Second, notching the narrow lines out of the recordings:** this was wrong too. A notch also removes the chip's own tones at that frequency; 214 A4 lost 3.8 dB near 1 kHz.
- **What works for the steady lines:** subtract them as sine waves. Each line's amplitude and phase are measured only in the recording's silences, then carried through the sounds and subtracted, the same way mains hum was tracked out earlier. The lines dropped 20-37 dB in silence, and the chip's tones at those frequencies were untouched.
- **What works for the broad 8 kHz clock cluster:** it isn't a sine wave, so the whole 8 kHz band is left out of scoring, and the graphs bridge it with a dashed line.

Side effect: with the lines gone, unit A's floor dropped about 8 dB, which exposed a filtering artefact in the scorer's sound-detection threshold. Fixed, and 15 more quiet recordings became measurable.

**3. The 4 kHz spikes: real output, but not "lines"**

214 A4 shows a spike at about 4 kHz and 213 A3 a dip. Here the evidence goes the other way from 8 kHz. Both units agree within 0.6 dB, the emulation matches within 2 dB, and both are 12-50 dB above the recordings' silence. So they're genuinely in the AtariVox's output.

What they are: the chip computes about 8000 samples a second and holds each one until the next. Every tone at f therefore also appears at about 8014 − f, 8014 + f and so on. The AtariVox has no proper reconstruction filter after the chip, so those images reach the speaker. Near 4 kHz a tone and its own image land in the same 1/6-octave band, which makes a spike, or a dip when there's little there.

**4. The debate**

I first argued they should stay in the scoring because they're real output and the emulation reproduces them. Then I agreed to exclude them without saying clearly that the measurement hadn't changed. Rightly, that looked like flip-flopping. Both statements hold at once: the images are real AtariVox output, and they aren't part of the lines the SpeakJet means to make. Andrew's view is that they're a bug in the AtariVox (no reconstruction filter). It's a fair call: they're a hardware flaw, not the SpeakJet's intended sound.

**5. Where it stands**

- **Scoring:** 3.8-4.27 kHz, 7.5-8.6 kHz and 15.4-16.4 kHz are left out of all comparisons, with dashed bridges in the graphs. The recordings' steady path lines are subtracted at source. Overall scores barely moved, and the gate thresholds weren't affected.
- **The emulation still produces the clock images,** because a real AtariVox does. The open question is whether to keep that as the default (faithful to the hardware) or offer a switch for a corrected "ideal SpeakJet" output, or the other way round.

Lessons: before calling anything near 4 or 8 kHz "chip output" or "artefact", check it in the recording's silence and on both units. And treat a scoring exclusion as an explicit choice, saying what it costs.