Benno Senoner: Linux Pinball in the South Tyrol
In the Italian South Tyrol, they recently built as a tourist
attraction, a large pinball-like machine where various sounds
are triggered by the passing balls. Benno Senoner put together
the audio part using Linux, and here we talk to him about the
project.
More info
Would you like to tell us a little background about the pinball project?
It is not actually a real pinball, only a pinball-like game. Basically the local museum about tourism wanted an interactive game for museum visitors that provided an ironic and entertaining demonstration of how the advent of tourism shaped the landscape and economic habits in the small Italian province of Southtyrol. Teo Mahlknecht (www.byteo.com) , the artist that was commissioned to create the artwork, is a friend of mine and we live in the same town. The control of sensors and electric motors is performed using an industrial controller, but the artist and the company that implemented the electronics part were what hardware to use for the audio playback. Originally they wanted to use a hardware MP3 player controlled by either a serial cable or directly by attaching the play button wires to the industrial controller's outs. But this solution had several disadvantages: the required number of audio speakers for the game was around 14-16 and this means you would need to buy 16 mp3 players and you would occupy lots of output ports / serial ports on the industrial controller which would drive the cost up further and increase the program complexity. But cost was not the only disadvantage of the hardware mp3 solution. The problem was ease of use and flexibility of the audio system. For example there are some space constraints that involve having to place sensors 30-40cm away from the moving/sounding object. This means the sound must be delayed by a certain amount. Not to mention the need to avoid the game sounding monotonous, we wanted a decent variation of sounds which the Linux Audio PC can store and manage thanks the availability of large RAM and HD space amounts in common PCs. (The box has 512MB RAM, 40GB HD).
Thanks to a simple GUI I wrote, the artist can assign samples (regular WAV files) to the 16 audio output channels, tune parameters like delay, volume, random playback order etc. The PC solution eased the task for the programmer of the industrial controlller too because he simply has to send a byte (representing the sensor ID) over the serial port when a sensor is triggered by the passing of a ball. For example if multiple sensors trigger simultaneously the industrial controller simply sends a stream of bytes over the serial port. The delay between the triggering of the sensor and the sample becoming audible is only a few milliseconds. Anyway the game does not require very tight trigger times, 100-200msec would have sufficed too. But having fast response times never hurts. ;-) Think about the audio PC like a very simple hardware sampler that is driven by the serial port. (we do not use the MIDI protocol because we need only to start samples, pitch etc is not needed so 1 byte long commands was the natural choice).
I got involved because the artist knows that I'm an audio freak and he asked me if a linux based PC solution would be better than the clunky "a dozen of mp3 players" solution. I explained to them what could be done with the PC and that the cost of hardware would lie around $1200. (Athlon PC + 2 Delta1010 cards which provide a total of 16 mono output channels). They immediately agreed that the PC solution was the way to go. Additionally I told them to put two HDs in the machine so that the filesystem could be put on a software RAID1 volume which ensures reliability and prevents data loss. I quickly put together this small sample player app, agreed with the industrial controller guy what kind of serial protocol to use, added a simple GUI for loading and setting up samples and my job was done.
Did you write the code that picks up the serial traffic and translates it into something that triggers the player, or did you hack something that's already around?
No I wrote the code entirely myself. I've written several sample playback routines over the years and since the pinball game does not need variable pitch or mixing of several voices on the same channel it was relatively easy to make it work. The serial input is handled by a separate high priority thread which communicates with the audio threads (one per card) and issues trigger commands via shared memory. The serial threads is kinda trivial. Open the serial port (/dev/ttyS0) , read() a byte from it. Look at the code and figure out which channel it corresponds to. Set the trigger flag in the corresponding audio channel structure that is preriodically scanned by the audio thread which will in turn strart the sample (by loading the correct sample pointers, volumes, setting the delay etc).
What sort of sensors did you use? Are they optical or some sort of pressure thing (they'd have to be sensitive!)?
I'm not the guy that developed the electronics but AFAIK the sensors are sensitive to iron and (balls are built of iron or iron with a wooden shell). This means if the ball passes near the sensor the sensor triggers. The advantage is that because of the absence of physical contact the lifetime of the sensors is practically unlimited plus dust and dirt do not compromise their correct operation like it could happen when using optical sensors.
What is the audio chain after the PC - line, mixer, amp, speaker array?
The audio chain is as simple as possible: PC - audio out - line in of active PC speakers. We used standard active PC speakers because the low cost and because they suit our purpose perfectly. The speakers are stereo but the samples used are mono so basically we have 16 audio outputs on the soundcards that are connected to 8 pairs of active PC stereo speakers which we use as 16 mono speakers. (background noises do not need to be stereo).
Thanks Benno.
Bookmark:
post to Delicious Digg Reddit Facebook StumbleUpon
Recent on Mstation: music: Vivian Girls, America's Cup, music: Too Young to Fall..., music: Pains of Being Pure At Heart, Berlin Lakes, music: Atarah Valentine, Travel - Copenhagen, House in the Desert
front page / music / software / games / hardware /wetware / guides / books / art / search / travel /rss / podcasts / contact us