CODINGLISTINGS ★ Sound advice ★

Sound - Sound Advice (Popular Computing Weekly)Coding Listings
★ Ce texte vous est présenté dans sa version originale ★ 
 ★ This text is presented to you in its original version ★ 
 ★ Este texto se presenta en su versión original ★ 
 ★ Dieser Text wird in seiner Originalfassung präsentiert ★ 
Design your own sounds on the Amstrad machines with this urogram from John Durst

One of the most ambitious features of the Amstrad machines is the system which produces computer music. With up to three channels on the go, along with volume envelopes and tonal modulation, it can produce quite impressive Victory fanfares and the like. But the cost in human wear and tear is appalling; people have been found running through the snowy streets in their underwear, scattering handfuls of graphs and data lists. Before things get hopelessly out of hand, something must be done to reduce the drudgery. And here, for a start, is a Basic program which can help.

The two features which most affect the quality of a musical note (in Amstrad terms) are the Volume Envelope and the Tone Envelope. The first allows you to sculpture the loudness of the note; the second modifies the frequency of the note, with much the same effect as the way a violinist waggles his finger on the string to give an added richness to the note he is playing. Both these features can be coded, using the Env function (for Envelope Volume) and the Enc function (Envelope Tone). These two functions are programmed in Basic as Data lists, which can be read off by the Sound command. They have to be entered as lists of figures, which must be calculated in advance - usually from graphic sketches of the shapes of envelope required.

Now. graphics and calculations are two things computers are very good at, so why not get the Amstrad to take the sweat out of coding the envelopes ? The program here lets you draw the outline of the envelope you are planning, on the TV screen. As described in the User Instructions (Ch6, p8), the envelope has to be made up of straight-line sections; in this program, you hit the Enter key at the end of each section you have drawn and the computer calculates and stores the appropriate values (and prints them out). When you have designed your envelope you hit the Numeric Pad Enter and the whole thing is converted mto an Env (or Enf) function and the musical note is played. You can then go on to design another one and see how that works.

There is room for up to 15 of each kind of Envelope (stored in two arrays) and, obviously, these can be Saved and used later in your own programs.

Program Notes

  • 1-100 Lets you choose whether you want to design for Env or Ent. They also set up the arrays (Line 5); "ev", for Volume; "et" for Tone; and "en" as a working array in which to hold the values you enter.
  • 160 Sends you to a subroutine which draws the graph paper. It comes up in dark blue and light blue squares, with whitish lines and a general black background.
  • 170-380 Does the actual drawing of the graphs, in 4-pixel horizontal, or vertical steps. These are controlled by the cursor pad. If you make a mistake, you can rub out (more or less) the lines you have drawn by keying Copy - and then going back over the steps you have taken. Copy again will put you back on visible graphic lines. Don't expect too much of the corrections, though; if you make a real hash, it is better to start again.
  • 240 Prints your vertical position, relative to the baseline, to help you to get back to 0 at the end of your envelope. When you have completed each stepped section, key (Numeric) Enter for the next phase.
  • 360-470 This section does the calculations to get the figures for Env or Ent, luckily they both take the same form.
  • 360 First, this line sorts out whether there is a matching number of vertical and horizontal entries. If there has been a mistake, it will signal, 'Unmatched number of steps', and you have to look at the drawing and decide whether there should be one more vertical. or one more horizontal entry. If all is well, the calculations are made and the three parameters printed out. You then get a chance to enter another section -up to five.
  • 490-630 Finally, this section enters the figures in the "ev" or "et" arrays and plays you the result. By the way, it will play the envelope you have just designed, accompanied by the last one it finds, in the array holding the alternative function. Enter starts you off on a new envelope; any other key plays the note again.

A program of this kind relies heavily on single, plus or minus increments. You are dealing all the time with the three numbers 1 , 0 and 1. Hence the rash of flags, "Sgn" and "Abs". Basic is very cumbersome when coping with this; look at Lines 330/340, for instance. This is a case when machine code would be both neater and easier to understand. However, the whole thing seems to work and it really does help to take some of the headache out of Amstrad music.


★ YEAR: 1985
★ AUTHOR: John Durst


» Sound  Advice    (Popular  Computing  Weekly)    ENGLISH    LISTINGDATE: 2017-05-07
DL: 28 fois
SIZE: 115Ko
NOTE: Uploaded by hERMOL ; 2 pages/PDFlib v1.6

Je participe au site:
» Newfile(s) upload/Envoye de fichier(s)
★ AMSTRAD CPC ★ A voir aussi sur CPCrulez , les sujets suivants pourront vous intéresser...

» Coding Src's » Disassembly of AMSDOS ROM
» Coding Src's » Origins (Computing With the Amstrad)
» Coding Src's » Window-Routinen (CPC Amstrad International)
» Coding Src's » Graphic - Arnjewel (Amstrad Computer User)
» Coding Src's » Invasion (Amstrad Computer User)
» Coding Src's » 3D Donut (CPC Computing)


L'alinéa 8 de l'article L122-5 du Code de la propriété intellectuelle explique que « Lorsque l'œuvre a été divulguée, l'auteur ne peut interdire la reproduction d'une œuvre et sa représentation effectuées à des fins de conservation ou destinées à préserver les conditions de sa consultation à des fins de recherche ou détudes privées par des particuliers, dans les locaux de l'établissement et sur des terminaux dédiés par des bibliothèques accessibles au public, par des musées ou par des services d'archives, sous réserve que ceux-ci ne recherchent aucun avantage économique ou commercial ». Pas de problème donc pour nous!

CPCrulez[Content Management System] v8.7-desktop/cache
Page créée en 105 millisecondes et consultée 1015 fois

L'Amstrad CPC est une machine 8 bits à base d'un Z80 à 4MHz. Le premier de la gamme fut le CPC 464 en 1984, équipé d'un lecteur de cassettes intégré il se plaçait en concurrent  du Commodore C64 beaucoup plus compliqué à utiliser et plus cher. Ce fut un réel succès et sorti cette même années le CPC 664 équipé d'un lecteur de disquettes trois pouces intégré. Sa vie fut de courte durée puisqu'en 1985 il fut remplacé par le CPC 6128 qui était plus compact, plus soigné et surtout qui avait 128Ko de RAM au lieu de 64Ko.