Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Sound Computer Science Higher Lesson 5: Sound Learning intentions To know how a computer stores sound files To know how a computer can reduce the size of sound files Success criteria I can describe how a computer stores sound files whether they be sampled or synthesised. I can calculate the file storage requirements for a sound file given the length of time the file is, sampling frequency, number of channels and the sample depth. I can describe how audio files are compressed using perceptual noise shaping. Synthesised Sound Synthesised sound is generated by a sound card and does not support vocals. MIDI (Musical Instrument Digital Interface) files are an example of synthesised sound. MIDI is a file format and protocol for communicating between devices. MIDI is used to send digital data about music between devices, rather than the resulting analogue sound. A MIDI sound file does not store samples. Like a vector graphic, a MIDI file is a set of instructions that is used to play music. Each note has attributes (sound, length, volume, time etc) that place it into the sequence of notes in the file. MIDI files can be played back by a computer using its own digital instruments. Sampled sound Sampled sounds are stored by digitising the sound wave recorded by a microphone. The sound wave is sampled thousands of times per second and the values are recorded into a file. The quality of a sound file is determined by how many samples per second are taken, and the sampling depth of each sample (the number of bits used to represent the sample) Sounds you can hear are in analogue format, in order to record a sound to be stored on a computer a device such as a microphone must be used. This converts the audio waves (analogue signal) into electrical signals by an analogue to digital converter. Sampled sound files The size and quality of an audio file can be calculated provided you have the following information: 1. The length of time the audio file is (in seconds) 2. The sampling frequency – The number of times per second that the sound is sampled. This is measured in KHz. 31.6KHz would be converted to 31600 for the purposes of our calculations. 3. The number of channels – This depends on how many channels were used when recording the sound. One = Mono, Two = Stereo 4. The sample depth - How many bits are used to store each sample, much like the concept of bit depth in relation to a bit mapped graphic. Calculating sampled sound file sizes Audio file size = [time in seconds]*[sampling frequency]*[number of channels]*[sampling depth] Example: Calculate the file size for a 1-minute audio file with a sampling size of 43.5KHz. The audio was recorded in stereo and has a sampling rate of 8 bits. [60]*[43500]*[2]*[8] = 41760000 bits /8 = 5220000 bytes /1024 = 5097.65 kilobytes /1024 = 4.97 megabytes Calculating sampled sound file sizes Audio file size = [time in seconds]*[sampling frequency]*[number of channels]*[sampling depth] Example: Calculate the file size for a 1-minute audio file with a sampling size of 43.5KHz. The audio was recorded in stereo and has a sampling rate of 8 bits. [60]*[43500]*[2]*[8] = 41760000 bits /8 = 5220000 bytes /1024 = 5097.65 kilobytes /1024 = 4.97 megabytes Sound compression In a sound, lossy compression can be used to filter out parts of the sound that humans cannot hear. Less data is stored which results in a smaller file. Lossless sound compression compresses files by spotting patterns in the binary that represent the sound. This is unlikely to reduce the size of the file by much. Perceptual noise shaping MP3 audio files are compressed using a technique called perceptual noise shaping. For example: There are certain sounds that the human ear cannot hear. There are certain sounds that the human ear hears much better than others. If there are two sounds playing simultaneously, we hear the louder one but cannot hear the softer one. Using facts like these, certain parts of a song can be eliminated without significantly hurting the quality of the song for the listener. This is an example of lossy compression. Sound summary Synthesised sound is generated by a sound card and does not support vocals. MIDI files are an example of synthesised sound. MIDI is a file format and protocol for communicating between devices. A MIDI file is a set of instructions that is used to play music. Each note has attributes that place it into the sequence of notes in the file. Sounds recorded via a microphone are an example of sampled sound. The sound wave is sampled thousands of times per second and the values are recorded into a file. The quality of a sampled sound file is determined by how many samples per second are taken, and the sampling depth of each sample . Sound summary A microphone will have an analogue – digital converter to change the analogue signals in the air to a digital format. Audio file size can be calculated with the following formula: Audio file size = [time in seconds]*[sampling frequency]*[number of channels]*[sampling depth]