Drawing sound

C

Chris

I want a program that can "draw" sound.

Imagine drawing a graph of frequency against time -
and then being able to play it over the computer speakers.

Can this be done in Python?

As a start, consider this simple QBASIC program that generates random
frequencies:

10 frequency = 40 + 400 * RND
20 SOUND frequency, 7
30 GOTO 10

That's fine - except that it plays over the PC speaker - the one that's
just there for the happy beep - and not through the sound card and
proper speakers.

Can that be done in Python?
Or in any other language?
 
P

Peter Hansen

Chris said:
I want a program that can "draw" sound.

Imagine drawing a graph of frequency against time -
and then being able to play it over the computer speakers.

Can this be done in Python?

As a start, consider this simple QBASIC program that generates random
frequencies:

10 frequency = 40 + 400 * RND
20 SOUND frequency, 7
30 GOTO 10

That's fine - except that it plays over the PC speaker - the one that's
just there for the happy beep - and not through the sound card and
proper speakers.

Can that be done in Python?
Or in any other language?

Certainly. Python or any other decent general-purpose language
can do this.

In Python, you'd want to look into PyGame, or perhaps wxPython
or one of the other GUI frameworks (provided it has adequate
sound support... wxPython has the wx.Sound class but I don't know
whether it's up to the job in this case).

-Peter
 
F

fee

Chris said:
I want a program that can "draw" sound.

Imagine drawing a graph of frequency against time -
and then being able to play it over the computer speakers.
Can that be done in Python?
Or in any other language?

Using programs to create sound through a soundcard is
a quite popular activity. What you describe may be
best done with the program csound (http://www.csounds.com/).

If you want to do it with python, you might try looking here
first:

http://docs.python.org/lib/mmedia.html

Tobiah
 
E

Elaine Jackson

It sounds like you are looking for something along the following lines:

<QUOTE>
The Snack Sound Toolkit is designed to be used with a scripting language such as
Tcl/Tk or Python. Using Snack you can create powerful multi-platform audio
applications with just a few lines of code. Snack has commands for basic sound
handling, such as playback, recording, file and socket I/O. Snack also provides
primitives for sound visualization, e.g. waveforms and spectrograms. It was
developed mainly to handle digital recordings of speech, but is just as useful
for general audio. Snack has also successfully been applied to other
one-dimensional signals.
</QUOTE>

If so, you can download it from here:

http://www.speech.kth.se/snack/

HTH

news:ttNMvZB0zGVBFwRQ@[127.0.0.1]...
| I want a program that can "draw" sound.
|
| Imagine drawing a graph of frequency against time -
| and then being able to play it over the computer speakers.
|
| Can this be done in Python?
|
| As a start, consider this simple QBASIC program that generates random
| frequencies:
|
| 10 frequency = 40 + 400 * RND
| 20 SOUND frequency, 7
| 30 GOTO 10
|
| That's fine - except that it plays over the PC speaker - the one that's
| just there for the happy beep - and not through the sound card and
| proper speakers.
|
| Can that be done in Python?
| Or in any other language?
| --
| Chris
 
J

Jeff Sandys

If you want to play specific notes there are several
Python Midi packages available.

Here is a neat article on how to do a power spectral
density diagram (draw sound):

http://www.onlamp.com/pub/a/python/2001/01/31/numerically.html

I think what you are asking is to drag the mouse on a
canvas and then 'play' the canvas as though it were a
piano roll? Something like what the MIT Media Lab
program 'Hyperscore' does.

Because Python is soooo cross platform there is no one
way to generate tones on all these platforms, like in
qbasic. Tinker for the graphics and PyMidi or Snack
would be your best bet on windows. Pygame has graphics
and sound capabilities. Other ways are available.

Thanks,
Jeff Sandys
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,535
Members
45,008
Latest member
obedient dusk

Latest Threads

Top