Magazine Archive

Home -> Magazines -> Issues -> Articles in this issue -> View

Music Sequencer

Article from Electronic Soundmaker & Computer Music, December 1983

Some interesting possibilities


A simple but versatile sequencer programme designed for Atari and other micros by Gary Herman

Having worked your way through the pings and plonks that a simple computer sound instruction offers, you will doubtless find yourself keen to expand your musical horizons. Sequencing is probably the most important step in such an expansion — by utilising the computer's memory a sequencing programme obviates the need to write a new programme each time you want to play a new tune. Storing notes for subsequent replay is the essence of composing — in traditional as much as in electronic media.

This programme - essentially the skeleton of a composing package for ATARI machines — offers maximum versatility with minimal notation. It does print out the sequence of stored notes (up to 99) before playing them and, despite its obvious limitations it does produce much more natural and pleasant tones than most commercial composing software.

Altering or adding to the programme would be a fairly simple matter. Lines 10 to 50 determine the names, range and precise frequencies of the notes playable (two full octaves from C below middle-C to C above middle-C). The array A(T) stores the frequency data listed in lines 30 and 40. The string N$ gives all the acceptable note names (plus RST for rest). Lines 100 to 170 ask you to input a note name and duration in the form of a five-character string (eg CS204). The longest duration — 01 — is about three seconds. Lines 190 to 250 check whether the input corresponds to an aceptable note and duration, looping back if it doesn't (220, 230 and 240 are the heart of the programme and would repay study). Lines 270 to 320 play the most recently entered note, using B(Q) to store duration information and C(Q) to store frequency information. String X$ stores note names.

Lines 350 to 430, accessed by inputting "PLA" after a request for a note, play the sequence so far, displaying the note names on the screen. By manipulating the note array C(X), it would be a simple matter to change or delete any stored note, although for the sake of brevity such a facility has been omitted. For those intending to add an editing facility, the variable Q counts the notes entered and is therefore crucial. Tempo can be changed by altering the step variable in lines 290 and 390. This variable is minus the duration figure stored in B(X). More adventurous experimenters might try adding a facility to change the note envelope which is effectively controlled by the variable V in lines 290, 300, 310, 390, 400 and 410. (Changes to the programme can be made in mid-run by use of the 'break' key and the CONT instruction to stop and re-start the run. Memory is not cleared this way.)

Stringing Along



The programme is written in Atari BASIC (available on any Atari machine). This BASIC has a number of peculiarities, particularly in its treatment of strings and the lack of string arrays. However, it would be easy to use the MID$ feature of most BASICS in the relevant lines (230 and 270), removing the string dimension statements in line 10. The programme could be rewritten for any BASIC including a sound command specifying frequency and volume in simple numerical form (eg BBC, Texas, ORIC, SORD). The programme can be pared down to its absolute bones by omitting all lines but 5, 10, 20, 30, 40, 50, 170, 190, 220, 230, 240, 330, 380, 390, 400, 410, 430 and 450 (and changing GOTO 70 to GOTO 170 and GOTO 350 to GOTO 380).

Sequencer Programme Listing


1 REM ATARI SEQUENCER
2 REM COPYRIGHT G. HERMAN 1983
3 REM INITIALISE ROUTINE
5 Q = 0
10 DIM A(26), B(99), M$(5), N$(78), X$(495), Y$(1), Z$(5)
20 NS = "CN1CS1DN1DS1EN1FN1 FS1GN1GS1AN1AS1BN1 CN2CS2DN2DS2EN2FN2FS2GN2GS2 AN2AS2BN2CN3RST"
30 DATA 243, 230,217, 204, 193, 182, 173, 162, 153, 144, 136, 128, 121
40 DATA 114, 108, 102, 96, 91,85, 81, 76, 72, 68, 64, 60, 0
50 FOR T = 1 TO 26: READ X: A(T) = X:NEXTT
60 REM INPUT ROUTINE
70 FOR P=1 TO 500: NEXT P
80 TRAP 70
90 ZS=""
100 PRINT"": REM CLEAR SCREEN
110 PRINT "Input note (CN1, CS1,DN1,... CN3)"
120 PRINT "or rest (RST) or play (PLA)."
130 PRINT: PRINT "Note and rest should be followed by"
140 PRINT: "duration (01 longest to 48 shortest)."
150 PRINT: PRINT "(input example: CS204 plays"
160 PRINT "C-sharp, second octave, quarter note.)"
170 INPUT M$
180 REM CHECK INPUT OK
190 IF M$ (1,3)= "PLA" THEN 350
200 IF LEN (M$) 5 THEN PRINT "wrong length": GOTO 70
210 IF VAL (M$(4, 5)) 1 OR VAL (M$(4,5)) 48 THEN PRINT "duration not right": GOTO 70
220 FOR T = 1 TO 76 STEP 3
230 IF M$(1,3) = N$(T,T + 2) THEN R=(T+1)/3:Q = Q + 1:C(Q) = A(R): B(Q) = VAL(M$(4,5)):Z$ = M$
240 NEXTT
250 IF Z$ = " " THEN PRINT "mistake — try again": GOTO 70
260 REM PLAY AND STORE NOTE
270 X$(LEN(X$+ - ) = Z$
280 PRINT "current note"; Z$
290 FOR V = 144 TO 0 STEP - B(Q)
300 SOUND O, C(Q), 10, V/10
310 NEXT V
320 SOUND 0, 0, 0,0
330 GOTO 70
340 REM PLAY SEQUENCE
350 PRINT " ": REM CLEAR SCREEN
360 IF Q =0 THEN 70
370 PRINT X$, 99-Q; "notes left"
380 FOR T = 1 TO Q
390 FOR V = 144 TO 0 STEP - B(T)
400 SOUND 0, C(T), 10, V/10
410 NEXT V
420 SOUND 0,0, 0,0
430 NEXTT
440 PRINT: PRINT "Carry on (YIN)": INPUT YS: IF YS = "N" THEN END
450 GOTO 70


More from these topics


Browse by Topic:

Computing

Sequencing



Previous Article in this issue

MIDI

Next article in this issue

Speech Synthesis


Publisher: Electronic Soundmaker & Computer Music - Cover Publications Ltd, Northern & Shell Ltd.

The current copyright owner/s of this content may differ from the originally published copyright notice.
More details on copyright ownership...

 

Electronic Soundmaker - Dec 1983

Donated & scanned by: Mike Gorman

Feature by Gary Herman

Previous article in this issue:

> MIDI

Next article in this issue:

> Speech Synthesis


Help Support The Things You Love

mu:zines is the result of thousands of hours of effort, and will require many thousands more going forward to reach our goals of getting all this content online.

If you value this resource, you can support this project - it really helps!

Donations for April 2025
Issues donated this month: 1

New issues that have been donated or scanned for us this month.

Funds donated this month: £4.00

All donations and support are gratefully appreciated - thank you.


Magazines Needed - Can You Help?

Do you have any of these magazine issues?

> See all issues we need

If so, and you can donate, lend or scan them to help complete our archive, please get in touch via the Contribute page - thanks!

Please Contribute to mu:zines by supplying magazines, scanning or donating funds. Thanks!

Monetary donations go towards site running costs, and the occasional coffee for me if there's anything left over!
muzines_logo_02

Small Print

Terms of usePrivacy