Path: utzoo!attcan!uunet!lll-winken!sun-barr!cs.utexas.edu!samsung!dali.cs.montana.edu!uakari.primate.wisc.edu!zaphod.mps.ohio-state.edu!sdd.hp.com!hplabs!hpl-opus!hpnmdla!roger From: roger@hpnmdla.HP.COM (Roger Petersen) Newsgroups: comp.windows.x Subject: X11R5 wish: better sound Message-ID: <990003@hpnmdla.HP.COM> Date: 1 Aug 90 02:56:53 GMT Organization: HP Network Measurements Div, Santa Rosa, CA Lines: 42 I'd like an easier, better sounding way of playing music or generating tones in X11. Right now, there's the XBell() and XChangeKeyboardControl() functions, which allow setting the pitch, duration, and volume, and then generating the sound. This makes it hard to do anything more than just beep, since the XBell() calls are executed asynchronously. I wrote a simple program called xmorse that generates Morse code, and the code sounds pretty crappy. The same is true when trying to play a melody. It's really choppy. (I'm using XChangeKeyboardControl to set up the tone and duration, then XBell to make the sound. Then I use a select() call to sleep until the tone's duration is complete. Is there a better way?) -------------------------------------------- What I'd really like is a way to pass the XBell() routine (or maybe some *new* XSound() routine) a pointer to an array of tones structs. The structure could be the same as the XKeyboardControl structure, or maybe a simpler one: typedef struct { int bell_percent; int bell_pitch; int bell_duration; } XBellTone; /* pick your favorite name here */ Then I could simply pass the XSound() routine a pointer to an array of XBellTones, and it would play the tones synchronously, one after the other. For pauses, the bell_pitch would simply be set to full off. [Notice that I didn't ask for support for multipe voices, noise sources, streams of digitized sound, etc. These *could* be considered too...] -------------------------------------------- Has anyone else wrestled with generating sounds in X? Roger Petersen roger@hpnmdla.hp.com