- Use a single Pd instance with multiple patches, with each patch wrapped in adc~ and dac~
Then I have a simple JUCE app (based on the sampler example) that drives
these pd patches.
There is no problem with doing switch~ and such, but I am
getting distortion that seems like clipping in both cases (one pd instance with many patches
or multiple pd instances with one patch)
To be more clear these wrapper patches are like:
Patch 1: [adc~] -> [lop~ 200] -> [dac~]
Patch 2: [adc~] -> [hip~ 200] -> [dac~]
These wrapper patches also have a loadbang to pd dsp 1;
Then the code that calls these patches does something like this calling libpd:
for (each buffer from the audio callback) {
for (a smaller buffer that’s the pd block size (eg 64)) {
pd->processFloat (oneTick, smallBufferIn, smallBufferOut);
}
}
I tried scaling the input and output to these wrapper patches after the adc~ and before the dac~
and that does not solve the distortion/clipping problem either.
There are a couple of more things I can try:
- make the wrapper patches even simpler, just scaling instead of the filters.
- dump the samples to a file and maybe that will shed some light on the problem.
- making a much simpler example program that I can share will you all.
I have libpd and pd source directly compiled into my example
Any other ideas would be greatly appreciated!
This approach works well, but the problem is I can’t insert non-Pd signal processing