Forums > MaxMSP

drawing straight lines in multislider

November 4, 2008 | 9:47 pm

I’d like to draw straight lines in multislider in order to draw a waveform into buffer~. I want to use the same sort of straight-line drawer that is included in the table object. Is there some way to use this outside of table?


November 4, 2008 | 10:03 pm

always forget to mention that i’m using 4.6
thanks~


November 4, 2008 | 10:14 pm

If I am reading you correctly, then the
answer is "No."


November 6, 2008 | 8:16 am

Jay Bodley schrieb:
> I’d like to draw straight lines in multislider in order to draw a
> waveform into buffer~. I want to use the same sort of straight-line
> drawer that is included in the table object. Is there some way to
> use this outside of table?

You have to patch it yourself I am afraid, but why don’t you draw the
waveform with waveform~ directly into the buffer~?

you could construct such a function with the aid of mousestate by the way…

Another way is to use a function and dump its lines into a buffer~
Below an de-encapsulated version of my envbuffer~ abhaXion, after the
dump you can go on and draw to your liking…

Stefan

– Pasted Max Patch, click to expand. –


Stefan Tiedje————x——-
–_____———–|————–
–(_|_ —-|—–|—–()——-
– _|_)—-|—–()————–
———-()——–www.ccmix.com


November 6, 2008 | 6:42 pm

Use a [vexpr] object to create a list out of a function, then send the list to multislider.


November 6, 2008 | 8:20 pm

Since the table/itable object can do this already, why not just use an itable instead of the multislider?


November 7, 2008 | 9:36 pm

You can also use bpfunction to draw the lines. Set the domain size to the size of the buffer you want, then dump the values out into peek~ (yourbuffer~). I think there’s a dump command for all values at once, otherwise use the index outlet of an uzi.

The posts about generating your own functions to create these waveforms are also good. Experiment a bit with sin, pow, etc… you can send ranges of good values through them to generate interesting signal-level values (-1.0 to 1.0), particularly with sin/cos as these give values within this range naturally. You can then use pow on them, multiply them together, etc… lots of good ear and eye candy there.

-CJ


November 7, 2008 | 10:19 pm

I was at the house of one of my students/band-mates a few weeks ago and I showed him how you could make something like that using [function] and [record~] to draw envelopes into a buffer (could easily be used for waveforms as well).

I am not sure CJ’s idea will work very elegantly because the dump of [function] only dumps the breakpoints, so you would need to add a [line~] to fill in the values into the whole buffer (I think?).

I will ask him to email me the patch and I’ll post it, maybe someone can point out how to combine CJ and my techniques into some sort of non-realtime dump.


November 7, 2008 | 10:23 pm

Quote: stefantiedje wrote on Thu, 06 November 2008 03:16
—————————————————-

>
> Another way is to use a function and dump its lines into a buffer~
> Below an de-encapsulated version of my envbuffer~ abhaXion, after the
> dump you can go on and draw to your liking…
>

oh, didn’t notice Stefan was talking about this too. I think we may be talking about something similar but I can’t seem to get his to work. Anyway, I really should be finishing this emails and not hanging out on the Max list, so I will explore his patch again later.


November 8, 2008 | 12:24 am

Here is the example I was talking about:

– Pasted Max Patch, click to expand. –

And while I haven’t had a chance to try it, I bet I couldn’t get Stefan’s to work because I foolishly forgot to turn on DSP.


November 9, 2008 | 11:49 pm

That example is cool. I altered it a bit (*~2. then -~1. to give signal/buffer values between -1. and 1.) Also you can preset the bpfunction to save your line designs.

– Pasted Max Patch, click to expand. –

November 9, 2008 | 11:52 pm

Yes, yes, much more useful to actually use with [preset] included.

Just wanted to mention, that the original I posted was for making envelopes–nice to have them in buffers, glad you noticed my examples wasn’t for waveform drawing and made the write changes. I’ll link the thread to my friend so he can check out your additions.


November 10, 2008 | 12:03 am

Quote: seejayjames wrote on Sun, 09 November 2008 18:49
—————————————————-
> That example is cool. I altered it a bit (*~2. then -~1. to give signal/buffer values between -1. and 1.) Also you can preset the bpfunction to save your line designs.
>

It has been a long day, so I didn’t think of it when writing my last post, but you can save the extra MSP objects by changing the min/max of the [function] if you get info on it.

Also, sorry laotze, I overlooked that you were on Max 4.6. Here is my original example in 4.6 but like you asked, I changed the min/max already to -1, +1, for waveform drawing (unlike the default of 0, +1, which works well for writing an envelope into the [buffer~]).

#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P newex 174 389 64 196617 record~ aaa;
#P toggle 321 354 15 0;
#P newex 300 289 31 196617 t b 1;
#P newex 174 324 32 196617 line~;
#P message 71 134 33 196617 clear;
#P number 111 90 62 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 323 157 89 196617 buffer~ aaa 1000;
#P user function 111 170 311 270 1 1 0 0;
#X frgb 82 82 82;
#X brgb 204 204 204;
#X rgb2 85 85 85;
#X rgb3 255 255 255;
#X rgb4 0 0 0;
#X rgb5 0 0 0;
#X domain 1000.;
#X range -1. 1.;
#X done;
#P newex 323 132 66 196617 prepend size;
#P newex 111 134 93 196617 prepend setdomain;
#P connect 1 0 3 0;
#P connect 6 0 9 0;
#P connect 8 0 9 0;
#P connect 4 0 0 0;
#P connect 4 0 1 0;
#P connect 6 1 8 0;
#P fasten 7 0 2 0 305 308 305 314 101 314 101 167 116 167;
#P connect 7 1 8 0;
#P connect 2 3 7 0;
#P connect 2 1 6 0;
#P connect 5 0 2 0;
#P connect 0 0 2 0;
#P window clipboard copycount 10;


November 10, 2008 | 1:22 am

One of my ongoing projects is creating a waveshaping patch for use with [cycle~] that uses [multislider] to draw the wave. So far it has a few functions like smooth, digitise, randomise etc. but I’m now looking into using [ubutton] or a transparent [lcd] for drawing straight lines. I’ll let you know how it progresses.

lh


November 10, 2008 | 2:15 am

i’d be interested in seeing this patch if you wouldn’t mind sharing. keep in mind i’m on 4.6 – if the patch can be used in 4.6 i’d love to check it out.

the reason i’m asking about this in the first place is that i’m making a waveshaper using multislider.


November 10, 2008 | 2:29 am

It’s written in 5 I’m afraid and uses 512 element lists for the wavetable in [cycle~]. Also I’m not sure how many of the [zl] modes I’ve used were included in 4.6.

It’s not quite finished yet anyway but I have tomorrow off work so it won’t be long. If you want I could post it to the list and maybe someone will create a 4.6 version. Or I could take a screenshot and you could try to piece it back together yourself. Just let me know and I’ll see what I can do.

lh


November 10, 2008 | 10:07 am

If you’re OK with 3rd party dependencies, then [gen24] from PerColate might be the thing for you; see below.
cheers
Roger

– Pasted Max Patch, click to expand. –

November 16, 2008 | 5:48 pm

Here are the screenshots, let me know if you have trouble re-creating them, it’s by no means perfect. If anyone else is interested in seeing them let me know and I’ll post the max 5 versions here.

lh

http://tinyurl.com/5drlqy


November 16, 2008 | 5:52 pm

thanks a lot for sharing. i’m looking forward to re-creating this.


November 16, 2008 | 6:28 pm

Once my main patch is finished I will show you what I have. I had a look on your blog and like the look of your interpolation process, how does it sound? Sometimes waveshaping interpolation throws up some unexpected timbres if you’re using the waveform as an audio range oscillator, which can be good or bad depending on your taste. You might want to look into spectrum interpolation which should give you a more expected "musical" change. Oh, and I really like "Bruteforce" well done on that front it’s quite mesmerising.

lh


November 16, 2008 | 6:44 pm

Hey, thanks for checking it out. The interpolator is working pretty well, although i can’t say i’ve worked out every last bug. But yeah, sometimes if you’re switching from one waveshape to another drastically different one, you get some strange unpleasant sound and especially around zero it gets quiet (as you would expect). It’s coming along though. I’m using function now to get straight lines but I’d rather be able to just draw them as I’ve indicated. Thanks again for your help.


Viewing 21 posts - 1 through 21 (of 21 total)