Difference between revisions of "MEA8000 Voice Generator"

From CPCWiki - THE Amstrad CPC encyclopedia!
Jump to: navigation, search
Line 4: Line 4:
  
 
== Overview ==
 
== Overview ==
 
 
  Voiced (Sawtooth)          <-------- Digital Filters --------->
 
  Voiced (Sawtooth)          <-------- Digital Filters --------->
 
   ________    ______
 
   ________    ______
Line 14: Line 13:
 
  | RANDOM |---| AMPL |--o
 
  | RANDOM |---| AMPL |--o
 
  |________|  |______|
 
  |________|  |______|
 
 
Unvoiced (Noise) (when PI=?)
 
  
== Missing Specifications ==
+
Unvoiced (Noise) (when PI=-16)
 +
 
 +
== Digital Filters (processed on each 8kHz sample) ==
 +
Each of the four filter stages works like so:
 +
  fm_cos = cos(+2*pi * fm_Hz/8096Hz)*2
 +
  bw_exp = exp(-1*pi * bw_Hz/8096Hz)
 +
                              _____                            _____
 +
  ---sample----------------->|    |------------------------->|    |---+--->
 +
          _______________    | ADD |        ______________    | ADD |  |
 +
    +-->|*-bw_exp*bw_exp|-->|_____|  +-->|*fm_cos*bw_exp|-->|_____|  |
 +
    |  |_______________|    _____    |  |______________|    _____    |
 +
    +-----------------------|OLDER|<--+----------------------| OLD |<--+
  
The MEA8000 datasheet contains very little information about the voice generator.
+
                            |_____|                          |_____|
* The internal timings and formulas aren't well described.
+
* And, the content of the internal Parameter-Translation table is unknown.
+
* Note: The source code for the MESS emulator might contain some useful info.
+
  
== Unsorted Information Fragments ==
+
== Pitch Generator (Sawtooth) (active when PI<>-16) ==
 +
Based on 3 registers: SAW_LEVEL is probably signed 13bit, P is probably unsigned 9bit, PI is signed 5bit. The following is processed every 125us (8kHz):
 +
  SAW_LEVEL=(SAW_LEVEL+P) AND 1FFFh  ;sawtooth (-1000h..+0FFFh)
 +
  sample = SAW_LEVEL * AMPLITUDE      ;volume
 +
And, additionally, every 8ms (125Hz):
 +
  P=(P+PI) AND 1FFh    ;the "AND 1FFh" is assuming that P is only 9bit wide
  
The device contains an internal 3.84MHz oscillator (but can be also driven by external oscillator, or external TTL clock of max 4MHz). The device internally divides the 3.84MHz (and outputs 1.28MHz on CLK OUT pin for general purpose).
+
== Noise Generator (Random) (active when PI=-16) ==
The internal sample rate is 8kHz (after applying the AMPL,PITCH,FM,BW stuff), the 8kHz samples are then resampled to 64kHz (with linear interpolation between the samples), and the 64kHz samples are then passed to the DAC.
+
The following is processed every 125us (8kHz):
Bandwidth is "4 KH" (4000 hours? probably means 4000 hertz).
+
  NOISE_LEVEL=random(-1000h..+0FFFh) ;random
 +
  sample = SAW_LEVEL * AMPLITUDE      ;volume
 +
The exact random algorithm is unknown (one information fragment implies that it is done by some ADD/MULTIPLY logic) (not sure if that is true, it may also be simple SHIFT/XOR or so).
  
The AMPL, FM, BW, and FD values are translated via an internal "Code to Parameter ROM" (the content of that ROM is unknown, but it's possibly non-linear).
+
== Linear Interpolations (AMPL/FM/BW) ==
PITCH is directly passed to the PITCH register without translation.
+
Changes to AMPL,FM,BW are applied by interpolation (ie. not abruptly) (ie. it takes whatever time until the new setting is reached... the interpolation speed is unknown; it is merely described to depend on FD... Probably it's meant to be the whole FD period, ie. the new Target value isn't reached until the END of the frame).
PI is probably sign-expanded and added to PITCH at whatever rate. Setting PI to whatever (?) value selects unvoiced noise mode.
+
Theoretically, the device can output only <either> sawtooth <or> noise... however, looking at the block diagram, it looks as if it can output both added together... so, maybe it does fade-out/fade-in the sound sources when switching from noise to sawtooth or vice-versa.
+
  
Changes to PI,AMPL,FM,BW are applied by interpolation (ie. not abruptly) (ie. it takes whatever time until the new setting is reached) (the interpolation speed is unknown; it is merely described to depend on FD).
+
== DAC Output ==
The MEA8000 is similar to the PCF8200 (the difference is that the PCF8200 has 5kHz bandwidth, uses 40bit speech frames, and five filter stages; with BW1=3bit, BW2=3bit, FM4=3bit, FM5=1bit, BW5=2bit, and has selectable male/female parameter tables, and 11bit DAC, and additional 8bit DAC factor; which is sent after the 8bit pitch; and 12.8ms, 25.6ms, 38.4ms, 64ms durations).
+
The 8kHz samples (coming from the filters) are resampled to 64kHz samples using linear interpolation, for example, if each "_" is a 8kHz sample:
 +
          _    ______                                  _____
 +
  8kHz  __ _____      _____    --->      64kHz __/\____/    \____
 +
The 64kHz samples are then passed to an 8bit D/A converter. According to the french datasheet, the 8bit DAC internally consists of two 4bit DACs (one for LSBs, one for MSBs) whose outputs are merged together via 1:16 resistors or so.
  
Pitch is the step, ie. Sample=Sample+Pitch  (=sawtooth)
+
== Oscillator ==
Each of the 4 filters memorizes an OLD and OLDER sample.
+
The device can be driven by a 3.84MHz crystal, or external TTL clock of max 4MHz). The 8kHz sample rate, timings, and pitch/filter frequencies in this doc apply for the recommended 3.84MHz.
bandwidth is 4kHz
+
DAC is 8bit
+

Revision as of 10:03, 23 January 2010

Overview

Voiced (Sawtooth)           <-------- Digital Filters --------->
 ________     ______
|        |   |      |
| PITCH  |---| AMPL |--o    _____     _____     _____     _____     _____
|________|   |______|   \  | FM1 |   | FM2 |   | FM3 |   | FM4 |   |     |
 ________     ______     o-| BW1 |---| BW2 |---| BW3 |---| BW4 |---| DAC |--->
|        |   |      |      |_____|   |_____|   |_____|   |_____|   |_____|
| RANDOM |---| AMPL |--o
|________|   |______|
Unvoiced (Noise) (when PI=-16)

Digital Filters (processed on each 8kHz sample)

Each of the four filter stages works like so:

 fm_cos = cos(+2*pi * fm_Hz/8096Hz)*2
 bw_exp = exp(-1*pi * bw_Hz/8096Hz)
                             _____                            _____
 ---sample----------------->|     |------------------------->|     |---+--->
         _______________    | ADD |        ______________    | ADD |   |
    +-->|*-bw_exp*bw_exp|-->|_____|   +-->|*fm_cos*bw_exp|-->|_____|   |
    |   |_______________|    _____    |   |______________|    _____    |
    +-----------------------|OLDER|<--+----------------------| OLD |<--+
                            |_____|                          |_____|

Pitch Generator (Sawtooth) (active when PI<>-16)

Based on 3 registers: SAW_LEVEL is probably signed 13bit, P is probably unsigned 9bit, PI is signed 5bit. The following is processed every 125us (8kHz):

 SAW_LEVEL=(SAW_LEVEL+P) AND 1FFFh   ;sawtooth (-1000h..+0FFFh)
 sample = SAW_LEVEL * AMPLITUDE      ;volume

And, additionally, every 8ms (125Hz):

 P=(P+PI) AND 1FFh    ;the "AND 1FFh" is assuming that P is only 9bit wide

Noise Generator (Random) (active when PI=-16)

The following is processed every 125us (8kHz):

 NOISE_LEVEL=random(-1000h..+0FFFh)  ;random
 sample = SAW_LEVEL * AMPLITUDE      ;volume

The exact random algorithm is unknown (one information fragment implies that it is done by some ADD/MULTIPLY logic) (not sure if that is true, it may also be simple SHIFT/XOR or so).

Linear Interpolations (AMPL/FM/BW)

Changes to AMPL,FM,BW are applied by interpolation (ie. not abruptly) (ie. it takes whatever time until the new setting is reached... the interpolation speed is unknown; it is merely described to depend on FD... Probably it's meant to be the whole FD period, ie. the new Target value isn't reached until the END of the frame).

DAC Output

The 8kHz samples (coming from the filters) are resampled to 64kHz samples using linear interpolation, for example, if each "_" is a 8kHz sample:

         _     ______                                  _____
 8kHz  __ _____      _____    --->      64kHz __/\____/     \____

The 64kHz samples are then passed to an 8bit D/A converter. According to the french datasheet, the 8bit DAC internally consists of two 4bit DACs (one for LSBs, one for MSBs) whose outputs are merged together via 1:16 resistors or so.

Oscillator

The device can be driven by a 3.84MHz crystal, or external TTL clock of max 4MHz). The 8kHz sample rate, timings, and pitch/filter frequencies in this doc apply for the recommended 3.84MHz.