From 4e946435ffe9619f42e723a24562e065f793dfb8 Mon Sep 17 00:00:00 2001 From: Damien Clarke Date: Fri, 16 Jul 2021 00:44:09 +1000 Subject: [PATCH] break: shift default pitch down an octave --- packages/xenpaper-ui/src/PitchRuler.tsx | 2 +- packages/xenpaper-ui/src/Sidebars.tsx | 2 +- .../data/__tests__/process-grammar.test.ts | 132 +++++++++--------- .../xenpaper-ui/src/data/process-grammar.ts | 2 +- 4 files changed, 69 insertions(+), 69 deletions(-) diff --git a/packages/xenpaper-ui/src/PitchRuler.tsx b/packages/xenpaper-ui/src/PitchRuler.tsx index a7df257..37db905 100644 --- a/packages/xenpaper-ui/src/PitchRuler.tsx +++ b/packages/xenpaper-ui/src/PitchRuler.tsx @@ -55,7 +55,7 @@ export type InitialRulerState = { export function useRulerState({lowHz, highHz, ...rest}: InitialRulerState = {}) { return useDendriform(() => { - let viewPan = hzToPan(440 * 1.5); + let viewPan = hzToPan(220 * 1.5); let viewZoom = 1.5; if(lowHz && highHz) { diff --git a/packages/xenpaper-ui/src/Sidebars.tsx b/packages/xenpaper-ui/src/Sidebars.tsx index c9d6d62..da97f35 100644 --- a/packages/xenpaper-ui/src/Sidebars.tsx +++ b/packages/xenpaper-ui/src/Sidebars.tsx @@ -64,7 +64,7 @@ export const SidebarInfo = (props: SidebarInfoProps): React.ReactElement => {
- as divisions of an octave 11{'\\'}19,
- as divisions of an octave with a specific size (e.g. 3) 5{'\\'}13o3
- as cycles per second 432Hz - + Notes can be shifted up or down octaves. {"'"} shifts the following note up 1 octave, " shifts the following note up 2 octaves, and ` shifts the following note down an octave. diff --git a/packages/xenpaper-ui/src/data/__tests__/process-grammar.test.ts b/packages/xenpaper-ui/src/data/__tests__/process-grammar.test.ts index 9fd63a7..60d8b6a 100644 --- a/packages/xenpaper-ui/src/data/__tests__/process-grammar.test.ts +++ b/packages/xenpaper-ui/src/data/__tests__/process-grammar.test.ts @@ -73,28 +73,28 @@ describe('grammar to mosc score', () => { type: 'NOTE_TIME', time: 0, timeEnd: 0.5, - hz: 440, + hz: 220, label: '1/1 0.0c' }, { type: 'NOTE_TIME', time: 0.5, timeEnd: 1, - hz: 550, + hz: 275, label: '5/4 386.3c' }, { type: 'NOTE_TIME', time: 1, timeEnd: 1.5, - hz: 660, + hz: 330, label: '3/2 702.0c' }, { type: 'NOTE_TIME', time: 1.5, timeEnd: 2, - hz: 880, + hz: 440, label: '2/1 1200.0c' }, // pitch cents @@ -102,28 +102,28 @@ describe('grammar to mosc score', () => { type: 'NOTE_TIME', time: 2, timeEnd: 2.5, - hz: 440, + hz: 220, label: '0c' }, { type: 'NOTE_TIME', time: 2.5, timeEnd: 3, - hz: 554.3652619537442, + hz: 277.1826309768721, label: '400c' }, { type: 'NOTE_TIME', time: 3, timeEnd: 3.5, - hz: 659.2551138257398, + hz: 329.6275569128699, label: '700c' }, { type: 'NOTE_TIME', time: 3.5, timeEnd: 4, - hz: 880, + hz: 440, label: '1200c' }, // pitch hz @@ -160,7 +160,7 @@ describe('grammar to mosc score', () => { type: 'NOTE_TIME', time: 6, timeEnd: 6.5, - hz: 440, + hz: 220, label: '0\\4 0.0c' }, { @@ -168,7 +168,7 @@ describe('grammar to mosc score', () => { time: 6.5, timeEnd: 7, // @ts-ignore - hz: expect.toBeAround(523.2511306011972), + hz: expect.toBeAround(261.6255653005986), label: '1\\4 300.0c' }, { @@ -176,7 +176,7 @@ describe('grammar to mosc score', () => { time: 7, timeEnd: 7.5, // @ts-ignore - hz: expect.toBeAround(622.2539674441618), + hz: expect.toBeAround(311.1269837220809), label: '2\\4 600.0c' }, { @@ -184,7 +184,7 @@ describe('grammar to mosc score', () => { time: 7.5, timeEnd: 8, // @ts-ignore - hz: expect.toBeAround(739.9888454232688), + hz: expect.toBeAround(369.99442271163446), label: '3\\4 900.0c' }, { @@ -221,28 +221,28 @@ describe('grammar to mosc score', () => { type: 'NOTE_TIME', time: 0, timeEnd: 0.5, - hz: 440, + hz: 220, label: '0\\12 0.0c' }, { type: 'NOTE_TIME', time: 0.5, timeEnd: 1, - hz: 554.3652619537442, + hz: 277.1826309768721, label: '4\\12 400.0c' }, { type: 'NOTE_TIME', time: 1, timeEnd: 1.5, - hz: 659.2551138257398, + hz: 329.6275569128699, label: '7\\12 700.0c' }, { type: 'NOTE_TIME', time: 1.5, timeEnd: 2, - hz: 880, + hz: 440, label: '0\\12 0.0c' }, // ratios scale @@ -250,28 +250,28 @@ describe('grammar to mosc score', () => { type: 'NOTE_TIME', time: 2, timeEnd: 2.5, - hz: 440, + hz: 220, label: '1/1 0.0c' }, { type: 'NOTE_TIME', time: 2.5, timeEnd: 3, - hz: 550, + hz: 275, label: '5/4 386.3c' }, { type: 'NOTE_TIME', time: 3, timeEnd: 3.5, - hz: 660, + hz: 330, label: '3/2 702.0c' }, { type: 'NOTE_TIME', time: 3.5, timeEnd: 4, - hz: 880, + hz: 440, label: '2/1 1200.0c' }, // 19edo scale @@ -279,28 +279,28 @@ describe('grammar to mosc score', () => { type: 'NOTE_TIME', time: 4, timeEnd: 4.5, - hz: 440, + hz: 220, label: '0\\19 0.0c' }, { type: 'NOTE_TIME', time: 4.5, timeEnd: 5, - hz: 547.6647393641703, + hz: 273.83236968208513, label: '6\\19 378.9c' }, { type: 'NOTE_TIME', time: 5, timeEnd: 5.5, - hz: 657.2539431279737, + hz: 328.62697156398684, label: '11\\19 694.7c' }, { type: 'NOTE_TIME', time: 5.5, timeEnd: 6, - hz: 880, + hz: 440, label: '0\\19 0.0c' }, // multi ratio scale @@ -308,28 +308,28 @@ describe('grammar to mosc score', () => { type: 'NOTE_TIME', time: 6, timeEnd: 6.5, - hz: 440, + hz: 220, label: '4/4 0.0c' }, { type: 'NOTE_TIME', time: 6.5, timeEnd: 7, - hz: 550, + hz: 275, label: '5/4 386.3c' }, { type: 'NOTE_TIME', time: 7, timeEnd: 7.5, - hz: 660, + hz: 330, label: '6/4 702.0c' }, { type: 'NOTE_TIME', time: 7.5, timeEnd: 8, - hz: 880, + hz: 440, label: '8/4 1200.0c' }, { @@ -356,49 +356,49 @@ describe('grammar to mosc score', () => { type: 'NOTE_TIME', time: 0, timeEnd: 0.5, - hz: 440, + hz: 220, label: '0\\12 0.0c' }, { type: 'NOTE_TIME', time: 0.5, timeEnd: 1, - hz: 440, + hz: 220, label: '0\\12 0.0c' }, { type: 'NOTE_TIME', time: 1, timeEnd: 2, - hz: 440, + hz: 220, label: '0\\12 0.0c' }, { type: 'NOTE_TIME', time: 2, timeEnd: 3, - hz: 440, + hz: 220, label: '0\\12 0.0c' }, { type: 'NOTE_TIME', time: 3, timeEnd: 3.5, - hz: 440, + hz: 220, label: '0\\12 0.0c' }, { type: 'NOTE_TIME', time: 4, timeEnd: 5.5, - hz: 440, + hz: 220, label: '0\\12 0.0c' }, { type: 'NOTE_TIME', time: 6, timeEnd: 6.5, - hz: 440, + hz: 220, label: '0\\12 0.0c' }, { @@ -431,63 +431,63 @@ describe('grammar to mosc score', () => { type: 'NOTE_TIME', time: 0, timeEnd: 0.5, - hz: 440, + hz: 220, label: '0\\12 0.0c' }, { type: 'NOTE_TIME', time: 0.5, timeEnd: 1, - hz: 440, + hz: 220, label: '0\\12 0.0c' }, { type: 'NOTE_TIME', time: 1, timeEnd: 1.5, - hz: 440, + hz: 220, label: '0\\12 0.0c' }, { type: 'NOTE_TIME', time: 1.5, timeEnd: 2.5, - hz: 440, + hz: 220, label: '0\\12 0.0c' }, { type: 'NOTE_TIME', time: 2.5, timeEnd: 3.5, - hz: 440, + hz: 220, label: '0\\12 0.0c' }, { type: 'NOTE_TIME', time: 3.5, timeEnd: 4.5, - hz: 440, + hz: 220, label: '0\\12 0.0c' }, { type: 'NOTE_TIME', time: 4.5, timeEnd: 4.75, - hz: 440, + hz: 220, label: '0\\12 0.0c' }, { type: 'NOTE_TIME', time: 4.75, timeEnd: 5, - hz: 440, + hz: 220, label: '0\\12 0.0c' }, { type: 'NOTE_TIME', time: 5, timeEnd: 5.25, - hz: 440, + hz: 220, label: '0\\12 0.0c' }, { @@ -517,14 +517,14 @@ describe('grammar to mosc score', () => { type: 'NOTE_TIME', time: 0, timeEnd: 0.5, - hz: 440, + hz: 220, label: '0\\12 0.0c' }, { type: 'NOTE_TIME', time: 0.5, timeEnd: 1, - hz: 440, + hz: 220, label: '0\\12 0.0c' }, { @@ -537,14 +537,14 @@ describe('grammar to mosc score', () => { type: 'NOTE_TIME', time: 1, timeEnd: 1.5, - hz: 440, + hz: 220, label: '0\\12 0.0c' }, { type: 'NOTE_TIME', time: 1.5, timeEnd: 2, - hz: 440, + hz: 220, label: '0\\12 0.0c' }, { @@ -574,14 +574,14 @@ describe('grammar to mosc score', () => { type: 'NOTE_TIME', time: 0, timeEnd: 0.5, - hz: 440, + hz: 220, label: '0\\12 0.0c' }, { type: 'NOTE_TIME', time: 0.5, timeEnd: 1, - hz: 440, + hz: 220, label: '0\\12 0.0c' }, { @@ -594,14 +594,14 @@ describe('grammar to mosc score', () => { type: 'NOTE_TIME', time: 1, timeEnd: 1.5, - hz: 440, + hz: 220, label: '0\\12 0.0c' }, { type: 'NOTE_TIME', time: 1.5, timeEnd: 2, - hz: 440, + hz: 220, label: '0\\12 0.0c' }, { @@ -628,49 +628,49 @@ describe('grammar to mosc score', () => { type: 'NOTE_TIME', time: 0, timeEnd: 1, - hz: 440, + hz: 220, label: '0\\12 0.0c' }, { type: 'NOTE_TIME', time: 0, timeEnd: 1, - hz: 554.3652619537442, + hz: 277.1826309768721, label: '4\\12 400.0c' }, { type: 'NOTE_TIME', time: 0, timeEnd: 1, - hz: 659.2551138257398, + hz: 329.6275569128699, label: '7\\12 700.0c' }, { type: 'NOTE_TIME', time: 1, timeEnd: 2, - hz: 493.8833012561241, + hz: 246.94165062806206, label: '2\\12 200.0c' }, { type: 'NOTE_TIME', time: 1, timeEnd: 2, - hz: 698.4564628660078, + hz: 349.2282314330039, label: '8\\12 800.0c' }, { type: 'NOTE_TIME', time: 1, timeEnd: 2, - hz: 830.6093951598903, + hz: 415.3046975799451, label: '11\\12 1100.0c' }, { type: 'NOTE_TIME', time: 1, timeEnd: 2, - hz: 932.3275230361799, + hz: 466.1637615180899, label: '1\\12 100.0c' }, { @@ -697,28 +697,28 @@ describe('grammar to mosc score', () => { type: 'NOTE_TIME', time: 0, timeEnd: 1, - hz: 440, + hz: 220, label: '4/4 0.0c' }, { type: 'NOTE_TIME', time: 0, timeEnd: 1, - hz: 550, + hz: 275, label: '5/4 386.3c' }, { type: 'NOTE_TIME', time: 1, timeEnd: 2, - hz: 440, + hz: 220, label: '4/4 0.0c' }, { type: 'NOTE_TIME', time: 1, timeEnd: 2, - hz: 550, + hz: 275, label: '5/4 386.3c' }, { @@ -741,11 +741,11 @@ describe('grammar to ruler state', () => { it('should translate ruler range', () => { expect(processGrammar(RULER_RANGE_TEST).initialRulerState).toEqual({ - lowHz: 440, - highHz: 880, + lowHz: 220, + highHz: 440, octaveSize: 2, plots: [], - rootHz: 440 + rootHz: 220 }); }); }); diff --git a/packages/xenpaper-ui/src/data/process-grammar.ts b/packages/xenpaper-ui/src/data/process-grammar.ts index 6f3edad..8c24a99 100644 --- a/packages/xenpaper-ui/src/data/process-grammar.ts +++ b/packages/xenpaper-ui/src/data/process-grammar.ts @@ -538,7 +538,7 @@ export const processGrammar = (grammar: XenpaperAST): Processed => { const scale = edoToRatios(12, 2); const context: Context = { - rootHz: 440, + rootHz: 220, time: 0, subdivision: 0.5, scale,