accessing buffer~

Mar 7, 2011 at 11:48am

accessing buffer~

it’s my second post on this topic, i’m writing it because it’s a more general question.

how can i access a buffer~ and copy all the amplitudes in an array of doubles in my external,
i need it to perform an fft using fftw3 library and write the output as a list of float on the first inlet, i want the external to perform the fft on an array of 4096 samples (zero padding if the sample in the buffer are less than 4096 or taking the first 4096 if the buffer is bigger) when receiving a bang in its left and only inlet.

i know how to perform the fft in a stand alone program, so i can write the method, but i cannot understand how to access the buffer, and also i don’t know if i have to write an msp external or just a max external (no inlet or outlets are sending/receiving signals) just bang -> inlet; outlet -> list of amplitudes.

thanks to all the community and of course to cycling74 for this software.

Attachments:
  1. Archivio.zip
#55376
Mar 7, 2011 at 2:40pm

This might help:

http://74objects.com/2009/03/22/accessing-buffers/

from what I know you don’t necessarily need to make a msp external

#199277
Mar 7, 2011 at 3:21pm

Hello stanzarossa,

max external or msp external ?

It really depends of what you try to achieve; but IHMO you need to understand well C and the max SDK if you want to do something better than native maxMSP “fft~” objects.

I postes an example in the other thread.

#199278
Mar 7, 2011 at 3:24pm

he wants non-realtime fft processing, and that is not really possible with max’ native fft objects (ok, maybe with the non-realtime driver)

what you could do though is do it in jitter, there are some examples for that on this forum

#199279
Mar 7, 2011 at 3:43pm

@Timo Rozendal : you are right ; i’m not a fft expert ;-)

@stanzarossa :
- if you have jitter have a look on [jit.fft] ?
- in the case you want to implement an external and if you don’t need DSP, write a max external ; you can access the buffer same way.

#199280
Mar 8, 2011 at 12:19am

i don’t need DSP, so i’ll try to convert the external you send me in the other thread to a max external.

my project was to write a c program, that read a wavfile, perform FFT using FFTW3 library, than output the foundamental frequenecy amplitude, and all the harmonics amplitudes, and then use additive synthesis to create a similar sound. than i decided to convert it to a max/msp external because it was too easy for a degree thesis.

it’s not useful and not needed, but good for my purpose because in italy we have a project after 3 years of university and the real final project after 5 years.
this is my 3rd-year project, and my first external.
i hope in 2013 with some more experience i’ll code something better and maybe usefull.

anyway thanks a lot for your replies, i learned more in 3 days writing on the forum and reading forum posts than 10 days reading the sdk manual: it’s the power of the community.

#199281
Mar 8, 2011 at 6:58am

Hello stanzarossa,

when i started to learn coding i did those empty externals to did all tests i want ; more easy to understand what’s happened when you have few functions than in a big messy project.

I hope when you will find the next incredible pitch tracker you will share it with the “dedicated group of users and enthusiasts from all over the world” ;-)

HTH

#199282
Mar 8, 2011 at 6:59am

oops …

#199283
Mar 8, 2011 at 7:01am

oops, zip too big …

Attachments:
  1. flipFlopFlap.zip
#199284
Mar 8, 2011 at 7:33am

i will share it for sure, i have been a linux user for a long time, sharing is my world :D

#199285
Jun 17, 2013 at 11:28am

@STANZAROSSA did you ever figure out how to access the buffer in none-realtime? I am in need to do the same thing and any pointers would be really appreciated.

I am fairly new to the SDK, I did read the blog entry Timo mentioned above but I am not sure if that’s a purely MSP implementation or if that could be used in a Max environment as well…

Thanks!!

#253013
Jun 17, 2013 at 11:06pm

Hi,

1. Accessing [buffer~] in Max-6.x SDK and in Max-5.1.7 SDK seems different. The Tim’s blog entry is a bit outdated for current release.

http://cycling74.com/forums/topic/buffer-access-with-sdk6-1-1-buffer_perform_begin-buffer_locksamples/

http://cycling74.com/search-results/?q=buffer_perform_begin

2. What’s the SDK that you use ?
3. It certainly can be possible to access the [buffer~] in that way because [peek~] do it ;-)

#253075
Jun 19, 2013 at 10:38am

Here is what Timothy Place had to say. Scroll down to the comments. There is a link to tap.buffer.norm~ code which I am trying to make work right now…

http://74objects.com/2009/03/22/accessing-buffers/

#253302
Jun 19, 2013 at 10:16pm

Hi,

Thanks, good to know.

#253389

You must be logged in to reply to this topic.