2020-10-11 09:55:01 +00:00
|
|
|
defmodule MIDITools.Schedule do
|
|
|
|
def convert_events(events) do
|
|
|
|
events
|
|
|
|
|> Enum.flat_map(&MIDITools.Event.convert/1)
|
|
|
|
|> Enum.reduce(%{}, fn {time, midi}, acc ->
|
2020-10-11 10:34:11 +00:00
|
|
|
Map.update(acc, time, midi, &<<&1::binary, midi::binary>>)
|
2020-10-11 09:55:01 +00:00
|
|
|
end)
|
|
|
|
|> Enum.sort()
|
|
|
|
end
|
|
|
|
end
|