0
$\begingroup$

I have 2 frequencies in my application: $12000\mathrm{Hz}$, $13000\mathrm{Hz}$. I want to set a parallel Goertzel filters and every 100ms I want to take the bigger magnitude for detecting the tone received.

Is there any way to implement this? That is, how can I evaluate two functions in parallel in C#?

I work on WPF, C#

Thanks

$\endgroup$

closed as off-topic by jojek, MBaz, lennon310, Peter K. May 21 '15 at 16:44

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "General programming questions are off-topic here, but can be asked on Stack Overflow." – jojek, MBaz, lennon310, Peter K.
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    $\begingroup$ Yes, there is a way to implement this. Next question, please. $\endgroup$ – JRE May 21 '15 at 8:36
  • $\begingroup$ My question is not: "Hey, Give me a link for something that works". But: How making this filters in c# run parallel to each other? Or, in other words, how can I run 2 codes in the same time? $\endgroup$ – axcelenator May 21 '15 at 8:42
  • $\begingroup$ Is your question about concurrency in C# or a parallel filter topology? It sounds like the latter, but reads like the former. If you can be more clear (add some images, give some background that shows you've done your research), you will get better answers. $\endgroup$ – ruoho ruotsi May 21 '15 at 16:39
1
$\begingroup$

First of all, a link to an example of the Goertzel algorithm.

Second, the goertzel algorithm is so fast that you don't need to get into multithreading.

Just create a class that does the goertzel algorithm for a frequency and sampling rate that you define when you create an instance.
Make a list or array of instances of that class, then for every sample, run through that array and have it calculate the goertzel for that sample.

In your case, you just need two instances so you don't really need an array of instances. Fast and simple.
I've done this very thing with several hundred instances on a fairly old PC, and updating the GUI causes more of a load than the processing.

$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.