 < Granular synthesis is used to stretch the duration of the source soprano
 < tone (sop1.b3 from /sflib/voice), originally 6.33 seconds, to 10 seconds
 < This time stretching is accomplished in p8, where every 2 seconds we loop
   < back to an earlier point in the source soundfile 
 < Notes: (1) A certain amount of "chorusing," or "reverberation" coloration
   < almost always results from this type of time stretching
 < (2) Grain overlap (duty factor) & cross fade (p4) times are important in
   <  obtaining a smooth output. If the grains overlap too much, comb filtering
   < coloration will result. If the grains are too short, a stuttering or buzzy
   < quality can result.

*f1 0 524288 -1 "/sflib/voice/sop1.b3.wav"  0 0 0;

instr gran  0 10. ; < read in  soundfile grains for 10. beats {seconds}
p3 .07;      < create a new grain every 70 milliseconds
  < duty factor:  determines overlap of grains
  < normal range is between 100.02 and 100.2 {producing .02-.2 second overlaps}
du  100.15;      < overlap the grains by .15 seconds
   < p4 cross-fade time for both fade-in & fade-out ;
   <   p4  normally = c. 1/2 duty factor fraction { 1/2 the grain overlap time}
p4  .08;  < fade-in & fade-out times for each grain = .08 second

   < p5 = output amplitude : raw amp {10.1-32767} or multiplier {.001 - 10.}
       < default 0 = same amplitude as input soundfile
p5  15000;

   < p6 = gen1 function number
p6  1;     < function number 1 is the soprano tone, defined above
   < p7 = length of soundfile to be used, in seconds {duration} OR # of samples
p7  280748;    < number of samples in the source soundfile

   < p8 = skip time into gen1 func : if positive p8  = skip time in seconds
      < if negative {between -.001 and -.999}, p8 = % of soundfile skipped
p8 mo 2. 0 2.5 / 2. 1. 3.5 / 2. 2. 4.5 / 2. 3. 5.5 / 2. 4.1  6.3;
   < p9 = pitch multiplier {default 0 = no pitch change}
p9      < no argument here, so retain original pitch level
   < for stereo output only p10 = pan location {1. = hard left, 0 = hard right}
p10
  <  Added user p-fields: 
end;  <<< End of ### gransop ### example score >>>
