Voicform.ck 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. public class Voicform extends SongPart
  2. {
  3. 0.82 => float ON_RATIO ;
  4. 1.0 - ON_RATIO => float OFF_RATIO ;
  5. [
  6. "eee" , "ihh" , "ehh" , "aaa" ,
  7. "ahh" , "aww" , "ohh" , "uhh" ,
  8. "uuu" , "ooo" , "rrr" , "lll" ,
  9. "mmm" , "nnn" , "nng" , "ngg" ,
  10. "fff" , "sss" , "thh" , "shh" ,
  11. "xxx" , "hee" , "hoo" , "hah" ,
  12. "bbb" , "ddd" , "jjj" , "ggg" ,
  13. "vvv" , "zzz" , "thz" , "zhh"
  14. ] @=> string PHONEMES[] ; 3 => int N_PHONEMES ; -1 => int N ; 0 => int Toggle ;
  15. VoicForm instrument ;
  16. fun void setInstrument(VoicForm aVoicForm)
  17. {
  18. aVoicForm @=> instrument ;
  19. "ihh" => instrument.phoneme ;
  20. 6.0 => instrument.vibratoFreq ;
  21. 0.1 => instrument.vibratoGain ;
  22. 1.0 => instrument.pitchSweepRate ;
  23. }
  24. fun dur playNote(int noteN)
  25. {
  26. //if (!Toggle => Toggle) PHONEMES[(N + 1) % N_PHONEMES => N] => instrument.phoneme ; <<< "PHONEMES[" , N , "]=" , PHONEMES[N] >>> ;
  27. if (frequencies[noteN] >= 20.0)
  28. {
  29. frequencies[noteN] => instrument.freq ;
  30. 1.0 => instrument.speak ;
  31. 1.0 => instrument.noteOn ;
  32. }
  33. return durations[noteN] * ON_RATIO ;
  34. //<<< "playNote() frequency=" , frequencies[noteN] , " duration=" , durations[noteN] >>> ;
  35. }
  36. fun dur stopNote(int noteN) { 1.0 => instrument.noteOff ; 1.0 => instrument.quiet ; return durations[noteN] * OFF_RATIO ; }
  37. }