-
jfred1979
I have a Java project with a really, really simple patch that simply loads sound data into a readsf object and plays it. Everything works perfectly in the PureData environment, and everything works in the Java project using and older build of LibPD (built from the source of this github repo (https://github.com/wivlaro/libpd-java-build).
However, when I make a build of the library from the latest source from the main LibPD repo I encounter an issue: the audio plays for a brief moment (a barely audible blip) and then stops. I've dug into the Java side and found that the PdBase.process method is writing an array full of zeros (except for that first audio blip, when it writes real data). I've confirmed that I can actually manually write data to the same array on the Java side and hear it, so this seems to indicate that something weird is going on in the actual LibPD native code.
Even more interesting is the fact that I can hook up an osc object in the same patch and I hear that fine! So its just the readsf object that is acting strange.
I'm really not sure how to proceed with this problem at this point. My C is not very good, so I fear that trying to debug the core LibPD code would be a huge undertaking (not that I'm opposed to learning new things, its just that I'm actively working on a project that I need to finish). Is there anyone that would be willing to run my super simple test Java project to see if its exhibiting the same behavior? Or does anyone have new-ish 32 and 64 bit LibPD DLLs that they could share with me to see if something weird happened during my build process (nothing was reported, and everything else seems to work fine)? Any other Java developers out there who might have encountered a similar thing?
-
jfred1979
I'm a bit new to LibPD (and PD in general) so please be gentle on me. I've asked this question in the Create Digital Music forum as well, didn't get much response.
I've built a little test patch to try to grab some fft data from an array and am having some problems. The patch is pretty damn simple and it seems to work as expected in the PD editor. I'm seeing array data show up in the table display, however when I try to grab it from the client side (Java code in this case) the array is filled with 0's.
Here's a shot of the patch I'm using:
and the test code in question:
float[] fftData = new float[32];
PdBase.sendBang("calculateFFT");
PdBase.readArray(fftData, 0, "fft", 0, 32);
for(int i = 0; i < fftData.length; i++) {
System.out.println(fftData[i]);
}Couldn't be simpler, right? This is wired to a button press, so I can arbitrarily fire it whenever. The audio is already loaded and playing fine at this point. Both the bang and the readArray are returning 0 so it appears that all the communication is working fine. However, I end up with an array full of 0's! Am I missing something? Interestingly I do get one chunk of actual data the first time when I keep "save contents" selected in the patch, which seems to be expected. Also, the tabwrite connected bang is definitely working correctly when I run the patch in PD, the "fft" array gets filled with new data every time I press it.
I assume there's something stupid I'm doing wrong here since I'm so new to this.!