Created
June 18, 2010 07:05
-
-
Save jsoffer/443348 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Haskore.Basic.Duration | |
import Haskore.Interface.MIDI.Render | |
import Haskore.Melody | |
import Haskore.Basic.Interval | |
import Haskore.Music.GeneralMIDI as GM | |
import Haskore.Basic.Scale | |
import Haskore.Basic.Tempo | |
import Haskore.Basic.Pitch as BP | |
import qualified Haskore.Music as Music | |
tr = Music.transpose | |
test m = fileFromGeneralMIDIMusic "test.mid" $ GM.fromMelodyNullAttr AcousticBass m | |
-- convierte una lista de intervalos al anterior en intervalos al primero | |
transiciones = scanl1 (+) | |
-- xs es la lista de distancias respecto al anterior (en-partitura) | |
secuencia modo base xs = line $ map ((flip tr) base) $ convierte modo base $ transiciones xs | |
-- ys es la lista de duraciones de cada nota relativas a la duración de la base | |
secuencia_t modo base xs ys = line $ zipWith changeTempo (map (1/) ys) $ map ((flip tr) base) $ convierte modo base $ transiciones xs | |
render tempo xs = test $ changeTempo (tempo/60) | |
$ xs | |
offset clase = case clase of | |
C -> 0 | |
Cf -> 0 | |
Cs -> 0 | |
D -> 1 | |
Ds -> 1 | |
Df -> 1 | |
E -> 2 | |
Es -> 2 | |
Ef -> 2 | |
F -> 3 | |
Fs -> 3 | |
Ff -> 3 | |
G -> 4 | |
Gs -> 4 | |
Gf -> 4 | |
A -> 5 | |
As -> 5 | |
Af -> 5 | |
B -> 6 | |
Bs -> 6 | |
Bf -> 6 | |
rotateL n xs = (drop n xs) ++ (take n xs) | |
-- convierte lista de saltos gráficos con base en lista de intervalos con base | |
convierte mode base xs = map balance xs where | |
(_,reference) = noteToPitch base | |
center = offset reference | |
positivos = scanl (+) 0 $ concat $ repeat $ rotateL center mode | |
negativos = scanl (-) 0 $ concat $ repeat $ reverse $ rotateL center mode | |
balance x | |
| x >= 0 = positivos !! (x) | |
| otherwise = negativos !! (-x) | |
-- every heart, última parte, en Fmin (phrygian) | |
-- http://www.boajjang.com/index.php?id=21 compases 91-98 | |
s = secuencia phrygianRel | |
st = secuencia_t phrygianRel | |
todo = there_is +:+ in_my | |
there_is = st (af 0 qn ()) [0,0,0,-1,1,-1,-2,0,1,0] [1,1,1,1,1,1,1,1,1/2,9/2] +:+ hnr +:+ qnr | |
in_my = st (af 0 en ()) [0,0,0,0,0,0,-1,1,1,-4,0,1,2,-3,1] [1,1,1,1,1,1,2,2,2,2,6,3,1,1,3] +:+ qnr |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment