Forums > MaxMSP

Continuous writing and reading of buffers

March 3, 2009 | 3:07 pm

Hello,
I am trying to write and read FFT information to a buffer. I have a working patch in that the buffer is read back with delay and can also alternate between two buffers, clearing one whilst the other is being written to. The problem is that I seem to run out of RAM as the buffer cuts out when it is filled up and I get a high pitched squeal. I am writing the FFT information to the buffer, indexed with the sample rate using count~ and index~ objects. I thought that if I cleared one buffer whilst the other was writing then I would not run out of RAM but it would seem that I run out anyway. Does any one know why this is and how I may go about solving it?

I have already tried resetting the count to 0 every once in a while to start indexing at the start of the next buffer but this does not work due to the delayed frequency bins being ready back using a -~ as this then tries to read a negative value of the buffer when there is nothing there!

I have also researched into the help topics and manual but there does not seem to be a huge amount of information on how buffers and RAM interrelate. Please correct me if I am wrong though.

Any help would be greatly appreciated. Thank you very much.


March 3, 2009 | 5:09 pm

If I understand correctly, you want to store one frame of FFT data in a [buffer~] while reading the pervious frame from a [buffer~]? If so, then using two halves 1 [buffer~] that is double the size would probably work better than trying to flip flop between two different [buffer~]s. I know it doesn’t work, but could you post your patch so I could take a look and make sure I’m giving you advice to do what you want to be doing?

If my guess of your goals is right, I have a patch that does this I was planning to post to the list anyway to get some feedback to see if someone else can think of a better solution.

I’ll post it up later today when I find which copy I already commented up. Stay tuned!


March 3, 2009 | 5:50 pm

Here is the patch I was referring to. It seems as though there is some mistake in it. It works fine normally, but when you toggle-DSP some artifacts seem to get added to the resynthesis (sounds a little like a feedback delay sort of sound). From my tests seems to work okay the first time DSP is turned on after opening the patch.

So to "student": I hope this might help you out (if indeed this was what you were trying to do).

and to everyone else out there: any idea why this would seem to break down after toggling DSP? or any thoughts on a better way of accomplishing this? Later today if I have time I may work on experimenting with putting together another version that uses [count~].


Viewing 3 posts - 1 through 3 (of 3 total)