Page 1 of 1

DSP: The two bin solution

Posted: Friday 05th July 2019 6:54pm
by Cedron
(13.1 KiB) Downloaded 55 times
This project is in support of ... of-signals

The code demonstrates how to calculate the frequency, amplitude, and phase of a pure real tone. Although is quite efficient is also somewhat fragile. Too much noise/interference can lead to errors in the calculation and a frequency that is too close to a bin will also fare poorly. There are remedies for both situations, but have not been implemented as to not obscure the workings of the math.

I will be writing a blog article as a fuller explanation. In the meanwhile, the original explanations of the derivations of the equations are available in prior articles:

The program does the following steps:

1) Generate a synthetic pure real tone signal

2) Calculates two DFT bins

3) Calculates the frequency from the two bin values

4) Calculates the amplitude and phase from the two bin values and the frequency

Don't let anybody tell you it can't be done. This code proves otherwise.


Re: DSP: The two bin solution

Posted: Saturday 06th July 2019 11:08am
by cogier
This is way over my head but I see you like a puzzle.

I spent a lot of time working on the tasks at Rosetta Code. Many of my solutions are under Examples on the Gambas Playground. I have done over a hundred of these here. There is a list here of tasks that need to be completed. I managed to get Gambas up to position 93 for the languages with the most contributions, it has slipped to 245, see here.

The site prompted me to write the 15 Puzzle game which is available here

I thought you, or anybody reading this, might like to add to the list.

Re: DSP: The two bin solution

Posted: Friday 12th July 2019 7:15pm
by Cedron
Hey Gogier,

That is a neat resource. If my to do list wasn't so long I would knock a few of those off.

Yeah, this is some esoteric math, but it is actually some core DSP stuff. It is not nearly as impenetrable as it appears at first glance, once you start to understand it. I've got the blog article which explains the code and references the source articles posted.

I'm not sure how much more useful that is to a DSP newbie, but for someone who was taught that what I did is impossible, it should be illuminating.