Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!mcvax!ukc!its63b!hwcs!zen!jules From: jules@zen.UUCP (Julian Perry) Newsgroups: comp.sys.hp Subject: Re: Guts of the tone generator on the 320 system Message-ID: <598@zen.UUCP> Date: Sun, 26-Apr-87 09:00:20 EDT Article-I.D.: zen.598 Posted: Sun Apr 26 09:00:20 1987 Date-Received: Wed, 29-Apr-87 05:13:33 EDT References: <1365@ucbcad.berkeley.edu> Reply-To: jules@zen.UUCP (Julian Perry) Organization: Zengrange Limited, Leeds, England Lines: 100 Keywords: bobcats tones In article <1365@ucbcad.berkeley.edu> chris@ic (Chris Guthrie) writes: >We spent last night playing with the tone generator on our 320s. >Although we were able to get a number of unique and interesting >noises out of them, we couldn't figure out the layout of the >four bytes in the EFTSBP ioctl command (other than the volume and >timer bits). Can anyone post the layout of these bytes. Thanks! > >(The EFTSBP is the ioctl command for the rhil device which sends >four data bytes to the tone generator. Beyond that, none of my >documentation details the purpose of those bytes). > Chris Guthrie > U.C.B. Here is a small program which demonstates how to use the beeper on an hp9000s500, I guess it's the same on a 300. The main limitation of the beeper system is the poor selection of frequencies available which limits its tunefullness, but having 4 channels is really nice. On a 500 you will need this device file, as for a 300 I'll let you know when I get one (along with the 850 etc etc) crw-rw-rw- 1 root other 41 0xff0000 Apr 7 1986 /dev/hil8042 -----beep.c----- #include #define tone 13 int ton[tone]={189,247,311,330,370,440,450,470,490,510,530,550,570}; int fd; void beep(voice,fre,amp,dur) int voice; double fre; int amp; double dur; { struct eft2 bytes; int n; n = 1.2 * (83333.3 / fre); bytes.b[0] = (128 + (32 * voice) + (n % 16)); bytes.b[1] = n / 16; bytes.b[2] = (128 + (32 * voice) + 31 - amp); bytes.b[3] = (unsigned char) (dur * 100.0); ioctl(fd,EFTSBP,&bytes); } main() { int b=0; double root, third, fifth; int i,lp; fd = open("/dev/hil8042",0); for ( lp = 0 ; lp < tone ; ++lp ) { root = ton[lp]; third = root * 1.26; fifth = root * 1.5; beep(0,root,15,0.9); beep(1,third,15,0.9); beep(2,fifth,15,0.9); for ( i = 0 ; i < 50000 ; ++i ) i = i+0; } for ( lp = tone - 1 ; lp >= 0 ; --lp ) { root = ton[lp]; third = root * 1.26; fifth = root * 1.5; beep(0,root,15,0.9); beep(1,third,15,0.9); beep(2,fifth,15,0.9); for ( i = 0 ; i < 50000 ; ++i ) i = i+0; } close(fd); } -------------- Jules [the noisy] -- IN-REAL-LIFE: Julian Perry E-MAIL: jules@zen.co.uk || ...!mcvax!ukc!zen.co.uk!jules PHONE: +44 532 489048 ext 217 ADDRESS: Zengrange Limited, Greenfield Road, Leeds, England, LS9 8DB