Max For Live JavaScript Random Generator Tutorial 01

Max For Live JavaScript Random Generator Tutorial 01

Yan Terrien

5 лет назад

1,520 Просмотров

In that first video, I will show you how I create a MIDI notes random generator with JavaScript in Max For Live.
- First, add a Max Midi Effect to a MIDI track.
- Then click on the yellow button to enter programing mode.
- Max For Live editor will open.
- Use the shortcut key of your OS to zoom if you like.
- Double click to create an object.
- In this object, write JS followed by the name of the device.
- Right click in to open menu. Choose, object, edit random midi.
- It will open a text editor where you will write the script.
- At the top of that script, write "inlets=1" and "outlets=3".
- Save your script in a folder that Ableton has in Places.
- Save also the device in the same folder.
- You can see that one inlet and three outlets have been created on your JavaScript object.
- Double click to create a new object
- Write inside the object the text "metro 4n @active 1"
- Then create a new object called "transport".
- And finally create an other object called "noteout"
- Link outlet 0 of metro to inlet 0 of transport.
- Link outlet 1 of transport to inlet 0 of your JavaScript object
- Link outlet 0 and outlet 1 of the JavaScript object to inlet 0 and inlet 1 of noteout
- In the script, write this code:

var note=0
function msg_int(i)
{
outlet(1,0);
outlet(0, note);
note= 50 + parseInt(Math.random()*30);
velo = 30 + parseInt(Math.random()*70);
outlet(1,velo);
outlet(0, note);
}

Outlet sends a value to output. The first call stops the sound of the previous note by sending a velocity of zero. Then a new note with a new velocity is created by using a random function. The note is between 50 and 80. The velocity is between 30 and 100. Then the new note is sent with outlet.

In the next video, I will show how to create buttons to interact with the JavaScript code.
Ссылки и html тэги не поддерживаются


Комментарии: