

                          FA10 Sound command sequencer
                                   7-1-90 -med

        The command sequencer consists of one byte per command with an 
        optional extended byte on some commands. There are two processing 
        methods available, a flat sequencer, and a compressed sequencer. 

        When the sequencer is in operation, the source is always tone 
        regardless of the setting of the Input switch for the channel. 
        The Hearing aid simulator settings are also ignored. The output 
        destination will be based on the setting of the output switch for 
        the channel. The Frequency switch has no direct effect. The level 
        switches will control the sound level. The basic sine filters are 
        used to generate the sound. The special low frequency low pass 
        filters are not used. Doing so would inject excessive popping 
        noises into the sound output. Not using the low frequency filters 
        is not an overly large problem. However, a very slight high 
        frequency buzz may be noticeable for some people in frequencies 
        below 300Hz or so. In normal manual operation of the audiometer 
        the low frequency filters are used to eliminate the residual 
        noise cause by the digital filtering at the lower frequencies.


        Flat Sequencer:

        The flat sequencer is the default standard sequencer used. There 
        are four command types available, a note command, a delay 
        command, a control command, and an extended command.

        Each note command is specific to a tone output which will 
        continue until a new command changes the condition. A new command 
        is processed every 8ms. If the same note command is given again, 
        then the note will continue to sound. A note command of zero will 
        turn off the tone.

        Note values of 0 through 11 are the standard audiometric 
        frequencies. Note values between 24 and 96 are standard music 
        scale frequencies. Note values between 12-23, and 97 on up are 
        undefined currently and should not be used. The sequencer will 
        not be upset, but the note presented is not defined at this time. 

        The delay command provides a means to delay the processing of 
        the next instruction. A delay value of zero will cause the 
        sequencer to fetch the next command on the next 8ms tick. A delay 
        value of one will cause the sequencer to delay the fetch by one 
        tick count, thus waiting an additional 8ms before fetching the 
        next instruction. Note that since the sequencer takes 8ms 
        between commands a delay value of zero can be considered as a 
        delay of 8ms, and each note command has an automatic 8ms delay 
        built in since the next note command won't be read until 8ms 
        later. 






                                        1


        The delay value can be given between one and 125 which 
        corresponds to one second of delay maximum for each delay 
        command. Additional delays can be achieved by using additional 
        delay commands.

        The control commands provide conditional flow in the sequencer 
        and provides a mechanism for sub-processes. Four counters are  
        provided along with four conditional operations using the 
        counters. Each counter can be loaded separately with individual 
        load commands. Counters one and three are used with conditional 
        jump commands, and counters two and four are used with 
        conditional call commands. 

        A conditional Jump or Call command decrements the associated 
        counter and if the resulting counter value is non-zero, the Jump 
        or Call is taken. If the counter value is zero, the Jump or Call 
        is not taken, and the next command in the sequence will be read 
        on the next clock tick.

        A Jump command directly changes the command sequencer processing 
        to happen at a new location in the sequencer buffer. The command 
        jumps to the new location. Knowledge of the previous location is 
        not retained and can not be returned. 

        A Call command temporarily changes the command sequencer 
        processing to a sub-process within the sequencer buffer. At the 
        end of the sub-process a return command causes the sequencer to 
        return to the calling process. Up to 32 levels of sub-processes 
        can be called. After the 32nd process, previous process links 
        will start to be forgotten. Attempting to return to a process 
        from the main process will cause unknown things to happen. (The 
        last process address on the call stack will be returned.) This 
        will never damage the audiometer, the note sequencer may go into 
        an  infinite  loop  doing strange things  requiring  the  control 
        program to turn off the sequence program enable (or the  operator 
        can turn off the power).

        In addition to the conditional Jump and Call commands, there are 
        direct Jump and Call commands available. These work the same way 
        as the conditional Jump and Call commands, except that they do 
        not decrement the counter, and the Jump or Call is always taken.

        Note that the extended command (255) is the same command in both 
        flat and compressed modes. This is because it cannot be known 
        which mode the sequencer is in at the time of startup (compressed 
        or flat). Thus the very first command in the sequencer should be 
        a mode select using the extended command.

        The flat sequencer program is terminated with a GOTO 255, or it 
        will automatically terminate when the sequencer index reaches 255 
        while playing.






                                        2


        Compressed Sequencer:

        The compressed sequencer is similar to the flat sequencer except 
        for some differences in how the notes are presented. The 
        compressed sequencer is intended for music scale notes only. 
        Specifically to generate songs via the sequencer. This limitation 
        allows the compressed format to cut the command sequence size in 
        in half. This is done by including the note play time as a part 
        of the note command itself. The top two bits of the note command 
        specify a note style of the four possible to be used to play the 
        note. An additional set of four commands are added to set the 
        individual note styles. 

        To fit the commands all within a single byte, the available note 
        command list was also reduced. The audiometric frequencies are 
        not available in the compressed mode, and the music note range is 
        slightly reduced. See the note command list for the available 
        notes that can be played.

        Since the note play time is included as a part of the note 
        definition, the delay command is not available in the compressed 
        mode. Additionally, because of the limited commands available, 
        only two counters and conditional controls are available.

        Note that the extended command (255) is the same command in both 
        flat and compressed modes. This is because it cannot be known 
        which mode the sequencer is in at the time of startup (compressed 
        or flat). Thus the very first command in the sequencer should be 
        a mode select using the extended command.

        The compressed sequencer program is terminated with a GOTO 255, 
        or it will automatically terminate when the sequencer index 
        reaches 255 while playing.
























                                        3


                       Compressed Sequencer Mode Commands

        The command byte is divided into two parts. The sub-command bits 
        are the top two bits of the command (C0 and C1). For normal note 
        playing, these bits determine the note style. In a command byte 
        they indicate the sub-command action. The Note bytes (N0-N5) 
        indicate the note to be played when the value is between 1 and 
        60. A note value of zero indicates a rest, and a note value 
        between 61 and 63 indicates a command.

        Note Command byte:

            Byte 0 = Bit:   7   6   5   4   3   2   1   0
                     Cmd:   C1  C0  N5  N4  N3  N2  N1  N0 

            N = 0      :   Sub-command type #0
                 C = 0 : Rest for duration in note style #0 (no sound)
                 C = 1 : Rest for duration in note style #1 (no sound)
                 C = 2 : Rest for duration in note style #2 (no sound)
                 C = 3 : Rest for duration in note style #3 (no sound)
            N = 1 - 60 :   Sub-command type #1
                 C = 0 : Play indicated note using note style #0
                 C = 1 : Play indicated note using note style #1
                 C = 2 : Play indicated note using note style #2
                 C = 3 : Play indicated note using note style #3
            N = 61     :   Sub-command type #2
                 C = 0 : Set note style #0 to following byte definition
                 C = 1 : Set note style #1 to following byte definition
                 C = 2 : Set note style #2 to following byte definition
                 C = 3 : Set note style #3 to following byte definition
            N = 62     :   Sub-command type #3
                 C = 0 : Load counter #1 with data byte that follows
                 C = 1 : Load counter #2 with data byte that follows
                 C = 2 : Dec counter #1 and goto index byte that follows
                         if result is Non-Zero else ignore following byte
                 C = 3 : Dec counter #2 and gosub index byte that follows
                         if result is Non-Zero else ignore following byte
            N = 63     :   Sub-command type #4
                 C = 0 : Goto byte index that follows
                 C = 1 : Gosub to byte index that follows
                 C = 2 : Return to address on gosub stack (32 max levels)
                 C = 3 : Byte following is an extended command















                                        4


            Extended command byte:

            Byte 1 = Bit:   7   6   5   4   3   2   1   0
                     Cmd:   D7  D6  D5  D4  D3  D2  D1  D0 

        The extended command byte provides for extended commands outside 
        the normal command sequencer instruction set. The command numbers 
        are the same for both the flat and compressed sequencer modes.

        There are currently three extended commands available. These 
        commands manage the sequencer control flags.

             N = 0 : Set Sequencer flags based on bit pattern that 
                     follows this byte. One bits turn on control flag.
                     Zero bits are ignored.   

             N = 1 : Clear Sequencer flags based on bit pattern that 
                     follows this byte. One bits turn off control flag.
                     Zero bits are ignored.   

             N = 2 : Load Sequencer flags from the bit pattern that 
                     follows this byte. All bits are directly loaded
                     into the control flags.   

             N > 2 : Not currently used. These commands do not do 
                     anything. If encountered, the command will eat up 
                     an 8ms time slice without changing the current
                     sequencer activity. 


            Sequence Control Flags:

            Byte 1 = Bit:   7   6   5   4   3   2   1   0
                     Cmd:   F7  F6  F5  F4  F3  F2  F1  F0 

             F0 : Note play ; This bit is read only. It is controlled 
                  status    ; automatically when you call a note command. 
                            ; Any value you place in this bit is ignored.

             F1 : 0 = Use normal note style
                  1 = Use Staccato note style  (compressed mode only)

             F2 : 0 = Use Stereo output
                  1 = Mix L+R for mono output

             F3 : 0 = Use pure tone output
                  1 = Use Narrow Band Noise output

             F3 - F6 : These flag bits are not currently used
                       They should be left at zero.

             F7 : 0 = Flat sequencer mode
                  1 = Compressed sequencer mode




                                        5


        There are two compressed note style command bytes the first style 
        allows for a staccato within the note. This allows staccato to 
        happen in a single note command instead of having to generate two 
        note commands. The disadvantage is that the note style commands 
        have a short time duration. 0-224ms of staccato (32ms 
        increments), and 16-512ms of play time (16ms increments).

        The other note style command allows for longer note play time 
        (8-2048ms) by eliminating the staccato. It also allows for a better 
        note resolution (8ms increments).

        The type of note style command used is controlled by the sequence 
        control command byte.


            Note style type one command byte:

            Byte 1 = Bit:   7   6   5   4   3   2   1   0
                     Cmd:   S2  S1  S0  D4  D3  D2  D1  D0 
                
             S = 0 - 2 : The staccato bits control the staccato of the
                  note. These bits control the note off time. The time is 
                  given in 32ms increments. The minimum note off time is 
                  none (0). The maximum note off time is 224ms (7).

             D = 0 - 4 : The Duration bits control the note duration 
                  (both active and inactive). The delay is in 16mS 
                  increments. The value given is the total time allocated 
                  to the note play time. The minimum note duration is 
                  16ms (0) the maximum note duration is 512ms (63).


            Note style type two command byte:

            Byte 1 = Bit:   7   6   5   4   3   2   1   0
                     Cmd:   D7  D6  D5  D4  D3  D2  D1  D0 
                
             D = 0 - 7 : The Duration bits control the note duration 
                  (both active and inactive). The delay is in 8mS 
                  increments. The value given is the total time allocated 
                  to the note play time. The minimum note duration is 
                  8ms (0) the maximum note duration is 2048MS (255).


        System configuration:
         
        There are two voices available in the system. One for the left 
        channel, and one for the right channel. Each voice has a 
        sequencer memory of 255 bytes. Any location in the sequencer can 
        be reached through a goto, gosub, or return command. 
        Additionally, the sound sequence is terminated when sequencer 
        address 255 is reached. Startup of the sequencer (begin sequence) 
        normally occurs at address 0, but is controllable.




                                        6


                   Compressed Sequencer Mode Commands (Notes)

                        1/12th Octave notes (music scale)

        Cmd# Freq  Oct Note               Cmd# Freq   Oct Note

        0    Rest                          
        1    131Hz  O1 [A ]                37  1047Hz  O4 [A ] 
        2    139Hz  O1 [A#]                38  1109Hz  O4 [A#] 
        3    147Hz  O1 [B ]                39  1175Hz  O4 [B ] 
        4    156Hz  O1 [C ]                40  1245Hz  O4 [C ]     
        5    165Hz  O1 [C#]                41  1319Hz  O4 [C#]     
        6    175Hz  O1 [D ]                42  1397Hz  O4 [D ]     
        7    185Hz  O1 [D#]                43  1480Hz  O4 [D#]      
        8    196Hz  O1 [E ]                44  1568Hz  O4 [E ]      
        9    208Hz  O1 [F ]                45  1661Hz  O4 [F ]      
        10   220Hz  O1 [F#]                46  1760Hz  O4 [F#]      
        11   233Hz  O1 [G ]                47  1865Hz  O4 [G ]      
        12   247Hz  O1 [G#]                48  1976Hz  O4 [G#]     
        13   262Hz  O2 [A ]                49  2093Hz  O5 [A ]      
        14   277Hz  O2 [A#]                50  2217Hz  O5 [A#]      
        15   294Hz  O2 [B ]                51  2349Hz  O5 [B ]      
        16   311Hz  O2 [C ]                52  2489Hz  O5 [C ]      
        17   330Hz  O2 [C#]                53  2637Hz  O5 [C#]      
        18   349Hz  O2 [D ]                54  2794Hz  O5 [D ]     
        19   370Hz  O2 [D#]                55  2960Hz  O5 [D#]      
        20   392Hz  O2 [E ]                56  3136Hz  O5 [E ]      
        21   415Hz  O2 [F ]                57  3322Hz  O5 [F ]      
        22   440Hz  O2 [F#]                58  3520Hz  O5 [F#]      
        23   466Hz  O2 [G ]                59  3729Hz  O5 [G ] 
        24   494Hz  O2 [G#]                60  3951Hz  O5 [G#] 
        25   523Hz  O3 [A ]                
        26   554Hz  O3 [A#]                
        27   587Hz  O3 [B ]                
        28   622Hz  O3 [C ]                
        29   659Hz  O3 [C#]                61  Sub-command #2
        30   698Hz  O3 [D ]                62  Sub-command #3
        31   740Hz  O3 [D#]                63  Sub-command #4
        32   784Hz  O3 [E ]
        33   831Hz  O3 [F ]                Note:
        34   880Hz  O3 [F#]                See command description
        35   932Hz  O3 [G ]                for commands 61-63 and 0
        36   988Hz  O3 [G#]














                                        7


                      Flat Sequencer Mode Commands (Notes)

                         Audiometric frequencies

        Cmd#  Freq                         Cmd#  Freq 
        0     Rest                         6     1500Hz
        1     125Hz                        7     2000Hz
        2     250Hz                        8     3000Hz
        3     500Hz                        9     4000Hz
        4     750Hz                        10    6000Hz
        5    1000Hz                        11    8000Hz
        12-23 not used

                    1/12th Octave notes (music scale)

        Cmd# Freq  Oct Note               Cmd# Freq   Oct Note
        24   131Hz  O1 [A ]                60  1047Hz  O4 [A ] 
        25   139Hz  O1 [A#]                61  1109Hz  O4 [A#] 
        26   147Hz  O1 [B ]                62  1175Hz  O4 [B ] 
        27   156Hz  O1 [C ]                63  1245Hz  O4 [C ]     
        28   165Hz  O1 [C#]                64  1319Hz  O4 [C#]     
        29   175Hz  O1 [D ]                65  1397Hz  O4 [D ]     
        30   185Hz  O1 [D#]                66  1480Hz  O4 [D#]      
        31   196Hz  O1 [E ]                67  1568Hz  O4 [E ]      
        32   208Hz  O1 [F ]                68  1661Hz  O4 [F ]      
        33   220Hz  O1 [F#]                69  1760Hz  O4 [F#]      
        34   233Hz  O1 [G ]                70  1865Hz  O4 [G ]      
        35   247Hz  O1 [G#]                71  1976Hz  O4 [G#]     
        36   262Hz  O2 [A ]                72  2093Hz  O5 [A ]      
        37   277Hz  O2 [A#]                73  2217Hz  O5 [A#]      
        38   294Hz  O2 [B ]                74  2349Hz  O5 [B ]      
        39   311Hz  O2 [C ]                75  2489Hz  O5 [C ]      
        40   330Hz  O2 [C#]                76  2637Hz  O5 [C#]      
        41   349Hz  O2 [D ]                77  2794Hz  O5 [D ]     
        42   370Hz  O2 [D#]                78  2960Hz  O5 [D#]      
        43   392Hz  O2 [E ]                79  3136Hz  O5 [E ]      
        44   415Hz  O2 [F ]                80  3322Hz  O5 [F ]      
        45   440Hz  O2 [F#]                81  3520Hz  O5 [F#]      
        46   466Hz  O2 [G ]                82  3729Hz  O5 [G ] 
        47   494Hz  O2 [G#]                83  3951Hz  O5 [G#] 
        48   523Hz  O3 [A ]                84  4186Hz  O6 [A ] 
        49   554Hz  O3 [A#]                85  4435Hz  O6 [A#] 
        50   587Hz  O3 [B ]                86  4699Hz  O6 [B ] 
        51   622Hz  O3 [C ]                87  4978Hz  O6 [C ] 
        52   659Hz  O3 [C#]                88  5274Hz  O6 [C#] 
        53   698Hz  O3 [D ]                89  5588Hz  O6 [D ] 
        54   740Hz  O3 [D#]                90  5920Hz  O6 [D#] 
        55   784Hz  O3 [E ]                91  6272Hz  O6 [E ] 
        56   831Hz  O3 [F ]                92  6645Hz  O6 [F ] 
        57   880Hz  O3 [F#]                93  7040Hz  O6 [F#] 
        58   932Hz  O3 [G ]                94  7459Hz  O6 [G ] 
        59   988Hz  O3 [G#]                95  7902Hz  O6 [G#] 

                                           96-111 not used



                                        8


                             Flat Sequencer Commands

        Cmd#  : Description
        0     : Rest (turn off sound)
        1-111 : Play (turn on) indicated note
        112   : Load counter number 1 with the byte that follows
        113   : Load counter number 2 with the byte that follows
        114   : Load counter number 3 with the byte that follows
        115   : Load counter number 4 with the byte that follows
        116   : Dec counter #1 and goto index byte that follows 
                if result is Non-Zero else ignore following byte
        117   : Dec counter #2 and gosub index byte that follows   
                if result is Non-Zero else ignore following byte
        118   : Dec counter #3 and goto index byte that follows 
                if result is Non-Zero else ignore following byte
        119   : Dec counter #4 and gosub index byte that follows 
                if result is Non-Zero else ignore following byte
        120   : Goto byte index that follows                    
        121   : Gosub to byte index that follows                
        122   : Return to address on gosub stack (32 max levels)
        123-127 : <reserved> 
        128-252 : Delay 1-125*8ms
        253     : <reserved> 
        254     : <reserved> 
        255     : Do extended command 



        NOTE: It cannot be known which mode the sequencer is in at the 
        time of startup (compressed or flat). Thus the very first command 
        in the sequencer should be a mode select using the extended 
        command to insure that the desired operating mode for the 
        commands being used is selected. 

        The power on default is to start in flat mode, but this should 
        not be relied upon since any sequencer program that was run since 
        power on could change the mode.

        Sequencer playing is terminated when the index reaches 255. For 
        short  sequence  programs this can be achieved with  a  GOTO  255 
        command. Note that because of this mechanism, position 255 of the 
        sequencer  array can never be played. This is why there are  only 
        255 possible playable index positions in the sequencer array.

        Both sequencers increment at an 8ms rate on the same tick. Other 
        than that, they are totally independent of each other. Thus it is 
        possible  for  the sequencers to get out of step if you  are  not 
        careful to monitor the timing of each sequencer.


        *** WARNING: The command sequencer is specific to the FA10 series 
        *** audiometers. It is not available in other audiometers.

        <eof>



                                        9
