[BBC-Micro] Envelope command in Basic V
splodge at starfleet.homeunix.net
Sun Nov 19 17:01:58 GMT 2006
Tim Matthews wrote:
> Hi chaps,
> I've just been browsing Wikipedia as one does, and read: "the ENVELOPE
> keyword from BASIC V onwards is a command which takes fourteen numeric
> parameters and does nothing".
> Is this right? Why? So how does one get fancy sounds in Basic V?
Not right at all in fact.
ENVELOPE does not exist on Basic V (the Archimedes version of Basic) as
the sound system is different from the 8-bit micro. ENVELOPE on the BBC
Micro has been available from BASIC I, and takes an envelope number, and
13 parameters to define the pattern of a sound. One set defines pitch
variations, the other amplitude variations.
Anything for reasonably close violin sound to the sound of your
favourite police chopper can be created. Internally, the OS uses these
parameters to control the pitch and amplitude of the given channel (in
the SOUND statement) to follow the defined pattern. The sound chip can
only generate square wave tones (on 3 channels) or noise (channel 0),
and can't do complex digital audio*.
The sound system on the Archimedes on the other hand, has an 8-channel
44kHz digital audio system, run by VIDC. Sound patterns are defined by
modules which create sound wave data on demand as required by the OS
(and in turn, Basic V). Given that this sound pattern could be anything,
trying to get it to conform to an ENVELOPE would be seen as mildly
pointless (would you want a police siren to vary wildly in pitch?).
Getting a "fancy sound" in Basic V pretty much involves writing your own
module in ARM assembly, though you may find a number of examples of
skeleton source code (i.e. "enter your wave data here" programs) that
can make things easier.
The wikipedia article is clearly somewhat misguided :)
* It is actually possible to get the SN76489AN chip to do digital audio,
as is demonstrated by Bonecruncher's loading screen, and also SPEECH!
This isn't true digital audio, as the chip can only do tones & noise,
but involves setting the tone to some ridiculously high non-audible
frequency, so that the speaker cone appears to sit at a halfway point,
then vary the amplitude rapidly (i.e. beyond the capabilities of SOUND
and ENVELOPE, so machine code) to make that half-way point move up and
down. The result to our ears is reasonable analogue audio wave.
> This e-mail (and any attachments) is confidential and may contain personal views which are not the views of the BBC unless specifically stated.
> If you have received it in error, please delete it from your system.
> Do not use, copy or disclose the information in any way nor act in reliance on it and notify the sender immediately.
> Please note that the BBC monitors e-mails sent or received.
> Further communication will signify your consent to this.
> bbc-micro mailing list
> bbc-micro at lists.cloud9.co.uk
More information about the bbc-micro