Difference between revisions of "Willy"

From CPCWiki - THE Amstrad CPC encyclopedia!
Jump to: navigation, search
(OPL3 sound chip)
(Basic Components)
Line 68: Line 68:
  
 
* a distinct rhythm section, which incorporates a noise generator with some of the parts above to provide a few fixed percussion noises.
 
* a distinct rhythm section, which incorporates a noise generator with some of the parts above to provide a few fixed percussion noises.
 +
 +
<br>
 +
 +
==== logsin and exponent tables ====
 +
 +
The OPL3 uses two look-up tables, each containing 256 entries.
 +
 +
The exponent table exp[] is calculated by f(x)=round((power(2, x/256)-1)×1024) for x from 0 to 255. Given a value, the significand is calculated by exp[8 LSB] + 1024, and the exponent is the remaining MSBs, producing a floating-point value. Ten bits of exponent are required to represent all values in the table, the largest being 1,018.
 +
 +
The logsin table logsin[] is calculated by f(x)=round(-log(sin((x+0.5)*pi/512))/log(2)*256) for x from 0 to 255. It requires 12 bits to represent all values (largest is 2,137) and represents the first rising quarter of a sine wave.
  
 
<br>
 
<br>

Revision as of 02:04, 14 October 2024

Willy - MIDI and OPL3 Soundcard adapter for CPC

Willy1.jpg


Demonstrations


Weblinks


Cost

The cost for a Willy soundcard adapter is 10€. This does not include any soundcard, you have to buy those separately.


Compatible Serdaco soundcards


Technical information

2 ports are used to control the MIDI soundcard: &FEAC for data, and &FEAD for control and status.

3 ports are used to control the OPL3 soundcard: &FEBC and &FEBE are register select ports, and &FEBD is the data port.


OPL3 sound chip

OPL3 is register compatible with OPL2, with twice the number of signal sources, 4 new operator modes, 4 new selectable waveforms, and stereo output.

OPL3 offers 18 FM 2-op chans in its standard mode, but that can be configured:

  • One setting converts 3 of the FM chans into a 5-chan FM percussion set
  • Another setting pairs 12 of the FM chans into 6 FM 4-op chans
  • Both settings can be used at the same time, to obtain 6 FM 4-op chans + 3 FM 2-op chans + 5-chan FM percussion set


Basic Components

The most basic elements of an OPL FM synthesiser are:

  • envelope generators, which vary volume over time;
  • phase generators, which produce a waveform such as a sine wave at a programmatic rate;
  • operators, which combine an envelope generator and a phase generator;
  • a global low-frequency oscillator which can provide additional vibrato (i.e. back-and-forth modification of frequency) and tremolo (like vibrato, but for volume) to operators;
  • channels, which combine operators to produce a single tone output;
  • a distinct rhythm section, which incorporates a noise generator with some of the parts above to provide a few fixed percussion noises.


logsin and exponent tables

The OPL3 uses two look-up tables, each containing 256 entries.

The exponent table exp[] is calculated by f(x)=round((power(2, x/256)-1)×1024) for x from 0 to 255. Given a value, the significand is calculated by exp[8 LSB] + 1024, and the exponent is the remaining MSBs, producing a floating-point value. Ten bits of exponent are required to represent all values in the table, the largest being 1,018.

The logsin table logsin[] is calculated by f(x)=round(-log(sin((x+0.5)*pi/512))/log(2)*256) for x from 0 to 255. It requires 12 bits to represent all values (largest is 2,137) and represents the first rising quarter of a sine wave.


Waveforms

The original OPL only has access to the sine wave.

From the OPL2 onwards other waves are also available, specifically a half sine (i.e. the positive part only, silence for the second half of the period), rectified sine (the positive part repeated twice per cycle) or quarter sine (just the first ramp from 0 to 1, repeated twice, providing harmonics a lot like a sawtooth).

The OPL3 goes even further, adding some extra sine options plus a square wave and a logarithmic sawtooth.

Waveforms OPL3.jpg


FM Percussion Set

FM synthesis does a great job relative to its hardware requirements at reproducing melodic instruments but isn't especially useful for harsh percussion noises like drums. Yamaha provides separate drum noises for this purpose. The programmer has to forfeit three channels of regular FM synthesis, freeing up six operators for five rhythm instruments.

A global random level generator is implemented for this mode; it's a standard LFSR just like the noise generator on simple chips like the AY-3-8910 or SN76489, so it provides a one-bit semi-random output.

The OPL can then generate:

  • a bass drum, which is just another FM noise;
  • a tom tom, which is the unmodulated output of a single operator;
  • a snare drum, which combines the phase of a single operator with the random noise bit;
  • a cymbal which XORs six bits from the phase of two operators;
  • a high-hat, which uses the same XOR as the cymbal and combines it with the random noise bit.