Analog to digital - how is it done?

with regards to microphone voice capture

Page 1 of 1

5 Replies - 4476 Views - Last Post: 11 November 2009 - 10:39 AM

#1 BlackPhoenix   User is offline

  • D.I.C Head

Reputation: 5
  • View blog
  • Posts: 152
  • Joined: 11-July 09

Analog to digital - how is it done?

Posted 10 November 2009 - 02:10 PM

Hi everyone,

Sorry - I don't know where the General programming forum is, or I'd rather have this question posed there instead of here.

How does the conversion of analog to digital (with regards to voice) work? I know that all programs that use microphones, VoIP, music production, video chat, etc, take analog sound and turn it into a digital stream of bits, which in turn get transferred over a network or modified locally, and then get turned back into analog so we can hear it through our speakers.

How does this all work? How can we apply this knowledge and turn it into computer code, regardless of language (which is why I am uncomfortable that this topic will be seen ONLY from the C++ board).

There are plenty of programs that utilize this, so the real question is - where do they learn how?

Thanks for all the support you can give!

Thanks JackOfAllTrades!

This post has been edited by BlackPhoenix: 10 November 2009 - 02:33 PM


Is This A Good Question/Topic? 0
  • +

Replies To: Analog to digital - how is it done?

#2 JackOfAllTrades   User is offline

  • Saucy!
  • member icon

Reputation: 6260
  • View blog
  • Posts: 24,030
  • Joined: 23-August 08

Re: Analog to digital - how is it done?

Posted 10 November 2009 - 02:18 PM

Maybe the Computer Science forum would be better suited for this. Moving there.
Was This Post Helpful? 1
  • +
  • -

#3 gronk   User is offline

  • D.I.C Head

Reputation: 13
  • View blog
  • Posts: 168
  • Joined: 28-October 09

Re: Analog to digital - how is it done?

Posted 10 November 2009 - 04:30 PM

There's a good article on ADC at Wikipedia:
http://en.wikipedia....gital_converter
This is normally done in hardware, so the only code really would be to read from the ADC device when it's got a new piece of data for you. Performing ADC with C++ code running on a general purpose CPU is likely to be so slow you'd only be able to handle a few kHz at the most.
Was This Post Helpful? 0
  • +
  • -

#4 BlackPhoenix   User is offline

  • D.I.C Head

Reputation: 5
  • View blog
  • Posts: 152
  • Joined: 11-July 09

Re: Analog to digital - how is it done?

Posted 10 November 2009 - 04:53 PM

View Postgronk, on 10 Nov, 2009 - 03:30 PM, said:

There's a good article on ADC at Wikipedia:
http://en.wikipedia....gital_converter
This is normally done in hardware, so the only code really would be to read from the ADC device when it's got a new piece of data for you. Performing ADC with C++ code running on a general purpose CPU is likely to be so slow you'd only be able to handle a few kHz at the most.


I am sorry, you are absolutely right - I failed to properly state what I was trying to find out.

The actual analog to digital conversion WILL be done by the microphones we buy. How do I learn how to program software that can get and utilize this digital data? For instance, programs such as Audacity which allow you to record sound, Microsoft Sound Recorder, etc.
Was This Post Helpful? 0
  • +
  • -

#5 gronk   User is offline

  • D.I.C Head

Reputation: 13
  • View blog
  • Posts: 168
  • Joined: 28-October 09

Re: Analog to digital - how is it done?

Posted 10 November 2009 - 05:07 PM

Don't know, but the great thing about Audacity is that it's open source so you can just grab the source and see for yourself how they do it.
Was This Post Helpful? 0
  • +
  • -

#6 Aeternalis   User is offline

  • D.I.C Regular

Reputation: 28
  • View blog
  • Posts: 291
  • Joined: 13-July 09

Re: Analog to digital - how is it done?

Posted 11 November 2009 - 10:39 AM

In general you would need to take a course in data communications which covers the different methods of transmitting data. The class I took on it covered the different methods of digitization.

a microphone doesn't really turn analog data into digital. It turns sound waves into electrical signals that are usually analog signals. A sound card would then use that signal in it's hardware along with a selected codec to digitize it and make it a digital signal.

Turning analog into digital is basically the process of sampling the signal over and over and recording the data measured. The Analog waveform is "recorded" by recording the level of the waveform at the time of each sample. The quality of the recording is generally determined by the sample rate and the quantization depth.

Faster sampling rate gives you better resolution of the wave over time, while quantization can be imagined like a thermometer at each individual sample: If your thermometer has only two levels, then it can record cold and hot. for each sample you will get either a cold or hot reading. Its not going to provide a very good indication of the weather pattern. If your quantizer instead has 100 gradients, you can track the value much more accurately and get a much better re-creation of the original.

This is an oversimplification of course. There are formulas that can determine exactly what the sampling rate must be - Nyquist rate expressed in samples per second, And formulas to determine the quantization noise to minimum signal level are acceptable ..

The topic is broad and well documented in several texts if you are truly interested. Just keep in mind that it is not a simple subject to be described in a few paragraphs, and being a technical subject, the actual method depends on the technical details.


Aet
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1