WOLFRAM

generates one second of audio of a given model.

AudioGenerator[model,t]

generates t seconds of audio.

AudioGenerator[model,t,"type"]

generates audio samples of the specified "type".

Details and Options

  • AudioGenerator can generate different types of audio, including oscillators or noises.
  • Possible settings for model include:
  • fsample an arbitrary function f of time (in seconds)
    procgenerate samples from a random process proc
    tseriesgenerate samples from a TimeSeries tseries
    "model"generate sample from a named function "model"
  • Silence:
  • "Silence"silence (zero) signal
  • Oscillators:
  • {"Sin",freq,phase}sine wave
    {"Triangle",freq,phase}triangle wave
    {"Sawtooth",freq,phase}sawtooth wave
    {"Square",freq,phase}square wave
    {"Pulse",freq,phase,width}rectangular wave using the duty cycle width
    {"Impulse",freq,phase}impulse signal
  • By default, freq=TemplateBox[{440, "Hz", hertz, "Hertz"}, Quantity], phase=TemplateBox[{0, "rad", radians, "Radians"}, Quantity], and width=TemplateBox[{25, "%", percent, "Percent"}, QuantityPostfix] are used.
  • The parameters freq, phase, and width can be a scalar value, a Quantity, an Audio object, a TimeSeries, or a pure function.
  • Noise:
  • "White"constant power spectral density
    "Pink"power spectral density that follows 1/f
    "Brown"power spectral density that follows
    "Blue"power spectral density that follows
    {"Color",α}power spectral density that follows with
    {"White",dist}random noise with values sampled from dist
    "PeriodicRandomNoise"sum of sinusoidal components with constant amplitude and random phase
  • Other:
  • AudioGenerator generates an audio object of "Real32" type. See the reference page for Audio for possible settings of "type".
  • AudioGenerator has the same options as Audio.
  • List of all options

Examples

open allclose all

Basic Examples  (3)Summary of the most common use cases

Generate one second of sinusoidal audio:

Out[1]=1

Generate a signal from an arbitrary function:

Out[1]=1

Generate two seconds of white noise:

Out[1]=1

Scope  (17)Survey of the scope of standard use cases

Basic Uses  (2)

By default, 1 second of audio is generated:

Out[1]=1

Specify the duration:

Out[2]=2

Specify the duration as a time quantity:

Out[3]=3

Specify the number of samples to generate:

Out[4]=4

By default, the generated audio is of "Real32" type:

Out[1]=1

Specify a different data type:

Out[2]=2

Model Specifications  (15)

Oscillators  (5)

Sinusoidal oscillator at 2000 Hz:

Out[1]=1

Control the frequency of the sine wave with a function:

Out[1]=1

Visualize the spectrogram:

Out[2]=2

Control the frequency of the sine wave with another Audio object:

Out[1]=1

Visualize a spectrogram of the generated audio:

Out[2]=2

Control the frequency of the sine wave with a TimeSeries:

Out[1]=1
Out[2]=2

Generate different oscillators:

Out[2]=2

Noise Generators  (5)

Generate white noise:

Out[1]=1

The values for the white noise can be sampled from a distribution:

Out[1]=1

Generate different kinds of noises:

Out[2]=2

The spectra of pink, brown, and blue noises follow a distribution of f-α, with α equal to 1, 2, and , respectively:

Out[1]=1

The spectrum of "PeriodicRandomNoise" is perfectly flat:

Out[1]=1

Using Functions  (1)

AudioGenerator supports functions of time:

Out[2]=2

Using Processes  (2)

Generate audio from a noise process:

Out[1]=1

Use an audio object generated from a random process to control the amplitude of a sinusoid:

Out[2]=2

Using TimeSeries  (2)

Generate an audio object from a TimeSeries:

Out[1]=1

Generate an audio object from an irregular TimeSeries:

Out[1]=1
Out[2]=2

Options  (1)Common values & functionality for each option

SampleRate  (1)

By default, SampleRate->44100 is used:

Out[1]=1

Specify a different sample rate:

Out[2]=2

Applications  (8)Sample problems that can be solved with this function

Noise Applications  (2)

Add noise to an audio object:

Out[2]=2

Use "PeriodicRandomNoise" to test the frequency response of a linear system:

Out[1]=1

Audio Generation from Temporal Data  (2)

Compare the stock price trends of two companies:

Resample and smooth the data:

Out[2]=2

Generate audio controlled by the two time series:

Out[4]=4

Use a list of TimeSeries to control the amplitudes of a list of harmonic sine waves:

Out[4]=4
Out[5]=5

Multi-Frequency Generation  (3)

Generate a series of DTMF tones to simulate the dialing of a phone number:

Out[4]=4

Create a numeric keypad:

Out[1]=1

Create an auditory illusion:

Generate ramps to control frequencies and amplitudes of the oscillators:

Out[2]=2

Create frequencies that will control the oscillators. The frequencies are exactly one octave apart from each other and increase exponentially, so that pitch increases linearly:

Out[3]=3

Create amplitudes that will control the oscillators. Amplitudes go to 0 when the frequencies drop to the minimum value:

Out[4]=4

Show the relation between frequency and amplitude of one oscillator:

Out[5]=5

Combine a bank of oscillators using the created frequencies and amplitudes:

Out[6]=6
Out[7]=7

Frequency and Amplitude Modulation  (1)

Generation and reconstruction of an AM signal:

Out[2]=2

Modulate the amplitude with a 22050 Hz sinusoid to shift the content at the high end of the spectrum. The result should be already inaudible for most people:

Out[3]=3
Out[4]=4

Demodulate the AM signal by multiplying the result by another sinusoid at 22050 Hz with the same phase:

Out[5]=5

Possible Issues  (2)Common pitfalls and unexpected behavior

With oscillators, the frequency should be less than or equal to half of the sample rate:

Out[1]=1

If a TimeSeries is used as an input, it needs to have numeric non-negative time stamps:

Out[1]=1
Out[2]=2

The TimeSeries needs to have a single scalar-valued path:

Out[3]=3
Out[4]=4

Interactive Examples  (3)Examples with interactive outputs

Control frequency and phase of an oscillator:

Out[1]=1

The spectrum of AudioGenerator[{"Color",α}] follows a distribution of f-α:

Out[1]=1

Create a complex audio signal using frequency modulation:

Out[1]=1

Neat Examples  (4)Surprising or curious use cases

Sweep the frequency of the modulating signal:

Out[1]=1

Use the digits of Pi in base 24 to generate a sequence of frequencies for a sinusoidal oscillator:

Out[1]=1
Out[2]=2

Create a melody using DiscreteMarkovProcess:

Out[2]=2

Generate an audio signal using Morse code:

Create a function to translate a message to an audio signal using the dictionary:

Encode a string into an audio signal:

Out[3]=3
Out[4]=4
Wolfram Research (2016), AudioGenerator, Wolfram Language function, https://reference.wolfram.com/language/ref/AudioGenerator.html.
Wolfram Research (2016), AudioGenerator, Wolfram Language function, https://reference.wolfram.com/language/ref/AudioGenerator.html.

Text

Wolfram Research (2016), AudioGenerator, Wolfram Language function, https://reference.wolfram.com/language/ref/AudioGenerator.html.

Wolfram Research (2016), AudioGenerator, Wolfram Language function, https://reference.wolfram.com/language/ref/AudioGenerator.html.

CMS

Wolfram Language. 2016. "AudioGenerator." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/AudioGenerator.html.

Wolfram Language. 2016. "AudioGenerator." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/AudioGenerator.html.

APA

Wolfram Language. (2016). AudioGenerator. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/AudioGenerator.html

Wolfram Language. (2016). AudioGenerator. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/AudioGenerator.html

BibTeX

@misc{reference.wolfram_2025_audiogenerator, author="Wolfram Research", title="{AudioGenerator}", year="2016", howpublished="\url{https://reference.wolfram.com/language/ref/AudioGenerator.html}", note=[Accessed: 02-April-2025 ]}

@misc{reference.wolfram_2025_audiogenerator, author="Wolfram Research", title="{AudioGenerator}", year="2016", howpublished="\url{https://reference.wolfram.com/language/ref/AudioGenerator.html}", note=[Accessed: 02-April-2025 ]}

BibLaTeX

@online{reference.wolfram_2025_audiogenerator, organization={Wolfram Research}, title={AudioGenerator}, year={2016}, url={https://reference.wolfram.com/language/ref/AudioGenerator.html}, note=[Accessed: 02-April-2025 ]}

@online{reference.wolfram_2025_audiogenerator, organization={Wolfram Research}, title={AudioGenerator}, year={2016}, url={https://reference.wolfram.com/language/ref/AudioGenerator.html}, note=[Accessed: 02-April-2025 ]}