Inline the interval to frequency function

This commit is contained in:
Eric Rosenbaum 2017-06-22 11:06:12 -04:00
parent 66b4ae3795
commit b7ff586ca1

View file

@ -49,16 +49,8 @@ class PitchEffect {
* @returns {number} a playback ratio
*/
getRatio (val) {
return this.intervalToFrequencyRatio(val / 10);
}
/**
* Convert a musical interval to a frequency ratio.
* With thanks to Tone.js: https://github.com/Tonejs/Tone.js
* @param {number} interval - a musical interval, in semitones
* @returns {number} a frequency ratio
*/
intervalToFrequencyRatio (interval) {
const interval = val / 10;
// Convert the musical interval in semitones to a frequency ratio
return Math.pow(2, (interval / 12));
}