Group Abstract Group Abstract

Message Boards Message Boards

Generate sound from plot curves?

POSTED BY: Greg Keogh
7 Replies
Posted 7 years ago

Might be a little late, but here is the old example of playing the sound of the Riemann-Siegel function (a function constructed so that its zeroes correspond to the zeroes of $\zeta\left(\frac12+it\right)$):

Play[RiemannSiegelZ[2000 t], {t, 0, 15},
     PlayRange -> {-20, 20}, SampleRate -> 244800./11]
POSTED BY: J. M.

Dear Jose and J.M.,

Thanks for your quick reply and support. Your information excellent is very usefull to support my project.

Thanks again !

Regards,....Jos

POSTED BY: Jos Klaps
Posted 7 years ago

Dear All,

I seems a very nice and usefull code for my project. May I ask you a further question. Is it possible to integrate the attached "sound.wav" file into your code?

Your reply will be highly appreciated !

Best Regards,......Jos

Attachments:
POSTED BY: Jos Klaps

Glad you found it useful!

POSTED BY: Carlo Giacometti

Thanks Carlo, your answer has unlocked the secret of generating sound for me. Following help about AudioGenerator and AudioNormalize led me into a section of the documentation I haven't visited before. I didn't know those functions existed. The help topics Audio Processing, Signal Processing and Sound and Sonification contain a staggering set of functions, so now I just have to figure out which ones are useful for my modest needs. The 3 samples you provided are fabulous and I can expand upon them - Thanks, Greg

POSTED BY: Greg Keogh

To start, I suggest a slight modification in the function to avoid indeterminate values:

zwave[n_, x_] := Cos[N@Im[ZetaZero[n]] Log[x + $MachineEpsilon]]

There are two main ways to turn a function into an audio signal:

  • use the function to compute the samples directly:

    AudioNormalize@AudioGenerator[Sum[zwave[n, #], {n, 1, 100}] &]
    AudioGenerator[zwave[100, #] &]
    

This of course produces something useful only if the frequencies contained in the signal are high enough to be audible (you can check once the generation is done you can check with Periodogram and Spectrogram).

  • use the function to control the frequency of an oscillator:

    AudioGenerator[{"Sin", 400 + 200*zwave[1, #] &}]
    AudioGenerator[{"Sin", 400 + 200*Sum[zwave[n, #], {n, 1, 60}] &}, 10]
    

This usually produces better results for more slowly varying functions.

POSTED BY: Carlo Giacometti
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard