Wolfram Language

Computational Audio

Build an Audio Compressor

Build an audio compressor.

In[1]:=
Click for copyable input
a = Import["ExampleData/rule30.wav"]
Out[1]=
In[2]:=
Click for copyable input
AudioPlot[a, ImageSize -> Medium]
Out[2]=

Compute the RMS amplitude of the signal with a threshold of 0.02.

In[3]:=
Click for copyable input
amplitude = AudioBlockMap[Max[.02, Sqrt@Mean[#^2]] &, a, {.01, .005}]
Out[3]=

Compress the dynamic range of the signal.

In[4]:=
Click for copyable input
AudioNormalize[a/AudioGenerator[amplitude]]
Out[4]=
In[5]:=
Click for copyable input
AudioNormalize[a/AudioGenerator[amplitude]]; AudioPlot[%, ImageSize -> Medium]
Out[5]=

Related Examples

de es fr ja ko pt-br ru zh