This book is for everyone with a BBC micro. Whatever your reasons for buying a computer, your decision to purchase a BBC micro has been rewarded with a very versatile and powerful machine. If all its features were investigated thoroughly, the resulting books would occupy several shelves. This book is about one of its most exciting features - the sound generator.
The inclusion of a sound generating chip in personal computers is a fairly recent development and it is no doubt responsible, along with advanced graphics capabilities, for the growing interest in computers.
Over 75 per cent of all information we receive from the outside world comes through our sense of sight, so it is hardly surprising that computer graphics tend to dominate computer advertisements. But what is a missile exploding without a bang, and what is a flight simulator or powerboat race without the whine of the engines? Music and sound have a greater effect upon us than you may realise. The next time you're watching a horror movie or car chase on TV, turn the sound off for a moment and you will see how much the music and effects contribute to the excitement. It is a case of the sum of the parts being greater than the whole and the addition of sound to any computer program, even a utility program, can more than double its enjoyment and effectiveness.
As well as sound effects, the BBC micro can be programmed to produce music. This opens up a totally new area for exploration, an area without precedence in the world of personal computing. Armed with the ability to produce ordered sequences of notes, we have a complete music system which can not only play tunes in three-part harmony, but which is imbibed with the speed and decision-making attributes of a computer.
As the BBC micro underwent development, various additions and modifications were made to the Operating System, which resulted in the issue of at least three separate OS chips. The first was called OS 0.1: it contained an infamous number of bugs and was way below specification. Subsequent issues cured the bugs and included many 'enhancements' and new functions which made the BBC micro even more powerful. The main problem with OS 0.1 was the notorious 'cassette bug' which sometimes refused to save the first block of a program. This and other bugs relating to plotting routines and data handling with PUT and GET have been fixed.
Enhancements include the use of the function keys with the SHIFT key and CTRL key to produce teletext effect codes in mode 7. These allow colour codes and graphics characters to be printed directly on to the screen. Additions have been made to the PLOT command to include fill routines and there are a host of new *FX commands and OSBYTE calls which give direct access to the Operating System through BASIC commands. Some of these are fisted on page 418 of the User Guide, but many more are undocumented and are only coming to light through exploration.
The new Operating Systems should have been upward compatible but, for a variety of reasons, some programs which worked on OS 0.1 will not work on OS 1.2. Any programs using the new features of OS 1 .2 will not, of course, work on OS 0.1. If you do not have OS 1.2, it is really worthwhile having it fitted because, soon, most new software will not run on the old system as programmers will use more of the new commands.
The programs in this book were written with OS 1.2, although they may run on earlier versions. To check what version is in your machine type:
*FX0
This will print the OS number. If you need a new Operating System, contact your dealer.
The aim of this book is to act as a springboard for further experiments and programs which I hope you will write and develop. The accent is on sound and music and how you can get the best from the powerful sound generating system incorporated in the BBC micro.
The programs are written in a fairly structured manner and are documented so that you can understand the workings behind them. Generally, they will not have many frills, which should minimise the time required to enter them and should help to cut down on mistakes. The overall appearance of a program is as important as the performance, and suggestions regarding the finishing touches are made where relevant. These can be added later to suit your own taste and style. Suggestions for further experiments, alterations and developments are also made, usually in such cases where a subject has too many aspects and is too complex to tackle completely - without writing another book.
This book was written to be read from Chapter 1 onwards, but you can dip into it at whichever chapter takes your fancy. For those who decide to read it so, I make no apologies for the odd repetition of information and the constant referral to other chapters. Those well versed in music and computing will forgive me; those who are not so accomplished will, I hope, thank me.
Whether you are looking for a new laser sound for your latest arcade game, whether you want to write a new tune for your musical doorbell, whether you want to use the computer to help you learn about music, whether you want to add something to the business utility program you've written or whether you simply want to see what you can do with the SOUND and ENVELOPE commands, I hope this book contains something for you and that it will encourage you to carry on experimenting from where I leave off.
Before you begin, perhaps I can refer you to the appendices which contain hints and tips about entering and merging programs and other information you may find of interest. Please read them before entering programs.
Some of you might be unwilling to enter some of the longer programs in this book, because of the time this will take. For anyone who does find this a problem, a tape of these programs is available from me, Ian Waugh, do Sunshine Books, 12-13 Little Newport Street, London WC2R 3LD, for £5.95, including p&p. Available for readers in the UK only.
I would like to thank John Paisley for his help in measuring and listing the output frequencies of the sound chip and Leslie Thwaites for checking my early programs.
Thanks too, to David Lawrence for his encouragement and to Jenny Ireland for her international persistence.
Warning: When entering programs from this book, please be careful that you key them in correctly. Copy from a computer printer can be rather faded - commas, in particular, may look like full stops at first glance.