1--- 2title: Xenharmonic Functions 3layout: ../../layouts/MainLayout.astro 4--- 5 6import { MiniRepl } from '../../docs/MiniRepl'; 7import { JsDoc } from '../../docs/JsDoc'; 8 9# Xenharmonic Functions (experimental) 10 11{/* TODO expand explanation of xenharmony */} 12 13These functions allow the use of scales other than your typical chromatic 12 based ones. 14 15### tune(scale) 16 17{/* TODO (maybe): combine jsdoc things in tune.mjs with here */} 18 19<JsDoc client:idle name="tune" h={0} /> 20 21Here's an example of how to configure a basic hexany scale: 22 23<MiniRepl client:idle tune={`i("0 1 2 3 4 5").tune("hexany15").mul("220").freq()`} /> 24 25Try other scales like `hexany1`, `iraq`, `gumbeng`, `gunkali`, or `tranh3` 26 27For a full list of available scales from tunejs, see http://abbernie.github.io/tune/scales.html 28 29You can set your root to be a particular note with `getFreq` 30 31<MiniRepl 32 client:idle 33 tune={`i("4 8 9 10 - - 5 7 9 11 - -").tune("tranh3") 34 .mul(getFreq('c3')) 35 .freq().clip(.5).room(1)`} 36/> 37 38Some tunings become more pronounced with a longer reverb decay: 39 40<MiniRepl 41 client:idle 42 tune={`i("<[5 6 8 10] - [5 7 9 12] -> -").tune("gumbeng") 43 .mul(getFreq('c3')) 44 .freq().clip(.8).room("3:10").rdim(10000).rfade(5)`} 45/> 46 47Additionally, you can combo this with `fmap` so that the base note changes: 48 49<MiniRepl 50 client:idle 51 tune={`i("9 11 12 10 - - -").tune("gunkali") 52 .mul("<c3 c3 a3 d#3>".fmap(getFreq)) 53 .freq().legato("2 .7").room("1:15").rdim(8500).rlp(14000).rfade(8)`} 54/> 55 56Combining this with various polyrhythm tricks can become very evocative: 57 58<MiniRepl 59 client:idle 60 tune={`i("<[0 3 1 -] [-1 4 2 8]> ~ ~,<-4 -5>".add(4)) 61 .tune("iraq") 62 .mul("<c3 d3 c#3>".fmap(getFreq)) 63 .freq().clip(.5).room(1).rfade(9)`} 64/> 65 66Another helpful trick when exploring new tunings is to strum them. 67Many have a much more enchanting sound that was chosen over many generations of musicians for being strummed. 68 69Take the `sanza` tuning: 70 71<MiniRepl 72 client:idle 73 tune={`i("4 5 6 7 8 9").tune("sanza") 74 .mul(getFreq('c3')) 75 .freq()`} 76/> 77 78Notes 7 and 9 will clash quite a bit if you arp them normally. Many tunings will have this sort of sound, and it can feel distracting on its own. 79See how close they are on the pitch wheel? 80 81<MiniRepl client:idle tune={`i("[7 9]!3").tune("sanza").mul(getFreq('c3')).freq()._pitchwheel()`} /> 82 83This quality is often due to how the tunings were formed with instruments that were played differently than a piano. 84As such, some tunings are much better strummed, with the subtle clash of the detuned notes actually making the sound much more magical: 85 86<MiniRepl 87 client:idle 88 tune={`i("[0 1 2 3 4 5 6]@0.3 -" 89 .add("<2 5 8 1>")) 90 .tune("sanza") 91 .mul(getFreq('c3')).freq() 92 .legato("3").room(1).rfade(5)`} 93/> 94 95Note the legato and reverb effects make sure the sound of the strumming gets to wash together. Alternating the direction of the strum can make the 96tones sound even more alive, too. 97 98The `tranh3` tuning has a similar set of notes, with two clashing. You might trying plugging that in above and see if you find a favorite strumming pattern. 99 100You can also give tune a list of frequencies to use as the scale: 101 102<MiniRepl 103 client:idle 104 tune={`i("0 1 2 3 4").tune([ 105 261.6255653006, 106 302.72962012827, 107 350.29154279212, 108 405.32593044476, 109 469.00678383895, 110 523.2511306012 111 ]).mul(220).freq();`} 112/> 113 114### xen(scaleOrRatios) 115 116{/* TODO add explanation of EDO to documentation */} 117 118<JsDoc client:idle name="Pattern.xen" h={0} />