Forums > MaxMSP

Probably a relatively straight forward question. Could anyone help?

Jan 10 2010 | 4:22 pm

Hey guys. Could anyone help me?

I have a patch that loads in file types (they are HRTF’s to position a sound source in space) and to change the file type I have a number box going into a "sprintf MacHD/Users/Sample%" where the number box will input the number into the position of the %. (I’m usin SFplay to load in a guitar sample. . .and then into the SFplay I’m loading two files for the left and right ear that then tell sfplay where to place the sample)

My question is. . .I want to take away the system of a number box and just have a slider (from left to right) where I will load some preset file types that I want to use.

Is there a way this can be done?

If the number box is 270 (i.e 270 degrees). . .the sound file that is loaded makes the sample play in the right ear. If the file I upload it 90. . .it plays in the left ear. . .if it plays the 180 sample. . it plays directly in the centre. Ideally what I want is to load in the files 90, 100, 110, 120, 130, 140, 150, 160, 170, 180, 190, 200, 210, 220, 230, 240, 250, 260, 270. . .and then that would mean as I slid the slider from left to right. . . the file type that played would gradually change the pan from left to right. (using those files).

Is this possible or I do I have to keep manually changing the number box and then toggling the patch off and on.

I know I could make make 20 or so message buttons with each of those angles on and then click them for whichever angle I wanted to play, but is it possible to have these message buttons replaced with a slider?

Thanks a lot for your help and I’m sorry if I’m not very clear.


Jan 10 2010 | 4:47 pm

Oh Ho. I did it guys.

I limited the slider so it only went up in 5’s (I even fitted in more samples this way so it goes up in 5’s from 90 – 270).

Then It read all the file types and using a series of bangs I have it so that every time I move the slider (which I made horizontal by messing with the size by accident and trial and error :D) I pans the sound.

the only problem i have is that there is digital clicking that occurs as I slide the sound from left to right.

Does anyone know any tips that could reduce / eliminate this?

Thanks a lot.

Jan 10 2010 | 5:08 pm


Jan 10 2010 | 5:09 pm

I have one very small quick question if someone could help me with it.

Can I inverse the values of a slider.

You see as I increase the value of the slider (moving from left to right) the panning goes from right to left and this is quite unnatural.

Can I somehow make the lower value of the slider be 270. . .with the "maximum" value being 90? As opposed to the way I currently have it (90 as the minimum and 181 value steps upward).

Thanks a lot.

Jan 10 2010 | 5:58 pm

scale or zmap, can’t remember which does it which doesn’t.

but you might prefer:

– [maxvalue]

Jan 10 2010 | 6:27 pm

or [!- ] which will flip the numbers. [scale] also allows inverting.

Interesting that you’re controlling panning with the actual samples, I would have used gain~ settings for each. But maybe you’ve got something else in mind. again, you can easily use the slider value with appropriate [scale] objects to control the correct levels for gain~, though the ramp should be non-linear.

Probably loading the files is causing the clicking. You can try line~ as mentioned, or trapezoid~ is also good to smooth out clicks. So just before you load a new one (before the slider bangs the load message) you ramp down, and after you load the new file it ramps up. Will take a bit of fiddling. [trigger] and [delay] are great for this kind of timing trickery.

Jan 10 2010 | 8:30 pm

Hey guys. I can’t thank you enough for your answers.

I used the [!-] object box to put between my slider and the number box! :)

The reason I’m using samples to control the panning is because it’s a convoluted way of panning (and it’s the requirements of an assignment). :)

I have a sound sample (a guitar) that I play, and then input two channels of a HRTF set. The two samples from the HRTF (which are essentially clicks recorded by in ear microphones using a dummy head) allow me to place the guitar sample in the space where the HRTF’s dictate.

Thanks for your help.

One final question if I may.

I currently have 2 patches. . .running two totally different processes. Ideally I’d like to have these in the one patch window and choose which process to run via maybe an option at the top "Patch 1" and "Patch 2" message boxes.

The problem is I don’t know if I’m allowed to use Gate or Selector and I don’t know where to place the option generator. Is it directly before the input gain? or is it before the DAC. I’m not sure where to join the two patches.

There’s an images of the end of each patch that I’d like to merge. Does anyone know where I’d put the object that would allow me to route those into the same DAC?

Thanks guys

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

Forums > MaxMSP