-
Notifications
You must be signed in to change notification settings - Fork 2
5.0 Sound
The Oric's sound chip is an AY-3-8912 which has 3 tone channels, 1 noise channel and the ability to produce shaped waveforms (envelopes) independently of the 6502 CPU. To get the most from these commands, it is worth studying the AY-3-8912 chip features as an extensive description will not be given here.
There are three main sound functions, fairly similar to that provided by Oric BASIC.
The play command is the overall controller with the following syntax;
play tone:<int>,noise:<int>,env:<int>,period:<int>
tone: this is a 3 bit number (0 to 7) which specified which channels get pure tone (bit 0 = channel 1, bit 1 = channel 2, bit 3 = channel 3) noise: this is the same as tone but specifies which channels get noise env: this is the envelope setting to apply (0-15). Some settings are more useful than others (see examples) period: this is the period of the envelope (0-65535)
Some common settings are:
-
play 1,0,0,2000
: plays a short note on channel 1 which decays to zero -
play 1,0,0+8,2000
: plays a repeating series of notes on the previous example -
play 1,0,4,2000
: plays a short note on channel 1 which increases in volume from zero -
play 1,0,4+8,2000
: plays a repeating series of notes on the previous example
The sound command controls the frequency of the tone and noise channels;
sound channel:<int>,period:<int>,volume:<int>
-
- channel: this is the channel number to update - channel 1,2,3 represent the tone channel, 0 means the noise channel
-
- period: the frequency of the channel - 0-4095 for tone and 0-63 for noise
-
- volume: the volume of the tone channel (0-15) - not relevant for noise. If a tone volume is 0, then it will be controlled by the envelope waveform.
Technically, only play
and sound
are needed, the purpose of music is to help with creating tones on the musical scale;
music channel:<int>,octave:<int>,note:<int>,volume:<int>
-
- channel: this is the channel number 1, 2 or 3 as per sound (0 does not make sense)
-
- octave: this is the octave selection 0-5
-
- note: this is the note selection 0-11 (i.e. 12 standard intervals of an octave)
-
- volume: this is the volume selection as per sound
That is all the sound features in dflat. Although it looks simple, with some thought, it is possible to make really interesting effects through channel selection, noise mixing and envelope choices. For example it is perfectly easy to play a pure tone on one channel whilst a helicopter sound is played on another e.g. try;
play 3,2,4+8,150:sound 2,100,0:sound 1,300,10
To switch off all sound, issue play 0,0,0,0
Alas, there is no space as of yet to implement some classic Oric sounds such as ping, shoot, explode and the famous zap!