FX INTRODUCTION / 19

YM2612 formants: make an FM tone speak

Use the YM2612 as a harmonic-rich source, then shape it with the same liveFx formant filter. Compare chip feedback, musical pitch, and vowel color as three separate controls.

Play a melody on the Keyboard

The entry in Playground's Basic examples, singing-keyboard.js (examples/basic/singing-keyboard.js), also contains this sound. It starts in keyboard mode and includes comments explaining how to play. Try making a melody first, then change the numbers.

To play the code embedded on this page, switch it to keyboard mode:

  1. Press Stop, change experiment = 'A' near the top to experiment = 'K', then press Run.
  2. Open the bottom Keyboard tab. Select Mo: Fixed channel, Ch: CH1, and Pre: Current. Current keeps the YM2612 patch prepared by the code.
  3. Click the on-screen keys to play a melody. For PC keyboard playing, move focus out of the code editor by clicking the Keyboard area, then use the number and letter assignments shown on screen.

K prepares the patch and FX without starting a drone or an automatic pitch loop. Your keys control YM2612 pitch while the filter cycles through the vowels. Change feedback or vowelSeconds and compare the same melody.

The Keyboard shares the code's YM2612 patch and FX. The audition keyboard shown when opening a TFI in FILES is a separate path. Use Stop → Run when switching between K and A, B, or C. Leaving the Keyboard tab releases held keys, so use A, B, or C when you need a sustained sound for FX Monitor comparisons.

1. Listen first

Press Run to sustain a YM2612 tone at 130 Hz. In experiment A, the pitch stays fixed while the filter moves through a → i → u → e → o. The electronic voice color comes from the combination of chip harmonics and software resonances.

Run starts playback; Stop stops it. Edit the code during playback and press Run again to apply changes. The same-named FX keeps its filter state, and livePrepare avoids retriggering the sustained source. Stop and Run for a fresh start or when switching between K, A, B, and C. Play only one embedded example at a time: independent Playgrounds can otherwise sound together.

Open this code in a separate Playground tab ↗

2. Start with the chip, then add the filter

YM2612 OP1 + feedback → harmonic-rich tone → three parallel formant filters → mix → output

The starting preset is FM_PRESETS["sine"]. This example selects algorithm 7, in which all four operators can be carriers, but enables only OP1. The other operators are muted. OP1 is useful here because the chip's feedback path belongs to that operator.

At feedback = 0, OP1 is close to a sine-wave source. Raising feedback bends the oscillator's waveform and supplies more harmonics for the filter to emphasize. Start with feedback = 6, then compare 0, 3, and 6. Feedback changes the chip's source tone; it does not move F1, F2, or F3.

operatorLevel is the YM2612 Total Level (TL), a raw chip attenuation value: smaller is louder, larger is quieter. It is not a percentage. The example uses TL 16 for OP1 and TL 127 for the muted operators. Change TL cautiously when comparing different feedback settings.

The formant filters are software processing in liveFx on the AudioWorklet thread, after the chip output. The YM2612 does not contain these three formant filters. This does not emulate an LPC speech chip or analyze a microphone signal.

3. Separate three kinds of change

ControlWhat it changesFirst experiment
carrierHzYM2612 source frequency, in HzCompare 65, 130, and 260
feedbackSource waveform and harmonics; raw chip range 0–7Compare 0, 3, and 6
operatorLevelOP1 attenuation, raw TL 0–127Compare 16 and 28; larger is quieter
vowel / fixedVowelResonance target: 0=a, 1=i, 2=u, 3=e, 4=oCompare fixed targets 0 and 1
vowelSecondsInterval between automatic vowel targets, in elapsed secondsCompare 1.4 and 2.5
transitionMsFormant-parameter smoothing time scale, in millisecondsCompare 20, 60, and 200
lfoHz / lfoDepthFormant motion in cycles per second / octavesTry 0.8 and 0.3 for periodic vowel color
mixDry/wet balance, 0–10 hears the chip; 1 hears the filtered sound

The formants table contains [F1, F2, F3] in Hz for each vowel. Each band-pass receives the same input and the three outputs are mixed. F1 broadly relates to vowel openness, F2 to front/back tongue position, and F3 adds further voice quality. These are illustrative targets, not universal measurements. The formant vowels chapter explains the table and filter.

4. Compare experiments A, B, and C

experimentYM2612 pitchFormant filter
'A'Fixed at carrierHzMoves through five vowels
'B'Repeating frequency patternFixed at fixedVowel
'C'Same repeating frequency patternMoves through five vowels
  1. Start with A and mix: 0. Change feedback from 6 to 0 and Run again. This isolates what the YM2612 contributes.
  2. Restore feedback 6 and mix: 1. The filter now has more harmonics to shape. With feedback 0, the single main frequency cannot convincingly supply three formant resonances.
  3. Set experiment = 'B' and fixedVowel = 0. The melody moves but the resonance targets stay fixed. Try fixedVowel 1 next.
  4. Try C, then slow the vowel cycle with vowelSeconds: 2.5. Source pitch and vowel motion are controlled separately.
  5. For the LFO experiment, choose B and set lfoHz: 0.8, lfoDepth: 0.3. The filter moves periodically while the source loop continues to control pitch.

The source loop calls fm.setFrequency. The formant processor changes resonance frequencies using its own audio-thread position. Changing BPM does not change these second-based controls. A higher fundamental has fewer harmonics inside the formant regions, so the perceived vowel can still vary with source pitch.

5. Compare the chip and filtered sound in FX Monitor

After Run, open FX Monitor and select formant-ym2612. Blue is input from the sound sources; orange is the filtered output. Use View → Spectrum to compare harmonic balance and Oscilloscope to compare waveforms. Keep Y fixed when comparing heights; input and output share the scale.

With mix 0, input and output should overlap. With feedback 6 and mix 1, the orange spectrum emphasizes regions near the formants. Actual peaks remain near the source harmonics rather than necessarily exactly at F1, F2, and F3. In A, watch the broad spectral shape move without changing harmonic spacing. In B, harmonic spacing changes while the resonance targets stay put.

The effect processes the mixed source audio, not a selected YM2612 operator or channel. Keep other sources quiet when learning from this comparison.

6. What is smoothed, and what is not?

The formant processor keeps separate filter histories for the left and right audio channels, calculates coefficients from the actual AudioWorklet sample rate, smooths parameter targets, and limits excessive wet output. The same processing is used in the earlier three formant chapters.

Raw chip edits are separate: abrupt feedback, TL, or pitch changes can create waveform discontinuities and click sounds. Smooth formant movement does not guarantee that a direct YM2612 register change is click-free. The example preserves the source key state when code is applied, but does not add automatic smoothing to the chip's parameters.

This is a synthetic voice-color experiment. It does not produce consonants, reconstruct a human vocal tract, or read text aloud. Listener, pitch, feedback, and playback device affect how clearly the vowels are heard. Start at a comfortable level.

FX introduction index (work in progress)