mirror of
https://github.com/eliasstepanik/strudel-docker.git
synced 2026-01-23 11:38:37 +00:00
Format code
This commit is contained in:
parent
811346e83d
commit
ccf775e976
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
/*test for issue 302 support alternative solmization types */
|
/*test for issue 302 support alternative solmization types */
|
||||||
import { midi2note } from '../util.mjs';
|
import { midi2note } from '../util.mjs';
|
||||||
|
|
||||||
|
|||||||
@ -73,18 +73,53 @@ export const getFreq = (noteOrMidi) => {
|
|||||||
*/
|
*/
|
||||||
/* added code from here to solve issue 302*/
|
/* added code from here to solve issue 302*/
|
||||||
|
|
||||||
export const midi2note = (n,notation = 'letters') => {
|
export const midi2note = (n, notation = 'letters') => {
|
||||||
const solfeggio = ['Do','Reb','Re', 'Mib','Mi','Fa', 'Solb','Sol', 'Lab', 'La', 'Sib','Si']; /*solffegio notes*/
|
const solfeggio = ['Do', 'Reb', 'Re', 'Mib', 'Mi', 'Fa', 'Solb', 'Sol', 'Lab', 'La', 'Sib', 'Si']; /*solffegio notes*/
|
||||||
const indian = ['Sa', 'Re', 'Ga', 'Ma', 'Pa', 'Dha', 'Ni']; /*indian musical notes, seems like they do not use flats or sharps*/
|
const indian = [
|
||||||
const german = ['C', 'Db', 'D', 'Eb', 'E', 'F', 'Gb', 'G', 'Ab', 'A','Hb','H']; /*german & dutch musical notes*/
|
'Sa',
|
||||||
const byzantine = ['Ni', 'Pab', 'Pa', 'Voub', 'Vou', 'Ga', 'Dib', 'Di', 'Keb', 'Ke', 'Zob','Zo']; /*byzantine musical notes*/
|
'Re',
|
||||||
const japanese = [ 'I', 'Ro', 'Ha', 'Ni' , 'Ho' , 'He', 'To']; /*traditional japanese musical notes, seems like they do not use falts or sharps*/
|
'Ga',
|
||||||
const pc = notation === 'solfeggio' ? solfeggio : /*check if its is any of the following*/
|
'Ma',
|
||||||
notation === 'indian' ? indian :
|
'Pa',
|
||||||
notation === 'german' ? german :
|
'Dha',
|
||||||
notation === 'byzantine' ? byzantine :
|
'Ni',
|
||||||
notation === 'japanese' ? japanese :
|
]; /*indian musical notes, seems like they do not use flats or sharps*/
|
||||||
['C', 'Db', 'D', 'Eb', 'E', 'F', 'Gb', 'G', 'Ab', 'A', 'Bb', 'B']; /*if not use standard version*/
|
const german = ['C', 'Db', 'D', 'Eb', 'E', 'F', 'Gb', 'G', 'Ab', 'A', 'Hb', 'H']; /*german & dutch musical notes*/
|
||||||
|
const byzantine = [
|
||||||
|
'Ni',
|
||||||
|
'Pab',
|
||||||
|
'Pa',
|
||||||
|
'Voub',
|
||||||
|
'Vou',
|
||||||
|
'Ga',
|
||||||
|
'Dib',
|
||||||
|
'Di',
|
||||||
|
'Keb',
|
||||||
|
'Ke',
|
||||||
|
'Zob',
|
||||||
|
'Zo',
|
||||||
|
]; /*byzantine musical notes*/
|
||||||
|
const japanese = [
|
||||||
|
'I',
|
||||||
|
'Ro',
|
||||||
|
'Ha',
|
||||||
|
'Ni',
|
||||||
|
'Ho',
|
||||||
|
'He',
|
||||||
|
'To',
|
||||||
|
]; /*traditional japanese musical notes, seems like they do not use falts or sharps*/
|
||||||
|
const pc =
|
||||||
|
notation === 'solfeggio'
|
||||||
|
? solfeggio /*check if its is any of the following*/
|
||||||
|
: notation === 'indian'
|
||||||
|
? indian
|
||||||
|
: notation === 'german'
|
||||||
|
? german
|
||||||
|
: notation === 'byzantine'
|
||||||
|
? byzantine
|
||||||
|
: notation === 'japanese'
|
||||||
|
? japanese
|
||||||
|
: ['C', 'Db', 'D', 'Eb', 'E', 'F', 'Gb', 'G', 'Ab', 'A', 'Bb', 'B']; /*if not use standard version*/
|
||||||
const note = pc[n % 12]; /*calculating the midi value to the note*/
|
const note = pc[n % 12]; /*calculating the midi value to the note*/
|
||||||
const oct = Math.floor(n / 12) - 1;
|
const oct = Math.floor(n / 12) - 1;
|
||||||
return note + oct;
|
return note + oct;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user