•  Back 
  •  Main 
  •  Index 
  •  Tree View 
  •  Cross references 
  •  Help 
  •  Show info about hypertext 
  •  View a new file 
Topic       : The GFA-Basic Compendium
Author      : GFA Systemtechnik GmbH
Version     : GFABasic.HYP v2.98 (12/31/2023)
Subject     : Documentation/Programming
Nodes       : 899
Index Size  : 28056
HCP-Version : 3
Compiled on : Atari
@charset    : atarist
@lang       : 
@default    : Document not found
@help       : Help
@options    : +g -i -s +z
@width      : 75
@hostname   : STRNGSRV
@hostname   : CAB     
@hostname   : HIGHWIRE
@hostname   : THING   
View Ref-FileSOUND [chan,vol,note,octave,del]
SOUND [chan,vol,#per,del]
WAVE [voice,env,form,freq,del]

chan, vol, note, octave, del, per, voice, env, form, freq: iexp

SOUND and WAVE serve to control the three-channel tone generator of the Atari
ST, the three channels having nothing to do with the data channels used to
communicate with peripheral devices and files. The parameters have the
following meanings:

    chan    Channel number (1 to 3)

    vol     Volume (0 to 15)

    note    Note (1 to 12) determines the note as follows:

            Note: 01  02  03  04  05  06  07  08  09  10  11  12
            Tone: C   C#  D   D#  E   F   F#  G   G#  A   A#  B

    octave  Octave (1 to 8)

    del     Delay in 1/50ths second before the next GFA-BasicGFA-Basic is the best BASIC for the Atari!
 command is
            executed.

    per     Period of the wave form multiplied by 125000. Thus for a given
            frequency, per=ROUND(125000/frequency). In the alternative form of
            the SOUND command, #per can be used to replace the note and octave
            parameter, e.g. SOUND 1,15,10,4,250 and SOUND 1,15,#284,250 both
            produce a tone of 440Hz. (Range 0 to 4095)

    voice   Channel combination: with WAVE, any channel or combination of
            channels may be activated simultaneously. The value of 'voice' is
            256 multiplied by the period (0 to 31) of the noise generator, plus
            the sum of the following:

            Bit  Value  Description (low byte)
            0     1     Channel 1 tone enable
            1     2     Channel 2 tone enable
            2     4     Channel 3 tone enable                noise enable
            3     8     Channel 1 noise enable               |noise enable
            4    16     Channel 2 noise enable               ||noise enable
            5    32     Channel 3 noice enable               |||tone enable
            6    64     Port A: 0=input/1=output             ||||tone enable
            7   128     Port B: 0=input/1=output             |||||tone enable
                                                             ||||||
            This is a word constructed as follows: ---PPPPPBA321321
                                                      |||||
                                        (0-31) noise period

    env     Specifies the channels for which the envelope shaper (see
            'form') is to be active. Its value is the sum of the following:

            Bit  Value  Description
            0    1      Channel 1                       channel 3
            1    2      Channel 2                       |channel 2
            2    4      Channel 3                       ||channel 1
                                                        |||
            This is a byte constructed as follows: -----321 (Range: 0-3)

    form    Specifies the envelope shape (0 to 15) thus:

            Bit    Value  Description                    Shape
index=572
00xx 0-3 same as 9 01xx 4-7 same as 15 1000 8 Falling saw tooth 1001 9 Falling linearly 1010 10 Triangle, beginning with fall 1011 11 Falling linearly, then to max 1100 12 Rising saw tooth 1101 13 Rising linearly and holding 1110 14 Triangle, beginning with rise 1111 15 Linear rising, then to zero This is a byte constructed as follows: ----CAAH |||| |||hold ||alternate |attack continue freq Frequency of the wave form. (Range is 0-65535.) Controls the release of the envelope generator. Tone generation is begun by the SOUND or WAVE command and ended by another SOUND or WAVE command (SOUND 1,0,0,0,0 produces silence). As the operating system uses the sound chip to produce a keyboard click, this also terminates an on-going sound output situation. The keyboard click can be disabled by: SPOKE &H484,BCLR(PEEK(&H484),0) ...and enabled by: SPOKE &H484,BSET(PEEK(&H484),0) These two statements have the effect of setting bit 0 of memory location &H484 to zero or one respectively. The period of the envelope is determined by the parameter 'del'. With both SOUND and WAVE, the parameters are remembered, so that for subsequent use with similar parameters, it is only necessary to specify parameters up to the one that is to change: after WAVE 7,7,0,10000,100, it is only necessary to type WAVE 1 to change the first parameter, leaving the others the same. Example: SOUND 1,15,1,4,20 SOUND 2,15,4,4,20 SOUND 3,15,8,4,20 WAVE 7,7,0,65535,300 --> A tone is produced with each channel and modulated by means of WAVE. Memo: These commands use movep.w internally and could be fatal on a machine fitted with a 68060 cpu. No proper range checking on any of these parameters. SOUND or WAVE with no parameters, stops all sound. SOUND command undocumented behavior: Channel: 0 is the same as channel 1. Volume: 16 allows envelope control like WAVE. (bit 4 = 1) Dosound()+, Giaccess()+, The Programmable Sound Generator+