• dohpaz42@lemmy.world
      link
      fedilink
      English
      arrow-up
      7
      ·
      edit-2
      5 months ago

      This is not unique to just audio files. What you’re seeing is a readable representation of binary (or raw) data. This will happen if you open an image, zip, or other non-text files.

      Fun Fact: Microsoft Office’s .docx file is actually a zip file containing mostly plain text files in the XML format (XML is a markup language similar to HTML, and is used for describing data). You could theoretically unarchive a .docx file and modify the texts files by hand, and then rearchive the files back to .docx. Just be sure to back the file up before doing so. 😉

      Data essentially are 1’s and 0’s (zeros) that are arranged in such a way that a program can interpret the data to be used by the program.

      You’ve already seen the format that audio files get saved in. They are meant for music players, and as long as the codecs (a way to encode and decode data into a specific format for storage and playback) are supported, your music player will have no problem reading the contents of the file. Text editors will do their best to display plain text, and because text has a limited range of characters it can render, a lot of the data of raw files cannot be displayed. This is why if you opened an audio file in a text editor, and edited it, the file would be ruined. Same for images, zips, and exes.

      If you want to see your binary data as text, you should use a hex editor. A hex editor will render each bit of data in hexadecimal format (0 through 16, where 11 - 16 are shown as the letters A - F). Hex editors also then attempt to show the raw data as text too, so you get to see the data in a safe way. They also allow you to change the values of the data, but unless you know what you’re doing, you risk damaging the file and making it unreadable by its application.

    • Captain Aggravated@sh.itjust.works
      link
      fedilink
      English
      arrow-up
      2
      ·
      5 months ago

      For the second time in a few days I’m compelled to recommend a series on digital audio and CDs done by Alec on his youtube channel Technology Connections. He explains quite well how digital audio works.

    • BZ 🇨🇦@lemm.ee
      link
      fedilink
      arrow-up
      2
      ·
      5 months ago

      You’ve hit on half the magic!

      You’re talking about how the information is encoded, and the other side is how it can be decoded and turned back into analog sounds.

      There’s quite a bit at play here, but it’s pretty well documented out in the world. You might want to read about audio encoding, or codecs

      • cheese_greater@lemmy.worldOP
        link
        fedilink
        arrow-up
        3
        ·
        edit-2
        5 months ago

        Its just so incredible to me that plaintext can actually represent a real piece of sound to be rendered and that can be rendered exactly the same by any device (speaker quality/processing power aside)