Mozzi  version v2.0
sound synthesis library for Arduino
PDResonant Class Reference

PDResonant is a simple midi instrument using Phase distortion used to simulate resonant filter, based on https://en.wikipedia.org/wiki/Phase_distortion_synthesis. More...

#include <PDResonant.h>

Detailed Description

PDResonant is a simple midi instrument using Phase distortion used to simulate resonant filter, based on https://en.wikipedia.org/wiki/Phase_distortion_synthesis.

The class shows how the Mozzi Phasor class can be used to generate an index into a wavetable, and an ADSR is used to modulate the effect by modifying the Phasor frequency and sync. More complex phase distortion effects could be developed by using precalculated tables, or calcuating tables on the fly using a double buffer, or a line-breakpoint model, a sort of hybridPhasor-Line object.

Definition at line 31 of file PDResonant.h.

Public Member Functions

 PDResonant ()
 Constructor.
 
void noteOn (byte channel, byte pitch, byte velocity)
 Play a note in response to midi input. More...
 
void noteOff (byte channel, byte pitch, byte velocity)
 Stop a note in response to midi input. More...
 
void setPDEnv (int attack, int decay)
 Set the resonant filter sweep parameters. More...
 
void update ()
 Update the filter sweep. More...
 
int next ()
 Produce the audio output. More...
 

Member Function Documentation

◆ next()

int PDResonant::next ( )
inline

Produce the audio output.

This goes in updateAudio().

Definition at line 102 of file PDResonant.h.

◆ noteOff()

void PDResonant::noteOff ( byte  channel,
byte  pitch,
byte  velocity 
)
inline

Stop a note in response to midi input.

Params copied from MIDI library HandleNoteOff()

Parameters
channelis the midi channel
pitchis the midi note
velocityyou know what it is

Definition at line 67 of file PDResonant.h.

◆ noteOn()

void PDResonant::noteOn ( byte  channel,
byte  pitch,
byte  velocity 
)
inline

Play a note in response to midi input.

Params copied from MIDI library HandleNoteOn().

Parameters
channelis the midi channel
pitchis the midi note
velocityyou know what it is

Definition at line 52 of file PDResonant.h.

◆ setPDEnv()

void PDResonant::setPDEnv ( int  attack,
int  decay 
)
inline

Set the resonant filter sweep parameters.

Parameters
attackADSR attack
decayADSR decay

Definition at line 78 of file PDResonant.h.

◆ update()

void PDResonant::update ( )
inline

Update the filter sweep.

Use this in updateControl().

Definition at line 91 of file PDResonant.h.