Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Drawing sound

Reply
Thread Tools

Drawing sound

 
 
Chris
Guest
Posts: n/a
 
      09-24-2004
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
 
Reply With Quote
 
 
 
 
Peter Hansen
Guest
Posts: n/a
 
      09-24-2004
Chris wrote:
> 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
 
Reply With Quote
 
 
 
 
fee
Guest
Posts: n/a
 
      09-24-2004
Chris wrote:
> 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
 
Reply With Quote
 
Elaine Jackson
Guest
Posts: n/a
 
      09-24-2004
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

"Chris" <nospam@[127.0.0.1]> wrote in message
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


 
Reply With Quote
 
Jeff Sandys
Guest
Posts: n/a
 
      09-24-2004
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/2...merically.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

Chris wrote:
>
> 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

 
Reply With Quote
 
M.E.Farmer
Guest
Posts: n/a
 
      09-25-2004
Chris <nospam@[127.0.0.1]> wrote in message 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?
> Or in any other language?

Hello Chris,
This may be of intrest to you.
'http://hem.passagen.se/rasmuse/Coagula.htm'
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Guide to the standard library? Library for drawing in GUIs?drawing inbrowsers? defn noob Java 1 06-28-2008 02:50 AM
funny drawing software:ScreenPen,drawing directly on screen! yyzzbb@sina.com Digital Photography 0 02-04-2006 12:31 AM
System.Drawing For Drawing Text Images jjbutera@hotmail.com ASP .Net 1 01-09-2006 09:55 PM
Sound Quality In Sound API Luc The Perverse Java 4 10-31-2005 04:36 AM
No sound. Yellow exclamation by" Windows sound system". =?Utf-8?B?VGFueWE=?= MCSE 2 10-26-2003 07:44 PM



Advertisments