Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (defn is-note-off
- "Adds note if was turned off to accumulator"
- [acc [note command]]
- (if (= :note-off command)
- (conj acc note)
- acc))
- (defn is-note-on
- "Adds note if was turned on to accumulator"
- [acc [note command]]
- (if (= :note-on command)
- (conj acc note)
- acc))
- (defn note-offs
- "Associates a tick with notes turned off at it"
- [acc tick note-events]
- (assoc acc tick (reduce is-note-off [] note-events)))
- (defn note-ons
- "Associates a tick with notes turned on at it"
- [acc tick note-events]
- (assoc acc tick (reduce is-note-on [] note-events)))
- (defn get-notes-by-type
- "Returns a map: key is tick, value is notes that match the command arg"
- [notes-by-ticks-map command-type]
- (if (= :note-on command-type)
- (reduce-kv note-ons {} notes-by-ticks-map)
- (reduce-kv note-offs {} notes-by-ticks-map)))
Add Comment
Please, Sign In to add comment