Csound Csound-dev Csound-tekno Search About

Reading USB game controllers from CSound

Date2005-11-28 21:22
FromCharles Barry Groves
SubjectReading USB game controllers from CSound
I'm using CSound to read MIDI instruments and controllers.  MIDI 
Solutions makes a box that will convert a resistance-type controller 
(e.g. volume pedal, photoresistor) to a continuous, scaled MIDI signal 
(0-127), but this costs $130 - per controller.

I found a USB-compatible "Rumble Wheel" video game controller with two 
pedals at Wal-Mart for $40.  But I haven't been able to find any opcodes 
that read USB ports.

Besides the cost issue, I thought it a good idea to reduce the load on 
the midi port - I'm planning to use many continuous controllers.

Any ideas?

Thanks,
Barry
cbgroves@ix.netcom.com

Date2005-11-28 21:57
FromDavid Akbari
SubjectRe: Reading USB game controllers from CSound
On Nov 28, 2005, at 4:22 PM, Charles Barry Groves wrote:

> I'm using CSound to read MIDI instruments and controllers.  MIDI 
> Solutions makes a box that will convert a resistance-type controller 
> (e.g. volume pedal, photoresistor) to a continuous, scaled MIDI signal 
> (0-127), but this costs $130 - per controller.
>
> I found a USB-compatible "Rumble Wheel" video game controller with two 
> pedals at Wal-Mart for $40.  But I haven't been able to find any 
> opcodes that read USB ports.
>
> Besides the cost issue, I thought it a good idea to reduce the load on 
> the midi port - I'm planning to use many continuous controllers.
>
> Any ideas?

Yikes! Sounds expensive.

IMHO, at most you shouldn't spend more than $10 on something like a USB 
hub ...

My advice is to use Hans Christoph-Steiner's [hid] object for Pure Data 
and either

1) send out the data as OSC and make a responder in Csound (very 
flexible!)
2) use the data directly to control Csound via inchannel opcode using 
[csoundapi~] in Pure Data
3) send out MIDI data internally from Pure Data and set commandline 
Csound's input to Pd's virtual output.

If you are using multiple devices you should find some kind of software 
multiplexing solution to be of use. MIDI-Yoke for Windows and MIDI-Pipe 
for Mac OSX are two freeware applications to suit this purpose.

Now as far as creating opcodes to decide human interface data, we run 
into the problem of having a truly cross platform solution. Based on 
Hans's sources I've been muddling about with the idea of Csound opcodes 
to receive HID data but from looking at all the sources on the 3 major 
OSes (Windows, OSX, Linux) it would seem that the Linux event manager 
is the most efficient and easiest to understand.

For now I use a Gravis Gamepad Pro (cheap, <= $20.00) and Wingman 
Extreme Digital 3d Joystick to control Csound in realtime.

The bonus of using Pure Data as your "receiving interface" is

1) You can simultaneously use the same performance data to manipulate 
both audio AND video simultaneously.
2) commandline Csound(5) is still easily accessible in a variety of 
ways, most notably through OSC, [netsend] with the new TclCsound, 
simply with the -M flag on the commandline, or by using the 
[csoundapi~] object. To do synchronous audio/video, [csoundapi~] and 
OSC seem to be the best, IMHO.
3) ... it's free. Like Csound. :D

Hope this helps !!


-David

Date2005-11-28 22:09
FromKenneth Long
SubjectRe: Reading USB game controllers from CSound
Does csound have mouse (optical rotary) input?

or more appropriate question, how can someone 
interface optical rotary signal into csound?

thanks
ken


--- David Akbari  wrote:

> 
> On Nov 28, 2005, at 4:22 PM, Charles Barry Groves
> wrote:
> 
> > I'm using CSound to read MIDI instruments and
> controllers.  MIDI 
> > Solutions makes a box that will convert a
> resistance-type controller 
> > (e.g. volume pedal, photoresistor) to a
> continuous, scaled MIDI signal 
> > (0-127), but this costs $130 - per controller.
> >
> > I found a USB-compatible "Rumble Wheel" video game
> controller with two 
> > pedals at Wal-Mart for $40.  But I haven't been
> able to find any 
> > opcodes that read USB ports.
> >
> > Besides the cost issue, I thought it a good idea
> to reduce the load on 
> > the midi port - I'm planning to use many
> continuous controllers.
> >
> > Any ideas?
> 
> Yikes! Sounds expensive.
> 
> IMHO, at most you shouldn't spend more than $10 on
> something like a USB 
> hub ...
> 
> My advice is to use Hans Christoph-Steiner's [hid]
> object for Pure Data 
> and either
> 
> 1) send out the data as OSC and make a responder in
> Csound (very 
> flexible!)
> 2) use the data directly to control Csound via
> inchannel opcode using 
> [csoundapi~] in Pure Data
> 3) send out MIDI data internally from Pure Data and
> set commandline 
> Csound's input to Pd's virtual output.
> 
> If you are using multiple devices you should find
> some kind of software 
> multiplexing solution to be of use. MIDI-Yoke for
> Windows and MIDI-Pipe 
> for Mac OSX are two freeware applications to suit
> this purpose.
> 
> Now as far as creating opcodes to decide human
> interface data, we run 
> into the problem of having a truly cross platform
> solution. Based on 
> Hans's sources I've been muddling about with the
> idea of Csound opcodes 
> to receive HID data but from looking at all the
> sources on the 3 major 
> OSes (Windows, OSX, Linux) it would seem that the
> Linux event manager 
> is the most efficient and easiest to understand.
> 
> For now I use a Gravis Gamepad Pro (cheap, <=
> $20.00) and Wingman 
> Extreme Digital 3d Joystick to control Csound in
> realtime.
> 
> The bonus of using Pure Data as your "receiving
> interface" is
> 
> 1) You can simultaneously use the same performance
> data to manipulate 
> both audio AND video simultaneously.
> 2) commandline Csound(5) is still easily accessible
> in a variety of 
> ways, most notably through OSC, [netsend] with the
> new TclCsound, 
> simply with the -M flag on the commandline, or by
> using the 
> [csoundapi~] object. To do synchronous audio/video,
> [csoundapi~] and 
> OSC seem to be the best, IMHO.
> 3) ... it's free. Like Csound. :D
> 
> Hope this helps !!
> 
> 
> -David
> 
> -- 
> Send bugs reports to this list.
> To unsubscribe, send email to
> csound-unsubscribe@lists.bath.ac.uk
> 



		
__________________________________ 
Yahoo! Music Unlimited 
Access over 1 million songs. Try it free. 
http://music.yahoo.com/unlimited/

Date2005-11-29 15:10
FromAidan Collins
SubjectRe: Reading USB game controllers from CSound
AttachmentsNone  None  

Date2005-11-29 17:57
FromCharles Barry Groves
SubjectRe: Reading USB game controllers from CSound
Thanks to everyone who replied.  I think if I study PureData for the 
next six months I'll understand David's answer...:)  By the way, I'm 
confined to PC operating systems (XP Pro, 98, 95, 3.11(!)).  So the 
STEIM software, being Mac, can't help me right now.

I received the Pedal Controller, which is programmed by System Exclusive 
messages.  I had assumed I'd be able to send SysEx right out of CSound 
via MIDIOUT - now I don't think so, but it's hard to imagine such a 
common requirement is missing.

What have I overlooked?


David Akbari wrote:

> Yikes! Sounds expensive.
> IMHO, at most you shouldn't spend more than $10 on something like a 
> USB hub ...
> My advice is to use Hans Christoph-Steiner's [hid] object for Pure 
> Data and either
>

Date2005-11-29 22:50
FromBill Beck
SubjectRe: Reading USB game controllers from CSound
There is a joystick to midi converter called midijoy by vellocet:
http://www.vellocet.com/

I've used it and it's great. But you need to use a loopback system, 
which I know are out there but I haven't used; I just pluged a midi out 
cable right back into my midiman 2x2 and was good to go.

-Bill

Charles Barry Groves wrote:

> Thanks to everyone who replied.  I think if I study PureData for the 
> next six months I'll understand David's answer...:)  By the way, I'm 
> confined to PC operating systems (XP Pro, 98, 95, 3.11(!)).  So the 
> STEIM software, being Mac, can't help me right now.
>
> I received the Pedal Controller, which is programmed by System 
> Exclusive messages.  I had assumed I'd be able to send SysEx right out 
> of CSound via MIDIOUT - now I don't think so, but it's hard to imagine 
> such a common requirement is missing.
>
> What have I overlooked?
>
>
> David Akbari wrote:
>
>> Yikes! Sounds expensive.
>> IMHO, at most you shouldn't spend more than $10 on something like a 
>> USB hub ...
>> My advice is to use Hans Christoph-Steiner's [hid] object for Pure 
>> Data and either
>>

Date2005-12-02 17:48
FromCharles Barry Groves
SubjectSending MIDI System Exclusive messages from CSound
Still looking for a way to send System Exclusive messages to the MIDI 
Out port from within CSound, for live on-the-fly reprogramming of 
external devices.

All the MIDI opcodes I'm finding seem to have very strict formatting, 
unlike the send-bytes-until-done SysEx format.

Thanks,
Barry