Difference between revisions of "Digital signal processing"

From Synth DIY wiki
Jump to navigation Jump to search
(Sampling and Quantisation Considerations)
(Quantisation noise discussion - first draft)
Line 23: Line 23:
 
=== Sampling and Quantisation Considerations ===
 
=== Sampling and Quantisation Considerations ===
  
When considering the component selection for ADC, there are two main dimensions to consider.
+
When selecting an ADC (Analog to Digital Converter), there are two main dimensions to consider.
  
The first is the resolution of your conversion - the number of bits you want to represent. The choice here will affect the amount of quantisation noise introduced into your signal. For example, let's assume you have a bipolar input signal that varies between -1V and 1V. With an 8-bit converter, that means that a range of width 2V is represented by values of anything from -127 to 127 (or 255 steps). That means that the input voltage represented by 1 bit of the converted signal is equivalent to 7.84 mV. Assuming a perfectly linear, this means that when an input signal varies from one sample to the next by 3.92 mV or less, its digital representation will not change, whereas
+
The first is the resolution of your conversion - the number of bits you want to represent. The choice here will affect the amount of [https://en.wikipedia.org/wiki/Quantization_(signal_processing) quantisation] noise introduced into your signal. For example, let's assume you have a bipolar input signal that varies between -1V and 1V. With an 8-bit converter, that means that a range of width 2V is represented by values of anything from -127 to 127 (or 255 steps). That means that the input voltage represented by 1 bit of the converted signal is equivalent to 7.84 mV. Assuming a perfectly linear converter, where the quantisation error is uniformly distributed between -1/2 LSB (Least Significant Bit) and 1/2 LSB, this means that when an input signal increases from one sample to the next by 3.92 mV or less, its digital representation will not appear to change, whereas if it moves 3.93 mV or more, it will change by 1 bit (and similarly for decreases). This can be considered to be like a rounding error that gets injected, as noise, into the input stream as a consequence of conversion.
 +
 
 +
For an "ideal" ADC, the signal to quantisation noise ratio (SQNR) is calculated as:
 +
 
 +
'''SQNR = 20 log<sub>10</sub>(2<sup>Q</sup>)''' dB
 +
 
 +
where Q is the number of quantisation bits.
  
 
[[File:Sampling-illustration.png|frameless|1000x800px]]
 
[[File:Sampling-illustration.png|frameless|1000x800px]]

Revision as of 11:30, 6 May 2019

Editing Digital signal processing (DSP) ...

Introduction to Digital Signals

Continuous vs Discrete

In order to understand the benefits and limitations of Digital Signal Processing (DSP) it is important to understand the distinction between continuous and discrete signal representations. In the Synth DIY world, much use is made of the terms analog and digital without any clear explanation of the very different assumptions that underpin those terms.

A signal can be defined as any function that conveys information about the state of a physical system. This is usually represented as a variation of values over time or space. Signals are represented mathematically as functions of one or more independent variables.

Continuous-time signals are defined across a continuum of time and reflect a continuously variable value. So, for example

f(t) = sin(2wt)

is continuously defined for any and all values of t.

Discrete-time signals are only defined at specific times and the independent variables can therefore only take on discrete values. Discrete-time signals are represented by a sequence of discrete values. In the context of Synth applications, the specific times at which the signals are defined are regular and evenly spaced.

In real world applications, the values a signal takes on as it varies usually represents an amplitude. The signal amplitude can also be either continuous or discrete.

When we talk about an analog signal, we are usually referring to a signal that is both a continuous-time and continuous-amplitude signal. A digital signal is both a discrete-time and discrete-amplitude signal, which translates into the reality that it is both sampled (discrete-time) and quantised (discrete-amplitude).

This all sounds very academic, of course, but is important to understand the fundamental differences between the two domains when making design decisions around sample rates, bit resolution and cost when selecting components for implementing DSP hardware.

Domain Scope.png

Sampling and Quantisation Considerations

When selecting an ADC (Analog to Digital Converter), there are two main dimensions to consider.

The first is the resolution of your conversion - the number of bits you want to represent. The choice here will affect the amount of quantisation noise introduced into your signal. For example, let's assume you have a bipolar input signal that varies between -1V and 1V. With an 8-bit converter, that means that a range of width 2V is represented by values of anything from -127 to 127 (or 255 steps). That means that the input voltage represented by 1 bit of the converted signal is equivalent to 7.84 mV. Assuming a perfectly linear converter, where the quantisation error is uniformly distributed between -1/2 LSB (Least Significant Bit) and 1/2 LSB, this means that when an input signal increases from one sample to the next by 3.92 mV or less, its digital representation will not appear to change, whereas if it moves 3.93 mV or more, it will change by 1 bit (and similarly for decreases). This can be considered to be like a rounding error that gets injected, as noise, into the input stream as a consequence of conversion.

For an "ideal" ADC, the signal to quantisation noise ratio (SQNR) is calculated as:

SQNR = 20 log10(2Q) dB

where Q is the number of quantisation bits.

Sampling-illustration.png