This code is really confusing, please help me out!

Hi Everyone!

I am new to Elixir. I followed ElixirSchool and Elixir course at Pragmatic Studio. I also developed some toy Phoenix application. I mean I am familiar with the syntax (except the typespecs).

Right now i’m following The little Elixir & OTP Guidebook by @bentanweihao

The following code is really confusing. The writer has tried to explain it, but I didn’t get it, even if I am familiar with the Elixir syntax.

defmodule ID3Parser do

  def parse(file_name) do
    case File.read(file_name) do

      {:ok, mp3} ->
        mp3_byte_size = byte_size(mp3) - 128
       
        # from here
        << _ :: binary-size(mp3_byte_size), id3_tag :: binary >> = mp3

        << "TAG", title   :: binary-size(30),
                  artist  :: binary-size(30),
                  album   :: binary-size(30),
                  year    :: binary-size(4),
                  _rest   :: binary >>       = id3_tag
        # up to here


        IO.puts "#{artist} - #{title} (#{album}, #{year})"

      _ ->
        IO.puts "Couldn't open #{file_name}"

    end
  end
end

I have marked the points with comment. The code which is confusing.
Would someone explain it in more detail?

Also when I ran the program on a sample mp3 file, it didn’t give me the result as

Some Artist - Some Song (Some Album, 2020) 
:ok

but as

Some Artist^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@ - Some Song^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@ (Some Album^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@, 2020) 
:ok

(The sample file I had didn’t have metadata, so I added the metadata (title, artist, album and year) through VLC).

Thank you!