Mooog.ck 718 B

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