• ### Fast frequency calculation for modulating a pitch

Hi there,

I'm making a synth that uses LFOs to modulate the pitch of some oscillators. I'm using this to determine the output frequency of the desired pitch bend:

[inlet~] [inlet~]
| /
| /
| [sig~ 2] /
| | /
| [pow~]
| /
[*~]
[outlet~]

The left inlet would be a frequency like 440Hz or something, and the right inlet determines the pitch bend in octaves. (A value of 1 in the right inlet will pitch the frequency in the left up and octave).

Is there a more efficient way to do this? I'm running into some cpu issues with the pow~ object (I'm running libpd on mobile) and I'm trying to figure out the fastest way to do pitch calculations. Thanks in advance.

• Posts 5 | Views 3558
• I guess the better question to ask is there is a fast way to compute 2^x. I'm doing some digging around, I'll post my results here if I find something that works before anyone else does.

• hi you could render your function to a table, then use tabread4~ to read it.

• I usually use [ftom~], add the LFO (in semitones), and then [mtof~]. It's completely straightforward this way. Or if you don't want to do it that way, I think there's no need to use [pow~] when you can scale the LFO by log(2) and use [exp~]. That should be more efficient.

• Hi, I've tried using the tabread4~ solution and the mtof~ solution, but, I still haven't seen how much CPU I can save by taking the log(2) and exp~ approach. I'll post my findings here once I get it done. Thanks!

Posts 5 | Views 3558
Internal error.

Oops! Looks like something went wrong!