Created
August 29, 2009 08:16
-
-
Save jsoffer/177430 to your computer and use it in GitHub Desktop.
Haskore
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
-- Ejemplo de construcción de melodía (serie y paralelo) en Haskore | |
-- Suena horrible, pero hace exactamente lo que tiene que hacer. | |
-- haskore-0.1 | |
-- fileFromGeneralMIDIMusic | |
import Haskore.Interface.MIDI.Render | |
-- a..g ("la" a "sol") | |
import Haskore.Melody | |
-- AcousticGrandPiano, qn, =:=, +:+, fromMelodyNullAtr | |
import Haskore.Music.GeneralMIDI as GM | |
-- transpose, changeTempo, (? =:=, +:+ ) | |
import qualified Haskore.Music as Music | |
chords = | |
(c 0 qn () =:= e 0 qn () =:= g 0 qn ()) +:+ | |
(c 0 qn () =:= f 0 qn () =:= a 0 qn ()) +:+ | |
(d 0 qn () =:= g 0 qn () =:= b 0 qn ()) | |
--escala = iterate (\ k -> k +:+ (Music.transpose 1 k)) chords | |
escala = foldl (+:+) ac $ map (\k -> Music.transpose k ac) [3,6..30] where | |
ac = Music.transpose (-10) $ Music.changeTempo 2 chords | |
doble = foldl (+:+) ac $ map (\k -> Music.transpose k ac) (replicate 14 (0)) where | |
ac = Music.changeTempo 3 chords | |
{- | |
er = foldr (flip (+:+)) ac $ map (\k -> Music.transpose k ac) [20,15..(-20)] where | |
ac = Music.changeTempo 3 chords | |
-} | |
base1 = GM.fromMelodyNullAttr Cello escala | |
base2 = GM.fromMelodyNullAttr AcousticGrandPiano doble | |
song = | |
--(Music.transpose (3) (Music.changeTempo 3 chords)) | |
--(escala !! 10) | |
--(escala =:= er) | |
(base1 =:= base2) +:+ (GM.fromMelodyNullAttr ElectricGuitarJazz chords) | |
--er | |
export :: String -> IO () | |
export nombre = fileFromGeneralMIDIMusic nombre song |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment