O'Reilly logo

Elixir Cookbook by Paulo A Pereira

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Reading and writing metadata from MP3 files

In this chapter's introduction, we mentioned the fact that in Elixir, strings are binaries. In this recipe, we will use a binary file (an MP3 file) and apply some of the operations that we previously performed on strings. We will pattern match the MP3 binary file to extract some information—ID3 v2 information—and we will replace a portion of the file—ID3 v1 information—by constructing a new string and concatenating it to the end of the binary file. In the end, we will still have a proper MP3 file that we will be able to play on our favorite music player!

Note

MP3 files have some metadata stored on them in the form of ID3 tags. The first version of the ID3 tag was stored in the last 128 bytes of the file. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required