(Redirected from Audio Format)
For more information, see Audio file format on Wikipedia. A sound file format is a file format for storing audio on a computer. There are several different formats, each with its own benefits and drawbacks. The difference between formats generally has to do with storage space and sound quality. The processor of a computer typically decodes compressed sounds into a format that can be played by the computer.
Scratch 3.0 can only read MP3 and WAV sound files, and earlier versions of Scratch can only read WAV files.
Classes of Formats
This page or section is in question as to whether it is useful or not. You can discuss whether you think it should be deleted or not on its talk page. (Dec 2020) Reason: Sounds too technical |
This article or section needs additional citations for verification. Its information may not be accurate. Editors can help by adding references. (November 2020) |
There are three main types of audio formats: uncompressed, lossless compressed, and lossy.
Uncompressed audio files can be compared with BMP images. They reproduce the audio as clearly as possible, but take up a lot of space (the WAV format can take up around 10MB per minute[1]), a property that can be disruptive to the development of a Scratch project.
Lossless compressed audio files also sound perfectly, and are stored partially in 'compressed' ways, allowing them to be about half the size[citation needed] of an analogous uncompressed file. These may be useful in projects because they have smaller file sizes than uncompressed audio, with the same sound quality.
However, the most common type is a lossy audio file. These files ignore components of audio that are harder to hear, such as extremely high and low-pitched notes.
Sound files can also have different bitrates that may change the perceived sound quality, with the highest usually being 320 kb/s (kilobits per second) and the lowest usually used for music being 64 kb/s. Some formats also allow for a variable bitrate (VBR), which changes the bitrate as the music is more or less complex (with a limit). These files, in general, take up less space than those with a constant bitrate (CBR). A lossy MP3 file at 128kbit/s is about 1/11 the size of the same sound as an uncompressed audio file.[citation needed] The reason why that is important is that lossy audio file sizes are much lower compared to uncompressed or lossless audio files, so lossy audio can save a lot of space in a Scratch project.[citation needed]
List of Formats
Supported by Scratch
Below is a description of audio formats supported by Scratch:
- The most popular audio format, MP3 (also known as MPEG-3) is a lossy format playable on many devices and programs. However, due to numerous involved patents, some programs, especially open source or independently developed programs, cannot handle MP3 files as the developers do not have the resources to pay the necessary royalties.
- The default uncompressed audio format on Windows and also playable in most programs, WAV is a higher quality format than MP3, so it uses more storage.
Other
Below is a list of other common audio formats that are not supported by Scratch:
- AAC
- Apple's lossy audio format, the format of music purchased in iTunes. Has the
.m4a
file extension and is playable in iTunes, on Apple devices, and on the Nintendo DSi.
- M4A
- A lossy audio format, .m4a was intended to be the successor of .mp3. It is encoded with .acc, it is audio-only even though it wasn't originally designed to be.
- M4B
- An audio format that is very similar to .m4a but is specifically designed for audiobooks.
- OGG
- A lossy audio format developed to be an open-source alternative to MP3, often used in video games. Many wikis offer support of this audio format to be uploaded as a file.
- WMA
- Microsoft's lossy audio format, playable in Windows Media Player.
- AIFF
- The default uncompressed audio format on Mac OS X. Often has the
.aif
file extension.
- FLAC
- A popular open-source lossless audio format, playable in many open-source programs.
- ALAC
- Apple's lossless audio format, playable in iTunes. Has the extension
.m4a
like AAC files and is only distinguishable using another program.
- WMA Lossless
- Microsoft's lossless audio format, playable in Windows Media Player. Has the extension
.wma
like normal WMA files and is only distinguishable using another program.
Pulse-code Modulation
- See also: wikipedia:Pulse-code modulation
Pulse-code modulation is a method for digitally storing analog signals or sounds. It is the standard form of encoding used by computers and other electronic devices that use music. The quality of a Pulse-code modulation is determined through the sampling rate, how many times a second a sample is taken; and through the bit depth, which determines the total amount of amplitudes a value may take up.
Modulation
The encoding, or more commonly known as modulation, of a sound, is simply done through taking a series of samples from a sound and stacking them back to back. A sample is defined to be the amplitude of a sound at a given time.
Now, for example, consider the sound represented in the image.
The sound is recorded through a series of samples, running along the x-axis. Each sample is then given an amplitude, being assigned by some algorithm. Those amplitudes are represented by ticks on the y-axis.
In the same sound, the amplitudes of the samples are:
7, 9, 11, 12, 13, 14, 14, 15, 15, 15, 14, etc...
The bit depth of this sound is 4, so each amplitude can only be represented by four bits(1 hex digit) or one nibble. Once re-written to binary, the sound now becomes:
0111, 1001, 1011, 1100, 1101, 1110, 1110, 1111, 1111, 1111, 1110, etc...
Binary | 0111 | 1001 | 1011 | 1100 | 1101 | 1110 | 1110 | 1111 | 1111 | 1111 | 1110 | |
Hexadecimal | 7 | 9 | B | C | D | E | E | F | F | F | E |
Or more formally:
01111001101111001101111011101111111111111110, etc... (79BCDEEFFFE in hex)
These bits can now be further processed or compacted in accordance with sound file formats, like WAV.
Connecting Back to Scratch
There are a few lessons to be learned from Pulse-code modulation. An audio file with double the sample rate can have a double overall file size, due to the fact that there are twice the number of samples to store. This means that if space is an issue for a project, sounds with lower sample rates would be beneficial. There is a similar relationship between bit depth and file size.
Sounds are displayed in a rectangle in Scratch's sound editor using the principles of Pulse-code modulation. On the x-axis is time, while on the y-axis is sound pressure relative to atmospheric pressure, also known as amplitude. Normal atmospheric pressure corresponds to a y-position in the center between the top and bottom of the rectangle.
Why is Scratch Limited in Format Reading?
Scratch is limited to only reading .mp3 and .wav files because part of the data that makes up the Scratch program consists of the ability to read and convert to those files.[2] If Scratch were to have conversions and readings for every type of file, the data size of the Scratch program would increase, and therefore the online editor would take slightly longer to load (load time also depends on other factors). Furthermore, .mp3 files are compressed, saving space within the 10MB asset size limit in Scratch projects.
See Also
References
- ↑ wikipedia:Audio file format
- ↑ cheddargirl. (4/9/2013). "Scratch actually converts imported file types to the WAV format." post:131101