Modalbar.ck 657 B

123456789101112131415161718192021222324252627
  1. public class Modalbar extends SongPart
  2. {
  3. 1.0 => float ON_RATIO ;
  4. 1.0 - ON_RATIO => float OFF_RATIO ;
  5. ModalBar instrument ;
  6. fun void setInstrument(ModalBar aModalBar) { aModalBar @=> instrument ; }
  7. fun dur playNote(int noteN)
  8. {
  9. if (frequencies[noteN] >= 20.0)
  10. {
  11. frequencies[noteN] => instrument.freq ;
  12. 1.0 => instrument.strike ;
  13. 1.0 => instrument.noteOn ;
  14. }
  15. return durations[noteN] * ON_RATIO ;
  16. //<<< "playNote() frequency=" , frequencies[noteN] , " duration=" , durations[noteN] >>> ;
  17. }
  18. fun dur stopNote(int noteN) { return durations[noteN] * OFF_RATIO ; }
  19. }