DSP sampling frequency vs. real sampling frequency


    Jun 22 2010 | 2:42 pm
    Hello,
    I would like to understand something with the loading of a buffer~ object via peek~.
    Here is my patch :
    If you hit space bar and move the number box until 512 values are displayed, and then press the 'c' key you will load the buffer with this values.
    I made it via a coll object and a counter+metro because my values are coming (A1x) with a non constant sampling rate ... (around 200Hz) and I thought that I could load the buffer @200Hz after the coll object.
    This was a bad idea. I forgot that Max will load the buffer with the sampling rate in DSP status.
    So my question is : If I receive 512 values @ 200Hz from my sensor (so it is around a 2.5 sec buffer), how can I make Max load the buffer with the effective values at the effective sampling rate instead of loading it at 48000 KHz in my case ??
    I would like to get the FFT of this buffer, so I would like it to be sampled at the same frequency than my incoming values, and not the frequency of the DSP status. Am I wrong ??
    I am quite lost on this issue,
    Thanks a lot,
    Have a nice day,
    Mathieu

    • Jun 22 2010 | 2:54 pm
      You can send buffer~ an [sr 200 ] message to set its sample rate to 200Hz. I'm not totally sure if that will help with what you're asking.
    • Jun 23 2010 | 9:32 am
      Thanks it is better like that, I can get 512 values @ 200Hz in the buffer.
      Now it is really complicated to get the sonogram (spectrogram) of my buffer, I start thinking that Max is really good to get frequency content of sounds / music files but maybe I should use Matlab to get the frequency content of continuous data stream from accelerometers sensors ?
      Maybe someone have a solution to get the time-frequency content of a 512 values buffer @ 200Hz (when in DSP status I have fs=48000KHz, I/0 vector size =512 and signal vector size = 64).
      Here is my actual patch, I have to deal with frequency content after the peek~ object, playing the buffer into a FFT process :
      We can see that the buffer is well loaded, with 512 values @ 200 Hz. Could someone give me some directions at this point ? (Record a classical FFT and display it into a LCD or using sonogram to have real time frequency content, I don't know how to start and how to deal with FS, I/O and signal vector size).
      Thanks a lot,
      Have a nice day,
      Mathieu
    • Jun 23 2010 | 12:21 pm
      In spectroscope~ object reference we can read : " In left inlet: The input signal is analyzed and its spectrum is displayed ". Is there a way to know how the signal is analyzed ?
      If you try to make the following patch work, you will see that the sonogram displays something linked to the buffer content :
      But it is hard to say what is displayed and how.
      Any ideas ?
      Thanks a lot (again ^^),
      Mathieu
    • Jun 25 2010 | 12:43 am
      Forgive me if this shows a complete ignorance of what you're trying to do but could you not simply represent it as an audio rate signal interpolating between the missing samples?
      rampsmooth~ or line~ comes to mind but there are better ways surely. If its just for display I would think this would be accurate enough.