Take 2, then Take 3 -- new emulation - request for recordings

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

Andrew Davie

Well, I couldn't stop.  Since this is the headline I'll mention it a few times... size of code+tables is now under 15K and the emulation is 14% more accurate.  I won't push this code until it's thoroughly tested, so stick with the current version for now.

I wanted to see if a new cleanroom implementation would come up with effectively the same result as the current effort. It did, to a surprising degree of consistency.  So that was not going to replace the current version.

Then I explored a few ideas -- essentially I wanted to analyse HOW the chip produced the waveforms, rather than duplicating the waveforms. What components of the sounds, given the known capabilities of the chip from the technical reference, are used and where? More specifically, I wanted - for the most part - to remove "fitting" and instead have "parameterising".

It's been a whole day of tests trying to answer specific questions, and it's paid dividends so far. At the moment I have a functional replacement that's about 14% more accurate across all sounds. However I'm still mid-implementation.

There have been some exact, specific, new findings about the internal chip function...

---

**What the recordings say the chip does (voiced sounds)**

- It runs at about 8026 samples a second (the manual says 8192), with its own arithmetic in 8000ths.
- Each pitch period is floor(8000/Pitch)+1 ticks. At the start of every period the three formant oscillators — plain sines — restart, all at the same phase.
- The envelope over them has no attack: it switches on at full level and falls linearly over about 7 ms. We'd assumed a short ramp at first; measuring the first eight ticks of the pulse directly, on both units, showed there isn't one.
- Beside the sines there's a per-sound offset under the same envelope — a fourth oscillator parked at 0 Hz, which the chip's five-oscillator design allows for. It's one signed byte per sound, and it was the last big piece missing from the pulse.
- The AtariVox's output filter is two gentle poles, near 2 kHz and 2.9 kHz. The sample hold's images (8 kHz ± f, 16 kHz ± f ...) come straight through it, which is why the output is rendered at 48 kHz: what comes out of the jack genuinely has content up to 20 kHz, and it's part of the sound.

With those four things, the emulation's pulse for a vowel matches the chip's recorded pulse to about −17 to −21 dB (the two real chips agree with each other to −36 dB), and the formant peaks sit within a dB of the chip's. The 24 vowels, nasals and liquids that have isolated-pulse recordings now carry formants, levels and offsets measured from those pulses rather than fitted.

**How close is it**

I replaced the old score with a plainer one, P: physical distances (length, level over time, time-frequency cells, spectrum, formant peaks, pitch), each divided by how much the two real chips disagree with each other on the same thing. The two chips score about 0.22 against one another; lower is better.

                          fitted version  now
all 741 recordings            1.54        1.33  (14 % closer)
single allophones            1.08        0.90  (17 %)
the 24 measured vowels etc.  1.13        0.90  (20 %)
effects                      1.66        1.44
connected speech              1.66        1.48
Man Goes Down's phrases      2.66        2.42

**What's still wrong**

- A notch between the first two formants that the chip has and the model fills by ~10 dB. Real, located, unexplained.
- The effects: the biologicals (C-series), the M-series and the pulsed alarms are still *fitted recipes*. Their shapes were built from spectrograms, and the fitting has reached its floor — they need the same treatment the pulse got: isolate one cycle of what the chip does and read the mechanism off it.
- Stops and connected-speech timing, likewise still fitted.


Andrew Davie

**A request**

There is a new 3-minute test ROM, VoxProbe 6, that isolates exactly the "what's still wrong" things mentioned below: the voicing pulse at Pitch 20 (so every pulse stands alone), the voice at five Volumes, OW and WW at four Bends, one cycle of each pulsed effect, the stops slowed down, and word pairs at two Speeds. If you have an AtariVox (either kind) and can record its output straight into a line input, a recording of this ROM would answer the open questions above.


SpiceWare

Probe 6 results from AtariVox+ Vectrex Enhanced

SpiceWare

Probe 6 results from original AtariVox

NOTE: both recorded with volume control at the 3rd tick after MIN

Andrew Davie

Quote from: SpiceWare on 30 Oct 2026, 05:20 AMProbe 6 results from original AtariVox

NOTE: both recorded with volume control at the 3rd tick after MIN

TY Processing now. Results tomorrow.
Just FYI "The constant noise floor sits at −41 dBFS, driven by the chip's idle voicing at Pitch 88 plus the recurring 117 Hz line, with items peaking 27-35 dB above it—usable but quieter than earlier takes. "

Essentially, the processing is having a much harder time separating the various sounds due to the noise, and relatively low volume -- and also because this recording apparently contains some quiet sounds that are sitting at or below the noise level.  But it mostly succeeded, so these are useable.

TY!

SpiceWare

Probes 2 - 4 were recorded at Tick 4 on the volume control.

Probes 5 - 6 were record at Tick 3 due to this:

Quoteset it lower than last time, peaks around −6 dBFS, because loud effects clipped before.


I could split the difference to #3.5 and re-record them.


Andrew Davie

Quote from: SpiceWare on 30 Oct 2026, 05:42 AMI could split the difference to #3.5 and re-record them.

Not needed, but TY!  The recordings were sufficient to answer the questions the probe was asking.


Andrew Davie

Observations of probe 6 recordings...

Both VoxProbe 6 recordings are in: the AtariVox+ (unit A, your "Vectrex Enhanced" one) and the original AtariVox (unit B). Each converted through ffmpeg (Python's AIFF reader rejects the compression), signal on channel 1, peaks −5 dBFS, no clipping, a constant −41 dBFS floor of mains harmonics from the chain (−51 above 300 Hz). Aligned to the probe's chunks by onset, 76 of 77 each; the one miss is the quiet PE at Speed 60. The two units agree with each other within 10 ms and 1 dB on every item I compared, so what follows is the chip.

Confirmed in the library: sound length does not follow Pitch (Pitch 20 and 150 lengths within 8 %); the pulse rate at Pitch 20 is 50 ms; the Bend law (OW and WW lines at Bend 10 and 15 are identical to the library's); Volume from 32 up.

Applied (committed in both repos, references regenerated, parity 2.5e-5): the Volume table. Both units put Volume 16 at −15.5 dB re 96, then −1.3, −1.1, 0 and +2.2 at 32, 64, 96 and 127; the library had −3.3 at 16.

Measured, not yet applied (all in memory and the p6 files):

Pulsed effects at Pitch 20: C0 and M2 are 10 ms pulses with silence between, where the library's noise band and hum run on; M0 is a continuous sound, not pulsed; C3 is one pulse then a 150 ms hold; C7 pulses to its own irregular rhythm, not the pitch period. C8, A1 and A3 match.
Joins: at Speed 60 the vowel before a stop decays over 100 to 200 ms into the closure where the library cuts it in 30 ms, so those pairs run 25 to 50 % longer on the chip. A final FF after OH shows nothing above the floor on either unit where the library plays it 19 dB under the vowel; a final SE is played, so it is not a general phrase-final rule.
Output stage: the chip never flat-tops at Volume 127; its AW has a crest factor of 21 dB against the library's 12, so the chip's pulses are peakier; SE at Volume 127 is 12 dB quieter on the chip than in the library.

SpiceWare

Sounds good - I'll set it to 3.5 if we end up doing a Probe 7.

alex_79

Quote from: Andrew Davie on 30 Oct 2026, 02:44 AM[...] essentially I wanted to analyse HOW the chip produced the waveforms, rather than duplicating the waveforms. What components of the sounds, given the known capabilities of the chip from the technical reference, are used and where? [...]

Did you also fed the PIC18F1320 datasheet to Claude to help reverse engineer how the samples are generated?
The SpeakJet is a standard PIC18F1320 with a custom firmware.
https://www.microchip.com/en-us/product/pic18f1320#Documentation


Andrew Davie

Quote from: alex_79 on 30 Oct 2026, 07:47 PM
Quote from: Andrew Davie on 30 Oct 2026, 02:44 AM[...] essentially I wanted to analyse HOW the chip produced the waveforms, rather than duplicating the waveforms. What components of the sounds, given the known capabilities of the chip from the technical reference, are used and where? [...]

Did you also fed the PIC18F1320 datasheet to Claude to help reverse engineer how the samples are generated?
The SpeakJet is a standard PIC18F1320 with a custom firmware.
https://www.microchip.com/en-us/product/pic18f1320#Documentation


No, I did not. I had no idea.  I'm doing that now. TY.

Andrew Davie

Quote from: alex_79 on 30 Oct 2026, 07:47 PMDid you also fed the PIC18F1320 datasheet to Claude to help reverse engineer how the samples are generated?

Here's the response. Seems that a lot has already been reverse engineered correctly...

The PIC18F1320 datasheet fits everything measured so far and confirms several modelling choices. It adds one small new finding but no big change yet:

The clock confirms the timing model. The chip has no crystal, so it runs on the PIC's internal 8 MHz oscillator, calibrated to ±2 %. That gives 2 million instructions per second, and a nominal 8000 Hz sample rate is exactly 250 instruction cycles per sample. Our two units run at 8039 and 8013 Hz, 0.5 % and 0.2 % fast, well within that tolerance. It also explains why the tones come out at exactly the programmed frequency times the sample rate over 8000. The firmware assumes 8000 Hz, and each unit's oscillator error scales everything, as the library already models.
The manual's six-oscillator design fits a 250-cycle budget. With an 8x8 single-cycle multiplier, it can afford a table lookup and a multiply per oscillator per sample. That matches today's envelope-oscillator changes.
The PWM carrier can't be measured from our recordings. At 8 MHz a 32 kHz carrier gives about 248 output levels, roughly 8 bits, but the carrier lies above the recorder's band. The steady 15.7 kHz line in every recording turned out to be the Atari 2600's scanline rate, 3,579,545 Hz divided by 228. It's identical on both units, so it isn't the chip. The scorer already treats it as background.
New: the output adds a second harmonic about 40 dB under a tone. On 220 B0 it shows on both units, folded about each unit's own sample rate. The library has no such distortion. The effect on the scores will be small, so I've noted it rather than chased it.
What the datasheet can't tell us is the firmware's data: the per-sound tables, envelopes and rates. Those still come from the recordings.


Andrew Davie

Thanks @alex_79 that info opened up a new line of investigation.

The new probe ROM is ready to send: `VoxProbe7/vox_probe7.bin`. It's a 4K ROM, about 3½ minutes long, recorded exactly like VoxProbe 6. The [README.md](../VoxProbe7/README.md) beside it has the recording instructions for the tester.

**It has not been run anywhere.** The emulator doesn't implement the register-control mode, so the first real recording is the only test of the second half. The first half uses ordinary codes, which the earlier probes already proved.

**What it plays:**
1. **27 effects at Pitch 40, 60, 150 and 200.** These are all the effects never recorded at another Pitch: R0–R7, A0, A2, A4–A9, B0–B8, C5 and M0. They show each one's pulse rate and offset, and whether the robots' low lines are a pulse rate or tones.
2. **The same 27 at Bend 0 and 15.**
3. **AW, IY and OW straight after a Pitch change, and 172 EB repeated 5 times, twice.**
4. **The synthesiser driven directly, one oscillator at a time.** This gives the sine's exact shape, the output's step size, the volume laws, and whether oscillators 4 and 5 differ.
5. **The envelope oscillator's four waveforms at three rates.** This includes the saw at 20 Hz, which settles the voice pulse's real shape. The tone under the envelope is at 1030 Hz, not a multiple of the envelope rate, so a restart at each wrap shows in the waveform.
6. **The noise oscillator at five distortion settings, half-enveloping, and the mixer past the manual's limit of 63.**

Sections 4 to 6 work like this:
- **Entry and proof:** each one enters the chip's register-control mode and has it say "Ready", which proves the commands got through the AtariVox.
- **What gets written:** only the synthesiser's registers, never the EEPROM.
- **Exit:** each section ends by clearing the registers, leaving the mode and resetting the chip.

**For the tester:** the README tells them to listen for "Ready" three times in the second half. If they hear speech or nothing there instead, the direct commands didn't get through, and they should say so. The first half is still useful either way.


SpiceWare

Probe 7 results from AtariVox+ Vectrex Enhanced

Volume at 3.5 ticks

Heard Ready 3 times

Test ran longer than expected - recording is 4:45, not 3:30.

SpiceWare

Probe 7 results from original AtariVox

Same as above, 3.5 ticks, 3x "ready", and 4:45