- Using mc.gen~ for multichannel effects
- Use introspection for channel-specific processing
In the last recipe, we used MC objects to target specific instances of an mc.reson~ filter. The mc.gen~ object also creates a gen~ instance for each channel, but two new Gen operators have been added that allow each instance to learn about its place in the MC environment. The Gen objects mc_channel and mc_channelcount allow for basic introspection - where a patch can interrogate itself.
We use these objects to create a variation on a patch that was seen in the Max 8 promotional video: one that creates unique tones and delays for each processing channel.
- mc.gen~ : an MC-capable version of the gen~ object
- mc.channel : a gen object that outputs the channel number of the current instance
- mc.channelcount : a gen object that outputs the total number of channels
- jit.cellblock : display the contents of a multichannel signal
Things to Note
- Pressing the space bar will produce a short 'blip' and send it into the mc.gen~ object. The output is sent to a meter~ (which auto-adjusts to the number of channels), and to an mc.gain~/mc.dac combination.
- The mc.gen~ object creates one instance of the gen~ object for each of the channels. The littleblips.gendsp patch has two additional outputs which allow us to display the calculated delay times for each of the channels
- mc_channel is used inside the gendsp patch to retrieve the channel for each instance. We use this to create a channel-specific pitch (for the cycle object) and delay times for the upward moving delays. Note that we subtract one from the channel number because we want to start with no delay.
- In order to get the downward moving delays, we subtract the current channel from the total number of channels. We then add the delay time for all channels (which is when the upward delays are playing).
Change the number of channels in the mc.gen~ to see (and hear) the Gen patch adapt to its changed environment. Note, however, that when you change the number of channels, you may need to restart the DSP to implement the change.