473,396 Members | 1,767 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Drawing sound

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
Jul 18 '05 #1
5 5338
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
Jul 18 '05 #2
fee
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
Jul 18 '05 #3
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" <no****@[127.0.0.1]> wrote in message
news:tt**************@[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
Jul 18 '05 #4
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

Jul 18 '05 #5
Chris <no****@[127.0.0.1]> wrote in message news:<tt**************@[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'
Jul 18 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

19
by: Atif | last post by:
Hello all, In my html page I want to add an image say of 800x600. Now I want that when ever I am given two coordinates on this image say (x1, y1)=(50, 100) and (x2, y2)=(200, 300), the java script...
2
by: Tom Hornyak | last post by:
I need to do the following in C#: 1. Drop an arbitrary image from one control to another bitmap on another control. 2. Interact with this shape (stretch it, rotate it, etc,) once on the...
4
by: Michael | last post by:
Hello, I want to create a program that records a sound track from the microphone, and save it into a file. Can anybody tell me please how do I get the audio from the microphone? thanks for your...
2
by: Alex K. | last post by:
I need to play particular sound when user presses a button. I found PlaySound function in the Platform SDK, it works fine, but it can only play external wav file. I'd like to load my sound file...
5
by: iwdu15 | last post by:
hey, im wodering if anyone knows how i can play a soundin my VB.net windows app when a Form1_Click event is triggered? thanks
5
by: Nick | last post by:
Hi there, Im trying to use the PlaySnd API to play a system sound, such as "Asterisk" or "Question" within the windows section. Anyone got any ideas on how this is done? I've tried using the...
4
by: Galen Somerville | last post by:
My VB2005 app gets real time Heart sounds and an ECG from a USB device. I'm looking for a way to speed up the drawing of the traces on the screen. In the following code the routine GetSounds...
8
by: raylopez99 | last post by:
I have the latest version of Visual Studio 2008 Professional, which allows you to create resource files (this is the .resx file, no?), unlike the Express version, which does not. I am trying to...
2
by: nicolecastel | last post by:
Hello I'm a biginner in Csharp and I want to read a sound file I found this code in the net and I tried to correct it: using System; using System.Collections.Generic; using...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.