Data Representation: Storing Sound

Data Representation: Storing Sound

Basics of Sound Representation

  • Sound is a form of energy that we perceive through our ears.
  • In computing, sound is represented digitally as binary data.
  • Sound can be stored in several formats, with the most common ones being .wav, .mp3, .ogg, etc.

Analogue and Digital Sound

  • Analogue sound is how humans hear it in nature, continuous and fluid.
  • Computers, however, represent sound by collecting many small samples and stitching them together, this is called digital sound.

Sound Sampling

  • Digital representation is done by a process known as sampling. It involves measuring the sound wave’s intensity at fixed intervals.
  • The rate at which this measurement is done is called the sampling rate.
  • Higher sampling rate results in better sound quality but also requires more space to store the data.

Storing Sound

  • Once the sound data is sampled, it is quantized and then encoded into binary to create a digital sound file.
  • In a sound file, each sampled sound is stored as a binary number representing the amplitude of the sound wave at that moment of sampling.
  • Larger binary numbers yield a better representation of the original sound, but also take up more storage space.
  • This space-saving versus quality trade-off is often managed by sound file compression.

Bit Depth

  • Bit depth is the number of bits used for each audio sample.
  • Greater bit depth allows for a wider dynamic range and better sound quality.

Sound Compression

  • To reduce the size of digital sound files, compression algorithms are used.
  • Two main types of compression are: lossy compression (e.g., .mp3) and lossless compression (e.g., .flac).
  • Lossy compression significantly reduces file sizes by permanently removing certain sound frequencies that are less important or less likely to be detected by human ears.
  • Lossless compression reduces file sizes without any loss of quality, however, it doesn’t reduce sizes as drastically as lossy compression.

Stereo and Mono Sound

  • Stereo sound uses two channels (right and left) to produce sound, giving a sense of depth and directionality. Each channel is stored and processed separately.
  • Mono sound uses only one channel, making it less spatially complex than stereo sound but also less storage-intensive.

Importance of Sound Representation Knowledge

  • Understanding the basics of how sound is represented and stored is essential for working with audio files in programming, sound design, and other applications. It’s also needed to understand and manage sound file storage and quality.