cleaning up some commented out code

This commit is contained in:
Mikayla Dobson
2022-05-15 12:05:04 -05:00
parent fcc579eecb
commit cc6acfcd46
5 changed files with 40 additions and 21 deletions

View File

@@ -28,10 +28,6 @@ export const getProceduralPitches = () => {
let pitchNames = pitches.map(x => extractPitchName(x)); let pitchNames = pitches.map(x => extractPitchName(x));
let pitchNums = pitchNames.map(x => musicalPitches.indexOf(x)); let pitchNums = pitchNames.map(x => musicalPitches.indexOf(x));
// console.log(pitches);
// console.log(pitchNames);
// console.log(pitchNums);
// this value is assigned true only if the loop below finds an interval value // this value is assigned true only if the loop below finds an interval value
// which corresponds to a dissonance, 1 or 6 // which corresponds to a dissonance, 1 or 6

View File

@@ -25,8 +25,5 @@ export const getRandomPitches = () => {
} }
} }
} }
console.log(formattedPitches);
console.log(pitches);
return pitches; return pitches;
} }

View File

@@ -1,3 +1,3 @@
import { melodicGeneration } from "./melodicGeneration.js"; import { melodicGeneration } from "./melodicGeneration.js";
melodicGeneration(['C3', 'G3', 'A3', 'G4']); melodicGeneration(['C3', 'G3', 'A3', 'E5']);

View File

@@ -35,37 +35,64 @@ export const melodicGeneration = (prevPitches) => {
let pitchNumOne = musicalPitches.indexOf(pitchNameOne); let pitchNumOne = musicalPitches.indexOf(pitchNameOne);
let pitchNumTwo = musicalPitches.indexOf(pitchNameTwo); let pitchNumTwo = musicalPitches.indexOf(pitchNameTwo);
let interval = pitchNumTwo - pitchNumOne; let interval = pitchNumOne - pitchNumTwo;
console.log(prevSoprano, newSoprano); console.log(prevSoprano, newSoprano);
console.log(pitchNumOne, pitchNumTwo); console.log(pitchNumOne, pitchNumTwo);
// when the octave number is the same
if (octaveOne === octaveTwo) { if (octaveOne === octaveTwo) {
console.log("OCTAVE: same"); console.log("OCTAVE: same");
if (pitchNumOne > pitchNumTwo || pitchNumTwo === 0) {
if (pitchNumOne === pitchNumTwo) {
interval = 0;
} else if (pitchNumTwo === 0) {
interval = 12 - pitchNumOne;
} else if (pitchNumOne > pitchNumTwo) {
console.log("WRAP"); console.log("WRAP");
interval += 12; interval = pitchNumTwo - pitchNumOne;
} else if (pitchNumOne < pitchNumTwo) {
interval *= -1;
} }
} }
// accounts for when the octave marker is different between pitches // when the first octave number is higher
if (octaveOne > octaveTwo) { if (octaveOne > octaveTwo) {
console.log('OCTAVE: first is higher'); console.log('OCTAVE: first is higher');
if (pitchNumOne > pitchNumTwo) { if (pitchNumOne === pitchNumTwo) {
console.log("WRAP"); interval = 0;
interval = Math.abs(interval) + 12; } else if (pitchNumTwo === 0) {
interval = pitchNumOne * -1;
} else if (pitchNumOne > pitchNumTwo) {
const wrapperCheckOne = (pitchNumOne + 9) % 12;
const wrapperCheckTwo = (pitchNumTwo + 9) % 12;
console.log("---------------");
console.log("PROBLEMS HERE");
console.log(`interval: ${interval}`);
console.log(`adjusted pitch idx of first pitch: ${wrapperCheckOne}`);
console.log(`adjusted pitch idx of second pitch: ${wrapperCheckTwo}`);
console.log("---------------");
interval = pitchNumTwo - pitchNumOne - 12;
} else if (pitchNumOne < pitchNumTwo) {
console.log("caught");
interval = (interval + 12) * -1;
} else {
console.log("NO CONDITION APPLIES");
} }
// when the second octave number is higher
} else if (octaveOne < octaveTwo) { } else if (octaveOne < octaveTwo) {
console.log('OCTAVE: second is higher'); console.log('OCTAVE: second is higher');
if (pitchNumTwo === 0) {
console.log("Edge case: pitch two = 0");
interval = Math.abs(interval - 12) + 12;
}
if (pitchNumOne > pitchNumTwo) { if (pitchNumOne > pitchNumTwo) {
console.log("WRAP"); console.log("WRAP");
interval = 12 - Math.abs(interval); interval = 12 - Math.abs(interval);
} else if (pitchNumOne < pitchNumTwo) {
interval *= -1;
} else if (pitchNumTwo === 0) {
console.log("Edge case: pitch two = 0");
interval = (12 - pitchNumOne) + 12;
} }
} }

View File

@@ -24,7 +24,6 @@ showMore.onclick = () => {
} }
startButton.onclick = async () => { startButton.onclick = async () => {
// @ts-expect-error - namespace again, failed import from Tone
await Tone.start() await Tone.start()
.then(() => { .then(() => {
appReady = true; appReady = true;