Skip to navigation

Revs on the BBC Micro

Sound: soundData

Name: soundData [Show more] Type: Variable Category: Sound Summary: OSWORD blocks for making the various game sounds Deep dive: The engine sounds
Context: See this variable in context in the source code References: This variable is used as follows: * MakeDrivingSounds uses soundData * MakeSound uses soundData * MakeSoundEnvelope uses soundData

Sound data. To make a sound, the MakeSound passes the bytes in this table to OSWORD 7. These bytes are the OSWORD equivalents of the parameters passed to the SOUND keyword in BASIC. The parameters have these meanings: channel/flush, amplitude (or envelope number if 1-4), pitch, duration where each value consists of two bytes, with the low byte first and the high byte second. For the channel/flush parameter, the top nibble of the low byte is the flush control (where a flush control of 0 queues the sound, and a flush control of 1 makes the sound instantly), while the bottom nibble of the low byte is the channel number. When written in hexadecimal, the first figure gives the flush control, while the second is the channel (so &13 indicates flush control = 1 and channel = 3).
ORG &0B00 EQUB &10, &10 \ These bytes appear to be unused EQUB &10, &10 EQUB &10, &10 EQUB &10, &10 EQUB &10, &10 EQUB &10, &10 EQUB &10, &10 EQUB &10, &10 .soundData EQUB &10, &00 \ Sound #0: Engine exhaust (SOUND &10, -10, 3, 255) EQUB &F6, &FF EQUB &03, &00 EQUB &FF, &00 EQUB &11, &00 \ Sound #1: Engine tone 1 (SOUND &11, -10, 187, 255) EQUB &F6, &FF EQUB &BB, &00 EQUB &FF, &00 EQUB &12, &00 \ Sound #2: Engine tone 2 (SOUND &12, -10, 40, 255) EQUB &F6, &FF EQUB &28, &00 EQUB &FF, &00 EQUB &13, &00 \ Sound #3: Tyre squeal (SOUND &13, 1, 130, 255) EQUB &01, &00 EQUB &82, &00 EQUB &FF, &00 EQUB &10, &00 \ Sound #4: Crash/contact (SOUND &10, -10, 6, 4) EQUB &F6, &FF EQUB &06, &00 EQUB &04, &00