Problem 46973. How many bytes an audio requires from RAM?
Audio files, as many other files are stored compressed in our computers: MP3, OGG, or M4A, are all different types of compressed audio files. Audio must be first decompressed to its total size before it can be played: hearing compressed audio is utterly incomprehensible to humans. Your task is to compute its full length.
We may calculate an audio size in bits with the following formula: , in which t is its duration in minutes/seconds, s is its sample rate in hertz (Hz), c is its number of channels, and δ is its bit depth, the number of bits used to store audio intensity. Usually, an audio file's duration is easily obtained from any software, but the other parameters are not always available. Sometimes the bitrate is presented instead, which is defined as and is given as kbps (kilobits per second). Bit rate is used as a measure of quality for digital streamming:
Digital Walkie-talkies have a bitrate of 16kbps.
On-line AM radio has a bitrate of 32kbps.
On-line FM radio has a bitrate of 96kbps.
CD audio has a bitrate of 1,411 kbps.
HD audio may have a bitrate up to 9,216 kbps. (over 24 bit-depth, and 44 kHz sample rate)
Compute how many bytes an image requires from RAM, given its duration (d) and bitrate (b) or sample rate (s), number of channels (c) and bit depth δ. Moreover, make the results more human-readable by showing them with units: bytes (), KB (), MB (), GB () rounded to 2 decimal places. There must be at least a non-zero integer value to display it in some units, you should always use the greatest unit possible, and data cannot be stored in less than 1 byte (8 bits).
Note-1: The range of human hearing is 20 to 20,000 Hz, and unsurprisingly, audio sampling rate is usally greater than 40,000 Hz (Nyquist rate).
Note-2: Audio files do not need to be necessarily wholly loaded into the RAM; they only require that a certain amount of bytes per second be always available in it (their bitrate). However, loading full audio files into RAM for playing is the best option to guarantee a smooth sound (without lag).
Next:
How many bytes a video requires from RAM?
Solution Stats
Problem Comments
-
1 Comment
Dyuman Joshi
on 4 Feb 2022
Witcher, GoW, Doom - You seem to be a gamer, @Rafael!
Solution Comments
Show commentsProblem Recent Solvers9
Suggested Problems
-
2271 Solvers
-
1365 Solvers
-
17102 Solvers
-
668 Solvers
-
739 Solvers
More from this Author5
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!