2c_voice_allocation_setup.scd 1008 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. (
  2. //PUT HERE THE NUMBER OF POLYPHONY VOICES
  3. var nbVoices = 16;
  4. // LFO Synth
  5. ~lfo = Synth(\lfo, [\out, ~lfoBus.index]);
  6. // Synth array for voice allocation
  7. ~synths = Array.fill(nbVoices, {
  8. Synth(\rgbSynth, [\out, ~bus, \lfoBus, ~lfoBus.index], target: ~synthGroup, addAction: \addToTail)
  9. });
  10. // Filter envelope
  11. ~filterEnv = Synth(\filterEnv, [\out, ~filterEnvBus.index]);
  12. // Array to keep in memory active synths (i.e. active notes)
  13. ~activeNotes = Array.fill(nbVoices, { nil });
  14. // Function to modify a parameter for all synths
  15. ~setSynthsParam = { |param, value|
  16. ~synths.do { |synth|
  17. synth.set(param, value);
  18. };
  19. };
  20. ~filter = Synth(\lpf, [
  21. \in, ~bus,
  22. \out, 0,
  23. \lfoBus, ~lfoBus.index,
  24. \envBus, ~filterEnvBus.index
  25. ], target: ~filterGroup, addAction: \addToTail);
  26. "Voice allocation arrays loaded".postln
  27. )
  28. //~setSynthsParam.(\lfoDepth, 0.01);
  29. //~filter.set(\cutoff, 10000, \resonance, 0, \lfoDepth, 2, \envDepth, 0);
  30. //~filterEnv.set(\attack, 0, \decay, 0, \sustain, 0);