


SPAN(UCL5)        MISC. REFERENCE MANUAL PAGES         SPAN(UCL5)



NAME
     SPAN - programming language for formant synthesizer control

DESCRIPTION
     SPAN is a programming language which can  be  used  to  con-
     struct  sets  of  control parameters for producing synthetic
     speech with a formant synthesizer.  You should view  a  SPAN
     program as a specification for constructing a number of syn-
     thesizer  control  parameter  tables,  with  each  parameter
     specified  every 10ms.  The advantage of a SPAN program over
     the parameter table is that interpolations within the  table
     are calculated automatically, so that only turning points in
     a parameter specification with time need  to  be  specified.
     In  addition,  the SPAN language allows for the construction
     of a number of syntheses sharing common  components,  and  a
     SPAN  program  may be readily constructed for building a set
     of stimuli for use in a speech  perception  experiment,  for
     example.

STRUCTURE
     SPAN is actually implemented as a set of macros for a  stan-
     dard  C-language compiler.  When a SPAN program is compiled,
     it is built into a C source module and linked with  a  stan-
     dard  run-time  object  module  to construct a program which
     when run builds one or  more  synthesizer  parameter  tables
     from  the  SPAN  program specification.  These tables can be
     saved in SFS speech files or  replayed  through  a  hardware
     synthesizer.   For  details  of compilation and execution of
     SPAN programs see the SPANDRV manual page.

     The benefit of the C-language implementation  is  that  SPAN
     programs  can  make  use  of  all  the  facilities  of the C
     language in addition to the commands provided by SPAN  which
     are  detailed below.  Thus a SPAN program can use global and
     local variables,  call  sub-routines  and  use  the  C  pre-
     processor to modify the command language.

SOURCE LANGUAGE CONVENTIONS
     The basic source file  structure  follows  the  C  language.
     Statements  must  be separated by semicolons,  Comments must
     be enclosed in /* ...  */.   The  main  subroutine  must  be
     called as void SYNTH(char **args). The arguments are strings
     which may be passed on the command line.  The user  is  free
     to  construct  other  subroutines  which  can be called from
     SYNTH().  Thus the basic SPAN program looks like:

     /* comments */
     void SYNTH(char **args)
     {
          /* parameter settings in here */
     }




SFS                     Last change: UCL                        1






SPAN(UCL5)        MISC. REFERENCE MANUAL PAGES         SPAN(UCL5)



SYNTHESIS CONTROL COMMANDS
     The following commands are available for overall control  of
     a synthesis:

     LENGTH(t)  This sets the overall length of the synthesis  to
                t milliseconds.  The default length is taken from
                the lastest time at which an assignment is  made.
                You  need this command if modifications to a syn-
                thesis reduce its length.

     CLEAR      This  clears  the  entire  synthesis  table,  and
                resets the start time and end times to zero.

     FLUSH      This command  forces  construction  of  the  syn-
                thesizer  parameter  table  at  this point in the
                specification.  The synthesizer  parameter  table
                is  constructed  automatically  at the end of the
                SYNTH() routine, so you only need this command if
                your program builds more than one synthesis.

     SAVE       This command saves the current time  position  in
                the  synthesis  on  an internal stack.  Since all
                settings of AT(t) and WAIT(t) affect the  current
                time  position,  regardless  of  whether they are
                made in SYNTH() or in a subroutine, you may  need
                to  save the current time to make local parameter
                settings and then restore it.

     RESTORE    This command restores the last current time posi-
                tion save with SAVE.

PARAMETER SETTINGS
     The  parameter  setting  statements  are  all  of  the  form
     <paramname>(<value>,<interpolation>)  where  <paramname>  is
     from the list:

     FX(v,i)    Fundamental frequency (Hz).

     F1(v,i)    Frequency of formant 1 (Hz).

     A1(v,i)    Amplitude of formant 1 (dB).

     F2(v,i)    Frequency of formant 2 (Hz).

     A2(v,i)    Amplitude of formant 2 (dB).

     F3(v,i)    Frequency of formant 3 (Hz).

     A3(v,i)    Amplitude of formant 3 (dB).

     F4(v,i)    Frequency of formant 4 (Hz).




SFS                     Last change: UCL                        2






SPAN(UCL5)        MISC. REFERENCE MANUAL PAGES         SPAN(UCL5)



     A4(v,i)    Amplitude of formant 4 (dB).

     FN(v,i)    Frequency of nasal formant (Hz).

     AN(v,i)    Amplitude of nasal formant (dB).

     VR(v,i)    Voicing   ratio,   in   range   0(unvoiced)    to
                248(voiced).

     and where <value> is a decimal number representing the value
     to  which  to set the control parameter at the current time.
     The value NUL can be used to signify that no change  to  the
     currently  specified value at this position is requested (if
     only the interpolation type was to be changed, for example).

     The parameter <interpolation> is from this list:

     FIX        Set value at this time with no interpolation.

     LIN        Set value at this time  and  interpolate  to  the
                first  subsequent  specification for this parame-
                ter.  Interpolations are actually performed after
                all  specifications  are made, so you do not need
                to specify the end  value  of  the  interpolation
                before the start value.

     LOG        Set value at this time and logarithmically inter-
                polate  to  the  first subsequent setting of this
                parameter.

     NUL        Make no  changes  to  the  interpolation  setting
                currently specified at this time position.

     In addition to these parameter settings the command GET(p,t)
     returns the value of parameter p (FX,F1, etc) at time t. The
     global variable NOW  contains  the  current  time  position.
     This  command  does  not  make  any changes to the parameter
     table.  If you request the value of a parameter in an inter-
     polated region, GET returns the interpolated value using the
     current specifications for the start and end points.

     There is no range checking  on  the  values  used  in  these
     parameter  settings.   The allowed ranges will depend on the
     formant synthesizer that you will be using to make the  syn-
     thetic  speech.   Similarly,  some synthesizers may not make
     use of all the parameters (e.g. the JSRU system has a  fixed
     F4  and  AN  is  linked  to  A1).   There  is no synthesizer
     specific code in the SPAN language.

TIMING COMMANDS
     AT(t)      Set the current time position in the synthesis to
                absolute  t  milliseconds.  Only one current time



SFS                     Last change: UCL                        3






SPAN(UCL5)        MISC. REFERENCE MANUAL PAGES         SPAN(UCL5)



                position is maintained globally, so be careful of
                constructions such as:

                AT(100);
                rampamplitudes();
                FX(90,FIX);         /* does NOT change FX at time 100 */
                  :
                  :
                rampamplitudes()
                {
                     A1(NUL,LIN); A2(NUL,LIN); A3(NUL,LIN);
                     WAIT(50);
                     A1(0,FIX); A2(0,FIX); A3(0,FIX);
                }

                Use the SAVE and RESTORE commands within  subrou-
                tines  to preserve the current time position out-
                side the routine.

     WAIT(t)    Move the current  time  position  on  by  t  mil-
                liseconds.

     The global variable NOW contains the current time position.

EXAMPLE PROGRAM
     /* test.spn - demonstration SPAN program */

     #define SILENCE A1(0,LIN);A2(0,LIN);A3(0,LIN);A4(0,LIN);AN(0,LIN);

     SYNTH()
     {
     /* Synthesis 0 */
     AT(0);
          /* set up central vowel */
          FX(120,LOG); VR(248,LIN);
          F1(500,LIN); F2(1000,LIN); F3(1500,LIN);
          SILENCE;

     WAIT(50);
          /* ramp up amplitudes */
          A1(40,FIX); A2(35,FIX); A3(30,FIX); AN(GET(A1,NOW),FIX);

     AT(500);
          /* ramp down amplitudes */
          A1(NUL,LIN); A2(NUL,LIN); A3(NUL,LIN); AN(NUL,LIN);

     WAIT(50);
          /* end at /i/ vowel */
          FX(90,FIX);
          F1(250,FIX); F2(2500,FIX); F3(3300,FIX);
          SILENCE;




SFS                     Last change: UCL                        4






SPAN(UCL5)        MISC. REFERENCE MANUAL PAGES         SPAN(UCL5)



          /* make this synthesis */
          FLUSH;

     /* Synthesis 1 */
     AT(550);
          /* change end to /a/ vowel */
          F1(600,FIX);   F2(750,FIX);   F3(2500,FIX);

          /* and re-make it */
          FLUSH;

     }


VERSION/AUTHOR
     1.0        Mark Huckvale

SEE ALSO
     spandrv(1), enspan(1)

BUGS
     Should be a mechanism for using  parameter  names  as  vari-
     ables.
































SFS                     Last change: UCL                        5



