BASIC vs Python

Jan Dries jan.dries at dcube-resource.be
Sun Dec 19 21:39:04 CET 2004


Andrew Dalke wrote:

[snip]
> 
> It looks like FMOD/PySonic is the closest to what I'm thinking
> of, and Snack coming in second.  I didn't look too deeply.  Most
> of them only play sound clips (mp3, wav, etc.) and don't have
> a way to specify what notes to play.

If you just want to play notes, you could look at MIDI.
There's a Python module out there somewhere that reads and writes 
MIDI-files.
And there's plenty of programs (such as Windows Media Playes) that can 
play MIDI files or can convert them to mp3 or wav or whatever.

In fact, I used all of these a while ago to enable me to write something 
like:

import midi

notes = ( "MySong", """
instrument(piano)
key(4b)
vol(mf)
tempo(4=100)
F4 A4 A4 A2 A4- A4 G4 F4 G2 G2 r4 F4 F4 F4 A2-
A4 A4 G2 G4 B4 B4 A4 B4 C'2. r32 A4 C'2 C'2 C'4 C'4
C'4 B4 A4 B2 B2 r16 C'2 A2 G4 B2 B4 A4 F2. G4 E2 F2.
""" )

midi.generate(somefilepath,notes)

to generate MIDI-files from a simple notes description.

Regards,
Jan



More information about the Python-list mailing list