fft question


    Feb 19 2008 | 5:19 am
    I think I am having some conceptual problems here. Any help would be greatly appreciated.
    I am trying to send out the centre frequencies of bins with high amplitude values, then use those for further synthesis (additive, FM or whatnot). Is this approach suitable at all?? Or do I completely misunderstand the whole real/imaginary number thing??
    Thanks a bunch.

    • Feb 19 2008 | 9:32 am
      You aren't actually sending an audio signal out, so its appropriateness
      depends on your implementation. What is your plan for the frequency
      numbers?
      On 19/02/2008, Martin Ritter wrote:
      >
      >
      > I think I am having some conceptual problems here. Any help would be
      > greatly appreciated.
      > I am trying to send out the centre frequencies of bins with high amplitude
      > values, then use those for further synthesis (additive, FM or whatnot). Is
      > this approach suitable at all?? Or do I completely misunderstand the whole
      > real/imaginary number thing??
      > Thanks a bunch.
      >
      > #P window setfont "Sans Serif" 9.;
      > #P user number~ 243 226 312 241 9 3 3 2 0. 0. 0 0. 250 0. 0 0 0 221 221
      > 221 222 222 222 0 0 0;
      > #P window linecount 1;
      > #N in 2;
      > #P newobj 366 60 25 196617 in 2;
      > #P newex 207 226 35 196617 gate~;
      > #P newex 54 139 33 196617 >~ 0.;
      > #P newex 207 295 59 196617 send~ out1;
      > #P newex 54 102 53 196617 poltocar~;
      > #P flonum 301 128 52 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
      > #P newex 232 181 27 196617 *~;
      > #P newex 249 146 46 196617 / 1024.;
      > #P newex 268 106 53 196617 fftinfo~;
      > #P newex 249 77 29 196617 t f b;
      > #P newex 235 51 54 196617 dspstate~;
      > #P newex 54 54 141 196617 fftin~ 1;
      > #P window linecount 2;
      > #P comment 263 177 100 196617 center frequency of current bin;
      > #P connect 6 0 11 1;
      > #P connect 6 0 13 0;
      > #P connect 1 0 8 0;
      > #P connect 8 0 10 0;
      > #P connect 12 0 10 1;
      > #P connect 10 0 11 0;
      > #P connect 11 0 9 0;
      > #P fasten 1 2 6 0 189 126 237 126;
      > #P connect 2 1 3 0;
      > #P connect 3 0 5 0;
      > #P connect 5 0 6 1;
      > #P connect 3 1 4 0;
      > #P fasten 4 0 5 1 273 134 290 134;
      > #P connect 4 0 7 0;
      > #P window clipboard copycount 14;
      >
      >
      >
    • Feb 19 2008 | 9:35 am
      Also, I wasn't looking at your patch properly, but you need the cartopol
      object in order to get amplitude data
      On 19/02/2008, Joe Bicker wrote:
      >
      > You aren't actually sending an audio signal out, so its appropriateness
      > depends on your implementation. What is your plan for the frequency
      > numbers?
      >
      > On 19/02/2008, Martin Ritter wrote:
      > >
      > >
      > > I think I am having some conceptual problems here. Any help would be
      > > greatly appreciated.
      > > I am trying to send out the centre frequencies of bins with high
      > > amplitude values, then use those for further synthesis (additive, FM or
      > > whatnot). Is this approach suitable at all?? Or do I completely
      > > misunderstand the whole real/imaginary number thing??
      > > Thanks a bunch.
      > >
      > > #P window setfont "Sans Serif" 9.;
      > > #P user number~ 243 226 312 241 9 3 3 2 0. 0. 0 0. 250 0. 0 0 0 221 221
      > > 221 222 222 222 0 0 0;
      > > #P window linecount 1;
      > > #N in 2;
      > > #P newobj 366 60 25 196617 in 2;
      > > #P newex 207 226 35 196617 gate~;
      > > #P newex 54 139 33 196617 >~ 0.;
      > > #P newex 207 295 59 196617 send~ out1;
      > > #P newex 54 102 53 196617 poltocar~;
      > > #P flonum 301 128 52 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
      > > #P newex 232 181 27 196617 *~;
      > > #P newex 249 146 46 196617 / 1024.;
      > > #P newex 268 106 53 196617 fftinfo~;
      > > #P newex 249 77 29 196617 t f b;
      > > #P newex 235 51 54 196617 dspstate~;
      > > #P newex 54 54 141 196617 fftin~ 1;
      > > #P window linecount 2;
      > > #P comment 263 177 100 196617 center frequency of current bin;
      > > #P connect 6 0 11 1;
      > > #P connect 6 0 13 0;
      > > #P connect 1 0 8 0;
      > > #P connect 8 0 10 0;
      > > #P connect 12 0 10 1;
      > > #P connect 10 0 11 0;
      > > #P connect 11 0 9 0;
      > > #P fasten 1 2 6 0 189 126 237 126;
      > > #P connect 2 1 3 0;
      > > #P connect 3 0 5 0;
      > > #P connect 5 0 6 1;
      > > #P connect 3 1 4 0;
      > > #P fasten 4 0 5 1 273 134 290 134;
      > > #P connect 4 0 7 0;
      > > #P window clipboard copycount 14;
      > >
      > >
      > >
      >
      >
    • Feb 19 2008 | 9:57 am
      My bad about the cartopol~ ...
      Still, when I adjust the float for the >~, numbers bigger than 0.1 rarely give me any output. I would have assumed that numbers bigger than 0.5 would have that effect.
      As for the use of the frequency data... well, nothing very concrete at this point. I was hoping to maybe use the data to do some additive synthesis (maybe also use the amplitude data in some way) to create a backdrop of sort. It's all a bit vague right now, I am pretty sure though that I need those numbers...
      Save as binsAndStuff:
      Main Patch:
    • Feb 19 2008 | 4:45 pm
    • Feb 24 2008 | 3:03 am
      Thanks for the help so far. I agree about the send~/receive~, that was just meant to be a quick and dirty way to get at the data...
      I have been playing around a bit more and was hoping to get advice once again. I am now using minmax~ to regulate what goes through the gate~. I am wondering if there is a better way, this seems odd.
      The other thing I was wondering about is the capture~ part. I am planning to replace that with a buffer and use poke~. The question is: How do I get the data inside the buffer into the Max domain?? Would that be peek~? Sorry if that is obvious, but I have never used any of those. Also, how would I index the buffer data since I would only want numbers other than 0 to be written into it?? I think the index from the fftin~ is useless for this.
      So much to learn, so little time. Thanks for indulging in my ramblings.
      Main Patch:
      save as binsAndStuff.pfft
    • Feb 24 2008 | 9:05 am
      hey - i'm doing something similar - it still has some kinks reading through the buffer index but it's getting close if you want to take a look at it. i just posted this:
      i saw your post before, when i was searching the forum posts for clues - but i didn't look at the date! : )
      cheers,
      rama
    • Feb 24 2008 | 10:15 pm
      Thanks for the patch. Now I know how to use peek~ and poke~ :)
      I am still not sure on how to write just certain bins into the buffer - let's say bin 20, 34, 66 and 125 - but at index 1,2,3,4 respectively. Any ideas would be greatly appreciated.
    • Feb 24 2008 | 11:10 pm
      there might be a way to switch it around - but i think the default is labeling the bins by the "sample" index number. you can query the index/bins recorded into the buffer by using the peek~ object to get the readings - and dump it into a coll file and re-sort. this is what i've been doing (i just put a new version of the patch i've been working on with this over on the other thread that does this: http://www.cycling74.com/forums/index.php?t=msg&th=31368&start=0&rid=2973&S=4cc0c2654b18f181cda10b947f8cc450). i'm finding some time efficiency problems with using coll to sort this data - so i'm trying to find another way to do it too.
      but if you only have a few bins you are interested in, querying just those into a coll or table would be a lot faster than going through the whole fft maybe that might be a good way to go -
      hope that helps!
      /r
    • Feb 24 2008 | 11:30 pm
      after thought:
      also if you record a buffer longer than the frame-size used in pfft (actually half the frame-size) - the index numbers continue ascending. so using this logic, i believe mulitples of: bin number * (frame-size * frame-number), will give you the corresponding buffer index numbers for the same bin in successive frames.
      /r