| Name | Last modified | Size | Description | |
|---|---|---|---|---|
| Parent Directory | - | |||
| Makefile | 04-Jul-2000 07:51 | 615 | ||
| README.html | 26-Jul-2007 15:27 | 7.0K | ||
| beeper-0.5h17.tar.gz | 25-Oct-1999 08:17 | 4.2K | ||
| demo.c | 04-Jul-2000 07:51 | 1.4K | ||
| libbeep-0.666.src.tgz | 04-Jul-2000 11:49 | 6.7K | ||
| libbeep-src.tar.gz | 04-Jul-2000 11:49 | 6.7K | ||
| libbeep.c | 26-Feb-2002 11:03 | 4.9K | ||
| libbeep.h | 04-Jul-2000 07:51 | 294 | ||
| notes.h | 04-Jul-2000 07:51 | 720 | ||
| wasted_years.txt | 04-Jul-2000 07:51 | 129 | ||

A way to get music from your PC beeper in any Linux program. Implements most of the functionality from PLAY in GW/Q-basic.
sumake
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.
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.
This is the stuff you can feed the play(char *string) function. And it's case INsensitive.
<,>O[0123456]L<n>M[NLS]MN=normal style, MS=staccato
(shorter notes), ML=legato (notes run together)T<n>[ABCDEFG][#+-]*<l><.>#,+ turn it sharp, - flattens.<l> is present, change length only
for this note.C##4.... plays a long DN<n><.>n, see previous paragraph for explanation of
periods. The range is 0..84 (0 means pause!) and the length is
always the default one.P<l><.>How could this take 8 months? Beats me :-)
MB, MF and X commands are not
recognized. (read your Q-Basic manual if you care...)-ansi. That's simply because
usleep(3) isn't ANSI C.play() function eats anything. Try
(echo "T255L8"; cat demo.c) | beeplibdemo for some
modern music in C major.Raine M. Ekman, raine+spam@infa.abo.fi. (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.