


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



NAME
     K-SPAN - programming language for Klatt synthesizer control

DESCRIPTION
     K-SPAN is a programming language which can be used  to  con-
     struct  sets  of  control parameters for producing synthetic
     speech with the Klatt formant synthesizer.  You should  view
     a  K-SPAN  program  as  a  specification  for constructing a
     number of synthesizer control parameter  tables,  with  each
     parameter  specified  every  5ms.  The advantage of a K-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 K-SPAN language allows
     for the construction of a number of syntheses sharing common
     components,  and a K-SPAN program may be readily constructed
     for building a set of stimuli for use in a speech perception
     experiment, for example.

STRUCTURE
     K-SPAN is actually implemented as a  set  of  macros  for  a
     standard C-language compiler.  When a K-SPAN program is com-
     piled, it is built into a C source module and linked with  a
     standard run-time object module to construct a program which
     when run builds one or  more  synthesizer  parameter  tables
     from  the  K-SPAN  program  specification.  These tables are
     saved in files suitable from input  to  the  Klatt  software
     synthesizer  (see  klattsyn(1)  ) For details of compilation
     and execution of K-SPAN programs see the KSPAN manual page.

     The benefit of the C-language implementation is that  K-SPAN
     programs  can  make  use  of  all  the  facilities  of the C
     language in addition to  the  commands  provided  by  K-SPAN
     which  are  detailed  below.   Thus a K-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
     void SYNTH(char **param)
     The 'param' arguments are character strings from the command
     line from switches -A <value>, -B <value>, etc.  The user is
     free to construct other subroutines which can be called from
     SYNTH().  Thus the basic C-SPAN program looks like:

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



SFS                     Last change: UCL                        1






KSPAN(UCL5)       MISC. REFERENCE MANUAL PAGES        KSPAN(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:

     F0(v,i)    Fundamental frequency, in Hz. Range:  0  to  500.
                Default 100. (NOTE FX() may also be used)

     AV(v,i)    Amplitude of voicing, in  dB.  Range:  0  to  80.
                Default 60.

     OQ(v,i)    Open quotient (voicing open-time/period),  in  %.
                Range: 10 to 99. Default 50.

     SQ(v,i)    Speed quotient (rise/fall time, LF model), in  %.
                Range: 100 to 500. Default 200.

     TL(v,i)    Extra tilt of voicing spectrum, dB down @ 3  kHz.
                Range: 0 to 41. Default 0.



SFS                     Last change: UCL                        2






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



     FL(v,i)    Flutter (random fluct in f0), in  %  of  maximum.
                Range: 0 to 100. Default 0.

     DI(v,i)    Diplophonia (alt periods closer), in  %  of  max.
                Range: 0 to 100. Default 0.

     AH(v,i)    Amplitude of aspiration, in dB. Range: 0  to  80.
                Default 0.

     AF(v,i)    Amplitude of frication, in dB. Range:  0  to  80.
                Default 0.

     F1(v,i)    Frequency of 1st formant, in Hz.  Range:  180  to
                1300. Default 500.

     B1(v,i)    Bandwidth of 1st formant, in  Hz.  Range:  30  to
                1000. Default 60.

     DF1(v,i)   Change in F1 during open portion  of  period,  in
                Hz. Range: 0 to 100. Default 0.

     DB1(v,i)   Change in B1 during open portion  of  period,  in
                Hz. Range: 0 to 400. Default 0.

     F2(v,i)    Frequency of 2nd formant, in Hz.  Range:  550  to
                3000. Default 1500.

     B2(v,i)    Bandwidth of 2nd formant, in  Hz.  Range:  40  to
                1000. Default 90.

     F3(v,i)    Frequency of 3rd formant, in Hz. Range:  1200  to
                4800. Default 2500.

     B3(v,i)    Bandwidth of 3rd formant, in  Hz.  Range:  60  to
                1000. Default 150.

     F4(v,i)    Frequency of 4th formant, in Hz. Range:  2400  to
                4990. Default 3250.

     B4(v,i)    Bandwidth of 4th formant, in Hz.  Range:  100  to
                1000. Default 200.

     F5(v,i)    Frequency of 5th formant, in Hz. Range:  3000  to
                4990. Default 3700.

     B5(v,i)    Bandwidth of 5th formant, in Hz.  Range:  100  to
                1500. Default 200.

     F6(v,i)    Frequency of  6th  formant,  in  Hz  (applies  if
                NF=6). Range: 3000 to 4990. Default 4990.

     B6(v,i)    Bandwidth of  6th  formant,  in  Hz  (applies  if



SFS                     Last change: UCL                        3






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



                NF=6). Range: 100 to 4000. Default 500.

     FNP(v,i)   Frequency of nasal pole, in  Hz.  Range:  180  to
                500. Default 280.

     BNP(v,i)   Bandwidth of nasal pole,  in  Hz.  Range:  40  to
                1000. Default 90.

     FNZ(v,i)   Frequency of nasal zero, in  Hz.  Range:  180  to
                800. Default 280.

     BNZ(v,i)   Bandwidth of nasal zero,  in  Hz.  Range:  40  to
                1000. Default 90.

     FTP(v,i)   Frequency of tracheal pole, in Hz. Range: 300  to
                3000. Default 2150.

     BTP(v,i)   Bandwidth of tracheal pole, in Hz. Range:  40  to
                1000. Default 180.

     FTZ(v,i)   Frequency of tracheal zero, in Hz. Range: 300  to
                3000. Default 2150.

     BTZ(v,i)   Bandwidth of tracheal zero, in Hz. Range:  40  to
                2000. Default 180.

     A2F(v,i)   Amplitude of fric-excited parallel  2nd  formant,
                in dB. Range: 0 to 80. Default 0.

     A3F(v,i)   Amplitude of fric-excited parallel  3rd  formant,
                in dB. Range: 0 to 80. Default 0.

     A4F(v,i)   Amplitude of fric-excited parallel  4th  formant,
                in dB. Range: 0 to 80. Default 0.

     A5F(v,i)   Amplitude of fric-excited parallel  5th  formant,
                in dB. Range: 0 to 80. Default 0.

     A6F(v,i)   Amplitude of fric-excited parallel  6th  formant,
                in dB. Range: 0 to 80. Default 0.

     AB(v,i)    Amplitude of fric-excited parallel  bypass  path,
                in dB. Range: 0 to 80. Default 0.

     B2F(v,i)   Bandwidth of fric-excited parallel  2nd  formant,
                in Hz. Range: 40 to 1000. Default 250.

     B3F(v,i)   Bandwidth of fric-excited parallel  3rd  formant,
                in Hz. Range: 60 to 1000. Default 300.

     B4F(v,i)   Bandwidth of fric-excited parallel  4th  formant,
                in Hz. Range: 100 to 1000. Default 320.



SFS                     Last change: UCL                        4






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



     B5F(v,i)   Bandwidth of fric-excited parallel  5th  formant,
                in Hz. Range: 100 to 1500. Default 360.

     B6F(v,i)   Bandwidth of fric-excited parallel  6th  formant,
                in Hz. Range: 100 to 4000. Default 1500.

     ANV(v,i)   Amplitude of voice-excited  parallel  nasal  for-
                mant, in dB. Range: 0 to 80. Default 0.

     A1V(v,i)   Amplitude of voice-excited parallel 1st  formant,
                in dB. Range: 0 to 80. Default 60.

     A2V(v,i)   Amplitude of voice-excited parallel 2nd  formant,
                in dB. Range: 0 to 80. Default 60.

     A3V(v,i)   Amplitude of voice-excited parallel 3rd  formant,
                in dB. Range: 0 to 80. Default 60.

     A4V(v,i)   Amplitude of voice-excited parallel 4th  formant,
                in dB. Range: 0 to 80. Default 60.

     ATV(v,i)   Amplitude of voice-excited par tracheal  formant,
                in dB. Range: 0 to 80. Default 0.

     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



SFS                     Last change: UCL                        5






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



     you request the value of  a  parameter  in  an  interpolated
     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 in a K-SPAN program.

     The file kspan.h contains some useful macros to simplify the
     command  language  by using linear interpolations everywhere
     by default.

TIMING COMMANDS
     AT(t)      Set the current time position in the synthesis to
                absolute  t  milliseconds.  Only one current time
                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.spk - demonstration K-SPAN program */

     #define SILENCE {        AV(0); AH(0); AF(0);          A2F(0); A3F(0); A4F(0); A5F(0); A6F(0); AB(0); A1V(0); A2V(0); A3V(0); A4V(0); ATV(0); }

     void SYNTH(char **param)
     {
     /* Synthesis 0 */
     AT(0);
          /* set up central vowel */
          FX(120,LOG);
          F1(500,LIN); F2(1500,LIN); F3(2500,LIN);
          SILENCE;
          AV(60,FIX);



SFS                     Last change: UCL                        6






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



     WAIT(50);
          /* ramp up amplitudes */
          A1V(40,FIX); A2V(35,FIX); A3V(30,FIX);

     AT(500);
          /* ramp down amplitudes */
          A1V(NUL,LIN); A2V(NUL,LIN); A3V(NUL,LIN);

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

          /* 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
     kspan(1), c-span(5), enspan(1), klattsyn(1)

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


















SFS                     Last change: UCL                        7



