about: Poly-Ana
-
- KVRAF
- 8389 posts since 11 Apr, 2003 from back on the hillside again - but now with a garden!
-
- KVRAF
- 4738 posts since 20 Feb, 2004 from Gothenburg, Sweden
if you can do something else between calculating fr2 and warp that might be a good idea, so that you don't have to wait for fr2 to be calculated before calculating warp.
Stefan H Singer
https://dropshotaudio.com/
https://dropshotaudio.com/
-
- KVRAF
- 8389 posts since 11 Apr, 2003 from back on the hillside again - but now with a garden!
-
- KVRAF
- 4738 posts since 20 Feb, 2004 from Gothenburg, Sweden
- KVRAF
- 6478 posts since 16 Dec, 2002
funny the horner scheme should come up on this thread as well, because I fought with it's related optimisations recently as well. I actually stopped doing it to some extent because I wasn't seeing impact on performance.
Hence, I would presume compilers are actually fairly intelligent in this already (at least VC++ is), and they even handle the temp variable optimisations duncanparsons suggested internally.
..at least to some extent. I have limited tools to profile these things.
Hence, I would presume compilers are actually fairly intelligent in this already (at least VC++ is), and they even handle the temp variable optimisations duncanparsons suggested internally.
..at least to some extent. I have limited tools to profile these things.
-
AdmiralQuality AdmiralQuality https://www.kvraudio.com/forum/memberlist.php?mode=viewprofile&u=83902
- Banned
- Topic Starter
- 6657 posts since 10 Oct, 2005 from Toronto, Canada
It'll be faster than powf()! That's all I know.
Haven't tested this yet because I've needed a few days with my head out of the engine. But I plan to try it soon and will let you know.
Haven't tested this yet because I've needed a few days with my head out of the engine. But I plan to try it soon and will let you know.
-
AdmiralQuality AdmiralQuality https://www.kvraudio.com/forum/memberlist.php?mode=viewprofile&u=83902
- Banned
- Topic Starter
- 6657 posts since 10 Oct, 2005 from Toronto, Canada
OK, two weeks later and after adding a ton of new GUI features it's finally time to get my head back into the sound engine again.
So, sambean, I tried your algo and couldn't figure out how to get it to work. (Didn't spend much time on it yet but thought I'd just ask...)
How would I use your algo to replace powf in this line?...
fFreq = 440.f * pow( 2.0f, fNote);
So, sambean, I tried your algo and couldn't figure out how to get it to work. (Didn't spend much time on it yet but thought I'd just ask...)
How would I use your algo to replace powf in this line?...
fFreq = 440.f * pow( 2.0f, fNote);
-
VladimirDimitrievich VladimirDimitrievich https://www.kvraudio.com/forum/memberlist.php?mode=viewprofile&u=90429
- Banned
- 525 posts since 8 Dec, 2005
just looked at sambeans code, i might be wrong:AdmiralQuality wrote:OK, two weeks later and after adding a ton of new GUI features it's finally time to get my head back into the sound engine again.
So, sambean, I tried your algo and couldn't figure out how to get it to work. (Didn't spend much time on it yet but thought I'd just ask...)
How would I use your algo to replace powf in this line?...
fFreq = 440.f * pow( 2.0f, fNote);
looks like your fNote is the note offset based on 440hz, so its just
fFreq = fastishP2F(fNote) * 440.0f;
of course, inline fastishP2F for speed.
-
AdmiralQuality AdmiralQuality https://www.kvraudio.com/forum/memberlist.php?mode=viewprofile&u=83902
- Banned
- Topic Starter
- 6657 posts since 10 Oct, 2005 from Toronto, Canada
Nope, that's what I tried originally.VladimirDimitrievich wrote:just looked at sambeans code, i might be wrong:
looks like your fNote is the note offset based on 440hz, so its just
fFreq = fastishP2F(fNote) * 440.0f;
of course, inline fastishP2F for speed.
-
AdmiralQuality AdmiralQuality https://www.kvraudio.com/forum/memberlist.php?mode=viewprofile&u=83902
- Banned
- Topic Starter
- 6657 posts since 10 Oct, 2005 from Toronto, Canada
Oh wait, I got it now... needed to remove that line. Also I had made some changes that I forgot to put back.
Seems to be working!! Testing and evaluating...
Seems to be working!! Testing and evaluating...
-
- KVRAF
- 3404 posts since 15 Sep, 2002
I'm actually having this problem in my synth right now. It really, really doesn't seem to be linear. Earlier in this thread someone mentioned...
2*sin((2/rate) * frequency)
Is that the key?
On MusicDSP there's a filter with this:
f = 2.0f*(float)sin(M_PI*freq/samplerate);
2*sin((2/rate) * frequency)
Is that the key?
On MusicDSP there's a filter with this:
f = 2.0f*(float)sin(M_PI*freq/samplerate);
-
AdmiralQuality AdmiralQuality https://www.kvraudio.com/forum/memberlist.php?mode=viewprofile&u=83902
- Banned
- Topic Starter
- 6657 posts since 10 Oct, 2005 from Toronto, Canada
What kind of filter mistertoast? Poly's is an IIR. All I know for sure is it's VERY linear at the low end, but gets more and more out of tune as you raise the cutoff. Poly-Ana's internal oversampling almost completely cures this issue when running at 8X. But even at 4X the filter resonance is noticeably out of tune (unless you stick to a small range).mistertoast wrote:I'm actually having this problem in my synth right now. It really, really doesn't seem to be linear. Earlier in this thread someone mentioned...
2*sin((2/rate) * frequency)
Is that the key?
On MusicDSP there's a filter with this:
f = 2.0f*(float)sin(M_PI*freq/samplerate);
Just in case anyone is confused, we kind of have two subjects going here: 1. Scaling cutoff/resonant frequency in an IIR so it will track notes accurately. 2. Optimizing pitch to frequency conversion.
-
- KVRAF
- 3404 posts since 15 Sep, 2002
I'm also using an IIR. And I see now that several of the filters on MusicDSP have that line of code. Some approximate it, but warn of tuning error towards Nyquist. The 2*sin(M_PI*freq/sr) is the "correct" method. I just don't know why. I'll look for a derivation.
My only remaining problem is I don't happen to have the freq of my current note in Hz, but I should be able to get that going reasonably easily.
I'm going to assume this mystery is solved.
My only remaining problem is I don't happen to have the freq of my current note in Hz, but I should be able to get that going reasonably easily.
I'm going to assume this mystery is solved.
-
AdmiralQuality AdmiralQuality https://www.kvraudio.com/forum/memberlist.php?mode=viewprofile&u=83902
- Banned
- Topic Starter
- 6657 posts since 10 Oct, 2005 from Toronto, Canada
Hmmm, I'll give it a try then, but it seems like it'll be stronger than what I expect. Maybe that's just because, again, I only deal with the low end of the curve. (Obviously I'm programming from the gut here. But it got me this far!mistertoast wrote:I'm also using an IIR. And I see now that several of the filters on MusicDSP have that line of code. Some approximate it, but warn of tuning error towards Nyquist. The 2*sin(M_PI*freq/sr) is the "correct" method. I just don't know why. I'll look for a derivation.
My only remaining problem is I don't happen to have the freq of my current note in Hz, but I should be able to get that going reasonably easily.
I'm going to assume this mystery is solved.
And yes, a more optimal aproximation would be nice. Also would be nice if this could be built into the pitch to frequency calc! i.e. in a special case version just for the filter.
Curious, what form of frequency DO you have for your current note?


