ZX Forum #04
19 ноября 1997

world of sound Spectrum - Chapter 5: The operator PLAY for music coprocessor AY- 3-8910 (AY-3-8912).

<b>world of sound Spectrum</b> - Chapter 5: The operator PLAY for music coprocessor AY-
3-8910 (AY-3-8912).
             5. Operator PLAY


   With this chapter begins the book,
dedicated music coprocessor AY3-8910 (or AY-3-8912), built-in 
ZXSpectrum 128, as well as in all its variations. 

   When you turn on ZX-Spectrum 128 on-screen menu appears, 
offering a choice of a few points. They are all well described 
in [2], in our case, select 128 BASIC. In this mode, you become

available operator PLAY, music service co-processor.

   In general, the format statement PLAY looks like this:


   PLAY A $ [, B $, C $, D $, E $, F $, G $, H $]

where A $ ... H $ - character string specifying
music program. Coprocessor itself uses to manage its three 
channels (A, B and C) only A $, B $ and C $. If you three 
channels a lot, you can only use two or even one, setting the 
appropriate number of strings (Empty string also indicates that

channel is not used).

   The remaining lines (D $ ... H $) are designed to control 
musical instruments, which can be connected to the ZX-Spectrum 
128 via MIDI-interface. 

   All defined Thong performed simultaneously, which allows you 
to create complex and beautiful melodies.


   In Thong uses special commands. Dwell on them in detail.

   Notes do, re, MI, FA, SOL, LA, and SR denote the current 
octave lower case Latin letters, respectively, c, d, e, f, g, a 
and b (international standard). Notes of the next octave 
indicated by capital Latin letters C, D, E, F, G, A and B. For 
example, the operator 


   PLAY "cdefgabC"

lose range of C major.

  Halftones are given marks # (sharp) and $
(Flat) facing the note. For example,
C sharp is written as # c, and B-flat -
$ B. To play a scale in C minor, enter


   PLAY "cd $ efg $ a $ bC".


   Permissible to use a few sharps or flats in a row. For 
example, note d can be written as # # c.


   Length is determined by a number from 1
to 9, standing in front of the note (Table 3). Installed length 
applies to all subsequent notes and rests (see command

&). By default duration is 5 (one quarter).

   In addition to traditional music, you may ask
triplets. For this purpose, the number of 10
12. Notes triplets follow directly after the number. For 
example: 


   PLAY "3fed & 11fed & fed"


   Triplets do not alter the established duration of notes. 
Besides the standard duration of notes you can use arbitrary. 
To do this in front of the note by the underscore character 
("_") put several parameters defining the desired length. For 
example, a note to a duration of 3 / 8 (1 / 8 +1 / 4) can be 
written as follows: "3_5c". The duration of follow-up notes and 
rests specifies the last option in the bundle.


   Quite strange effects are obtained
when connecting to the usual duration of notes and
triplets (eg: "3_12cde"). Experiment with it.

   Pro recording music, like, everything. Now on
commands:

   O - changed octave. Number of octaves must be a number from 
0 to 8 following the team (default octave 5).


   Relevance command option O musical octave is given in Table. 
4. Notice that the notes an octave below b 1 without a 
MIDI-interface will be played correctly. It is also important 
that although the maximum number is eight octaves, you are free 
to use the following - the ninth, denoting notes in capital 
letters. 

   N - delimiter options. Used to separate the two numerical 
parameters from each other. For example, when you have to ask

duration of the note immediately after the installation of an 
octave: "O4N5d". In essence, this team is overkill, because 
instead You can use the blank: "O4 5d".


   & - A pause. Pause time is set as well as the duration of 
notes (See above). For example: "6c & de3 & de".


   V - set the volume. Volume is given a number from 0 (minimum 
- off) to 15 (maximum). For example: "V10". The default volume 
is 15. 

   W - programming effects. Sheet music can be played not only 
with a fixed volume, but also with all sorts of effects: decay, 
wavelets, etc. Nature of the effect given by the number from 0 
to 7 in accordance with the Table. 5. Default

set the effect of 0.

   X - time parameter is the sound effect. For the effects of 0 
... 3 parameter sets duration of action for 4 and 5 - a period

6 and 7 - halftime (see Table 5). Value
parameter is chosen from a range of 0 ...
65535. The default setting is 65535.

   Effects are disabled at the end of thongs or when the volume 
(command V).


   The following program will demonstrate
action of all the effects:


   10 FOR A = 0 TO 7

   20 PLAY "UX1000W" + STR $ A + "cdef &"

   30 NEXT A


   Unfortunately, the music co-processor is only one envelope 
generator, so you will not be able to configure multiple 
channels for different effects simultaneously. Although the 
same effects you can use in multiple channels, with parameters 
of the envelope must be set only one of them, and the rest is 
enough to specify a command U (see above). 

   T - the pace of execution. Given by the number of
60 to 240. By default
pace, the team T120. You can only set the pace for the whole 
tune in Overall, therefore, it is defined only in

string of channel A (in other channels of T team is ignored.)

   (.) - Repeat (reprise). Music
phrase, bracketed, repeated twice. Permissible to use brackets 
in brackets (up to 4 attachments). Closing bracket without a 
corresponding opening will make a musical phrase repeated 
endlessly from the beginning of string. Use it For example, a 
bass and drum parts. 

   H - Stop operator PLAY. Met
this command in a string of any channel operator PLAY finished. 
Team used, for example, to exit the "looped" bass line, the end 
of the main melody. 

   !. " - A comment. Used to
insert explanatory. For example:


   PLAY "! SCALE:! CdefgabC".


   If after a string of comments in any commands not, then 
closing mark "!" set is optional.


   M - sets the mode channels.
Each channel can play not only a pure tone, but also the 
so-called white noise. The distribution of modes is given a 
number from 1 to 63, determined by the sum of the codes 
appropriate mode for each channel (Table 6). As well as an 
envelope generator, noise generator in the music co-processor 
only one, so you will not be able to configure multiple 
channels simultaneously noise with different frequency. By 
default, all three channels are set to tone (command M7).


   In the following example, channel A is set to the tone, and 
the channel B - the noise: 


   PLAY "M17cegbdfaCH", "O3cC)".


   If you tell M0, then all channels will be silent and you 
hear the crackling. 

   Y - install channel MIDI-interface.
A number from 1 to 16 following the team
specifies the number of channel interface, which
need to output music
data.

   Z - transfer control codes MIDI-interface. Code MIDI (a 
number from 0 to 255) must be located directly behind the team.

Permissible to pass just two bytes. In
this case, their values ​​must be separated
from each other by a space or a team of N.

   Note that all commands of the operator PLAY should be typed 
in capital letters! 

   Finally, we give a brief summary of the commands of the 
operator PLAY (Table 7) and messages errors that may occur 
during execution time (Table 8).








Other articles:

Help - Description of the shell of an electronic book "ZX-FORUM 4.

Secrets of Successful Design - Head for the book "Design your Programs

screen effects - Running a string of R-Type.

screen effects - clearing the screen of Zynaps.

screen effects - "minimize" the screen from Comando Tracer.

screen effects - smooth "decay" of the screen Sommando Tracer.

screen effects - changed the character set for the original stylized font from the game Rockstar.

screen effects - "running out the string" out of the game Rockstar.

screen effects - "pouring" the screen of the game Rockstar.

screen effects - a complex multi-effects from the game Bubbler.

New top 40 procedures - scrolling display, a fusion of two images, inverting screen, rotate characters, replacement of attributes, fill a closed loop, the calculation of addresses in the screen, copy of the screen, etc.

Technology sprites - Part 1: Introduction.

Technology sprites - Part 2: The hunt for sprites (search and pulling).

Technology sprites - Part 3: Format of sprites.

Technology sprites - Part 4: Format of sprites with a mask.

Technology sprites - Part 5: Structure sprite blocks (both co-exist in memory sprite and mask, what data to help us quickly find the address of the sprite in memory, and much more.)

Technology sprites - Part 6: preparation of data for publication.

Technology sprites - Part 8: Printing sprites (coordinates are given in familiarity).

Technology sprites - Part 9: Printing sprites (coordinates given in pixels).

Technology sprites - Part 10: a review of programs to work with sprites and graphics.

world of sound Spectrum - Chapter 1: The Physics of Sound.

world of sound Spectrum - Chapter 2: Operator BEEP, Creating effects on BEEPe, Making Music on BEEPe.

world of sound Spectrum - Chapter 3: How is the sound device (BEEP'ra and methods of sound production).

world of sound Spectrum - Chapter 4: Programming sound in assembler.

world of sound Spectrum - Chapter 4.1: Programming sound effects - Tone, Noise, Complexes effects.

world of sound Spectrum - Chapter 4.2: Programming Sound Effects - Volume Control.

world of sound Spectrum - chapter 4.3: Sound Effects - Management timbre.

world of sound Spectrum - Chapter 4.4: Programming sound effects - music programming.

world of sound Spectrum - Chapter 4.5: Programming sound effects - Polyphonic ringtones (polyphonic).

world of sound Spectrum - chapter 4.6: Treatment of external signals - digitization.

world of sound Spectrum - Chapter 4.7: Handling of external signals - Reverberation.

world of sound Spectrum - chapter 4.8: Synthesis of speech.

world of sound Spectrum - Chapter 4.9: audio playback interrupt.

world of sound Spectrum - Chapter 5: The operator PLAY for music coprocessor AY- 3-8910 (AY-3-8912).

world of sound Spectrum - Chapter 5.1: Creating effects operator PLAY.

world of sound Spectrum - Chapter 5.2: Making Music on PLAYe.

world of sound Spectrum - Chapter 6.1: Description of the coprocessor registers of the musical AY- 3-8910 (AY-3-8912).

world of sound Spectrum - Chapter 6.2: Programming effects and music under the musical coprocessor AY- 3-8910 (AY-3-8912).

world of sound Spectrum - Chapter 7: Software Review ZX-Spectrum to create sounds and music.

world of sound Spectrum - chapter 7.1: Editor, Sound Effects SUPER SOUND.

world of sound Spectrum - Chapter 7.2: Music Editor Wham the Music Box.

world of sound Spectrum - Annex 1, 2: Listings sound effects SUPER SOUND'a, tips assembler.


Темы: Игры, Программное обеспечение, Пресса, Аппаратное обеспечение, Сеть, Демосцена, Люди, Программирование

Similar articles:
about people ... - On the history of education and plans of the group "ZX-Masters".
List BBS - A list of current BBS in the city of St. Petersburg.
Interview with Arty Noonzen - an interview with the organizer of Digital Reality.
Interview - An Interview with Kvazar'om of RUSH.
System - Description of program: Y-COMMANDER & MS COMPILER v1.08.

В этот день...   21 November