Most of the features of the SDL 2.0 port of BBC BASIC are either identical to, or have some restrictions compared with, their equivalents in BBC BASIC for Windows. However there is one major exception - SOUND and ENVELOPE. I have taken advantage of SDL's multimedia capabilities to support, out of the box, the High Quality (44.1 kHz, 16-bit, stereo) sound only available from BB4W by using the HQSOUND library.
Now I've gone even further by implementing two new commands to control the sound system: *STEREO and *VOICE; these have approximately the same functionality as the STEREO statement and the *CHANNELVOICE command in ARM BASIC (on RISC OS). Their syntax is as follows:
*STEREO chan,pan
*VOICE chan,waveform
where
chan is an integer value from 0 to 3,
pan is an integer value from -127 (fully left) to +127 (fully right), and
waveform is an integer value from 1 to 8. These commands are available in
BBC BASIC for SDL 2.0 v0.10a; the
Linux (x86) version can be downloaded from
http://www.rtr.myzen.co.uk/bbclinux.zip.
It gave me considerable satisfaction to provide the same eight waveforms that I chose for my Z80 Music program in 1981! That used only 8-bit samples so I performed a Fourier analysis to discover the harmonic content and synthesised new 16-bit waveforms to match the originals, but with much better quality.
Here the *VOICE command is used to reproduce, approximately, the original Z80 Music waveform switching in Ron Stickley's 1983 transcription of Come To The Fair.
Richard.