Summary

Create a waveform: sine, sawtooth, square, triangle, pulse or arbitrary.

Audio Connections

PortPurpose
Out 0Waveform Output

Functions

begin(waveform);

Configure the waveform type to create.

begin(level, frequency, waveform);

Output a waveform, and set the amplitude and frequency.

frequency(freq);

Change the frequency.

amplitude(level);

Change the amplitude. Set to 0 to turn the signal off.

phase(angle);

Cause the generated waveform to jump to a specific point within its cycle. Angle is from 0 to 360 degrees. When multiple objects are configured, AudioNoInterrupts() should be used to guarantee all new settings take effect together.

pulseWidth(amount);

Change the width (duty cycle) of the pulse.

arbitraryWaveform(array, maxFreq);

Configure the waveform to be used with WAVEFORM_ARBITRARY. Array must be an array of 256 samples. Currently, the data is used without any filtering, which can cause aliasing with frequencies above 172 Hz. For higher frequency output, you must bandwidth limit your waveform data. Someday, "maxFreq" will be used to do this automatically.

Examples

File > Examples > Audio > Synthesis > PlaySynthMusic

File > Examples > Audio > Synthesis > pulseWidth

File > Examples > Audio > HardwareTesting > WM8731MikroSine

Notes

Supported Waveforms: