Showing posts with label teaching. Show all posts
Showing posts with label teaching. Show all posts

Monday, October 08, 2012

Max for Live Basics Tutorial 3: Delay Line Audio Effect

Overview
The aim of this tutorial is to cover the basics of creating a delay line audio effect in Max for Live. This tutorial should be seen as a starting point that can be expanded upon. This tutorial assumes that you have read Max for Live Basics 1 as well as Max for Live Basics 2

Max for Live is an extension for Ableton Live. This allows users to load patches made in Cycling 74's Max inside of Ableton as Live devices. Max is a graphical programming language whereby patches are created by connecting various objects together. Each object performs a specific function, and multiple objects - interconnected in specific ways - can perform complex operations.

In Max for Live, three categories of devices can be created:
• Audio effects
• MIDI effects
• Instruments

An audio effect takes an audio signal as an input and outputs an audio signal.

A MIDI effect takes MIDI data as an input and outputs MIDI data.

An instrument takes MIDI data as an input and outputs an audio signal.

This tutorial will cover how to create a digital delay effect with feedback.













Basics: Digital Delay Line

Let's begin with working on a track that already has a sample or software synth on it - just something that makes some sound so that we can test our effect as we go.


Add a blank Max Audio Effect device, found in Live Devices > Audio Effects. 


Notice that the blank Max Audio Effect has two objects. The plugin~ object represents audio going into the device. The plugout~ object represents audio coming out of the device. The outlet / inlet on the left had side represents the left channel of audio.  The outlet / inlet on the right had side represents the right channel of audio. Open up the device in Max.


Save the device in the Max Audio Effects folder. I named mine Seb.ExampleAudioEffect. 


Remove the clutter of unnecessary comments and make the patching window larger. 


Create a tapin~ 2000 object. This represents the input of a delayed audio memory, used in delay effects such as a simple delay effect unit. The number 2000 represents the delay time in milliseconds. Connect the left outlet of the plugin~ object to the inlet of the tapin~ 2000 object.


Create a second tapin~ 2000 object. Connect the right outlet of the plugin~ object to this second tapin~ 2000. 


Create a  tapout~ 2000 object. This represents the input of a delayed audio memory, used in delay effects such as a simple delay effect unit. The number 2000 represents the delay time in milliseconds. Connect the outlet of the tapin~ 2000 object to the inlet of the tapout~ 2000 object. This connection simply links the two together so that they share the same audio memory - it is not an audio signal connection as such.


Create another  tapout~ 2000 object. This represents the input of a delayed audio memory, used in delay effects such as a simple delay effect unit. The number 2000 represents the delay time in milliseconds. Connect the outlet of the second tapin~ 2000 object to the inlet of the second tapout~ 2000 object. This connection simply links the two together so that they share the same audio memory - it is not an audio signal connection as such. 


Connect the outlet of the tapout~ 2000 object to the left inlet of the plugout~ object. This will route the audio signal to the output of the device. 


Connect the outlet of the second tapout~ 2000 object to the right inlet of the plugout~ object. This will route the audio signal to the output of the device. 


Create a live.numbox


Change the type to float. Change the Range / Enum to 0. 2000. 


Connect the left outlet of the live.numbox to the inlet of the tapin~ 2000 object. 


Connect the left outlet of the live.numbox to the inlet of the other tapin~ 2000 object. Thus, the live.numbox can control the delay time of the plugin.


Finally, add a comment to label the live.numbox correctly. 


Save your device and try it out in Ableton!












Extension: Adding Feedback

Like many delay effects, we might want feedback in this one too! Add two *~ objects. 


Connect the outlets of each of the tapout~ 2000 objects to each of the  *~ objects.


Route the output of each *~ object back to its respective tapin~ 2000 object. 


Create a live.numbox so that we can control the feedback amount. 


Change the Unit Style of the live.numbox to Float. Change the Range / Enum to 0. 1.


Connect the left outlet of the live.numbox to the right inlet of both of the *~ objects. The basic idea is: our audio signal is sent to the tapin~ 2000 object; then it is delayed; then it comes out of the tapout~ object; then it is routed to a gain stage (the *~ object); then the output from this signal is fed back to its own input stage, thus creating delayed feedback. 


Save your device and try it out in Live!











Exercises
• Add a filter in the feedback loop (hint objects: filtergraph, biquad~, *~, umenu)
• Control the delay time with a sinewave instead of a live.numbox (hint objects: cycle~, tapout~, +~, *~, i, f)
• Create a multi-tap delay (an effect with multiple delay lines

Max for Live Basics Tutorial 2: MIDI Transposition Effect

Overview
The aim of this tutorial is to cover the basics of creating a MIDI transposition effect in Max for Live. This tutorial should be seen as a starting point that can be expanded upon. This tutorial assumes that you have read Max for Live Basics 1.

Max for Live is an extension for Ableton Live. This allows users to load patches made in Cycling 74's Max inside of Ableton as Live devices. Max is a graphical programming language whereby patches are created by connecting various objects together. Each object performs a specific function, and multiple objects - interconnected in specific ways - can perform complex operations.

In Max for Live, three categories of devices can be created:
• Audio effects
• MIDI effects
• Instruments

An audio effect takes an audio signal as an input and outputs an audio signal.

A MIDI effect takes MIDI data as an input and outputs MIDI data.

An instrument takes MIDI data as an input and outputs an audio signal.

This tutorial will cover how to create a MIDI transposition effect.













Basics: MIDI Transposition



Create a blank Live Set. Create a blank MIDI track. Onto this MIDI track, put a blank Max for Live MIDI effect, which can be found in Live Devices > MIDI Effects > Max MIDI Effect. 


Note that the MIDI effect has one input and one output, representing MIDI data going into and coming out of the device. 


Open the device in Max by clicking on the edit icon. Max should open up with the device patch. 


Save your MIDI effect in the Max MIDI Effect folder. I have named mine Seb.ExampleTransposition. 


Delete the unnecessary comments and also delete the patch cable in between the midiin and midiout objects. These two objects represent the input and output of the device. To quickly select and delete multiple patch cables, simply click and drag the mouse cursor whilst holding down the option key.


Expand the size of the Max patching window. Add a midiparse object and connect the outlet of the midiin object to the midiparse object.


Just like in the previous example, we need to access the pitch of a note separately from the velocity. To do this, we once again need an unpack i i object connected to the first outlet of the midiin object.  Additionally, connect a midiformat object to the midiout object.

The midiformat object is basically the inverse of the midiparse object, and can transform simple numbers and lists into MIDI-formatted serial data that we can send on to whatever device is next in our Ableton Live effects chain.


Add a + object, and connect the first outlet of the pack i i object to it. The first outlet of the pack i i object represents the MIDI pitch of an incoming note.  The second outlet represents velocity.


Create a pack i i object. Connect the outlet of the + object to the first inlet of the pack i i. Connect the second outlet of the unpack i i object to the second inlet of the pack i i object. Thus, the velocity is passed straight through the plugin, leaving only the pitch to be affected. 

The midiformat object takes a list of two numbers (pitch and velocity) in its first inlet. We can create such a list after our transposition by packing our new MIDI pitch value along with our velocity into a message. 



Create a live.dial object. This is similar to the live.numbox, but looks a little different...


Like the live.numbox, the live.dial is used as part of the GUI. It can be automated just like any other Live parameter. 


Open up the object inspector for the live.dial object (command (apple) i). Change the Long Name and Short Name to "Transposition. This will mean that the dial will have the name Transposition on screen in the GUI, and also on screen when it is automated in the Arrangement Window. 


Change the type to "float". Change the Range / Enum to -48. 48. This is our transposition range in semitones.


You will see that the dial changes to reflect the new data range. You may need to make the object longer by resizing it with the mouse so that the whole word "transposition" can be seen.



Connect the left outlet of the Transposition dial to the right outlet of the + object.


Connect the output of the pack i i object to the midiformat object. 


Re-arrange your objects so that you can see them when you are in Live!


Try out the device in Live. 


You will see that in the Live Devices browser, the transposition device that you have created appears in a location relative to where you saved it. This way you can re-use it in other projects and sessions. 


You can even use it in conjunction with the sine synth made previously! 










Extension: Passing Through Original Notes As Well As Transposed Ones


At the moment, our MIDI effect only transposes the original pitch, but does not allow the original pitch through.  Let's add an option to allow the use to do exactly that! A simple on / off toggle, which - when switch to on - allows the original notes to pass through.

Create a live.toggle object. This is just an on / off button. When the button is switched from on to off, it sends out a 0. When the button is switched from off to on, it sends a 1.

 
Add a comment to describe the action of the button.


Create a new gate object. Connect the left outlet of the midiparse object to the right inlet of the gate. The gate allows message to go through when it is switched to on, and stops messages from going through when it is switched to off.

The left inlet of the gate controls this action. When the gate receives a 0 in its left inlet, nothing passes from the right inlet to the outlet. When the gate receives a 1 in its left inlet, any data that goes into its right inlet is automatically passed to the outlet.


Connect the outlet of the gate to the first inlet of the midiformat object. 


Connect the live.toggle object to the left inlet of the gate object. This way - whenever the gate is open by way of the toggle - any incoming notes are automatically sent to the output via the midiformat object.










Extension: Velocity Scaling

At the moment, our transposition object only changes the pitch. But what about the velocity? A useful addition might be a control that scales the velocity in terms of percentage.


Create a live.dial object.  Change the Long Name and Short Name to "Velocity". Change the Range / Enum to 0. 100.. Change the type to Float. Change the unit style to %.


Place the dial in an appropriate location. 


Delete the connection from the second outlet of the unpack i i object to the second inlet of the pack i i object. 


Add a * 1.0 object (not *~ 1.0!). Connect the outlet of the second outlet of the unpack i i object (our velocity) to the left inlet of the * 1.0 object.

The * 1.0 object is a simple multiplication object, and multiplies any numbers it receives in its left inlet by whichever number was last received in its right inlet. 


Connect the outlet of the * 1.0 object to the inlet of the pack i i object. This is our scaled velocity going to the output via the midiformat. 


Add a / 100. object. This object will simple divide the output range from the dial (which is from 0. - 100.) by 100., yielding a range of 0. 1.. Connect the left outlet of the live.dial object to the left inlet of the / 100. object.


Connect the outlet of the / 100. object to the  * 1. object. Thus, each velocity value is multiplied by a percentage between 0% and 100% as determined by the Velocity parameter.


Save your device, and try it out!









Exercises
• Edit your patch so that the MIDI transposed notes are in fact delayed in time (hint objects: pipe)
• Edit your patch so that there are multiple notes of transposition available simultaneously, each with its own transposition and velocity parameters.