[Tutor] Writing to Sound
Alan Gauld
alan.gauld at btinternet.com
Wed Sep 15 11:24:09 CEST 2010
"Corey Richardson" <kb1pkl at aim.com> wrote
> First off, here is what I'm doing. I'm taking pi (3.141592 etc. etc.
> etc.), taking two values at a time, and then mapping the two values
> to pitch and length. I'm then using winsound.Beep to beep for x ms,
> at y frequency.
So far I understand.
> What I want to do, is write that to file.
Write what?
The sound generated by Beep or the data used to drive Beep?
> Judging from
> http://codingmess.blogspot.com/2008/07/how-to-make-simple-wav-file-with-python.html,
> it seems to be more complex than I care to undertake without
> exploring the possibilities.
That tells you how to make a wav file that will play in any standard
media
player program. Is that what you want?
> Are there any simpler or higher level ways?
It depends what you want the file to be. What do you intend to do with
the file?
> wouldn't mind something like sound_file.write(freq, length) like
> Beep does, but that may or may not exist.
You can write the two values to a file so that you can read it back
later
and send the values to Beep. Thats trivial. But the file will not play
in a
standard player.
> I dunno, a simple google doesn't yield anything.
That probably depends on what you are searching for.
I'm not clear from your description what you want to do.
--
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/
More information about the Tutor
mailing list