I've previously seen simple equations that produce beautiful, complex shapes:
Is there an equivalent for music? I.e. a simple equation $A(t)$ that, when played as a sound, will produce a melody?
Or failing that, something in the Fourier domain that produces a surprisingly complex or beautiful melody with a simple equation?
I am trying to find a beautiful default for a little open-source utility I wrote that plays an equation as audio.
How functions can be interpreted as music
You can represent music by modeling it as a function, amplitude, with respect to time. More often it is modeled as two functions, one for each ear, i.e. stereo. These functions can be graphed just as any other function can:
Now this is discrete (sampled around 48,000Hz), but can be approximated by a continuous function. So we can perform operations on it. For example, you can use the FFT to approximate a Fourier transform.
Unfortunately, because this function is a discrete function comprising millions of datapoints, it can not be written compactly. Just in the same way that the beautiful image at the top of the page is not compact if you represent it as pixel data, yet is compact if you look at the mathematical function that generates that data.
Prototype
This is a proof of concept that you can make melodies with fairly simple equations:
\begin{align*} &\sin(440 \cdot 2 \pi t) \exp(-(t-1.1)^2 e^{(t-1.1)^2}) \\ + &\sin(554.365 \cdot 2 \pi t) \exp(-(t-3.0)^2 e^{(t-3.0)^2}) \\ + &\sin(659.225 \cdot 2 \pi t) \exp(-(t-4.9)^2 e^{(t-4.9)^2}) \end{align*}
It is somewhat ugly as it just combines the bump function with sinusoids to create an A-major arpeggio: A, C♯, E. The principle is that the function is varying in frequency and amplitude, and it's amplitude peaks when it hits pleasant frequencies.
I'm looking for a more natural version of this. Something similar to the equation at the top of this page that produces the surprisingly complex and beautiful image.
Making your own
Here's a Desmos graph of the first couple of bump functions I used if you want to play around with this. You then just multiply the bump function by the periodic function you want. You can change the delay of each one by changing $2.9$ to the delay you want. Each bump function lasts about 2 seconds, but you can change the width and shape by playing around with bump the function.


Cool utility! If you haven't already, I suggest learning about the relationships between a sound's waveform and its audible qualities, and manually experimenting.
You can get some fun results using methods from FM synthesis by modulating a signal (like a sine wave) by changing its parameters (amplitude, phase, frequency) over time using other functions, which themselves can be modulated further, resulting in nested function expressions.
Modulations at rates above around 20Hz affect the instantaneous audible pitch and timbre of the sound, whereas slower modulations result in audible changes to the sound over time.
Here's a neat example:
.2 sin((2000 pi + 10 sin(100 pi t)) t). I expected this to be a steady FM tone (a 1000 Hz wave, frequency-modulated by a 50 Hz wave), but I made a mistake: varying the frequency term also changes the instantaneous phase, and this phase error is proportional to the amount of time that has passed. It's clearer to view this as phase modulation:.2 sin(2000 pi t + 10 t sin(100 pi t)); if you remove the $t$ factor from the modulation amplitude, you get the expected steady tone.