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.readArray(fftData, 0, "fft", 0, 32);
for(int i = 0; i < fftData.length; 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.!