What form does a digital signal take after A to D conversion?

Started by Taylor, June 11, 2009, 01:27:08 AM

Previous topic - Next topic

Taylor

I don't know anything about DSP other than using graphical DSP languages on computers - Bidule, Puredata. Basically nothing about the innerworkings.

I am curious whether any fun can be had by messing with a digital signal using analog means. I'm wondering what a digital signal looks like to analog components (I'm aware that that might be like asking what an English-speaking computer thinks when it reads Рад тебя видеть).

What if I use an AD chip that outputs each bit on a separate pin, and then do some kind of analog signal processing of each bit, then put it back into a complimentary DA converter? Is each bit of digital data just an AC waveform that is always either high or low (like a pulse wave)?

Or is this like feeding a brownie recipe to my car's GPS unit and waiting for directions to Newark?

What does the raw output of an AD converter look like on a scope?

carrejans

Quote from: Taylor on June 11, 2009, 01:27:08 AM
I don't know anything about DSP other than using graphical DSP languages on computers - Bidule, Puredata. Basically nothing about the innerworkings.

I am curious whether any fun can be had by messing with a digital signal using analog means. I'm wondering what a digital signal looks like to analog components (I'm aware that that might be like asking what an English-speaking computer thinks when it reads Рад тебя видеть).

What if I use an AD chip that outputs each bit on a separate pin, and then do some kind of analog signal processing of each bit, then put it back into a complimentary DA converter? Is each bit of digital data just an AC waveform that is always either high or low (like a pulse wave)?

Or is this like feeding a brownie recipe to my car's GPS unit and waiting for directions to Newark?

What does the raw output of an AD converter look like on a scope?

An ADC converts signal waves into discrete numbers; just 1's and 0's. It depends on the ADC, in what form (binary, grey code, two-complement,...)
The conversion happens by "samling" and "quantisation".
You can find a lot of info about that on the internet.


tommy.genes

Well, A to D conversion is taking your continuously-variable analog signal and turning it into a sequence of discrete values (numbers) that can be number-crunched by a computer. Computers work with binary numbers, i.e. strings of ones and zeros. At the base band level (meaning not modulated for transmission through a channel), ones are represented by a high voltage such as 5 volts, and zeros are represented by a low voltage such as zero volts. Here is a table showing the various high/low thresholds for different types of logic devices.

Another way to look at it: if you had a digital string that was alternating 101010101, your analog waveform that represented that digital string would look exactly like a square wave. From there, you could sort of intuit what a string of 100101110110000100110 etc. might look like. If you were to analog process this square-wave-like signal, it really wouldn't have much effect until your modified signal started to go outside the high/low thresholds referenced above. Once that happened, you'd start to introduce bit errors into your digital stream. A small number of bit errors would probably go unnoticed, just enough bit errors will give you a "glitchy" sound kinda like a circuit-bending experiment, and too many bit errors will probably just kill your audio playback (after the DA conversion) all together.

So, the short(er) answer to your question: there is some fun to be had with playing with the digital stream in the analog domain, but it may not take the form you might think, and it might not yield the results you'd expect coming from an analog stompbox point of view. To get you started, I was going to direct you to the bit crusher schematic at Experimentalists Anonymous, but their site seems to be down at the moment. In essence, it was an AD converter feeding straight into a DA converter but with DIP switches on each of the data lines between the converters so you could, somewhat selectively, introduce bit errors to alter the sound.

Edit: here are some Wikipedia links if you are really interested, or if you need some sleep.

Pulse Code Modulation - is slightly older but still used. It needs multiple bits to represent each sample of the audio signal. When you hear about the 16bit/44.1kHz CD standard, this is what is being referred to. This is also what the ExpAnon circuit used IIRC.

Pulse Density Modulation - also referred to as "single bit" conversion, this method only requires one bit per sample, but must collect the samples at a much higher rate. This is what the Princeton chips (Rebote, Echo Base etc.) use, I believe.

Hope this all helps.

-- T. G. --
"A man works hard all week to keep his pants off all weekend." - Captain Eugene Harold "Armor Abs" Krabs

carrejans

Quote from: tommy.genes on June 11, 2009, 08:54:01 AM
Another way to look at it: if you had a digital string that was alternating 101010101, your analog waveform that represented that digital string would look exactly like a square wave.

Great explanation. But I don't agree on this part.

101010101 just represents one small piece of the analog wave. It is just a value; and not a square wave in the analog domain.


And also Taylor. DSP is nothing more than mathematical operations (adding, multiplying,...) on values; and storing them in registers and the opposite. (off course this is a simplified view). So it is quite different than analog processing.

tommy.genes

Quote from: carrejans on June 11, 2009, 09:49:15 AM101010101 just represents one small piece of the analog wave. It is just a value; and not a square wave in the analog domain.

I didn't mean that if you sampled an analog square wave the resulting the resulting data stream would be 1010101010. I meant that if you wrote a script to send the data stream 1010101010 out of a serial port, and you put the TX pin of that port straight into an oscilloscope, the trace would look like a square wave. You would have 5V for one clock cycle to indicate the logic "1", then 0V for one clock cycle to indicate logic "0", then 5V, then 0V etc. Taylor essentially asked what does a digital signal look like, and I used this  example to try to illustrate that.

If I understand it correctly, in Pulse Density Modulation a digital stream of 1010101010 would actually correspond to a silent passage in the original audio source material.

-- T. G. --
"A man works hard all week to keep his pants off all weekend." - Captain Eugene Harold "Armor Abs" Krabs

trendyironicname

#5
Quote from: carrejans on June 11, 2009, 09:49:15 AM
101010101 just represents one small piece of the analog wave. It is just a value; and not a square wave in the analog domain.

Depends on your resolution.....

that very well could represent a square wave. 
There are 10 types of people in the world, those who understand binary, and those who don't.

Taylor

Ah, cool, this is exactly what I was hoping for. Just to be clear, I don't expect to, say, put this digital signal into a Tube Screamer or something. And I had anticipated that only a max or min value would have any meaning (though I'm guessing that if a value of, say, 3 volts got into the D-to-C, it would count it as a 1 as long it is above 2.5v, is that right?)

I am definitely thinking of glitchy sounds here. I don't have any specific processing techniques or sounds I'm thinking of, but it seems like a potential for something really interesting and unique. Another thing I'm thinking is perhaps never converting back to digital. What if we use a guitar signal, convert it to bits, then process it and pitch it down into audio frequencies? I guess recording it and then playing it back way, way slower would be the best way to do this, but also maybe using a CMOS switch to cut out some of the pulses, or even just using a Whammy.

Some interesting experiments here.

iaresee

Quote from: Taylor on June 11, 2009, 03:40:22 PM
Ah, cool, this is exactly what I was hoping for. Just to be clear, I don't expect to, say, put this digital signal into a Tube Screamer or something. And I had anticipated that only a max or min value would have any meaning (though I'm guessing that if a value of, say, 3 volts got into the D-to-C, it would count it as a 1 as long it is above 2.5v, is that right?)
Not quite. Your A/D turns the analog signal into integers, represented in binary format. The higher the resolution on your A/D the more bits of precision it uses to represent the integer value version of the amplitude of you input signal at the point in time when it takes the sample. Lets say you've got a 24-bit sampler. If it's using 2's compliment notation it means you can represent −2^(N-1) through +2^(N-1)-1 integer values so that's -2^23 through 2^23-1 or -8388608 8388607 -- a total of 16777215 values. If the max input voltage your sampler can handle is 3V then it'll get converted into a sample with value 8388607. Get the idea? This is simplifying how things operate considerably, but it's the base for describing how sampling works. The higher the resolution of your sampler, the better your integer represents the actual value. For example: in our 24-bit system with a +/- 3V peak-to-peak range any signal in the range 2999.9989 mV - 3000 mV is actually captured as "3V" because you've got a resolution of about 0.00107 mV per sample step.

I can recommend a book here, that I ended up getting by accident no less, see: http://www.diystompboxes.com/smfforum/index.php?topic=74334.msg608528#msg608528 -- happy accident put that book in my lap and it does a very good job of explaining the finer details of sampling and how samplers are implemented in hardware.

Quotebut also maybe using a CMOS switch to cut out some of the pulses
So what you've got to take in to account here is: what does D-->A do? When you want to turn your discrete samples back into a continuous analog wave what happens? Your D/A takes in the discrete values and interpolates what the wave should look like in between the samples. So if you had three samples with values 1 5 and 10 and you deleted the middle sample, the output would still look kind of like the input. You have to go to some bigger lengths to really degrade the signal, especially when you're sampling at a high frequency and bit rate. Better would be sample at a low freqeuncy and low bit rate and then glitch that stream. This is some of what the Alesis Bitrman can do actually.

Taylor

Well, in the case of cutting out some samples, I meant this in the context of never converting the digital signal back to analog. What I was saying (and this is incredibly vague at this point) was that, if it is the case that a digital signal is an alternating current once it comes out of, for example, the DB1 pin of an ADC0801, then it can theoretically be considered an analog audio signal. I'm pretty sure, however, that it will be way higher in frequency than audio. So here we have an alternating current that is created by an input signal, though it comes out something like a PWM pulse wave. Am I right-ish so far?

If so, we have a PWM-ish signal that's created by the input instrument. Note that I have no idea and make no guesses as to what exactly this will sound like (well, it will not sound at all, but once we figure out how to slow/pitch it down to make it into audio range). I'm not expecting to play a guitar into it and have a simple PWM synth come out. I'm just interested in the idea of generating a new kind of signal with an instrument. Once we have that signal, there's a whole world of stuff we can try to get something interesting out of it (also, as a fan of 20th century classical, drill n bass, and Autechre, "interesting sound" has a much looser meaning to me than to most people  :icon_smile:).

So once we have this signal (and in fact, I think there will be several related but different signals coming out of a chip like the ADC0801, which has outputs for 8 separate bits), who knows what kind of mangling is possible? Possibly filtering and ring modulating the different bits together would give some audio range sounds.

By the way, Iaresee, just noticed you're the guy who posted the Loopholic review on GG. I'm "Sombrero", though I don't post much on that forum.

Edit: Actually, thinking about it a little more, I wonder what would happen feeding an analog signal right into a D-to-C converter. Using a signal at audio frequencies, I imagine it would just be bit crushed noise, or perhaps not audible, but using the opposite of the above thought experiments (tons of pitch shifting, heavily distorted, ring modulated). Oh, wait. Analog audio components probably aren't capable of outputting a signal at high enough frequency. I guess I'd need RF components? Maybe this direction is just not possible. Hmm.

iaresee

Quote from: Taylor on June 11, 2009, 05:13:58 PM
Well, in the case of cutting out some samples, I meant this in the context of never converting the digital signal back to analog. What I was saying (and this is incredibly vague at this point) was that, if it is the case that a digital signal is an alternating current once it comes out of, for example, the DB1 pin of an ADC0801, then it can theoretically be considered an analog audio signal. I'm pretty sure, however, that it will be way higher in frequency than audio. So here we have an alternating current that is created by an input signal, though it comes out something like a PWM pulse wave.
Yes you have a square wave with a random period from pulse-to-pulse but one that will no doubt end up being a very high frequency. If you want to hear what this kind of signal sounds like listen to an old MODEM. I don't know if I'm talking before your time now and this is in no way meant to come off as condescending but, before we had cable and DSL modems we had analog modems that transmitted the binary information over phone lines in the audible frequency range. It is essentially doing what you're talking about here: taking a random digital and turning it into audible sound.

And it sounds awful. I still remember the screaming that would happen from the office if you picked up the phone to make a call and someone happened to be "dialing in" to work. Both screaming from the handset as the MODEM tried to send and recieve bytes in the audible frequency and from whom ever happened to be dial in. Hehehe.

QuoteAm I right-ish so far?
Yup.

QuoteIf so, we have a PWM-ish signal that's created by the input instrument. Note that I have no idea and make no guesses as to what exactly this will sound like (well, it will not sound at all, but once we figure out how to slow/pitch it down to make it into audio range). I'm not expecting to play a guitar into it and have a simple PWM synth come out. I'm just interested in the idea of generating a new kind of signal with an instrument. Once we have that signal, there's a whole world of stuff we can try to get something interesting out of it (also, as a fan of 20th century classical, drill n bass, and Autechre, "interesting sound" has a much looser meaning to me than to most people  :icon_smile:).
The MODEM noise analogy above is pretty good. Modulated down into an audible frequency range it'll sound like any of the samples you hear here: http://www.freesound.org/packsViewSingle.php?id=379 -- especially pwm1, pwm2, pwm10 . :)

QuoteBy the way, Iaresee, just noticed you're the guy who posted the Loopholic review on GG. I'm "Sombrero", though I don't post much on that forum.
Cool. I just realized a few days ago I've racked up an insane post count there. Sick.

QuoteEdit: Actually, thinking about it a little more, I wonder what would happen feeding an analog signal right into a D-to-C converter. Using a signal at audio frequencies, I imagine it would just be bit crushed noise, or perhaps not audible, but using the opposite of the above thought experiments (tons of pitch shifting, heavily distorted, ring modulated). Oh, wait. Analog audio components probably aren't capable of outputting a signal at high enough frequency. I guess I'd need RF components? Maybe this direction is just not possible. Hmm.
Did you mean D/A? It would likely sound very, very awful.

Taylor

Haha, I am 22 and remember modems well (though not fondly). 56k was pretty standard when I first got on the internet when I was about 11, but I actually once hooked up an old modem (something like 4k) to a 386 running Windows 3.1 (this was around 98/99, so this was hilariously outdated even then), managed to sign onto the internet and had the slowest IM session ever - it took about 5 minutes to transmit each sentence.

Modem noises, while "awful" can be great. Check out "Possibly Maybe" by Bjork, or nearly any Autechre record, which my girlfriend refers to as "that modem noise crap you listen to".

I think there is some fertile ground here. I know it's going to take some creative thinking to make something "usable" out of this, but as per my elastic concept of "usable", I think something fun might just come out of this.

Taylor

Quote from: Taylor on June 11, 2009, 05:13:58 PMOh, wait. Analog audio components probably aren't capable of outputting a signal at high enough frequency. I guess I'd need RF components? Hmm.

Can anyone comment on this? Is it going to be impossible to process this digital signal with analog stuff, because the analog components don't have high enough frequency response/slew rate?

Blue_Toad

Hi Taylor,
This is my first post on this forum so bear with me,
I think first off to add to the original question which was what does the output of an A/D look like, I like to think of it as a series of black and white pictures, you take one picture and that has a number of different shades in it (bit depth) each sample that you take is a picture of a bunch of shades, and if you're sampling something like a guitar you are taking about 8000 pictures per second to show your guitar signal. Each picture only tells you what it looked like when you took it, and if you play all the pictures back at the same speed that you took them, you'll get an accurate representation of the signal.
As far as processing the digital signal with analog components what you're suggesting is possible, but I think what you're looking for is FSK (Frequency Shift Keying) basically this is a signal generator that changes the frequency based on the number that is fed into it, (there are some FSK chips that output signals in the audio band (old modem sounds)) You could take the output of your A/D , do something to the bits if you like and then feed them into the FSK and see what you get out, the sample rate I would imagine would be way to high for the rated FSK chip at those frequencies, but there would be no harm in trying (you won't kill the chip, just the data will not be an accurate representation, but it might be a cool sound).

Hope this helps,

Taylor