uos show spectrum / FFT

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
8 messages Options
jur
Reply | Threaded
Open this post in threaded view
|

uos show spectrum / FFT

jur
Hi,

I would like to produce a simple (real time) graph of the spectrum of a sound that i record with uos.
I am using an Raspberry 3 (Raspbian Jessie sept 2017) and a usb sound card. All examples work perfect.

I cant find a way to assess the freq data during recording.

Any help is appreciated,

regards Jur

Reply | Threaded
Open this post in threaded view
|

Re: uos show spectrum / FFT

fredvs
Administrator
This post was updated on .
Hello Jur.

For this you should use some filters.

function uos_InputAddFilter(PlayerIndex: cint32; InputIndex: cint32; LowFrequency: cint32;
  HighFrequency: cint32; Gain: cfloat; TypeFilter: cint32;
  AlsoBuf: boolean; Proc: TProc): cint32 ;
  // PlayerIndex : Index of a existing Player
  // InputIndex : InputIndex of a existing Input
  // LowFrequency : Lowest frequency of filter
  // HighFrequency : Highest frequency of filter
  // Gain : gain to apply to filter
  // TypeFilter: Type of filter : default = -1 = fBandSelect (fBandAll = 0, fBandSelect = 1, fBandReject = 2
  // fBandPass = 3, fHighPass = 4, fLowPass = 5)
  // AlsoBuf : The filter alter buffer aswell ( otherwise, only result is filled in fft.data )
  // LoopProc : External procedure to execute after DSP done
  //  result : index of DSPIn in array  -1 = error

IMHO, you may apply a filter fBandSelect for each frequency you want to mesure and see the level resulting.
And set AlsoBuf to false so the sound will not be affected but filled in fft.data ---> use the result in fft.data.

Maybe try filterplayer demos to give you some ideas.

Fre;D


 
Reply | Threaded
Open this post in threaded view
|

Re: uos show spectrum / FFT

fredvs
Administrator
This post was updated on .
In reply to this post by jur
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|

Re: uos show spectrum / FFT

fredvs
Administrator
This post was updated on .
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|

Re: uos show spectrum / FFT

fredvs
Administrator
Hello.

In last commit was added ConsoleSpectrum demo.
It shows how to do a spectrum from band-filters and how to use InputFiltersGetLevel.



Fre;D

Reply | Threaded
Open this post in threaded view
|

Re: uos show spectrum / FFT

aolopatin
In reply to this post by fredvs
Hi, Fredvs!
how do i access fft.data? fft is always nil for me.
Reply | Threaded
Open this post in threaded view
|

Re: uos show spectrum / FFT

fredvs
Administrator
Hello aolopatin.

Did you try the demo consolespectrum.pas ?
Is it working for you?
What is your OS (Linux, Windows. Mac, FreeBSD) ?

Fre;D
Reply | Threaded
Open this post in threaded view
|

Re: uos show spectrum / FFT

aolopatin
Hello, Fredvs!
OS Linux, Lazarus 2.0.2.
Yes, I tried your example, it works. But I wanted to get exactly the FFT readings in order to reflect them on the graph as a spectrogram. Your example, however, only shows the signal levels in the filters and does not have the fft.data property.
Thanks for the prompt replies.