# Wolfram Function Repository

Instant-use add-on functions for the Wolfram Language

Function Repository Resource:

Illustrate the behavior of a real-valued function in the form of sound

Contributed by:
Rauan Kaldybayev

ResourceFunction["FunctionAudiolize"][ makes an "audiolization" of |

ResourceFunction["FunctionAudiolize"] outputs a piece of audio such that the frequency at a particular moment is determined by the value of the plotted function for the corresponding value of the independent variable. The volume is constant.

ResourceFunction["FunctionAudiolize"] only accepts real-valued functions.

Frequency as a function of time, *f*(*t*), is determined by , where *y*(*x*) is the plotted function and *k*>=0,*T*>0. The higher the value of *y*, the higher the frequency. If *y* is negative and has a large absolute value, the frequency is low.

ResourceFunction["FunctionAudiolize"] can be useful to mathematicians/math enthusiasts who want to enhance their intuition about a particular function by converting it to audio; this especially applies to audials, people who perceive information better through hearing.

An audiolization can often be more intuitive than a regular plot. The ability to perceive functions through sound can potentially be tremendously helpful to sight-impaired people who want to learn math, but do not have access to the traditional teaching techniques that rely heavily on visual input.

ResourceFunction["FunctionAudiolize"] supports the following options:

"BaselineFrequency" | 440 | average frequency of the audiolization, in hertz |

"MinFrequency" | 120 | a lower bound below which the frequency is not allowed to fall, in hertz |

"MaxFrequency" | 1910 | an upper bound above which the frequency is not allowed to rise, in hertz |

"TimeStep" | 0.01 | time steps for discretization of the plotting domain |

SampleRate | 8000 | SampleRate of ResourceFunction["FunctionAudiolize"]; determines the quality of sound |

The frequency cannot surpass "MinFrequency" and "MaxFrequency", but it is not obliged to touch both of these bounds. The frequency generally touches exactly one of those limits, either the upper or the lower one.

The mean value of log(*f*(*t*)) over the length of the audio is bound to be equal to Log["BaselineFrequency"].

Make a 10-second audiolization of the function *f** **=** *Exp[-*x*/30]Cos[*x*] for *x* from 0 to 20* π* and compare to the regular plot. The swings in pitch reflect the oscillations of the function, and the decrease in the magnitude of these swings over time reflects the decaying exponential factor:

In[1]:= |

Out[1]= |

Use the function 1/*x*, where the audiolization starts with a high note and then drops down, resembling a whining dog:

In[2]:= |

Out[2]= |

While FunctionAudiolize does not directly support complex-valued functions, it is possible to plot the absolute value and phase as those are real functions:

In[3]:= |

Out[3]= |

One can instead work with the real and imaginary parts:

In[4]:= |

Out[4]= |

Change the baseline frequency (which is the mean frequency over the duration of the audio) from the default value of 440 Hz to 800 Hz:

In[5]:= |

Out[5]= |

In addition to the requirement that the mean frequency should have a certain value, the frequency also cannot fall below or exceed the given bounds, set by default to 120 and 1910 Hz. Changing the lower limit to 360 Hz decreases the frequency range:

In[6]:= |

Out[6]= |

Decrease the sample rate of FunctionAudiolize to decrease the computation time:

In[7]:= |

Out[7]= |

Increasing the time steps means that the domain will be split into fewer regions, which reduces the computation time at the cost of resolution:

In[8]:= |

Out[8]= |

For faster-changing functions, this effect can become significant:

In[9]:= |

Out[9]= |

Rescaling or adding a constant to the plotted function or the independent variable does not affect the output of FunctionAudiolize, as the latter automatically rescales the function to match the frequency range and audio duration criteria:

In[10]:= |

Out[10]= |

FunctionAudiolize uses the built-in function Play to make sounds, so the output of FunctionAudiolize[1,{*t*,0,1},1] is exactly the same as that of Play[Sin[2* π*·440

In[11]:= |

Out[11]= |

The function does not accept complex numbers. Because of numerical errors, calculations that are supposed to yield real numbers sometimes end up returning something that has some imaginary part. The expression below is supposed to evaluate to 1+cos(*x*), but there also is a small imaginary error term:

In[12]:= |

Out[12]= |

Trying to audiolize this results in an error message:

In[13]:= |

Out[13]= |

If it is known for sure that the plotted function is real-valued, one can just plot the real part:

In[14]:= |

Out[14]= |

Audiolization of the Riemann-Siegel function:

In[15]:= |

Out[15]= |

The sound plot of the Fibonacci numbers mod 17, *f*(*x*)=*F*_{Floor[x]}mod17, sounds like a pretty decent intro for piece of Prog Jazz:

In[16]:= |

Out[16]= |

Make a function whose audiolization is "The Last Airbender" theme:

In[17]:= |

Out[17]= |

The audiolization of log(log(*x*)) sounds like a death ray in the process of charging:

In[18]:= |

Out[18]= |

Audiolization of an Airy function:

In[19]:= |

Out[19]= |

- 1.0.0 – 25 January 2022

This work is licensed under a Creative Commons Attribution 4.0 International License