Support

If you have a problem or need to report a bug please email : support@dsprobotics.com

There are 3 sections to this support area:

DOWNLOADS: access to product manuals, support files and drivers

HELP & INFORMATION: tutorials and example files for learning or finding pre-made modules for your projects

USER FORUMS: meet with other users and exchange ideas, you can also get help and assistance here

NEW REGISTRATIONS - please contact us if you wish to register on the forum

frequency readout

Post any examples or modules that you want to share here

frequency readout

Postby BobF » Wed May 13, 2015 6:47 pm

Hello all,

Could some kind person show me a simple fsm frequency readout (meter) for reading oscillator and such outputs.

Thank you, BobF.....
BobF
 
Posts: 598
Joined: Mon Apr 20, 2015 9:54 pm

Re: frequency "readout"

Postby martinvicanek » Wed May 13, 2015 11:08 pm

There is no such thing as a frequency readout. You can readout sample values, but frequency is another quality. What you can do is analyze the signal and try to extract a frequency. Clearly, that will not work for polyphonic signals.

There are pitch extractors around here and in the SM forum based on different algorithms including counting zero crossings, ADSF, heterodyning and FFT. Perhaps that would be a good FS Guru blog topic. Hmmm...
User avatar
martinvicanek
 
Posts: 1318
Joined: Sat Jun 22, 2013 8:28 pm

Re: frequency readout

Postby BobF » Thu May 14, 2015 1:06 am

Thanks a lot Martin, I should have know that one. Just was not thinking clearly I guess.
Take care, BobF.....
BobF
 
Posts: 598
Joined: Mon Apr 20, 2015 9:54 pm

Re: frequency readout

Postby MyCo » Thu May 14, 2015 11:48 am

You can estimate the peak freqency quite easily... but it's not accurate, and sometime you might not even get any close to what you want.
Attachments
Peak Frequency (MyCo).fsm
(8.5 KiB) Downloaded 1124 times
User avatar
MyCo
 
Posts: 718
Joined: Tue Jul 13, 2010 12:33 pm
Location: Germany

Re: frequency readout

Postby BobF » Thu May 14, 2015 2:33 pm

Hi MyCo,

and thanks a lot. I guess for now anything is better than nothing !

Take care, BobF.....
BobF
 
Posts: 598
Joined: Mon Apr 20, 2015 9:54 pm

Re: frequency readout

Postby Spogg » Fri May 15, 2015 5:02 pm

Hi
I just made this quick and dirty one and it seems to work well, especially in the lower ranges (unlike the FFT one above which gets better at higher frequencies but very inaccurate for Bass).
When you trim mine to give middle A an output of 440 Hz then you get an accuracy of better than 0.3% across the useful audio range. There's also a Period output provided.
Free to a good home!
Cheers
Spogg
Attachments
Period and Frequency detector 1.0.fsm
Detects the frequency and period of an audio input.
(33.29 KiB) Downloaded 1148 times
User avatar
Spogg
 
Posts: 3323
Joined: Thu Nov 20, 2014 4:24 pm
Location: Birmingham, England

Re: frequency readout

Postby Perfect Human Interface » Fri May 15, 2015 5:32 pm

Hmm... I remember Martin was working on some pitch detection stuff that he wanted to use with bass ranges. It never occurred to me that certain methods work better for high freq while others work better for low...

Maybe there's a way to combine them!? :)
Perfect Human Interface
 
Posts: 643
Joined: Sun Mar 10, 2013 7:32 pm

Re: frequency readout

Postby BobF » Fri May 15, 2015 5:38 pm

Hello Spogg,

Hey, thanks a lot. With yours and MyCo's I should be set.
Again thanks and take care.
Later then, BobF.....
BobF
 
Posts: 598
Joined: Mon Apr 20, 2015 9:54 pm

Re: frequency readout

Postby MyCo » Fri May 15, 2015 7:19 pm

Perfect Human Interface wrote:It never occurred to me that certain methods work better for high freq while others work better for low...


There are many methods. They all have their pros and cons.
The FFT version above is just a good starting point. When you have an estimate, you could use eg. autocorrelation to fine trim your results. And this can be done fairly efficient. eg. when you have the FFT estimate, you position 2 autocorrelations, with a delay of sample_rate/(fft_peak_freq (+/-) offset). Then you'll find out, which of those 2 autocorrelations was better and in the next run you'll finetune the delays to sample_rate/(fft_peak_freq (+/-) last_best_offset + offset/2) ... and so on...

Never tested it though...
User avatar
MyCo
 
Posts: 718
Joined: Tue Jul 13, 2010 12:33 pm
Location: Germany

Re: frequency readout

Postby martinvicanek » Fri May 15, 2015 11:18 pm

It is not hard to extract the frequency of a static sine wave. You get a single peak in the FFT spectrum which you can take as it is, or you could get sub-bin resolution by taking the neighbor bins into account. Or simply measure the time between two successive zero crossings, use linear interpolation for subsample accuracy. The true challenge, however, is with real world signals: they are varying in pitch and have harmonics often stronger than the fundamental. Pitch or fundamental frequency estimation of such material requres more sophisticated algorithms than simple zero crossings or FFT peak location. A good pitch tracker should lock on the fundamental, should be accurate, and should adapt fast to pitch changes without producing artifacts. The task is even tougher if you want to do it in real time and with finite resources.
User avatar
martinvicanek
 
Posts: 1318
Joined: Sat Jun 22, 2013 8:28 pm

Next

Return to User Examples

Who is online

Users browsing this forum: No registered users and 26 guests

cron