Low frequency multiplier... Suggestions/info needed.


Closed Thread
Results 1 to 13 of 13

Hybrid View

  1. #1
    Join Date
    Mar 2009
    Posts
    653


    Did you find this post helpful? Yes | No

    Default Re: Low frequency multiplier... Suggestions/info needed.

    Wow Henrik...you really went the extra mile there - top man!

    Without wanting to hijack the thread, if you weren't constrained by the relatively low featured pic .....do you (or anyone else with experience) think it would be possible to detect pitch quickly - then output a multiple of it (say between 20.xxx% & 100%), so for example...

    if incoming frequency is 110Hz ('A' note)- then output 138.591 Hertz ('C#' note)

    Rather than using a LUT, I reckon I really need to multpily the incoming frequency ....becuase for sure there'll be occasions when the arriving frequencies are not quite as expected (instrument not in tune).

    Would such granularity be achievable? (eg detect the incoming frequency to XXX.yyy resolution then multiply by say 25.xxx%!)
    Last edited by HankMcSpank; - 22nd June 2011 at 00:00.

  2. #2
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,612


    Did you find this post helpful? Yes | No

    Default Re: Low frequency multiplier... Suggestions/info needed.

    Hi,
    Pitch = frequency, right? If so that is exactly what the above code is supposed to do. Though it could be tweaked to measure half a period instead of a full.

    What kind of performance to expect (and how or even IF to do to it) depends on the dynamic range you want. Is it 110-1100Hz or 11 to 11000Hz?

    Say you're running at 4Mhz, at 20Hz one half-period is 25ms or 25000 ticks - pretty good and you've got plenty of resolution as one tick equals a change in frequency of 20/25000=0.0008Hz ( I wonder if you can hear that? ).

    But go up an order of magnitude, or two, and do the math at 2kHz. Now a half cycle is 1/2000/2=250us and the resolution drops conciderably. One tick now equals a change in frequency of 2000/250=8Hz. At 10kHz all you'll get is 50ticks per half cycle and the resolution has now dropped to 1 tick per 200Hz - that kind of sucks.

    Run the PIC at 40MHz instead of 4 and get 10 times the resolution. But then the problem comes at the low end where the timer register will overflow. I guess that could be handled by counting the number of overflows though.

    So, it depends on the range you want/need and what kind of resolution and accuracy you need. 138Hz probably, 138.5 perhaps, 138.59 maby, 138.591.... you get the idea.

    There might be OTHER ways of doing it though - which I haven't thought about. But lets not mess this thread up, if you want to discuss this further may I kindly suggest we bring it to a new thread.

    /Henrik.

  3. #3
    Join Date
    Mar 2009
    Posts
    653


    Did you find this post helpful? Yes | No

    Default Re: Low frequency multiplier... Suggestions/info needed.

    Thanks Henrik... I'm not sure on the precision until I actually try the results on a guitar.... but at a guess I'd need measure the input 82Hz through 1500hz to say 0.1% accuracy .....and then multiply the output upto a top frequency 3000Hz at a similar accuracy.

    but as you rightly say, rather than muddy this one, I'll start a new thread!

  4. #4
    Join Date
    Apr 2011
    Posts
    53


    Did you find this post helpful? Yes | No

    Default Re: Low frequency multiplier... Suggestions/info needed.

    Would it be off-course to suggest you use discrete circuitry to detect the rising and falling edges of the squarewave and output a pulse at the detection of each?

  5. #5
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default Re: Low frequency multiplier... Suggestions/info needed.

    Quote Originally Posted by kellyseye View Post
    Would it be off-course to suggest you use discrete circuitry to detect the rising and falling edges of the squarewave and output a pulse at the detection of each?
    That would be like asking someone to blink a LED without using a MCU... What nerve
    Dave
    Always wear safety glasses while programming.

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts