259 lines
8 KiB
JavaScript
259 lines
8 KiB
JavaScript
|
/*
|
||
|
|
||
|
MusicTheory.Synesthesia : 0.3
|
||
|
------------------------------------------------------------
|
||
|
Peacock: “Instruments to perform color-music: Two centuries of technological experimentation,” Leonardo, 21 (1988), 397-406.
|
||
|
Gerstner: Karl Gerstner, The Forms of Color 1986
|
||
|
Klein: Colour-Music: The art of light, London: Crosby Lockwood and Son, 1927.
|
||
|
Jameson: “Visual music in a visual programming language,” IEEE Symposium on Visual Languages, 1999, 111-118.
|
||
|
Helmholtz: Treatise on Physiological Optics, New York: Dover Books, 1962
|
||
|
Jones: The art of light & color, New York: Van Nostrand Reinhold, 1972
|
||
|
------------------------------------------------------------
|
||
|
Reference: http://rhythmiclight.com/archives/ideas/colorscales.html
|
||
|
|
||
|
*/
|
||
|
|
||
|
if (typeof(MusicTheory) === "undefined") var MusicTheory = {};
|
||
|
if (typeof(MusicTheory.Synesthesia) === "undefined") MusicTheory.Synesthesia = {};
|
||
|
|
||
|
(function(root) {
|
||
|
root.data = {
|
||
|
'Isaac Newton (1704)': {
|
||
|
ref: "Gerstner, p.167",
|
||
|
english: ['red',null,'orange',null,'yellow','green',null,'blue',null,'indigo',null,'violet'],
|
||
|
0: [ 0, 96, 51 ], // C
|
||
|
1: [ 0, 0, 0 ], // C#
|
||
|
2: [ 29, 94, 52 ], // D
|
||
|
3: [ 0, 0, 0 ], // D#
|
||
|
4: [ 60, 90, 60 ], // E
|
||
|
5: [ 135, 76, 32 ], // F
|
||
|
6: [ 0, 0, 0 ], // F#
|
||
|
7: [ 248, 82, 28 ], // G
|
||
|
8: [ 0, 0, 0 ], // G#
|
||
|
9: [ 302, 88, 26 ], // A
|
||
|
10: [ 0, 0, 0 ], // A#
|
||
|
11: [ 325, 84, 46 ] // B
|
||
|
},
|
||
|
'Louis Bertrand Castel (1734)': {
|
||
|
ref: 'Peacock, p.400',
|
||
|
english: ['blue','blue-green','green','olive green','yellow','yellow-orange','orange','red','crimson','violet','agate','indigo'],
|
||
|
0: [ 248, 82, 28 ],
|
||
|
1: [ 172, 68, 34 ],
|
||
|
2: [ 135, 76, 32 ],
|
||
|
3: [ 79, 59, 36 ],
|
||
|
4: [ 60, 90, 60 ],
|
||
|
5: [ 49, 90, 60 ],
|
||
|
6: [ 29, 94, 52 ],
|
||
|
7: [ 360, 96, 51 ],
|
||
|
8: [ 1, 89, 33 ],
|
||
|
9: [ 325, 84, 46 ],
|
||
|
10: [ 273, 80, 27 ],
|
||
|
11: [ 302, 88, 26 ]
|
||
|
},
|
||
|
'George Field (1816)': {
|
||
|
ref: 'Klein, p.69',
|
||
|
english: ['blue',null,'purple',null,'red','orange',null,'yellow',null,'yellow green',null,'green'],
|
||
|
0: [ 248, 82, 28 ],
|
||
|
1: [ 0, 0, 0 ],
|
||
|
2: [ 302, 88, 26 ],
|
||
|
3: [ 0, 0, 0 ],
|
||
|
4: [ 360, 96, 51 ],
|
||
|
5: [ 29, 94, 52 ],
|
||
|
6: [ 0, 0, 0 ],
|
||
|
7: [ 60, 90, 60 ],
|
||
|
8: [ 0, 0, 0 ],
|
||
|
9: [ 79, 59, 36 ],
|
||
|
10: [ 0, 0, 0 ],
|
||
|
11: [ 135, 76, 32 ]
|
||
|
},
|
||
|
'D. D. Jameson (1844)': {
|
||
|
ref: 'Jameson, p.12',
|
||
|
english: ['red','red-orange','orange','orange-yellow','yellow','green','green-blue','blue','blue-purple','purple','purple-violet','violet'],
|
||
|
0: [ 360, 96, 51 ],
|
||
|
1: [ 14, 91, 51 ],
|
||
|
2: [ 29, 94, 52 ],
|
||
|
3: [ 49, 90, 60 ],
|
||
|
4: [ 60, 90, 60 ],
|
||
|
5: [ 135, 76, 32 ],
|
||
|
6: [ 172, 68, 34 ],
|
||
|
7: [ 248, 82, 28 ],
|
||
|
8: [ 273, 80, 27 ],
|
||
|
9: [ 302, 88, 26 ],
|
||
|
10: [ 313, 78, 37 ],
|
||
|
11: [ 325, 84, 46 ]
|
||
|
},
|
||
|
'Theodor Seemann (1881)': {
|
||
|
ref: 'Klein, p.86',
|
||
|
english: ['carmine','scarlet','orange','yellow-orange','yellow','green','green blue','blue','indigo','violet','brown','black'],
|
||
|
0: [ 0, 58, 26 ],
|
||
|
1: [ 360, 96, 51 ],
|
||
|
2: [ 29, 94, 52 ],
|
||
|
3: [ 49, 90, 60 ],
|
||
|
4: [ 60, 90, 60 ],
|
||
|
5: [ 135, 76, 32 ],
|
||
|
6: [ 172, 68, 34 ],
|
||
|
7: [ 248, 82, 28 ],
|
||
|
8: [ 302, 88, 26 ],
|
||
|
9: [ 325, 84, 46 ],
|
||
|
10: [ 0, 58, 26 ],
|
||
|
11: [ 0, 0, 3 ]
|
||
|
},
|
||
|
'A. Wallace Rimington (1893)': {
|
||
|
ref: 'Peacock, p.402',
|
||
|
english: ['deep red','crimson','orange-crimson','orange','yellow','yellow-green','green','blueish green','blue-green','indigo','deep blue','violet'],
|
||
|
0: [ 360, 96, 51 ],
|
||
|
1: [ 1, 89, 33 ],
|
||
|
2: [ 14, 91, 51 ],
|
||
|
3: [ 29, 94, 52 ],
|
||
|
4: [ 60, 90, 60 ],
|
||
|
5: [ 79, 59, 36 ],
|
||
|
6: [ 135, 76, 32 ],
|
||
|
7: [ 163, 62, 40 ],
|
||
|
8: [ 172, 68, 34 ],
|
||
|
9: [ 302, 88, 26 ],
|
||
|
10: [ 248, 82, 28 ],
|
||
|
11: [ 325, 84, 46 ]
|
||
|
},
|
||
|
'Bainbridge Bishop (1893)': {
|
||
|
ref: 'Bishop, p.11',
|
||
|
english: ['red','orange-red or scarlet','orange','gold or yellow-orange','yellow or green-gold','yellow-green','green','greenish-blue or aquamarine','blue','indigo or violet-blue','violet','violet-red','red'],
|
||
|
0: [ 360, 96, 51 ],
|
||
|
1: [ 1, 89, 33 ],
|
||
|
2: [ 29, 94, 52 ],
|
||
|
3: [ 50, 93, 52 ],
|
||
|
4: [ 60, 90, 60 ],
|
||
|
5: [ 73, 73, 55 ],
|
||
|
6: [ 135, 76, 32 ],
|
||
|
7: [ 163, 62, 40 ],
|
||
|
8: [ 302, 88, 26 ],
|
||
|
9: [ 325, 84, 46 ],
|
||
|
10: [ 343, 79, 47 ],
|
||
|
11: [ 360, 96, 51 ]
|
||
|
},
|
||
|
'H. von Helmholtz (1910)': {
|
||
|
ref: 'Helmholtz, p.22',
|
||
|
english: ['yellow','green','greenish blue','cayan-blue','indigo blue','violet','end of red','red','red','red','red orange','orange'],
|
||
|
0: [ 60, 90, 60 ],
|
||
|
1: [ 135, 76, 32 ],
|
||
|
2: [ 172, 68, 34 ],
|
||
|
3: [ 211, 70, 37 ],
|
||
|
4: [ 302, 88, 26 ],
|
||
|
5: [ 325, 84, 46 ],
|
||
|
6: [ 330, 84, 34 ],
|
||
|
7: [ 360, 96, 51 ],
|
||
|
8: [ 10, 91, 43 ],
|
||
|
9: [ 10, 91, 43 ],
|
||
|
10: [ 8, 93, 51 ],
|
||
|
11: [ 28, 89, 50 ]
|
||
|
},
|
||
|
'Alexander Scriabin (1911)': {
|
||
|
ref: 'Jones, p.104',
|
||
|
english: ['red','violet','yellow','steely with the glint of metal','pearly blue the shimmer of moonshine','dark red','bright blue','rosy orange','purple','green','steely with a glint of metal','pearly blue the shimmer of moonshine'],
|
||
|
0: [ 360, 96, 51 ],
|
||
|
1: [ 325, 84, 46 ],
|
||
|
2: [ 60, 90, 60 ],
|
||
|
3: [ 245, 21, 43 ],
|
||
|
4: [ 211, 70, 37 ],
|
||
|
5: [ 1, 89, 33 ],
|
||
|
6: [ 248, 82, 28 ],
|
||
|
7: [ 29, 94, 52 ],
|
||
|
8: [ 302, 88, 26 ],
|
||
|
9: [ 135, 76, 32 ],
|
||
|
10: [ 245, 21, 43 ],
|
||
|
11: [ 211, 70, 37 ]
|
||
|
},
|
||
|
'Adrian Bernard Klein (1930)': {
|
||
|
ref: 'Klein, p.209',
|
||
|
english: ['dark red','red','red orange','orange','yellow','yellow green','green','blue-green','blue','blue violet','violet','dark violet'],
|
||
|
0: [ 0, 91, 40 ],
|
||
|
1: [ 360, 96, 51 ],
|
||
|
2: [ 14, 91, 51 ],
|
||
|
3: [ 29, 94, 52 ],
|
||
|
4: [ 60, 90, 60 ],
|
||
|
5: [ 73, 73, 55 ],
|
||
|
6: [ 135, 76, 32 ],
|
||
|
7: [ 172, 68, 34 ],
|
||
|
8: [ 248, 82, 28 ],
|
||
|
9: [ 292, 70, 31 ],
|
||
|
10: [ 325, 84, 46 ],
|
||
|
11: [ 330, 84, 34 ]
|
||
|
},
|
||
|
'August Aeppli (1940)': {
|
||
|
ref: 'Gerstner, p.169',
|
||
|
english: ['red',null,'orange',null,'yellow',null,'green','blue-green',null,'ultramarine blue','violet','purple'],
|
||
|
0: [ 0, 96, 51 ],
|
||
|
1: [ 0, 0, 0 ],
|
||
|
2: [ 29, 94, 52 ],
|
||
|
3: [ 0, 0, 0 ],
|
||
|
4: [ 60, 90, 60 ],
|
||
|
5: [ 0, 0, 0 ],
|
||
|
6: [ 135, 76, 32 ],
|
||
|
7: [ 172, 68, 34 ],
|
||
|
8: [ 0, 0, 0 ],
|
||
|
9: [ 211, 70, 37 ],
|
||
|
10: [ 273, 80, 27 ],
|
||
|
11: [ 302, 88, 26 ]
|
||
|
},
|
||
|
'I. J. Belmont (1944)': {
|
||
|
ref: 'Belmont, p.226',
|
||
|
english: ['red','red-orange','orange','yellow-orange','yellow','yellow-green','green','blue-green','blue','blue-violet','violet','red-violet'],
|
||
|
0: [ 360, 96, 51 ],
|
||
|
1: [ 14, 91, 51 ],
|
||
|
2: [ 29, 94, 52 ],
|
||
|
3: [ 50, 93, 52 ],
|
||
|
4: [ 60, 90, 60 ],
|
||
|
5: [ 73, 73, 55 ],
|
||
|
6: [ 135, 76, 32 ],
|
||
|
7: [ 172, 68, 34 ],
|
||
|
8: [ 248, 82, 28 ],
|
||
|
9: [ 313, 78, 37 ],
|
||
|
10: [ 325, 84, 46 ],
|
||
|
11: [ 338, 85, 37 ]
|
||
|
},
|
||
|
'Steve Zieverink (2004)': {
|
||
|
ref: 'Cincinnati Contemporary Art Center',
|
||
|
english: ['yellow-green','green','blue-green','blue','indigo','violet','ultra violet','infra red','red','orange','yellow-white','yellow'],
|
||
|
0: [ 73, 73, 55 ],
|
||
|
1: [ 135, 76, 32 ],
|
||
|
2: [ 172, 68, 34 ],
|
||
|
3: [ 248, 82, 28 ],
|
||
|
4: [ 302, 88, 26 ],
|
||
|
5: [ 325, 84, 46 ],
|
||
|
6: [ 326, 79, 24 ],
|
||
|
7: [ 1, 89, 33 ],
|
||
|
8: [ 360, 96, 51 ],
|
||
|
9: [ 29, 94, 52 ],
|
||
|
10: [ 62, 78, 74 ],
|
||
|
11: [ 60, 90, 60 ]
|
||
|
}
|
||
|
};
|
||
|
|
||
|
root.map = function(type) {
|
||
|
var data = {};
|
||
|
var blend = function(a, b) {
|
||
|
return [ // blend two colors and round results
|
||
|
(a[0] * 0.5 + b[0] * 0.5 + 0.5) >> 0,
|
||
|
(a[1] * 0.5 + b[1] * 0.5 + 0.5) >> 0,
|
||
|
(a[2] * 0.5 + b[2] * 0.5 + 0.5) >> 0
|
||
|
];
|
||
|
};
|
||
|
var syn = root.data;
|
||
|
var colors = syn[type] || syn["D. D. Jameson (1844)"];
|
||
|
for (var note = 0; note <= 88; note ++) { // creates mapping for 88 notes
|
||
|
var clr = colors[(note + 9) % 12];
|
||
|
if (clr[0] == clr[1] && clr[1] == clr[2]) {
|
||
|
clr = blend(parray, colors[(note + 10) % 12]);
|
||
|
}
|
||
|
var amount = clr[2] / 10;
|
||
|
var octave = note / 12 >> 0;
|
||
|
var octaveLum = clr[2] + amount * octave - 3 * amount; // map luminance to octave
|
||
|
data[note] = {
|
||
|
hsl: 'hsla(' + clr[0] + ',' + clr[1] + '%,' + octaveLum + '%, 1)',
|
||
|
hex: Color.Space({H:clr[0], S:clr[1], L:octaveLum}, "HSL>RGB>HEX>STRING")
|
||
|
};
|
||
|
var parray = clr;
|
||
|
}
|
||
|
return data;
|
||
|
};
|
||
|
|
||
|
})(MusicTheory.Synesthesia);
|