Play sound at wanted frequency

M

Matteo

I need to playback a sound on a linux machine of a pre-determined
frequency like, say, 440 Hz. How can I do that with python? I found
the ossaudiodev package, but it says that the ossaudiodev.write()
method accepts data as a raw string. It doesn't explain what the
string should be like, and the oss documentation is mainly about C++.

Do you have any tips to share?
 
D

Diez B. Roggisch

Matteo said:
I need to playback a sound on a linux machine of a pre-determined
frequency like, say, 440 Hz. How can I do that with python? I found
the ossaudiodev package, but it says that the ossaudiodev.write()
method accepts data as a raw string. It doesn't explain what the
string should be like, and the oss documentation is mainly about C++.

Do you have any tips to share?

Try pygame. You can create samples with it, and play them.

See e.g. this: http://www.pygame.org/docs/ref/sndarray.html

Diez
 
M

Matteo

And realize that if you can get that to work, you can always cut into
pygame to see how _it_ accomplishes your task, and mimic that.

--Scott David Daniels
(e-mail address removed)

I'll give it a try, thanks ;)
 

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

Forum statistics

Threads
474,292
Messages
2,571,494
Members
48,183
Latest member
GarfieldBa

Latest Threads

Top