npisanti / ofxPDSP

openFrameworks addon for audio synthesis and generative music
Other
304 stars 37 forks source link

Cant set oscillator pitch correctly #74

Open steeley opened 2 years ago

steeley commented 2 years ago

using the example_basics1_patching on osx with OF 0.11.2. The pitch numbers don't appear to make any sense. Trying to set the frequency of an oscillator.

100.0f >> osc.in_pitch();

gives 2.62kHz

50.0f gives 150Hz

Clearly something very wrong here!

npisanti commented 2 years ago

in ofxPDSP anything with in_pitch() is scaled in semitones (by default using 440hz as reference, but that can be changed), and everything that uses in_freq() is scaled in hertz.

All the high level "modules" are composed by various DSP units and usually use pitch input, while the lower level blocks use freq inputs.

you can solve this either by using pitch values, by converting freq to pitch with the pdsp::f2p() function, or by making your own modules with freq inputs (that's more advanced stuff but you can start from the ones in the 'src/module` folder)

steeley commented 2 years ago

Ahh ok... sorry for the misunderstanding. Ideally it would be nice for all things that produce a waveform to have both in_pitch()and in_freq() by default. But I guess can usepdsp::f2p() to solve my immediate problem.