BUZZ - version 0.9

an RTLinux demo program

by Rob Butera (butera@helix.nih.gov)
Last updated: 05-October-1998

This program demonstrates how to program a variety of common tasks using RTLinux. I developed this program as a tool to learn the basics of RTLinux before moving onto the more complex task I have in mind (research applications in neurophysiology).

Requirements: RTLinux installed, some familiarity with it. For more information, see The RTLinux Home Page.

What is it?

BUZZ is a program that generates a frequency-modulated sound out of the PC speaker. The user can interactively specify the center frequency of the modulation, the amplitude of the frequency modulation, the modulation rate, and the waveform type (square, sine, rampup, rampdn, sawtooth).

How does it do it?

RTLinux! The Realtime process (buzz_module) generates the sound, subject to parameters passed through it via a FIFO and shared memory. Briefly:

How do I install it?

buzz-0.9.tgz - this is the most recent version. Download it. This file is also via anonymous ftp - contact me and I will tell you where to get it. We assume that RTLinux is installed in /usr/src/rtl. This program was developed using release9E on a 2.0.35 Linux Kernel. Maybe earlier versions will work ....

untar the package in /usr/src/ (it will make a directory named buzz).
 cd/usr/src/

tar xzvf buzz-0.9.tgz

cd buzz

edit buzz.h so that SHMEM_BASE_ADDRESS corresponds to the start of shared memory specified in /etc/lilo.conf. This program requires very little shared memory (under 1K). If this doesn't make sense, follow steps 1 and 2 on the RTLinux shared memory HOWTO.

make all
should make both buzz_app and buzz_module

runme
will load the necessary modules and run the program.

The program is interactive with a text prompt, type help for a list of commands.

NOTES and THANKS

All this was developed on a 486DX4-75MHz Compaq Contura laptop computer, running RedHat 4.2 with an updated kernel. It has also been tested on a 266MHz Pentium II running RedHat 5.1. Interesting, the speaker on the laptop sounds a lot better ....

Thanks to RTLinux for existing, and the example programs which came from the distribution. The sound generation code in buzz_module.c draws heavily from the example sound.c program

Thanks to the online information on RTLinux and shared memory, especially the page titled Using Shared Memory in Real-Time Linux

Thanks to the RTLinux email list (specifically this message, by jegco@sierra.net) for pointing out a necessary correction to the RTLinux Shared Memory HOWTO for assigning pointers to shared memory in the realtime process.

What's next? Besides my research application (model-reference control in neurophysiology), I think it would be neat to modify this to make a FIFO device that imitates /dev/midi - i.e. pipe in a MIDI file and a user selected channel of MIDI note data.


Rob Butera <butera@helix.nih.gov>