Emulates the General Instrument AY-3-8910 (a.k.a. the Yamaha YM2149) 3-voice sound chip, as found in the ZX Spectrum 128, the Atari ST, and various other home computers during the 1980s.
The emulation is provided by the libayemu library: http://sourceforge.net/projects/libayemu - I have merely wrapped it up as a SC UGen.
Typically, we think of oscillators as vibrating around zero (balanced output, with no DC offset).
The AY chip has three pulse oscillators and one noise oscillator (which may be multiplied in with the other oscillators' signals). They vibrate as follows (note that their sum is scaled down to valid floating-point signal range):
|Oscillator||Low value||High value|
control input controls whether the oscillator will be used or not, and whether the pulse wave will be multiplied by noise or not.
control disables an oscillator, it produces its nonzero value as DC. This way, the three oscillators working together can access all 8 possible states resulting from three bits.
This means oscillator B will be perceived to be quieter than A, and C quieter than B.
This characteristic can be used to simulate wave shapes. For example, if A:B:C = fundamental : octave : 2 octaves, mixing the three oscillators at equal volume is close to a sawtooth wave.
integer "tone" value for the first of the three voices, from 0 to 4095 (i.e. 12-bit range). Higher value = lower pitch. For convenience, the *freqtotone method converts a frequency value to something appropriate for the tone input.
integer "tone" value for the second of the three voices. See description of tonea.
integer "tone" value for the third of the three voices. See description of tonea.
the period of the pseudo-random noise generator, 0 to 31
controls how the noise is mixed into the tone(s), 0 to 63 (0 is mute). This is a binary mask value which masks the noise/tone mixture in each channel, so it's not linear.
Six bits are used:
Control value 7 will mix A, B and C's clean tones together. Control value 0 reduces all oscillators to DC.
volume of the first of the three voices, 0 to 15 (or 0 to 31 if using YM chiptype).
volume of the second of the three voices, 0 to 15 (or 0 to 31 if using YM chiptype). Its perceived volume is 1/2 of oscillator A's volume.
volume of the third of the three voices, 0 to 15 (or 0 to 31 if using YM chiptype). Its perceived volume is 1/4 of oscillator A's volume.
envelope frequency, 0 to 4095
type of envelope used, 0 to 15
0 for AY (default), 1 for YM. The models behave slightly differently. This input cannot be modulated - its value is only handled at the moment the UGen starts.
general multiply controls for the resulting signal
general add controls for the resulting signal
converts a frequency value to something appropriate for the tonea, toneb and tonec inputs.