# [SciPy-User] Convert a time-frequency array to sound file

Fri Feb 12 15:09:17 CST 2010

```On second thoughts, phase shouldn't be a problem with FT method, although amplitude discontinuities might be. If you go with the frequency synthesis method you may want to consider randomising the initial phases of each oscillator so that you don't get a big bang/crash at the beginning when everything is in phase.

----- Original Message ----
To: SciPy Users List <scipy-user@scipy.org>
Sent: Sat, 13 February, 2010 9:48:18 AM
Subject: Re: [SciPy-User] Convert a time-frequency array to sound file

You could just take the inverse fourier transform of each spectra and then just patch them end to end, but I suspect this will end up sounding pretty awful as you'd get lots of phase discontinuities at the end of each segment. A better strategy might be to generate a continuous sin wave for each frequency (with a good number of samples per segment), multiply each of these sin waves by the corresponding, interpolated, spectral amplitude, and then sum over the different frequencies.

This should be easy enough to do with the standard numpy functions.

David

----- Original Message ----
From: Yannick Copin <y.copin@ipnl.in2p3.fr>
To: scipy-user@scipy.org
Sent: Sat, 13 February, 2010 3:59:34 AM
Subject: [SciPy-User] Convert a time-frequency array to sound file

Hi,

for some illustration (!) purposes, I would like to convert a time-frequency
array (originating from a time series of spectra f(wavelegnth)) into an
audible sound clip, e.g. a WAV file. I quickly looked at what's available
under numpy/python (http://wiki.python.org/moin/Audio/, or Audiolab), but I
couldn't find a single procedure to do this conversion.

Disclaimer: I don't know anything about sound processing, and this is just for
fun, similar to what has been done there:
http://newscenter.lbl.gov/feature-stories/2010/01/25/music-of-the-universe/

Any hints or links on how to do that in a simple way?

Cheers,
--
.~.   Yannick COPIN  (o:>*  Doctus cum libro
/V\   Institut de physique nucléaire de Lyon
// \\  Université de Lyon - CNRS-IN2P3
/(   )\ AIM: YnCopin ICQ: 236931013
^`~'^  http://snovae.in2p3.fr/ycopin/

_______________________________________________
SciPy-User mailing list
SciPy-User@scipy.org
http://mail.scipy.org/mailman/listinfo/scipy-user

_______________________________________________
SciPy-User mailing list
SciPy-User@scipy.org
http://mail.scipy.org/mailman/listinfo/scipy-user

```