Zip module is result of merging Melodic and Rhyhm modules.
\begin{code}
module Music.Analysis.Abstract.Zip where
import Music.Analysis.PF ((><), p2)
import Music.Analysis.Base (Number, toRatio, toInteger)
import Music.Analysis.Abstract.Settings (Settings, union)
import Music.Analysis.Abstract.Motive
import Music.Analysis.Abstract.Melodic as Melodic
import Music.Analysis.Abstract.Rhythm as Rhythm
import Data.Function ((.), id)
import Prelude ()
\end{code}
At this stage will be join pieces, like melodic and rhythm.
\begin{code}
type VoiceZipNode = (MelodicNode, RhythmNode)
type VoiceZipAbsolute = (MelodicAbsolute, RhythmAbsolute)
type VoiceZipRelative = (MelodicRelative, RhythmRelative)
settings :: Settings
settings = Melodic.settings `union` Rhythm.settings
\end{code}
\begin{code}
transpose :: Number -> Motive VoiceZipAbsolute -> Motive VoiceZipAbsolute
transpose n =
joinMotivePair . (Melodic.transpose n >< id) . splitMotivePair
tempo :: Number -> Motive VoiceZipAbsolute -> Motive VoiceZipAbsolute
tempo n = joinMotivePair .
(id >< (Rhythm.tempo . toRatio . toInteger) n) .
splitMotivePair
duration :: Motive VoiceZipNode -> Number
duration = Rhythm.duration . p2 . splitMotivePair
reverse :: Motive VoiceZipNode -> Motive VoiceZipNode
reverse =
joinMotivePair . (Melodic.reverse >< Rhythm.reverse) . splitMotivePair
relative :: Motive VoiceZipAbsolute -> Motive VoiceZipRelative
relative =
joinMotivePair . (Melodic.relative >< Rhythm.relative) . splitMotivePair
absolute :: Motive VoiceZipRelative -> Motive VoiceZipAbsolute
absolute =
joinMotivePair . (Melodic.absolute >< Rhythm.absolute) . splitMotivePair
\end{code}