
Hey folks, I'm having the kids use the winsound.Beep library to write programs that play Christmas carols. I had in mind to switch to the Snack wrapper functions to switch to nicer sounding notes that play through the audio card/speakers, but... I seem to be having some trouble getting Snack to play and really don't like the fact that it has to pop-open a root window using Tk (we've not discussed GUIs yet). Does anyone know about either: 1. Another nice windows compatible sound library for python; or, 2. How to get Snack to play notes in series with either the Tk root window closed or minimized? Thanks, Rob __________________________________________________ Do You Yahoo!? Check out Yahoo! Shopping and Yahoo! Auctions for all of your unique holiday gifts! Buy at http://shopping.yahoo.com or bid at http://auctions.yahoo.com

Hi Rob, I've had similar problems with a back-burner project. I want a cross-platform way to create sounds based on a sine wave, but most of the python sound packages seem to be focussed on manipulation and playback of pre-recorded files (.wav, etc.). Here are the options I'm aware of, for what it's worth: Python Multimedia Services (part of standard install): Detect file type, manipulate raw audio data, but no playback http://www.python.org/doc/current/lib/mmedia.html Snack Sound Toolkit Multi-platform, can create, filter, playback, and visualize sound files. Some limited support for synthesizing sounds without playing a file. Requires a Tk window to run it's loop (although I think the window can be hidden?) http://www.speech.kth.se/snack/ Pythonware Sound Toolkit Reads numerous sound formats (AU, VOC, and WAV) and plays them back on a variety of hardware platforms (windows and sun boxen). http://www.pythonware.com/products/pst/index.htm ALPY 3D Sound Toolkit Interface to OpenAL (http://www.openal.org/home/), which is to audio what OpenGL is to graphics. I haven't played with this yet, but it's on my list of things to do. http://amoras.2y.net/alpy/ pygame A game building framework built on top of SDL (http://www.libsdl.org/), which includes sound capabilities. Another one I've been meaning to get around to trying. This appears to have more momentum (developers using it) than ALPY. http://pygame.seul.org/ There are also lots of special-purpose sound libraries for individual platforms (windows, linux, mac) and many (most?) have python bindings. It would be an interesting project to factor out the common features into one python package which worked cross platform and called the correct binary library depending on platform. This isn't something I have time for right now, although I'd be willing to help document it on the Contagious Fun website. If anyone knows of other options, or has experience they want to share about using any of the above, I'd be very interested in seeing it. HTH --Dethe -- Dethe Elza (delza@burningtiger.com) Chief Mad Scientist Burning Tiger Technologies (http://burningtiger.com) Living Code Weblog (http://livingcode.ca)

Hey folks, after some late night oil, I wrote these wrappers to Snack, to simplify the interface (my students haven't yet reached GUI or event driven programming). I hope this helps someone. (You will need Snack for Python here: http://www.speech.kth.se/snack/) Basically, there are 3 functions: SoundStart, SoundStop, and Beep. SoundStart wraps the initialization for Snack and Tkinter, and hides the tk window. SoundStop tries to clean-up after the initialization. Beep is exactly analogous to the winsound.Beep call, except that the duration is seconds rather than milliseconds. Example: import compsci compsci.SoundStart(50) #volume gain set to 50% compsci.Beep(261.63, 10) #plays Middle-C for 10 seconds compsci.SoundStop() #clean up Enjoy. __________________________ import Tkinter import tkSnack def SoundStart(volume=50): """Initialize the Sound System""" global root, filt root = Tkinter.Tk() tkSnack.initializeSnack(root) if volume > 100: volume = 100 elif volume < 0: volume = 0 tkSnack.audio.play_gain(volume) root.withdraw() def Beep(freq, duration): """Play a note of freq hertz for duration seconds""" s = tkSnack.Sound() filt = tkSnack.Filter('generator', freq, 30000, 0.0, 'sine', int(11500*duration)) s.stop() s.play(filter=filt, blocking=1) def SoundStop(): """Turn off the Sound System""" try: root = root.destroy() filt = None except: pass __________________________________________________ Do You Yahoo!? Check out Yahoo! Shopping and Yahoo! Auctions for all of your unique holiday gifts! Buy at http://shopping.yahoo.com or bid at http://auctions.yahoo.com

...Don't forget MIDI For recognizable tunes like Xmas songs, and fun programming with audible feeback MIDI makes a lot of sense. Most computers now have built in MIDI cards so no need for cables. Plus there are huge archives of MIDI files for free download no the web. Plus zillions of players, editors, sequencers and processors in softeare of all denonominations. MIDI is a protocol which applies well to programming. Changes of key, tempo, instrument, channel etc are significant and much easier than using FFTbased audio toolkits. Files are small and manageable. Cut and paste of elements also. To be honest I have not looked recently or very closely at Python for MIDI. I do know of these: http://www2.hku.nl/~simon2/python/ http://www.hyperreal.org/~est/python/MIDI/ http://www.quitte.de/midithing.html http://www.sabren.net/rants/2000/01/20000129a.php3 http://groups.google.com/groups?hl=en&selm=3C0F67FE.96E7CAE8%40alum.mit.edu See the MIDI python tools at The Vaults of Parnassus under 'Sound/Audio' http://www.vex.net/parnassus/apyllo.py/63131194 PyGame may well include MIDI handling. That would make interfacing with other devices a pleasure. The reason why I have not look at Python MIDI much is having to much fnu with two superb non-python music programming toolkits: KeyKit http://www.nosuch.com/keykit/ PD [PureData] http://www.pure-data.org/ http://www.danks.org/mark/GEM/ Whatever solution you use, if it invovves MIDI and you are using windows there are 2 essential free tools I recommend you install: MidiOx and MidiYoke http://www.midiox.com/ Together they provide a fabulous virtual patchbay allowing one to route MIDI siganl between several softawre on the fly, and also a monitor to watch the MIDI data stream in color + lots of cool system exclusive features. Both writen by MIDI software wizzards at Yamaha. For midi hardware, the best value I know of is also Yamaha. They make an external sythesizer and effects processor which connects via serial port to quickly provide amazing sound tools for around $50. Play very well with notebook computers as most po4rtable orchestra in your pocket with some remarakbel sounds based Yamaha's XG series. It includes MIDI connectors and also stereo efefct processing inputs for any soudn source. These are programmable via MIDI. http://www.yamahasynth.com/classic/mu10/q_mu10.htm http://www.yamaha.co.uk/xg/html/software/s_guide.htm A sub culture has grown up around the family of these with libraries, tool, interfaces and lore for gettind great results. One obvious value for teaching is that one can explore more than jst notes, but also ideas of depth, spacial efects yet remain within a programming context. http://xgmidi.wtal.de/software.html#XG%20-%20Editors good luck ./Jason

Season's greetings everyone! I saw a couple of pretty interesting looking new Python books in Barnes & Noble yesterday: Python Programming Patterns by Thomas W. Christopher Web Programming in Python: Techniques for Integrating Linux, Apache and MySQL by George K. Thiruvathukal, Thomas W. Christopher, John P. Shafaee ... meanwhile: http://www.goose-works.org/ Topic Maps Processing Model with Python API http://spectralpython.sourceforge.net/ Spectral Python (SPy): An Open Source Hyperspectral Image Processing Environment ... last but not least: http://mayavi.sourceforge.net/ The MayaVi Data Visualizer MayaVi is a free, easy to use scientific data visualizer. It is written in Python and uses the amazing Visualization Toolkit (VTK) for the graphics. It provides a GUI written using Tkinter. MayaVi is free and distributed under the GNU GPL. It is also cross platform and should run on any platform where both Python and VTK are available (which is almost any *nix, Mac OSX or Windows). yeow:-) regards ./Jason

Happy holograms! Not directly python related, but perhaps of interest to this group, O'Reilly has a new book out, "Physics for Game Developers," which could be very interesting in combination with, say, VPython or pyGame. The "Python and XML" book is supposed to be out this month, too. And while I was on the site looking up the above my eye was grabbed by "Ruby in a Nutshell" and "Programming Jabber," although the last one isn't due out until January. Ah, so much to read, so little time. I hope you all have a happy holiday season and a great new year. --Dethe -- Dethe Elza (delza@burningtiger.com) Chief Mad Scientist Burning Tiger Technologies (http://burningtiger.com) Living Code Weblog (http://livingcode.ca)

At 01:14 PM 12/19/2001 -0500, Jason Cunliffe wrote:
Season's greetings everyone!
I saw a couple of pretty interesting looking new Python books in Barnes & Noble yesterday:
Python Programming Patterns by Thomas W. Christopher
Web Programming in Python: Techniques for Integrating Linux, Apache and MySQL by George K. Thiruvathukal, Thomas W. Christopher, John P. Shafaee
also: Python Web Programming by Steve Holden (a frequent c.l.python poster) is due from New Riders on Jan 15.
participants (4)
-
Dethe Elza
-
Jason Cunliffe
-
Mats Wichmann
-
Robert Rickenbrode