Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > generating audio signals

Reply
Thread Tools

generating audio signals

 
 
nicke
Guest
Posts: n/a
 
      03-20-2005
I'm running linux and would like to generate specific frequencies and
play them(in OSS) or alternatively save them as wav files, how should I
accomplish this? Using python to play and generate is not strictly
necessary, as long as I can invoke the command from python.
I know for example xmms can do this, but I want a command-line only solution.

thanks
 
Reply With Quote
 
 
 
 
Alia Khouri
Guest
Posts: n/a
 
 
Reply With Quote
 
 
 
 
Bengt Richter
Guest
Posts: n/a
 
      03-21-2005
On Sun, 20 Mar 2005 12:25:22 +0200, nicke <(E-Mail Removed)> wrote:

>I'm running linux and would like to generate specific frequencies and
>play them(in OSS) or alternatively save them as wav files, how should I
>accomplish this? Using python to play and generate is not strictly
>necessary, as long as I can invoke the command from python.
>I know for example xmms can do this, but I want a command-line only solution.
>

Perhaps
http://docs.python.org/lib/module-wave.html
will help. I used it to create an echo effect toy for my grandson by reading existing .wav sound effect
files and adding delayed reduced-aplitude feeback to itself and writing another file. Parameters were
distance in feet to a reflecting wall (assuming 1000 ft/sec sound speed and relection volume factor.

Not hard. Maybe make yourself a little utility first that will show you the specs for any .wav file (i.e.,
sampling frequency, bytes per sample, channels, etc.) I don't recall at the moment whether you have to
deal with signed or offset amplitude values, but it won't be hard.

This won't play the sounds though.

Regards,
Bengt Richter
 
Reply With Quote
 
Cappy2112
Guest
Posts: n/a
 
      03-21-2005
>>Maybe make yourself a little utility first that will show you the
specs for any .wav file (i.e.,
>>sampling frequency, bytes per sample, channels, etc.)


You can do this with one function call - wave.Wave_read.getparams()
import wave
wave.open("filename","b")
wave.Wave_read.getparams()

 
Reply With Quote
 
Bengt Richter
Guest
Posts: n/a
 
      03-22-2005
On 21 Mar 2005 11:12:38 -0800, "Cappy2112" <(E-Mail Removed)> wrote:

>>>Maybe make yourself a little utility first that will show you the

>specs for any .wav file (i.e.,
>>>sampling frequency, bytes per sample, channels, etc.)

>
>You can do this with one function call - wave.Wave_read.getparams()
>import wave
>wave.open("filename","b")
>wave.Wave_read.getparams()
>

Yeah, I know I expected the OP to discover that really quick,
and enjoy an early tidbit of success, maybe printing the parameters
in a pretty format to his taste

Regards,
Bengt Richter
 
Reply With Quote
 
nicke
Guest
Posts: n/a
 
      03-22-2005
On Tue, 22 Mar 2005 00:51:57 GMT
http://www.velocityreviews.com/forums/(E-Mail Removed) (Bengt Richter) wrote:

> On 21 Mar 2005 11:12:38 -0800, "Cappy2112" <(E-Mail Removed)> wrote:
>
> >>>Maybe make yourself a little utility first that will show you the

> >specs for any .wav file (i.e.,
> >>>sampling frequency, bytes per sample, channels, etc.)

> >
> >You can do this with one function call - wave.Wave_read.getparams()
> >import wave
> >wave.open("filename","b")
> >wave.Wave_read.getparams()
> >

> Yeah, I know I expected the OP to discover that really quick,
> and enjoy an early tidbit of success, maybe printing the parameters
> in a pretty format to his taste
>
> Regards,
> Bengt Richter
> --
> http://mail.python.org/mailman/listinfo/python-list


already found it and used it, but did some more research...
packed/unpacked the wave files, made programs for generating
frequencies, playing them, saving them, and plotting the files as
amplitude as a function of time.
 
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
how mix multi-audio file to a audio file? aeonsun Java 2 03-11-2007 06:07 AM
Audio Test Signals? Use.Netuser.02 Computer Support 2 10-25-2006 11:49 PM
cannot playback audio strem, audio not available or hardware not responding chieyenne Computer Support 2 05-19-2005 07:01 PM
copying audio extras on dvd to audio CD? Mad Scientist Jr DVD Video 2 10-07-2004 03:17 PM
Any way to take the audio from a concert DVD to make audio files? NOT TO BE USED FOR PIRACY. Ant DVD Video 8 06-24-2004 05:52 AM



Advertisments