Building the interface layer
Let’s define a new module, MixMusic.DSL, to define the DSL module. The first thing we need to do is convert a list of options to a Note struct. So, we will define a function to do that:
lib/mix_music/dsl.ex
defmodule MixMusic.DSL do
  @moduledoc """
  DSL to compose music in Elixir
  """
  def note_from_options(class, options) do
    params =
      options
      |> Keyword.put(:class, class)
      |> Enum.into(%{})
    struct!(MixMusic.Note, params)
  end
end
			Next, let’s start working on the interface part of this module by defining the __using__/1 macro. As part of the __using__/1 macro, we will do the following:
Import the MixMusic.DSL module because it will define macros and functions used in the DSL
Register...