How to build a general LFO?

Learn about building and using Max for Live devices.
Post Reply
Kranzenmeyer
Posts: 5
Joined: Sun May 16, 2010 10:59 am

How to build a general LFO?

Post by Kranzenmeyer » Sun May 16, 2010 11:19 am

Hi!

I bought Max4Live yesterday, and I'm very excited! I've been looking around the forum and checked out the lessons, but I still have some basic problems. I want to build a general LFO device, synced to the internal clock.

So here is my questions:

1. How do I make a device that easily can manipulate say the mute/unmute on any channel? It would be nice if
it could behave like an external controller so it could be midi-mapped from project to project, but automated from max. I'm trying to achieve something like the LFO on the Elektron Machinedrum.

2. I made a simple automatic midi generator, synced to the internal clock as a test. It generates random midi pitch and
velocity. But when I close the patch, the device stops working. It seems like the device only shows input messages
from Live to the max. I would like to see the generated values. How can I achieve this?

Is there any good resources on how to build devices controlling other channels, devices and parameters outside its own
channel?


Thanks!
Kranz


This is my litte midigenerator:

{
"boxes" : [ {
"box" : {
"maxclass" : "newobj",
"text" : "noteout",
"fontname" : "Arial Bold",
"numoutlets" : 0,
"patching_rect" : [ 104.0, 336.0, 208.0, 18.0 ],
"id" : "obj-8",
"fontsize" : 10.0,
"numinlets" : 3
}

}
, {
"box" : {
"maxclass" : "number",
"fontname" : "Arial Bold",
"numoutlets" : 2,
"patching_rect" : [ 200.0, 280.0, 50.0, 18.0 ],
"presentation" : 1,
"id" : "obj-6",
"outlettype" : [ "int", "bang" ],
"fontsize" : 10.0,
"presentation_rect" : [ 160.0, 96.0, 50.0, 18.0 ],
"numinlets" : 1
}

}
, {
"box" : {
"maxclass" : "number",
"fontname" : "Arial Bold",
"numoutlets" : 2,
"patching_rect" : [ 103.0, 276.0, 50.0, 18.0 ],
"presentation" : 1,
"id" : "obj-5",
"outlettype" : [ "int", "bang" ],
"fontsize" : 10.0,
"presentation_rect" : [ 32.0, 96.0, 50.0, 18.0 ],
"numinlets" : 1
}

}
, {
"box" : {
"maxclass" : "newobj",
"text" : "between 1 127",
"fontname" : "Arial Bold",
"numoutlets" : 1,
"patching_rect" : [ 200.0, 248.0, 78.0, 18.0 ],
"id" : "obj-3",
"outlettype" : [ "int" ],
"fontsize" : 10.0,
"presentation_rect" : [ 197.0, 246.0, 0.0, 0.0 ],
"numinlets" : 3
}

}
, {
"box" : {
"maxclass" : "newobj",
"text" : "between 1 127",
"fontname" : "Arial Bold",
"numoutlets" : 1,
"patching_rect" : [ 103.0, 245.0, 78.0, 18.0 ],
"id" : "obj-2",
"outlettype" : [ "int" ],
"fontsize" : 10.0,
"numinlets" : 3
}

}
, {
"box" : {
"maxclass" : "newobj",
"text" : "loadbang",
"fontname" : "Arial Bold",
"numoutlets" : 1,
"patching_rect" : [ 140.0, 59.0, 55.0, 18.0 ],
"id" : "obj-18",
"outlettype" : [ "bang" ],
"fontsize" : 10.0,
"numinlets" : 1
}

}
, {
"box" : {
"maxclass" : "message",
"text" : "\"to MaxMSP 1\"",
"fontname" : "Arial Bold",
"numoutlets" : 1,
"patching_rect" : [ 140.0, 90.0, 81.0, 16.0 ],
"id" : "obj-17",
"outlettype" : [ "" ],
"fontsize" : 10.0,
"numinlets" : 2
}

}
, {
"box" : {
"maxclass" : "button",
"numoutlets" : 1,
"patching_rect" : [ 169.0, 189.0, 20.0, 20.0 ],
"presentation" : 1,
"id" : "obj-16",
"outlettype" : [ "bang" ],
"presentation_rect" : [ 95.0, 62.0, 53.0, 53.0 ],
"numinlets" : 1
}

}
, {
"box" : {
"maxclass" : "newobj",
"text" : "rtin",
"fontname" : "Arial Bold",
"numoutlets" : 1,
"patching_rect" : [ 140.0, 120.0, 27.0, 18.0 ],
"id" : "obj-4",
"outlettype" : [ "int" ],
"fontsize" : 10.0,
"numinlets" : 1
}

}
, {
"box" : {
"maxclass" : "newobj",
"text" : "sync~",
"fontname" : "Arial Bold",
"numoutlets" : 3,
"patching_rect" : [ 140.0, 151.0, 77.0, 18.0 ],
"id" : "obj-1",
"outlettype" : [ "signal", "", "int" ],
"fontsize" : 10.0,
"numinlets" : 1
}

}
],
"lines" : [ {
"patchline" : {
"source" : [ "obj-6", 0 ],
"destination" : [ "obj-8", 1 ],
"hidden" : 0,
"midpoints" : [ ]
}

}
, {
"patchline" : {
"source" : [ "obj-5", 0 ],
"destination" : [ "obj-8", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}

}
, {
"patchline" : {
"source" : [ "obj-3", 0 ],
"destination" : [ "obj-6", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}

}
, {
"patchline" : {
"source" : [ "obj-2", 0 ],
"destination" : [ "obj-5", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}

}
, {
"patchline" : {
"source" : [ "obj-16", 0 ],
"destination" : [ "obj-3", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}

}
, {
"patchline" : {
"source" : [ "obj-16", 0 ],
"destination" : [ "obj-2", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}

}
, {
"patchline" : {
"source" : [ "obj-4", 0 ],
"destination" : [ "obj-1", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}

}
, {
"patchline" : {
"source" : [ "obj-1", 1 ],
"destination" : [ "obj-16", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}

}
, {
"patchline" : {
"source" : [ "obj-17", 0 ],
"destination" : [ "obj-4", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}

}
, {
"patchline" : {
"source" : [ "obj-18", 0 ],
"destination" : [ "obj-17", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}

}
]
}

bulo
Posts: 434
Joined: Sat Sep 09, 2006 7:57 pm
Location: France
Contact:

Re: How to build a general LFO?

Post by bulo » Sun May 16, 2010 2:28 pm

Max tutorials, alongside with the LOM, is the starting point.
Don't think you can achieve something without learning how the software works (even a simple LFO). I understand that you are excited, but after one day...
My tongue spits english like a frog and my head is currently searching for a comprehensive language.
And I shit here

Kranzenmeyer
Posts: 5
Joined: Sun May 16, 2010 10:59 am

Re: How to build a general LFO?

Post by Kranzenmeyer » Sun May 16, 2010 3:00 pm

Thanks for your reply bulo, I totally agree with you regarding the tutorials and the lessons. However, I have been using Max/msp/jitter for many years and I have made different LFO patches for Ableton using ctrlout, making it behave like an automated external controller. My first question was how the same is possible inside M4L, as a midi device. I could not find that in any of the tutorials. So any input on this is greatly appreciated.

Thanks,
Kranz

pid
Posts: 354
Joined: Thu Nov 05, 2009 9:51 am

Re: How to build a general LFO?

Post by pid » Sun May 16, 2010 4:02 pm

if you are already a max user it might be worth taking apart a couple of the lfos from maxforlive.com ?
3dot... wrote: in short.. we live in disappointing times..

Kranzenmeyer
Posts: 5
Joined: Sun May 16, 2010 10:59 am

Re: How to build a general LFO?

Post by Kranzenmeyer » Sun May 16, 2010 4:16 pm

Thats exactly what I was looking for!

Thanks!
Kranz

Tone Deft
Posts: 24152
Joined: Mon Oct 02, 2006 5:19 pm

Re: How to build a general LFO?

Post by Tone Deft » Sun May 16, 2010 5:08 pm

bunch of LFO tutorials here:

http://cycling74.com/category/tutorials/
In my life
Why do I smile
At people who I'd much rather kick in the eye?
-Moz

Khazul
Posts: 3185
Joined: Wed Feb 23, 2005 5:19 pm
Location: Reading, UK

Re: How to build a general LFO?

Post by Khazul » Sun May 16, 2010 10:17 pm

This is one Im currently developing - a midi note triggerable algorythmic function generator and gives you access to the live mixer etc.

It was actually to drive lighting, but I was pleasently surpised at what some of its odd shapes can do to audio, especially as the waveforms can be continuously modulated as well via the contour and quantize controls, or even modulated with another funcgen :)

Contoured triangle controlling master crossfader (uselsss, but for illustration).
Image

Quantized and contoured envelope controling a send level:
Image

The little circle is like live's loop progress indicator.

I'm currently a bit sidetracked with it to see what can be done in terms of cranking the waveforms generator upto audio frequencies for synthesis purposes 8)

As other suggested best advice is look at existing patches and of course some of the helper sub patchers stuff that are included. Pull the global transport window apart can be useful too - but you will need to predit the text file and delete a load of window control relatted stuff to make it editable.

Read up on phasor~, rate~, sync~, metro, snapshot (if you want non-audio frequency updates - which TBH are mostly good enough) and live.remote~ objects for the actual signal generator and control (you wont need rate~ or sync~ but they are a useful read). live.path / live.object for selectign live parameters, and live.observer if you want to see values in real time. When reading up on phasor~/metro - pay special atttension to tempo relative time information.

If you want to go algortythmic, then jsui/js or java externals. Mine uses js for the function generator and jsui for the waveshape display. js is just about fast enough for this kind of thing if you are very careful.
Nothing to see here - move along!

Tone Deft
Posts: 24152
Joined: Mon Oct 02, 2006 5:19 pm

Re: How to build a general LFO?

Post by Tone Deft » Sun May 16, 2010 10:45 pm

nice. I'm going for a more primitive approach by adding an LFO to a device parameter remote control I made
http://www.maxforlive.com/library/devic ... d=285#1061

it's working, just need to add a few more LFO shapes and fix some easy bugs.


that and watching the Stanley Cup.

Sharks... :cry:
In my life
Why do I smile
At people who I'd much rather kick in the eye?
-Moz

Kranzenmeyer
Posts: 5
Joined: Sun May 16, 2010 10:59 am

Re: How to build a general LFO?

Post by Kranzenmeyer » Tue May 18, 2010 1:29 pm

Khazul, that looks fantastic! Will it be available at maxforlive.com ?

Khazul
Posts: 3185
Joined: Wed Feb 23, 2005 5:19 pm
Location: Reading, UK

Re: How to build a general LFO?

Post by Khazul » Tue May 18, 2010 2:11 pm

Cheers! :)

Yes eventually - once I have learned a bit more about the peculiarities of M4L vs MAX - in particular - how not to crash it so easily ;)
Also I have been a bit side tracked tryign to get to know the Live object model alot better - hence this thread: viewtopic.php?f=35&t=142866 8)
Nothing to see here - move along!

Post Reply