21 April 2007

mixer

mixer

This is collection of a few patches we made to use in main patches for using our effects. It is more than a simple mixer, but it certainly hasn't got all the functionalities of a professional mixer. It has got all that might be useful for our effects project: gain control, mute control, external input or wave files, many channels that are all summed on a bus to the master,... A functionality like sends and returns is not implemented. The structure that is used (apart input and channel patches) implicitly has this function, because one can attach multiple signals to them.
This document documents on the patches.
v1.0 [pdf]
v1.1 [pdf]
new block added; channel bug temporarily fixed

inputmulti~

This block implements a multichannel input. One can choose ten different wave files or five stereo files. When using wave files one can loop them. One can internally adjust the input gain of the signal to the best non-clipping level. The gain, clip and instantaneous RMS level is displayed on the block. It's best to not use more than one instance of this block in the same patch.

version

v1.0: built 15/05/2007 with Pd v0.40-2 [pd]

interface


To choose other sound files, one must open the input patch, specify the soundfile in the right folder in a message and click on that message.

Output 1, 2, 3, 4, 5, 6, 7, 8, 9, 10: a levelled mono audio signal

Internal controls:
start: start the chosen wave file. ctlin message 48.
play: when the wave file is done it is immediately replayed. ctlin message 49.
TO DO: we might better call this a loop button or something.

implementation

The wave playback section: each tabplay~ block starts playing when it receives a bang. It then plays the wave file that is loaded in the array with its name, found in the graph at the bottom left. One can choose another one by specifying a new soundfile in a message block. When the tabplay~ block is finished playing a track, it bangs the right output. This bang is used to let the message 1 allow the multiplication (when it's zero or without banging the hot input of the multiplication, the bang that follows will not be reached). The play toggle has a value of 127 to be consistent with the MIDI message value. A select block selects this value and bangs the tabplay~ block to replay the track.
A simple section is provided to adjust single gain factors per channel. Just specify another factor in the right message and click on it.

This implementation leaves away many features of the other input. But we found a bug there: if one wants to play different tracks he cannot. Due to the dollar problem with arrays it would change the array of each input~ block.




input~

This block implements a dual input. One can choose to use wave files or to go live with an external input (adc~). Both are calculated real-time. When using wave files one can loop them. When using the adc~ one can choose which channel of the audio card is routed to left and right channel. One can adjust the input gain of the signal to the best non-clipping level. The gain, clip and instantaneous RMS level is displayed on the block. When using more than one input~ block in a patch be sure to include an argument after the block name.

version

v1.0: built 20/04/2007 with Pd v0.40-2 [pd]

interface


To choose other sound files, one must open the input patch and click on a specific message that contains the file

Output 1: The mono audio signal or the left channel audio signal
Output 2: The right channel audio signal

Controls:
source for left, right: One can choose a channel from 1 to 8 from the soundcard that is available. When another routing is chosen, you must first enter 0 too. Otherwise you will be adding different channels from your soundcard to the same outputchannel of this block. If you are playing wavefiles it's best to put these sources to 0.
start: start the chosen wave file. ctlin message 48.
play: when the wave file is done it is immediately replayed. ctlin message 49.
TO DO: we might better call this a loop button or something.
reset: reset the gain to 0
gain slider: adjust the gain. the number box next to it only shows the chosen gain value, it does not change it!
clip: When the RMs of the signal exceeds 100dB (the zero attenuation level) this knob lights up in red.
VU-meter: shows the level of the signal at any time. You can also use it to see if it's a stereo signal or not.
TO DO: implement peak meter

implementation

The gain system: when reset is pressed, a message is banged that will send a 0 to the gain slider. The gain slider is he first control in the gain system, the rest is linked from there. The number box thus only shows results and does not adapt them. The slider ranges from -100 to +20 dB. It is then shifted and recalculated to RMS values before being used as an attenuation factor at the output, equal for both channels. The clip bang lights up in red when the moses block detects a RMS value higher than 0dB on the left channel.
TO DO: also check the right channel for clipping.
The wave playback section: the tabplay~ block starts playing when it receives a bang. It then plays the wave file that is loaded in the arrays named leftInput and rightInput, both contained in the graphs at the top right. One can choose another one by clicking on the specific message bottom left. When the tabplay~ block is finished playing a track, it bangs the right output. This bang is used to let the message 1 allow the multiplication (when it's zero or without banging the hot input of the multiplication, the bang that follows will not be reached). The play toggle has a value of 127 to be consistent with the MIDI message value. A select block selects this value and bangs the tabplay~ block to replay the track.
The VU meter section: The VU meters have to receive control messages in dB values ranging from -100 to +112. The output signals are therefore sampled with the snapshot~ block and recalculated from RMS to dB. In the future we might replace this wit env~ blocks or EARdetection~ blocks.
The adc source selection: The signal that is input in a specific input of your soundcard is multiplied by a 0 or a 1 depending on which number you input in the number box in the display. If you select two times another valid number for the same audio channel, they will be both output. So be careful to also select another number (0) to mute all the inputs.





channelM2M~

This is one of the channel blocks. It's the bottom part of channels on a real mixer. It allows to make all kinds of routing in your patch. It's output is routed to a master~ block to make it audible. When multiple blocks of this kind are used, one must specify a unique argument. This is almost always the case. No outlet is visible, because the signal is put on the right (depending on the signal: left or right channel bus of...) master bus internally. Be sure to include a master~ block in your patch!
In this block one can mute this channel, reverse the signal and adjust the level. A VU-meter is also visible to follow what happens. This specific block is one that has no counterpart in a real mixer, because you cannot put it in a stereo image. But it is useful though as an inline amplification block.

version

v1.0: built 20/04/2007 with Pd v0.40-2 [pd]

interface

Input 1: The mono audio signal
Input 2: A control input for the dB level. It ranges from 0 to 127, the former meaning silence, the latter the loudest.

Controls:
solo:
doesn't work yet
mute: when enabled, the signal is not throughput to the masterbus. When released again, the last value is taken again.
reverse: when enabled, the phase of the signal is reversed. This is not audible per se, only in comparison with other tracks or itself.
dB-slider: see Input 2.
VU-meter: shows the level of the signal at any time.
TO DO: implement peak meter

implementation

The dB-level is divided by 1.27 to make the input of the dbtorms range from 0 to 100. This is smoothed (line~) and multiplied with the high passed signal at the input of the block. This signal is not connected to the hot inlet as normal, but this works because the level control signal is turned into an audio signal in the line~ block.
The reverse logic is the same as in the rev~ block [v1.0 pd] [v1.0 pdf]. In the future it might be substituted here.
The logic for driving the input of the VU-meter is a dB calculation and a shift to the right scale. But this might be replaced by an env~ block in the future.
The mute logic: If mute is banged the message 0 is put as master-lvl while the previous value is stored in the bottom f(loat) object. Another bang releases this value again on the master-lvl.





channelM2S~

This is one of the channel blocks. It's the bottom part of channels on a real mixer. It allows to make all kinds of routing in your patch. It's output is routed to a master~ block to make it audible. When multiple blocks of this kind are used, one must specify a unique argument. This is almost always the case. No outlet is visible, because the signal is put on the left and right master bus internally. Be sure to include a master~ block in your patch!
In this block one can mute this channel, reverse each channel signal and adjust the level. A VU-meter is also visible to follow what happens. One can also change and reset the place of the signal in the stereospectrum with the PAN parameter.

version

v1.0: built 20/04/2007 with Pd v0.40-2 [pd]

interface

Input 1: The mono audio signal
Input 2: A control input for the dB level. It ranges from 0 to 127, the former meaning silence, the latter the loudest.
Input 3: A control input for the PAN position. -128 means left and 128 means right.

Controls:
pan: when clicking on the bang the PAN position is reset to zero. The number box can be used to change the position and the result of either a change with the number box, either a change at the corresponding inlet will be visible with the slider. Internally (in the block) one can choose between 4 panning laws, also look at the documentation of the monopanner~). The default law is a sine curve.
solo: doesn't work yet
mute: when enabled, the signal is not throughput to the masterbus. When released again, the last value is taken again.
reverseL, reverseR: when enabled, the phase of the signal is reversed. This is not audible per se, only in comparison with other tracks or itself.
dB-slider: see Input 2.
VU-meter: shows the level of the signal at any time.
TO DO: implement peak meter

implementation

The dB-level is divided by 1.27 to make the input of the dbtorms range from 0 to 100. This is smoothed (line~) and multiplied with the high passed signal at the input of the block. This signal is not connected to the hot inlet as normal, but this works because the level control signal is turned into an audio signal in the line~ block.
The reverse logic is the same as in the rev~ block [v1.0 pd] [v1.0 pdf]. In the future it might be substituted here.
The logic for driving the input of the VU-meter is a dB calculation and a shift to the right scale. But this might be replaced by an env~ block in the future.
The mute logic: If mute is banged the message 0 is put as master-lvl while the previous value is stored in the bottom f(loat) object. Another bang releases this value again on the master-lvl.
The panorama logic is the same as in the monopanner~ block. view that documentation.




channelS2S~

This is one of the channel blocks. It's the bottom part of channels on a real mixer. It allows to make all kinds of routing in your patch. It's output is routed to a master~ block to make it audible. When multiple blocks of this kind are used, one must specify a unique argument. This is almost always the case. No outlet is visible, because the signal is put on the left and right master bus internally. Be sure to include a master~ block in your patch!
In this block one can mute this channel, reverse each channel signal and adjust the level. A VU-meter is also visible to follow what happens. One can also change and reset the place of the signal in the stereospectrum with the PAN parameter.

version

v1.0: built 20/04/2007 with Pd v0.40-2 [pd]

interface

Input 1, 2: The two channels of the stereo audio signal
Input 3: A control input for the dB level. It ranges from 0 to 127, the former meaning silence, the latter the loudest.
Input 4: A control input for the PAN position. -128 means left and 128 means right.

Controls:
pan: when clicking on the bang the PAN position is reset to zero. The number box can be used to change the position and the result of either a change with the number box, either a change at the corresponding inlet will be visible with the slider. Internally (in the block) one can choose between 4 panning laws, also look at the documentation of the monopanner~). The default law is a sine curve.
solo: doesn't work yet
mute: when enabled, the signal is not throughput to the masterbus. When released again, the last value is taken again.
reverseL, reverseR: when enabled, the phase of the signal is reversed. This is not audible per se, only in comparison with other tracks or itself.
dB-slider: see Input 3.
VU-meter: shows the level of the signal at any time.
TO DO: implement peak meter

implementation

The dB-level is divided by 1.27 to make the input of the dbtorms range from 0 to 100. This is smoothed (line~) and multiplied with the high passed signal at the input of the block. This signal is not connected to the hot inlet as normal, but this works because the level control signal is turned into an audio signal in the line~ block.
The reverse logic is the same as in the rev~ block [v1.0 pd] [v1.0 pdf]. In the future it might be substituted here.
The logic for driving the input of the VU-meter is a dB calculation and a shift to the right scale. But this might be replaced by an env~ block in the future.
The mute logic: If mute is banged the message 0 is put as master-lvl while the previous value is stored in the bottom f(loat) object. Another bang releases this value again on the master-lvl.
The panorama logic is the same as in the monopanner~ block. view that documentation. One might call it balance instead of pan, but the implementation is the same, because the two channels of the stereo spectrum are mixed before entering the pan logic.



master~

Each analog mixer has an audio chain that ends with a master section. It represents the last step and is connected with the master outs. This block is also the last block in our chain. It puts the two master busses on the speaker outputs. There can be only one master~ block per patch.

version

v1.0: built 20/04/2007 with Pd v0.40-2 [pd]
TO DO: also implement a recording facility for recording examples of our results.

interface

Controls:
mute: when enabled, the signal is not throughput to the speakers. Also the DSP is stopped. One can use it as a panic! knob. When released again, the last value is taken again. When the MIDI value 40 is received mute is toggled.
dB-slider: controls the volume level of each channel. They are both controllable with the MIDI values 30 and 7 (two last sliders on a Korg MICROkorg)
VU-meter: shows the level of the signal at any time.
TO DO: implement peak meter

implementation

For the level and meter logic the same implementation is used as in the examples above.
The DSP is stopped when the mute knob has value 1, with the command pd dsp 0. When it's not 1 (but lower, thus being 0) the command pd dsp 1 puts the DSP (and the sound) back on.






No comments: