Message Boards Message Boards

Generate sound from plot curves?

Hello everyone, I’ve just joined the community. On March 5th I'm giving a Meetup group presentation titled "The Greatest Unsolved Problem in Mathematics", which is of course the Riemann hypothesis. I will include many classical images of races between the prime "staircase" and various functions. I also want to include entertaining sounds, so I made this example of how zeta “waves” sum to prime “spikes”.

zwave[n_,x_]:=Cos[Im[ZetaZero[n]] Log[x]];

However, I can’t figure out how to turn these plots into sound in a pleasant Hz range. I tried increasing the frequency by using a multiplier inside, but I keep getting something inaudible. Can someone help me create sound out of these plots, and explain what a general strategy might be?

P.S. Any contributions of great sounds generated by primes and zeta zeroes would be welcome, and I’ll attribute you in my talk.

POSTED BY: Greg Keogh
7 Replies
Posted 5 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]

Dear Jose and J.M.,

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

Thanks again !


POSTED BY: Jos Klaps
Posted 5 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

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
or Discard

Group Abstract Group Abstract