updates to imports

This commit is contained in:
Mikayla Dobson
2022-05-13 07:50:17 -05:00
parent 77d13ee46c
commit 3f13c3f090
7 changed files with 15 additions and 16 deletions

View File

@@ -1,7 +1,7 @@
import { soundChord } from "../app.js"; import { soundChord } from "../app.js";
import { getRandomPitches } from "./vector_logic/getRandomPitches.js"; import { getRandomPitches } from "./pitch_generation/getRandomPitches.js";
import { getProceduralPitches } from "./pitch_generation/getProceduralPitches.js";
import { extractPitchset } from "./vector_logic/extractPitchset.js"; import { extractPitchset } from "./vector_logic/extractPitchset.js";
import { getProceduralPitches } from "./vector_logic/getProceduralPitches.js";
// initial test: generate a single, random chord // initial test: generate a single, random chord
export const fullRandomChord = () => { export const fullRandomChord = () => {

View File

@@ -1,5 +1,5 @@
import { pitchsets, musicalPitches } from "../harmonyUtil.js"; import { pitchsets, musicalPitches } from "../harmonyUtil.js";
import { extractPitchName } from "./extractPitchName.js"; import { extractPitchName } from "../vector_logic/extractPitchName.js";
import { getRandomIndex } from "./getRandomPitches.js"; import { getRandomIndex } from "./getRandomPitches.js";
// an additional method based on the structure of getRandomPitches, // an additional method based on the structure of getRandomPitches,

View File

@@ -1,5 +1,5 @@
import { pitchsets } from "../harmonyUtil.js"; import { pitchsets } from "../harmonyUtil.js";
import { extractPitchName } from "./extractPitchName.js"; import { extractPitchName } from "../vector_logic/extractPitchName.js";
// helper function for assigning a random index for a given voice's pitchset // helper function for assigning a random index for a given voice's pitchset
export const getRandomIndex = (voice) => Math.floor(Math.random() * 100) % voice.length; export const getRandomIndex = (voice) => Math.floor(Math.random() * 100) % voice.length;

View File

@@ -1,4 +1,4 @@
import { getRandomPitches } from './getRandomPitches.js'; import { getRandomPitches } from '../pitch_generation/getRandomPitches.js';
import { extractPitchset } from "./extractPitchset.js"; import { extractPitchset } from "./extractPitchset.js";
import { findVector } from "./findVector.js"; import { findVector } from "./findVector.js";

View File

@@ -1,2 +1 @@
const regex = /[A-Gb#]/g; export const extractPitchName = (tonePitchName) => tonePitchName.match(/[A-Gb#]/g).join('');
export const extractPitchName = (tonePitchName) => tonePitchName.match(regex).join('');

View File

@@ -13,9 +13,13 @@ export const findVector = (pitches) => {
} }
do { do {
let thing = (sorted[j] - sorted[i]) % 6 let interval = (sorted[j] - sorted[i]);
if (!(intervalClasses.includes(thing))) { if (interval > 6) {
intervalClasses.push(thing); interval = 12 - interval;
}
if (!(intervalClasses.includes(interval))) {
intervalClasses.push(interval);
} }
j++; j++;
} while (j < sorted.length); } while (j < sorted.length);

View File

@@ -1,6 +1,7 @@
import { pitchsets, musicalPitches } from '../harmonyUtil.js'; import { pitchsets, musicalPitches } from '../harmonyUtil.js';
import { extractPitchName } from './extractPitchName.js'; import { extractPitchName } from './extractPitchName.js';
import { getRandomIndex } from './getRandomPitches.js'; import { getRandomIndex } from '../pitch_generation/getRandomPitches.js';
import { findVector } from './findVector.js';
let callCount = 0; let callCount = 0;
@@ -62,11 +63,6 @@ const iteratePitchsets = () => {
} }
} }
let final = iteratePitchsets();
console.log(final);
function twoPointIteration() { function twoPointIteration() {
let caught = false; let caught = false;
let data = [1,2,3,4,5,6]; let data = [1,2,3,4,5,6];