Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ; Overtone Set Functions
- ; gets overtone keynums of keynum- hard-coded to make partials {5 7 11 13 15 21}
- function Overtone_Chord_Step_1(fundamentalKeyNum) ;DEF1 works
- with alteredNotes = {}, harmonic_List = {5 7 11 13 15 21}, Harm = 0
- loop
- for h in harmonic_List
- set Harm = last(keynum(harmonics(1, h, hertz(fundamentalKeyNum))))
- set alteredNotes &= Harm
- finally alteredNotes
- end
- end
- Overtone_Chord_Step_1(1)
- ; gets mtpcs
- function Get_microtonal_pcs_of_alt_notes(KeyNum_Of_Fundamental) ;DEF2 works now
- with re-tuned_Notes = Overtone_Chord_Step_1(KeyNum_Of_Fundamental), ;usingDEF1
- FinalChord = {}, mctpcs = {},
- c = 0, CentVals = 0
- loop for n in re-tuned_Notes
- set c = n - floor(n)
- set CentVals = c
- set mctpcs &= c + pitch-class(floor(n))
- finally mctpcs
- end
- end
- Get_microtonal_pcs_of_alt_notes(60)
- function Round_List(list_to_round) ;DEF2.5
- loop
- with roundlist = {}
- for n in list_to_round
- set roundlist &= round(n)
- finally roundlist
- end
- end
- function Overtone_Chord_step_2(noteSet, fundamentalKeynum) ;DEF3
- with comparitorSet = Get_microtonal_pcs_of_alt_notes(fundamentalKeynum), ;usingDEF(2[1])
- roundedComparitor = Round_List(comparitorSet), ;using;DEF2.5
- NoteSetPcs = pitch-class(noteSet),
- finalList = {}, newCompr = {}
- if (length(list-intersection( roundedComparitor, NoteSetPcs)) = 0)
- set finalList = noteSet
- else
- loop
- with hit = 0
- for indexCount from 0
- for n in NoteSetPcs
- set newCompr &= n
- set hit = length(list-intersection(roundedComparitor, newCompr))
- if (hit < 1)
- set finalList &= noteSet[indexCount]
- else
- loop for microtonalNote in comparitorSet
- if (round(microtonalNote) = n )
- set finalList &= microtonalNote
- set newCompr = {}
- end
- end
- end
- finally finalList
- end
- end
- end
- Overtone_Chord_step_2({60 61 62 63 64 65 66 67 68 69 70 71 72}, 60)
- function octaveMultipliers(noteSet) ;DEF4
- loop
- with octaveMulti = {}
- for n in noteSet
- set octaveMulti &= floor(n / 12.0)
- finally octaveMulti
- end
- end
- octaveMultipliers({ 60 61 62 63})
- function OvertoneChord(noteSet, fundamentalKeynum) ;DEF5
- loop
- with properRegister = {},
- improperRegister = Overtone_Chord_step_2(noteSet, fundamentalKeynum), ;usingDEF(3[2.5,2,1])
- getOctaveMultiplier = octaveMultipliers(noteSet) ;usingDEF4
- for om in getOctaveMultiplier
- for n in improperRegister
- if (n != floor(n))
- set properRegister &= n + 12 * om
- else
- set properRegister &= n
- end
- finally properRegister
- end
- end
- ;testing
- OvertoneChord({60 61 62 63 64 65 66 67 68 69 70 71 72}, 0)
- OvertoneChord({60 61 62 63 64 65 66 67 68 69 70 71 72}, 1)
- OvertoneChord({60 61 62 63 64 65 66 67 68 69 70 71 72}, 2)
- OvertoneChord({60 61 62 63 64 65 66 67 68 69 70 71 72}, 3)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement