system
Given the following post, respond as if you're commenting on Reddit:
human
ELI5: How is sound digitally stored?

I understand how for storing an image the shade of each pixel is assigned to a number and remembered, but I don't get how this works with sound. Is every single tone/volume/pitch assigned to a number?
gpt
You're actually pretty close to the truth for some forms of sound storage.  

Sound is recorded with a microphone, basically just creates an electrical signal that responds to different levels of air pressure.  You can record those air pressures, and you record the sound.  Analog recording, could say, connect the microphone with its electrical changes related to air pressure to a little arm that would go up and down with the air pressure, to engrave a track in wax cylinder or similar reasonably soft object.   Then to play it back, you use the little arm to regulate the electrical power sent to speaker, which moves back and forth pushing air to recreate those pressure changes.  

For a computer, you  set it up so that you can record a measurement of the pressure enough times every second, that when you recreate those pressures with a speaker it sounds like the same sound.  And storing data this way will basically give you .wav file.  Its also how the data is stored on a CD.  

However you're also right about storing sound as a collection of pitches with volume.  That's for example how an MP3 does it.   You take all that data and you do a bit of math to it called a Fourier transform.  (Interestingly this transform is also used as part of jpeg image format).    The Fourier transform isn't any type of compression in itself, its a very general piece of math used everywhere in science.  It lets you take all this data you gathered of sound pressure over time, and change the way you look at it.  Now what you have is a collection of sound frequencies and how loudly they're represented, and if you add them all up you get the original signal recreated exactly as well as you first measured it.  Now if you want to save space in making an mp3 file, you can use this new way of looking at the information you measured, and drop pieces of it.  Frequencies above and below human hearing? gone.  Anything else people can't hear the difference between? Kill it with fire.   How aggressive you are depends on the bit rate.  But it is definitely very common to store sound on a computer as collection of intensities at a series of frequencies.  

You had a pretty good guess.