[Tutor] How to generate a pure tones and random noise using Python?

Pablo Lucena plucena24 at gmail.com
Sun Jul 26 23:32:57 CEST 2015


>
>
> I just have read this webpage about Generate Audio with Python.
> It seem writing by Python 2? Esp. itertools (izip, imap).
> I try to change izip and imap to zip and map, but I get error:
>
> ​​
> beatfreq, amplitude = remainder.split('/')
> ​​
> ValueError: need more than 1 value to unpack
>
> Are there some way to conver it to the code of Python 3?
>
> I'm too anxious to hear the sound from Python though I'm a absolute
> beginner.
>
> Many thanks
>
> Paul Z
>
>
​If you are using Python 3, replace calls to itertools.izip and
itertools.imap with simply "zip" and "map" respectively. Why not just use
Pyton2 instead, as there may be other things that will break.

​beatfreq, amplitude =
> ​​
> remainder.split('/')


​This throwing an exception means there is an issue with the data you are
trying to split, not necessarily a Py2 vs Py3 thing. What string is
assigned `remainder`?

-- 
*Pablo Lucena*


More information about the Tutor mailing list