Index of /~raine/pub/software/beeper

[ICO]NameLast modifiedSizeDescription

[DIR]Parent Directory  -  
[   ]Makefile04-Jul-2000 07:51 615  
[TXT]README.html26-Jul-2007 15:27 7.0K 
[   ]beeper-0.5h17.tar.gz25-Oct-1999 08:17 4.2K 
[TXT]demo.c04-Jul-2000 07:51 1.4K 
[   ]libbeep-0.666.src.tgz04-Jul-2000 11:49 6.7K 
[   ]libbeep-src.tar.gz04-Jul-2000 11:49 6.7K 
[TXT]libbeep.c26-Feb-2002 11:03 4.9K 
[TXT]libbeep.h04-Jul-2000 07:51 294  
[TXT]notes.h04-Jul-2000 07:51 720  
[TXT]wasted_years.txt04-Jul-2000 07:51 129  

...libbeep, BeepeR, beeplib... Works on my machine


what? - usage - music macro language - license - version history - bugs - author & other credits


A way to get music from your PC beeper in any Linux program. Implements most of the functionality from PLAY in GW/Q-basic.


Short version


There you have it, a library ready to compile into your own alarm clock, midi player or whatever. The library is dropped into /usr/lib. A program called beeplibdemo will appear in /usr/bin.

Slightly longer version with some light on the library functions

Look at the Makefile, decide what you need, what you want to adjust and just do it.

void noteon(int i)

Turns on note i. Silences any previously playing note. i can range from 0 to 84 (0 meaning pause).

void noteoff()

Turns off the playing note.

int play(char *str)

Plays the contents of str, check out the music macro language below.

void retune(int pos, float hz, int type)

Retune with frequency hz in position pos. type can be EQUIDISTANT or NATURAL. There is also a constant MID_A defined for using as pos.

demo.c is an example of how to use libbeep. Compile it (-lm) and feed it wasted_years.txt to see if everything works. To try out retuning you can use the -n [frequency] and -e [frequency] options. And remember to turn off the noise if your own program gets signalled!

As the speaker is part of the Linux console your finished program should have console access (either run from the console or root privileges). I don't think root privileges is a good idea, there is always a potential for dangerous bugs in that.

Don't even try to build this on anything else than Linux if you don't know exactly what you're doing. I haven't given portability the slightest thought.

MUSIC MACRO LANGUAGE (I didn't name it that way...)

This is the stuff you can feed the play(char *string) function. And it's case INsensitive.

Change octave (> up, < down)
Sets the current octave.
Sets the default length, 1=1/1 note, 4=1/4 note and so on. Legal range 1..96.
Style: MN=normal style, MS=staccato (shorter notes), ML=legato (notes run together)
Tempo (number of L4's in a minute) can range from 10 to 300. Default 120.
Play a note:
Play note n, see previous paragraph for explanation of periods. The range is 0..84 (0 means pause!) and the length is always the default one.
Play (or actually don't play :-{) a pause, the length can be specified.


  1. You can do whatever you want with the code, including using it as an example of bad C code.
  2. You don't have to pay me anything, and I'm not going to provide any support.
  3. Bugfixes are welcome. New features can be added if they're easy enough to implement (if it's up to me). If you feel inspired enough to build a MIDI player on top of this they'll be coming to take you away, ha-haa!(actually I gave that a thought... :-{)


0.666 (Eddie) 2000-07-01

How could this take 8 months? Beats me :-)

0.5h17 1999-10-25



Raine M. Ekman, (Visit my home page)


I'm not a programmer. I'm a slacker, don't expect any new versions to appear. This is just a way of destroying some of that rare spare time when an urge to do something comes over me.