Re: Joystick

From: John Lazzaro (lazzaro@cs.berkeley.edu)
Date: Sat Apr 22 2000 - 11:58:50 EDT


> Does anyone know if it would be possible to use a joystick as an input
> device for a compiled SAOL and SASL ?

Writing a control driver for sfront to do this should be
straightforward -- since I'm a Linux person, here's how
I would do it under Linux:

[1] I'd download the latest version of the joystick driver
for Linux, at:

http://atrey.karlin.mff.cuni.cz/~vojtech/joystick/

The tar.gz driver includes a description of the simple
API for the joystick (unzip and untar, and look at README-API)
-- the joystick is mapped as a device (/dev/js) that you
open, and you read a stream of timestamped "js_events" from
/dev/js, that tell about joystick changes. Your system probably
has the driver installed already (do as "ls /dev/js*" and see),
so this download is just to get the API docs.

[2] I'd prototype up a zero-order sfront control driver, that
did a monophonic sine-wave synth, that used one button to
start the note, and a second to end the note. See the (new!)
HTML documentation for the control driver interface for an
intro to how it works:

http://www.cs.berkeley.edu/~lazzaro/sa/sfman/devel/intro/index.html
http://www.cs.berkeley.edu/~lazzaro/sa/sfman/devel/cdriver/intro/index.html

Here's how I would probably approach the design:

The sfront control driver would be a SASL driver, not a
MIDI driver. It would launch labelled instances of the
sine-wave synth instr with each "note start" button press.
The SAOL code for this instr would include a few ksig
imports variables that didn't have corresponding global
variables. I'd use the SASL control driver to send labelled
SASL control statements to the instance to communicate
joystick state updates. When the updated variable was the
press of the "note end" button, the SAOL instr would
execute a "turnoff" statement (probably after a suitable
decay time) and kill itself, since the control driver
interface (like SASL itself) doesn't have a mechanism
for killing instruments directly (like the SAOL-MIDI
control logic does, via NoteOff).

Once you got this simple synth working, then the issues
change from the nuts-and-bolts of getting the joystick
to talk to sfront, to the art and science of musical
instrument design ...

Hope this helps,

                                                --jl
-------------------------------------------------------------------------
John Lazzaro -- Research Specialist -- CS Division -- EECS -- UC Berkeley
lazzaro [at] cs [dot] berkeley [dot] edu www.cs.berkeley.edu/~lazzaro
-------------------------------------------------------------------------



This archive was generated by hypermail 2b29 : Mon Jan 28 2002 - 11:46:38 EST