14
$\begingroup$

I have a list of numbers from a simulation of acoustic pressure generated by a virtual musical instrument by another program (Comsol multiphysics). I would like to "hear" the tone produced by different settings in the virtual instrument.

How can I do this? In particular, can I convert the data into a .wav file?

$\endgroup$
2
  • $\begingroup$ Could you please provide a sample of your data? Or give a link to where it can be found. $\endgroup$ Dec 2, 2012 at 6:48
  • $\begingroup$ Welcome to Mathematica.SE! I suggest the following: 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Read the FAQs! 3) When you see good Q&A, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. ALSO, remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign` $\endgroup$ Dec 2, 2012 at 9:35

1 Answer 1

17
$\begingroup$

In Mathematica it is easy to turn any time series data into sound. Here are the Boston temperatures for a few decades:

data = WeatherData["Boston", "MeanTemperature", {{1970}, {2012}, "Day"}];
DateListLogPlot[data, PlotStyle -> PointSize[0], AspectRatio -> 1/5]

enter image description here

To turn it into sound and play it in a Mathematica notebook:

ListPlay[data[[All, 2]], SampleRate -> 2000]

enter image description here

To export to .wav file:

Export["test.wav", %]
$\endgroup$
3
  • $\begingroup$ +1 Very nice example! I personally like the sound of the RiemannZeta function. $\endgroup$
    – Matariki
    Dec 2, 2012 at 18:44
  • $\begingroup$ @Matariki Thanks! I am not sure about sampling rate for RiemannZeta and other details. Will your code fit in a comment? $\endgroup$ Dec 2, 2012 at 19:51
  • 3
    $\begingroup$ Its rather simple. I got it years back I think it was a Mathematica example. Play[RiemannSiegelZ[2000 t], {t, 0, 5}, PlayRange -> {-20, 20}] $\endgroup$
    – Matariki
    Dec 2, 2012 at 20:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.