Skip to content

Commit

Permalink
Updated comments and documentation.
Browse files Browse the repository at this point in the history
  • Loading branch information
robertesler committed Sep 7, 2021
1 parent 982a572 commit 2a0de2f
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 24 deletions.
2 changes: 1 addition & 1 deletion examples/Filters/VocoderDemo/VocoderDemo.pde
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ double[] smooth;
pd = Pd.getInstance(music);
tab = new double[music.getNumOfFilters()];
smooth = new double[music.getNumOfFilters()];
music.setAudioFile("C:\\Users\\rwe8\\Desktop\\P3-Tests\\voice.wav");
music.setAudioFile("C:\\Users\\&&&\\Desktop\\voice.wav");
//start the Pd engine thread
pd.start();

Expand Down
15 changes: 1 addition & 14 deletions examples/Modelling/PAFSynthesis/PAF.pde
Original file line number Diff line number Diff line change
Expand Up @@ -41,20 +41,7 @@ class PAF extends PdMaster {
p = 1 - q
*/

/*
double w = phasor.perform(f);
double a = line1.perform(index, 50);
double sh = samphold.perform(cf, w);
double q = wrap.perform((float)sh);
double k = sh - q;
double p = 1 - q;
double modulator = a * cos1.perform((w *.5)-.25);
double carrier = p * cos2.perform(k * w) + q * cos3.perform((k+1)*w);
double g = tabread.perform(modulator + 100 );
double paf = g * modulator * carrier;
*/


//Keep in mind cos.perform(x) - .25 is a sine wave
phase = phasor.perform(f);
modulator = (cos1.perform((phase * .5) - .25) * line1.perform(index, 50));
gauss = tabread.perform(modulator + tabSize/2);
Expand Down
31 changes: 24 additions & 7 deletions examples/Modelling/PAFSynthesis/PAFSynthesis.pde
Original file line number Diff line number Diff line change
@@ -1,12 +1,25 @@
import com.pdplusplus.*;

//declare Pd and create new class that inherits PdAlgorithm
/*
This sketch demonstrates phase aligned formant synthesis. This
algorithm is patented by IRCAM but allowable for open source or
educational purposes, but don't go selling software with this unless
you contact them first.
One use of PAF is speech synthesis, but it is useful for making
synths or vocoders.
Use mouse X/Y to control the frequency and index of the
synthesizer.
The animation is the frequency bands and their amplitude.
*/

Pd pd;
MyMusic music;

double bins[];
double smooth[];
int counter = 0;
double smooth[];

void setup() {
size(640, 360);
Expand All @@ -29,6 +42,7 @@ double bins[];

float f = map(mouseX, 0, width, 50, 250);
float index = map(mouseY, 0, height, 200, 10);
//We set the center frequency to 1/10 of the fundamental.
music.setFreq(f, f/10, index);
background(255);
fill(0);
Expand Down Expand Up @@ -61,7 +75,8 @@ double bins[];
}

/*
This is where you should put all of your music/audio behavior and DSP
This class implements a PAF object and then analyzes it.
The FFT bin magnitude is then sent back to P3 for drawing.
*/
class MyMusic extends PdAlgorithm {

Expand All @@ -74,7 +89,7 @@ double bins[];
double centerFreq = 10;
double index = 50;
double[] sf = new double[1];
boolean recording = false;
boolean recording = false;//Set this to true if you want to record what you do.

double[] bins;
double[] hannWindow;
Expand All @@ -85,8 +100,10 @@ double bins[];

//All DSP code goes here
void runAlgorithm(double in1, double in2) {
//get our Hanning window

//get our Hanning window
double hann = hannWindow[counter++];
//perform our PAF with freq, center freq and modulation index
double out = paf.perform(getFreq(), getCenterFreq(), getIndex());

sf[0] = out;
Expand Down Expand Up @@ -151,7 +168,7 @@ double bins[];

void setSynth() {
if(recording)
writesf.open("C:\\Users\\rwe8\\Desktop\\paf.wav", 1);
writesf.open("C:\\Users\\&&&\\Desktop\\paf.wav", 1);

paf.setSynth();
}
Expand Down
1 change: 0 additions & 1 deletion examples/Modelling/PAFSynthesis/Wrap.pde
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
//This class mimic's Pd's wrap~ object
//This mimics the wrap~ object in Pure Data
class Wrap {


Expand Down
2 changes: 1 addition & 1 deletion examples/Sampling/TimeCompression/TimeCompression.pde
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import com.pdplusplus.*;

music = new MyMusic();
pd = Pd.getInstance(music);
music.loadAudioFile("C:\\Users\\&&&\\Desktop\\P3-Tests\\voice.wav");
music.loadAudioFile("C:\\Users\\&&&\\Desktop\\voice.wav");
//start the Pd engine thread
pd.start();

Expand Down

0 comments on commit 2a0de2f

Please sign in to comment.