View Full Version : Geeky science question


colaroid
17-12-2008, 11:36
This has vaguely been bugging me for years though I have never bothered to find out the answer. How does binary code give you orchestral music? I don't understand how on off gives you trumpets and violins etc? Just looked on the internet and cannot find the answer.

Thanks:huh:

I should have put this in the general discussion how do you move it?

L00b
17-12-2008, 11:48
It should be in 'Computer & Tech'

As to the question, you need to refine it a bit, methinks ;)

Do you mean: 'how do 0's and 1's read from some medium or other (memory, CD, DVD, etc.) become wavelengths (audio)?'

Start here (link) (http://audacity.sourceforge.net/manual-1.2/tutorial_basics_1.html), and continue here (link) (http://en.wikipedia.org/wiki/Digital_audio).

TimmyR
17-12-2008, 11:51
The horns and violins etc all produce sound which is the form of a wave. In orchestral music these waves all "add" together to form the rich sound that you hear. The wave vibrates your eardrum etc. Very simply, the wave form is sampled and the level at each sample converted into a binary number.

just_words
25-06-2009, 13:49
The analogue electrical response can be viewed like a vibrational wave. This then can be discretised by using quantisation, e.g. by drawing the analogue wave on a grid and then using it like a graph, x for time sequencing and the nearest y for the quantity of amplitude to store. Then when playing back the series of y values are used to vary the voltage for the speaker. Even though to many it may sound like a smooth analogue wave, it's actually quite jumpy (in steps).

Ghozer
25-06-2009, 13:59
binary, 1 and 0, on and off..

a string of binary, (8 bit often (10101010)) is converted to an analogue signal which (in audio terms) is one millisecond of audio, it's actually an indication of the frequencies for that milisecond (the same way that 01010 = 10 in binary) this is then stringed together (every millisecond) which forms the complete wave form (like an Oscilliscope output) which in turn is played through whatever application is capable.

I hope this makes sence, this is a VERY basic explination, and this isn't to say that an 8bit binary string is EXACTLY 1ms of audio, that was just an example.

just_words
25-06-2009, 14:11
mmm, binary only really becomes useful when in strings. With an 8 bit binary string you can represent 256 (0-255) different symbols (letters, numbers, etc). With numbers you'll usually have 32 bit or 64 bit numbers, which can obviously represent larger numbers.

To read binary you go from right to left (like a stream where first come, first served), the first element is worth 1, the second 2, the third 4, and so on they are doubled, up until say 128 as in 8 bit numbers.

128 64 32 16 8 4 2 1
-----------------------------
1 1 1 1 1 1 1 1 = 255
1 0 0 0 0 0 0 0 = 128
0 0 0 0 0 0 1 1 = 3


In the above example, wherever there's a one add the number column represents. Simplez...

Reg Reader
25-06-2009, 18:33
Look up quantization (http://en.wikipedia.org/wiki/Quantization_(sound_processing)).

Just words has it. It's basically a way of making a wave form out of binary digits (BITS). The higher the number, the higher the wave form on the Y axis of the wave form. You also need to represent time because just having the up and down information doesn't do anything, you need the X axis. The X axis is what is referred to as the sample rate, that 44 KHz you see on some media players. Your sample rate and bit level multiplied give you your bit rate, again which you see on media players, you might have seen this expressed as 128Kbps.

You need to see images really to get a good idea.

Images like this one help (http://www.webkinesia.com/games/images/quant.gif). It looks like an analogue wave but it's not. It's where the numbers meet that's important. The BITS are the height and the sample rate is the time interval.

Reg Reader
25-06-2009, 18:39
mmm, binary only really becomes useful when in strings. With an 8 bit binary string you can represent 256 (0-255) different symbols (letters, numbers, etc). With numbers you'll usually have 32 bit or 64 bit numbers, which can obviously represent larger numbers.

To read binary you go from right to left (like a stream where first come, first served), the first element is worth 1, the second 2, the third 4, and so on they are doubled, up until say 128 as in 8 bit numbers.

128 64 32 16 8 4 2 1
-----------------------------
1 1 1 1 1 1 1 1 = 255
1 0 0 0 0 0 0 0 = 128
0 0 0 0 0 0 1 1 = 3


In the above example, wherever there's a one add the number column represents. Simplez...

Again, as Just Words states, the higher the BITS the higher the number you can get in one swoop. Therefore, the higher your sine wave can be more accuretly drawn which results in a clearer sound as the wave can contain more information. 8 BITS only allow you a max number of 256 whereas CD audio which is 16 BIT allows a max number of 65 536. The amount of incrementals between your top and bottom scales is far higher and so allows for a more accurately replicated sine wave.

Reg Reader
25-06-2009, 18:42
binary, 1 and 0, on and off..

a string of binary, (8 bit often (10101010)) is converted to an analogue signal which (in audio terms) is one millisecond of audio, it's actually an indication of the frequencies for that milisecond (the same way that 01010 = 10 in binary) this is then stringed together (every millisecond) which forms the complete wave form (like an Oscilliscope output) which in turn is played through whatever application is capable.

I hope this makes sence, this is a VERY basic explination, and this isn't to say that an 8bit binary string is EXACTLY 1ms of audio, that was just an example.

This is wrong. The sample rate defines the timing not the BITS. The BITS define the possible number of incrementals in the sine wave height.

Ghozer
25-06-2009, 19:09
This is wrong. The sample rate defines the timing not the BITS. The BITS define the possible number of incrementals in the sine wave height.

I was trying to simplify it a little, not get too deep into technicalities and different wave types etc..

Richeh
29-06-2009, 12:59
...yeah. If I can confuse the issue a bit further, binary is just numbers written differently. A "musical waveform" is basically like a graph if you think of it visually. You probably remember from high school maths taking a load of numbers, and using them to draw a line on a graph. That, in essence, is how numbers are used to describe music.

VideoPro
29-06-2009, 15:49
Analog Recording

When a sound is recorded using analog technology, the sound waves are recorded as a continuous electrical signal. Typically, the vibrations in the air contact the diaphragm of a microphone, setting the diaphragm in motion. A transducer in the microphone converts the diaphragm’s motion into an electric signal. The compressed parts of the sound wave are recorded as positive electrical voltages, and the rarefied parts of the wave are recorded as negative voltages. The voltage of the recorded signal is an analog of the wave’s frequencies and their relative amplitudes at any point in time.

Analog recording technology was originally developed using mechanical means to etch the sound signal directly onto wax cylinders or lacquer disks. Its simplicity, and the rapid development of electronics during the twentieth century, led to its widespread use for recording music and for adding sound to motion pictures. However, analog audio recording is subject to several problems in achieving high- fidelity reproduction of sound. These include noise, distortion, and loss of quality each time the audio signal is copied or reproduced.

Digital Recording

When a sound is digitally recorded, the sound waves are recorded as a series of samples onto a hard disk or other digital storage medium. A sample stores the voltages corresponding to the wave’s frequencies and their relative amplitudes as a series of binary numbers, or bits. Each sample is like a snapshot of the sound at a particular instant in time.

Digital recording technology offers several advantages over analog technology for recording sound, including lower noise, wider frequency response, and less distortion (if the sound is recorded at the proper level). In addition, digital recordings can be reproduced any number of times without any loss of audio quality. These advantages, combined with the popularity of personal computers, have led to the rapid development of digital audio as a leading technology for music production.

Sample Rate and Bit Depth

The audio quality of any digital recording depends on two factors: the sample rate and the bit depth used to record the signal. The sample rate is the number of samples recorded per second. The bit depth is the number of digital bits each sample contains. Together, these two factors determine the amount of information contained in a digital audio recording. The higher the sample rate and bit depth of a recording, the more accurately the recording reproduces the original sound.

Recording music digitally requires a very high sample rate and bit depth to reproduce the nuances in the music satisfactorily. The Nyquist theorem states that sounds must be recorded at no less than double the rate of the highest frequency being sampled to accurately reproduce the original sound. Audio CDs are recorded at a sample rate of 44.1 kHz and a bit depth of 16 bits (some CDs use a higher 20- or 24-bit depth). Audio for DVDs is often recorded using a slightly higher sample rate of 48 kHz. Some high end solutions let you record and play back digital audio files at sample rates of up to 96 kHz, and at bit depths of up to 24 bits.