I’ve noticed some files I opened in a text editor have all kinds of crazy unrenderable chars

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

    Can you comment on the specific makeup of a “rendered” audio file in plaintext, how is the computer representing every little noise bit of sound at any given point, the polyphony etc?

    What are the conventions of such representation? How can a spectrogram tell pitches are where they are, how is the computer representing that?

    Is it the same to view plaintext as analysing it with a hex-viewer?

    • Ephera@lemmy.ml
      link
      fedilink
      arrow-up
      4
      ·
      2 months ago

      There’s two things at play here.

      MP3 (or WAV, OGG, FLAC etc.) provide a way to encode polyphony and stereo and such into a sequence of bytes.

      And then separately, there’s Unicode (or ASCII) for encoding letters into bytes. These are just big tables which say e.g.:

      • 01000001 = uppercase ‘A’
      • 01000010 = uppercase ‘B’
      • 01100001 = lowercase ‘A’

      So, what your text editor does, is that it looks at the sequence of bytes that MP3 encoded and then it just looks into its table and somewhat erronously interprets it as individual letters.

    • AbouBenAdhem@lemmy.world
      link
      fedilink
      English
      arrow-up
      2
      ·
      2 months ago

      Most binary-to-text encodings don’t attempt to make the text human-readable—they’re just intended to transmit the data over a text-only medium to a recipient who will decode it back to the original binary format.

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

        I do understand I’m not able to read it myself, I’m more curious about the architecture of how that data is represented and stored and conceptually how such representation is practically organized/reified…

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

          The original binary format is split into six-bit chunks (e.g., 100101), which in decimal format correspond to the integers from 0 to 63. These are just mapped to letters in order:

          1. 000000 = A,
          2. 000001 = B,
          3. 000010 = C,
          4. 000011 = D,

          etc.—it goes through the capital letters first, then lower-case letters, then digits, then “+” and “/”. It’s so simple you could do it by hand from the above description, if you were looking at the data in binary format.