Skip to content

Instantly share code, notes, and snippets.

@jsoffer
Created June 17, 2010 21:27
Show Gist options
  • Save jsoffer/442808 to your computer and use it in GitHub Desktop.
Save jsoffer/442808 to your computer and use it in GitHub Desktop.
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 intervalos respecto al anterior
secuencia base xs = line $ map ((flip tr) base) $ transiciones xs
-- ys es la lista de duraciones de cada nota relativas a la duración de la base
secuencia_t base xs ys = line $ zipWith changeTempo (map (1/) ys) $ map ((flip tr) base) $ transiciones xs
render tempo xs = test $ changeTempo (tempo/60)
$ xs
-- Every Heart (http://www.boajjang.com/index.php?id=21)
-- Notas destino para 2min: Fa y Si (tonalidad Fmaj)
s = secuencia
st = secuencia_t
todo = intro +:+ eh1 +:+ eh2 +:+ eh3
intro = st (f 1 en ()) [0, -1, -4, 5, -1, -4, 5, 7, 5] [1,1,1,1,1,1,4,2,4]
eh1 = tell_me +:+ how_many +:+ every +:+ e_is_not +:+ shall_i +:+
i_can +:+ every +:+ doesnt
eh2 = i_was +:+ raid_of +:+ cos_i +:+ i_left +:+
so_i +:+ raid_of +:+ raid_of +:+ stars
eh3 = eh3' +:+ eh3' where eh3' = round_and +:+ volre_round +:+ round_and +:+ love_and
tell_me = st (d 0 hn ()) [0,2,1] [1,3/4,5/4]
how_many = st (f 0 en ()) [0,0,-1,-2,-2,0,0,-2,-1] [1,1,1,1,2,1,2,3,4] +:+ hnr
every = tell_me
e_is_not = st (f 0 en ()) [0,0,-1,1,2,0,0,2,-4] [1,1,1,1,2,1,2,3,6] +:+ qnr
shall_i = every
i_can = st (f 0 en ()) [0,0,-1,-2,-2,0,7,-9,-1] [1,1,1,1,2,1,2,3,4] +:+ hnr
doesnt = st (f 0 en ()) [0,0,-1,1,2,0,2,-2,-2,2,-2] [1,1,1,1,2,1,2,1,1,1,4]
i_was = st (f 0 sn ()) [0,0,2] [1,1,2]
-- cambio de tonalidad: Fmin
-- 2min hacia La y Re
raid_of = st (af 0 en ()) [0,0,-1,-2] [2,1,2,3]
cos_i = raid_of
i_left = st (ef 0 en ()) [0,2,-2,-2,-1] [2,1,2,3,4] +:+ qnr
so_i = s (f 0 en ()) [0,2]
stars = st (g 0 wn ()) [0] [2]
-- regresa a Fmaj
round_and = st (f 0 en ()) [0,0,2,2,3,-2,-1] [2,1,2,3,3,2,3]
volre_round = st (g 0 en ()) [0,0,-2,2,2] [2,1,2,2,7] +:+ qnr
love_and = st (g 0 en ()) [0,0,2,-2,-2,2,-2] [2,1,2,1,1,1,6] +:+ qnr
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment