# Generate sound from plot curves?

Posted 5 months ago
1071 Views
|
7 Replies
|
12 Total Likes
|
 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]]; Plot[zwave[1,x],{x,1,10}] Plot[zwave[2,x],{x,1,10}] Plot[Sum[zwave[n,x],{n,1,60}],{x,2,12}] 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.
7 Replies
Sort By:
Posted 5 months ago
 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. Answer Posted 5 months ago  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 Answer Posted 5 months ago  Glad you found it useful! Answer Posted 4 months 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: Answer Posted 4 months ago  This might be interesting: http://matecmaticaacustica.weebly.com/graph-and-sound-of-sine-waves.html and http://matecmaticaacustica.weebly.com/fourier-synthesis.html hope that helps, regards Jose Attachments: Answer Posted 4 months 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]