Changes

Jump to: navigation, search

BTC640/Sound

4,892 bytes added, 20:22, 18 February 2013
Part 2
= Lecture =
Textbook chapter: 4 (though it's rather week weak on this subject).
Sound is a wave in the air. As any wave it has an amplitude and a frequency. The amplitude controls the loudness and the frequency controls the pitch.
44.1kHz was chosen for raw audio because people cannot hear better than half that frequency, thus cannot tell that the reconstructed wave is different from the original. Some claim that they can distinguish a live performance from an Audio CD playback but even such claims are rare.
 
=== WAV/AIFF ===
 
These two are basically identical formats but given that WAV has been the supported-by-default format in windows - it's much more popular.
 
Sound is stored completely uncompressed, similar to how it's stored on Audio CDs. The format is not exactly the same though so conversion is necessary to transfer files from/to audio CDs.
 
Because of their age and lack of encoding/decoding requirement they are usually default formats for audio creation and editing tools.
 
=== FLAC ===
 
Flac is a lossless compressed format. A wav file can be compressed with any generic compression tool so you can understand Flac playback as on-the-fly decompression, but it's been optimised to allow better audio compression, seeking to random places in the file, and storing audio metadata.
 
Playing a flac file is more CPU-intensive than playing a WAV file though so which format you choose is a balance between space required and decoding speed.
 
The speed of the encoder also varies. You can create better compressed Flac files by spending more time encoding them.
 
A flac file can be converted to any other lossless format such as WAV and back without any loss of audio data.
== Compressed Sound ==
There are lots of them out there, see http://en.wikipedia.org/wiki/Comparison_of_audio_codecs for a list. One other worth mentioning here is AAC - a format mostly used by Apple products. It has some benefits over MP3 but is roughly as popular as OGG (both far less used than MP3.
== Uncompressed Electronic Sound - MIDI == MIDI is actually much more than just a file format, it's an interchange format that's used in many electronic sound instruments such as synthesizers. Instead of recording real sound (and often there is no real sound to record in the first place, the music is electronically generated) the audio is stored as a set of instructions, something like sheet music. The instructions include the instrument type, length and amplitude of each note. It is up to the player to combine (like an orchestra) all those instructions into a single song. MIDI files on computers were much more popular when the internet was slow and the harddrives small because they are tiny compared even to the best compressed audio file. It was common to hear a MIDI playing when visiting an early webpage. These days support for MIDI on computers is spotty because they're not a big requirement and sound cards no longer have MIDI hardware on them like they used to. == Metadata == Most audio formats (but not WAV and AIFF) can have metadata associated with them. This usually includes the artist, album, and track name, the year, and genre. Most playback software can be used to edit the metadata. Format conversion software usually also copies the metadata into the appropriate fields. For MP3 files ID3v1 is the old way of storing metadata inside MP3 files, but it doesn't support unicode so around the world it's not very popular. For example it will not work well even for latin-based languages such as german (they have some non-english characters). ID3v2 is completely different from ID3v1 and pretty much every player these days (software or hardware) supports this. == Audio on the web ==
=== WAV/AIFF ===Unfortunately not all browsers support the same formats, so you need more than one format to have your sound work on multiple browsers.
These two are basically identical formats but given that WAV has been the supported-by-default format in windows - it's much more popular.== Everyone ==
Sound is stored completely uncompressed, similar Bring headphones to how it's stored on Audio CDs. The format is not exactly the same though so conversion is necessary to transfer files from/to audio CDsnext lab.
Because of their age and lack of encoding/decoding requirement they are usually default formats for audio creation and editing tools.= Links =
=== FLAC ===* http://en.wikipedia.org/wiki/Sound* http://en.wikipedia.org/wiki/Note* http://en.wikipedia.org/wiki/Amplitude* http://en.wikipedia.org/wiki/Sample_rate* http://en.wikipedia.org/wiki/Red_Book_%28CD_standard%29* http://en.wikipedia.org/wiki/WAV* http://en.wikipedia.org/wiki/Aiff* http://en.wikipedia.org/wiki/Mp3* http://en.wikipedia.org/wiki/Ogg* http://en.wikipedia.org/wiki/Flac* http://en.wikipedia.org/wiki/Comparison_of_audio_codecs* http://en.wikipedia.org/wiki/Midi* http://en.wikipedia.org/wiki/Advanced_Audio_Coding* http://en.wikipedia.org/wiki/Variable_bitrate* http://www.techterms.com/definition/sampling
Flac is a lossless compressed format. A wav file can be compressed with any generic compression tool so you can understand Flac playback as on-the-fly decompression, but it's been optimised to allow better audio compression, seeking to random places in the file, and storing audio metadata.= Lab =
Playing a flac file is more CPU-intensive than playing a WAV file though so which format you choose This is a balance between space required and decoding speedmarked lab. Please submit it using Moodle (Lab4).
The speed of the encoder also variesWe're going to use this song to play with, because there are no copying rules associated with it: http://www. You can create better compressed Flac files by spending more time encoding themopenbsd.org/lyrics.html#36
A flac file can be converted to any other lossless format such as WAV and back without any loss of audio data.== Audacity ==
== Electronic Sound ==On windows the version of Audacity available isn't the newest one (it's a challenge to compile) and because there is no package management a few plugins are not avaiable. But we can still do a few neat things with it in the lab. If you have your own linux box - by all means use that.
=== Part 1 ===
* Go to http://audacity.sourceforge.net/ and download and install the newest windows version.
* Download the pond-erosa puff ogg file.
* Open that file in audacity. On windows the menu option is "open", on newer versions in linux it's "import".
* Export the file as wav and as ogg.
* Try to export it as mp3. You may get an error saying that lame is not found. Go back to the audacity page and download and install lame for audacity for windows.
* Export as mp3 as well.
* Export as flac as well.
* Make a screenshot with the folder with all 4 files and audacity with the original open.
* Submit that screenshot
Note that you would normally start with an uncompressed file (wav or flac) and use that to creat the compressed files, but we don't have the uncompressed version of this file so we're just going to pretend.
== Metadata =Part 2 ===We're going to blip out some words we don't like in the song.
Most image formats * Pick a word you don't like (but not WAV for example "free") that's mentioned at least 3 times in the song and AIFF) can have metadata associated with themfind where it appears in audacity, make a note of the times in a text file. This usually includes The lyrics are on the artist, albumwebsite, should make that a little easier.* Note: you can select a region of the song and play only that.* Add a new track name, (mono should do)* Generate a tone to overlap with the playback of the words you selected earlier. Try not to overlap other parts of the song.* Zoom out so the yearwhole song is on one screen, and genremake a screenshot.* Submit your text file and the screenshot.
Most playback software can be used to edit the metadata. Format conversion software usually also copies the metadata into the appropriate fields.== Compression & browser support ==
= Lab =On linux you can compress things with tar cvzf dest.tar.gz sourcefile On windows you'll have to download and install winrar (or another app if you prefer).
audacity* Use the tool to compress every one of your files separately.* Make an html page with a table with the sizes of the originals and the compressed versions and two more columns.* In the third column use the HTML5 <audio> tag to allow the user to play that version of the audio file.gz compress wav* In the fourth column make a note of which browsers that worked in. In the lab you can test with Firefox, IE9, mprChrome, flacand Safari.* If no audio files work in IE - try to upload your HTML and audio files to matrix and view the page there.* Submit the HTML page (without the big files).

Navigation menu