Bandedwg.ck 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. public class Bandedwg extends SongPart
  2. {
  3. 0.75 => float ON_RATIO ;
  4. 1.0 - ON_RATIO => float OFF_RATIO ;
  5. 0 => int UNIFORM_BAR ;
  6. 1 => int TUNED_BAR ;
  7. 2 => int GLASS_HARMONICA ;
  8. 3 => int TIBETAN_BOWL ;
  9. BandedWG instrument ;
  10. fun void setInstrument(BandedWG aBandedWG)
  11. {
  12. aBandedWG @=> instrument ;
  13. 0 => instrument.preset ;
  14. }
  15. fun dur playNote(int noteN)
  16. {
  17. //if (!Toggle => Toggle) PHONEMES[(N + 1) % N_PHONEMES => N] => instrument.phoneme ; <<< "PHONEMES[" , N , "]=" , PHONEMES[N] >>> ;
  18. if (frequencies[noteN] >= 20.0)
  19. {
  20. frequencies[noteN] * 1 => instrument.freq ;
  21. // 1.0 => instrument.startBowing ;
  22. 1.0 => instrument.noteOn ;
  23. 1.0 => instrument.pluck ;
  24. }
  25. return durations[noteN] * ON_RATIO ;
  26. //<<< "playNote() frequency=" , frequencies[noteN] , " duration=" , durations[noteN] >>> ;
  27. }
  28. fun dur stopNote(int noteN) { 1.0 => instrument.noteOff ; 1.0 => instrument.stopBowing ; return durations[noteN] * OFF_RATIO ; }
  29. }