Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/cwilso/PitchDetect
Browse files Browse the repository at this point in the history
Conflicts:
	js/pitchdetect.js
  • Loading branch information
cwilso committed Dec 5, 2013
2 parents 9027300 + 6de4bd8 commit 631f2a8
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions js/pitchdetect.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,10 @@ function error() {

function getUserMedia(dictionary, callback) {
try {
if (!navigator.getUserMedia)
navigator.getUserMedia = navigator.webkitGetUserMedia;
navigator.getUserMedia =
navigator.getUserMedia ||
navigator.webkitGetUserMedia ||
navigator.mozGetUserMedia;
navigator.getUserMedia(dictionary, callback, error);
} catch (e) {
alert('getUserMedia threw exception :' + e);
Expand Down Expand Up @@ -303,17 +305,17 @@ function updatePitch( time ) {
} else {
pitchElem.innerText = Math.floor( pitch ) + "Hz : " + Math.floor(ac) ;
var note = noteFromPitch( pitch );
noteElem.innerText = noteStrings[note%12];
noteElem.innerHTML = noteStrings[note%12];
var detune = centsOffFromPitch( pitch, note );
if (detune == 0 ) {
detuneElem.className = "";
detuneAmount.innerText = "--";
detuneAmount.innerHTML = "--";
} else {
if (detune < 0)
detuneElem.className = "flat";
else
detuneElem.className = "sharp";
detuneAmount.innerText = Math.abs( detune );
detuneAmount.innerHTML = Math.abs( detune );
}
}

Expand Down

0 comments on commit 631f2a8

Please sign in to comment.