Joystick audio control

edward@nunheadchapel.plus.com's icon

Hello! I'm wondering whether anyone can help me with a patch I'm trying to cobble together. I have been using the buttons on a USB joystick to trigger sounds using MIDI, but I dont know how to map the x, yand z axes to work as controller changes. What I'd really like to do is use the x and y axis to control the volume and panning of a live audio feed, but I don't have a clue how to do this... Here's the (rather limited) code I've got so far:

Max Patch
Copy patch and select New From Clipboard in Max.

If anyone can help, I'd be very grateful...

Ed

Owen Green's icon

Ed wrote:
> What I'd really like to
> do is use the x and y axis to control the volume and panning of a
> live audio feed, but I don't have a clue how to do this... Here's the
> (rather limited) code I've got so far:

Your patch doesn't make sense to me for what you seem to want to do:

- There's no MSP stuff for controlling gain or pan of some audio source.

- All that happens is that joystick input is reformatted as midi
messages (but not rescaled, which is probably bad) and sent out of a
midi output.

Is the volume / pan thing you want to control going to be in your patch,
or somewhere else?

If it's going to be in your patch, first make something in msp that
controls the gain / pan of a signal, consulting the docs,
maxobjects.com, and list archives as needed. The rest will then be
considerably more apparent - the aim would be to rescale the joystick
input to a range that works with whatever your eventual volume / pan
controls expect. I don't see that midi *needs* to come into it.

--
Owen

edward@nunheadchapel.plus.com's icon

Thanks Owen, I was going through the max tutorials and not finding a lot about audio. Now I've found the MSP tutorials, things are better! Although this new patch I've written is giving me weird latency problems, but I'm fairly sure its my eccentric soundcard. I haven't sussed out panning yet but I've made a simple volume control:

Max Patch
Copy patch and select New From Clipboard in Max.

Thanks very much for your reply!

Ed

Owen Green's icon

Ed wrote:
> Thanks Owen, I was going through the max tutorials and not finding a
> lot about audio. Now I've found the MSP tutorials, things are better!

Yeah, they'll help :)

> Although this new patch I've written is giving me weird latency
> problems, but I'm fairly sure its my eccentric soundcard.

Check your buffer settings in the dsp status window. If you're on
windows, make sure you're using a proper ASIO driver, if available,

> I haven't
> sussed out panning yet but I've made a simple volume control:

Good going - you'll find that the linear mapping you've got at the
moment sounds uneven, I suspect. The [gain~] object may be helpful.

Panners are more involved, but the examples folder is your friend.

--
Owen

wippen's icon

We did this a while back, using a sort of surround-sound installation approach; it was fun. If you are having wierd reactions, take a look at the polling frequency in the [hi] object. I set ours to 10ms, which was more than fast enough.

dGarden's icon

hi,
I made this some weeks ago to illustrate the tutorial of Andrew Benson about making connections between a Joystick and Max.

Hope it will give you some ideas ...