Skip to main content

Lesson 3 - Line, metro and automation of processes

Completion requirements
Graphical control and automation of processes introducing line and metro objects to
control pitch and volume.

Lesson 3:

edu sharing object


00:08 - Lesson 03. Line, metro and automation of processes. In this tutorial we are going to introduce some objects to make the patch we created in the previous tutorial look nicer. Let’s refine our patch by introducing a graphical control for the volume. The name of such a control object is “slider” and can be found in “Insert” menu —> “vertical slider”. 00:39 - If you rightclick on it and select “Properties” we can assign an appropriate range to the slider. Since we want floating-point numbers between 0 and 1, in order to reduce the volume, we need to edit this field here. Now we can connect it either directly to our signal multiplier or to the “number box” if we want to display the number that is generated by the slider. We can do something similar for the oscillator as well. We take a horizontal “slider”. 01:15 - Connect it, and once we expose the “Properties” window we can assign a relevant range of frequencies. In this way I gained a more versatile control over the signal I’m producing. Let’s introduce a new object that allows us to create ramps. What is a ramp? A ramp is a sequence of values in ascending or descending order within an assigned range. To see how it works, let’s create a new object and write inside “line tilde” because we want to create a ramp for signals. 02:06 - Let’s delete the slider by selecting it and pressing the delete key, and we’ll use our “line” to set the right operand of the multiplier. 02:20 - The idea is to create a crescendo for our volume from 0. to 1. In order to create the crescendo, we need to tell the “line” two things: which value we want to reach and how long the ramp will last. To do that we need a “message”. To create a message you can type ctrl_2/cmd_2, or from the “Insert” menu select “Message”. 02:53 - You will recognize that this box is a message and not an object by its different shape. Let’s write inside our message 1 [one], because we want the line to reach 1, and 5000 because we want to reach 1 in 5 seconds or, according to the line’s syntax, 5000 milliseconds. Before trying it, let’s create another message to go back to 0 in 1 second. 03:38 - We could do something similar for our oscillator as well. Let’s create a new “line” and connect it to the oscillator. 03:57 - Let’s say we want to reach 1000 Hertz in 3 seconds, and then go back to 50 Hz. So basically we implemented a “glissando”. 04:32 - Let’s introduce some new objects that will allow us to automate some of the processes we’ve been doing manually until now. How about we create these glissandos rhythmically and do the same for “crescendo” and “decrescendo”. First of all let’s shorten the duration of our glissandos. For example, 30 milliseconds to go up to 1000 Hertz and the same amount of time to go down to 50 Hertz. 05:06 - Now we need something which is able to trigger these two messages rhythmically. To do this we need to produce the “bangs” we already met before but at a given rate. The object for doing this is called “metro”, because it basically acts as a metronome. It takes as argument the speed or rate at which I want to produce the “bangs”. Let’s say half of a second, so 500 milliseconds. 05:37 - If I connect a “bang” to the “metro” outlet I won’t see anything yet because the metro is still off. To turn it on I need to introduce a new special object called “toggle” and connect it to the metro’s inlet. 06:00 - This object is just a switch; if I select it once, it sends out a 1, if I select it again it sends out a 0. Let’s try to see it in action and the bangs come out of the “metro” object each half second. Of course I can set a different speed for the “metro” just by using a “number box” and connecting it to the right metro’s inlet, because as we said already sending a number to an object’s cold inlet will overwrite that object’s argument. We can now connect this bang to the message that sets the frequency of the oscillator. 06:46 - As you may have noticed there is no difference, the reason is that the oscillator has already reached 1000 Hz, so we need a way to set it back to 50 Hz. To do this I can first connect another “toggle” to the “bang” coming from the “metro”. 07:13 - As you see, each time a bang is received the “toggle” is alternately set to 1 or 0. I can check this behaviour by connecting a number box to this toggle. Now all I need to do is to tell my algorithm that when this “toggle” is set to 1 it triggers the “up glissando”, and when it is set to 0 it triggers the “down glissando”. 07:44 - The object that allows us to do this is called “select”. If “select” gets a value that matches its argument it sends out a bang from a specific outlet. Since the “toggle” produces only 0 and 1, these are going to be the arguments of “select”. When “select” receives 1 it sends out a bang from the left-most outlet, when it receives 0 the bangs go out the middle outlet, and if the incoming value doesn’t match any argument, the value itself passes through the right-most outlet. You can easily check this by creating two new bangs and connecting those to the output of the ‘select’ object. 08:34 - Each time we encounter a new object it is a good practice to always check its help file. To see it, just right-click on the object you want to know more about, and select “Help” from the contextual menu. 08:52 - Let’s close the help file and go on. Now we can connect our two bangs to the messages we want to trigger and raise up the volume to listen to the result. 09:21 - In this way we can create rhythmical glissandos. At this point we are free to set a different speed for the “metro” too , and I can already create some interesting scenarios. 09:09 - Nothing prevents us from doing something similar for the control of the volume as well. It is enough to copy and paste the part of the algorithm we want to replicate by selecting it and typing ctrl_C/cmd_C to copy it, and ctrl_V/cmd_V to paste it. Then I can drag it and connect the outputs of “select” to the messages that I want to send to the “line” object controlling the volume. 10:16 - Let’s adjust the length of the ramp of the volume, to better perceive the rhythmical aspects. 10:49 - One more thing we can do is to delete the “bang” we used to trigger the “tabwrite” object, because now we could just use the “bangs” sent out by the “metro”, which is controlling themoscillator, in order to trigger the “tabwrite” automatically. 11:10 - As you can see “metro” is an extremely versatile object which allows us to execute something cyclically. 11:19 - With this basic patch we are already able to achieve an interesting variety of results. In the next tutorial we are going to see how we can introduce randomness into our processes.

Example Patch:


edu sharing object

Last modified: Tuesday, 12 September 2023, 6:09 PM