Closed molo32 closed 3 years ago
Hi @molo32! If I understand what you are asking you want to make your own synthesized sounds then send it to the audio driver. Below I've copied the code from the DummyTemplate.pde sketch. But all the examples do the same thing. The outputL
and outputR
variables inherited from the class PdAlgorithm write the values it receives directly to the audio block.
Any number from -1 to 1 will go to your hardware (actually on some OSs numbers larger than that will work and distort tremendously so be careful with your ears).
If I have misunderstood your question please correct me. Thank you for your interest in Pd4P3.
class MyMusic extends PdAlgorithm {
float dummy = 0;
//All DSP code goes here
void runAlgorithm(double in1, double in2) {
outputL = outputR = 0; //write any numbers from -1 to 1 here
}
//We use synchronized to communicate with the audio thread
synchronized void setFloat(float f1) {
dummy = f1;
}
synchronized float getFloat() {
return dummy;
}
//Free all objects created from Pd4P3 lib
void free() {
}
}
I would like to synthesize sounds generating samples and listen to it directly.