Пример #1
0
void SFZVoice::calcPitchRatio()
{
	double note = curMidiNote;
	note += region->transpose;
	note += region->tune / 100.0;

	double sampleRate = getSampleRate();
	double adjustedPitch =
		region->pitch_keycenter +
		(note - region->pitch_keycenter) * (region->pitch_keytrack / 100.0);
	if (curPitchWheel != 8192) {
		double wheel = ((2.0 * curPitchWheel / 16383.0) - 1.0);
		if (wheel > 0)
			adjustedPitch += wheel * region->bend_up / 100.0;
		else
			adjustedPitch += wheel * region->bend_down / -100.0;
		}
	double targetFreq = noteHz(adjustedPitch);
	double naturalFreq = MidiMessage::getMidiNoteInHertz(region->pitch_keycenter);
	pitchRatio =
		(targetFreq * region->sample->getSampleRate()) /
		(naturalFreq * sampleRate);
}
Пример #2
0
smp_t noteMap(int key, int octave)
{
    return noteHz(key, octave);
}