https://wiki.xiph.org/api.php?action=feedcontributions&user=Gmaxwell&feedformat=atomXiphWiki - User contributions [en]2024-03-29T06:47:48ZUser contributionsMediaWiki 1.40.1https://wiki.xiph.org/index.php?title=OpusFAQ&diff=14618OpusFAQ2014-04-22T06:40:17Z<p>Gmaxwell: /* Now that Opus is standardized, will its development stop, or can it be further improved? */ updates per cluesticking by technopredator on IRC.</p>
<hr />
<div>[[Image:Opus logo trans.png|right]]<br />
<br />
== General Questions ==<br />
<br />
=== What is Opus? Who created it? ===<br />
<br />
Opus is a totally open, royalty-free, highly versatile audio codec. It is primarily designed for interactive speech and music transmission over the Internet, but is also applicable to storage and streaming applications. It incorporates technology from Skype's SILK codec and Xiph.Org's CELT codec. It has been standardized by the Internet Engineering Task Force (IETF) as '''[http://tools.ietf.org/html/rfc6716 RFC 6716]'''. <br />
<br />
Opus has been in development since early 2007. Programmers associated with Xiph.Org, Skype, and several other organizations have contributed to its development and to the standardization process as part of the IETF's codec working group.<br />
<br />
=== How does Opus compare to other codecs? ===<br />
<br />
Opus is distinguished from most formats for high quality audio (AAC, Vorbis, MP3) by having low delay and it is distinguished from most low delay formats (G.711, GSM, Speex) by supporting high audio quality. It meets or exceeds existing codecs' quality across a wide range of bitrates, and it operates at lower delay than virtually any existing compressed format. Further, the Opus format itself and the reference implementation are available under liberal royalty-free licenses, making it easy to adopt, compatible with free software, and suitable for usage as part of the basic infrastructure of the Internet. See the Opus [http://opus-codec.org/comparison comparison page] for more details.<br />
<br />
=== Does Opus make all those other lossy codecs obsolete? ===<br />
<br />
Theoretically, yes. From technical point of view (loss, delay, bitrates, ...) it can replace both Vorbis and Speex, and the common proprietary codecs too.<br />
<br />
=== Will Opus replace Vorbis in video files? ===<br />
<br />
For OGG Theora video files, it can, just the overall size reduction will be minimal, and it will break compatibility with existing players.<br />
<br />
For WebM video files, same does apply, but additionally this would need a change of the spec, as the current spec says that the only allowed video codec is VP8 and the only allowed audio codec is Vorbis.<br />
<br />
=== How do I use Opus? What programs support Opus? ===<br />
<br />
Opus decoding support is now included in many applications, including Firefox, foobar2000, and VLC, as well as in frameworks such as GStreamer and FFmpeg. For now, the best way to '''encode''' Opus files is to use the opusenc command-line tool from the opus-tools package. For real-time applications, Opus support should soon be available in the Google webrtc codebase. Opus is still a new codec, expect many more applications to support it in the near future.<br />
<br />
=== Does Opus support higher sampling rates, such as 96 kHz or 192 kHz? ===<br />
<br />
Yes and no. Opus encoding tools like opusenc will happily encode files that are sampled at 96 or 192 kHz. However, input files at these rates are internally converted to 48 kHz, and then only frequencies up to 20 kHz are encoded. The reason is simple: lossy codecs are designed to preserve audible details while discarding irrelevant information. Since the human ear can only hear up to 20 kHz at best (usually lower than that), frequency content above 20 kHz is the first thing to go. See Monty's [http://people.xiph.org/~xiphmont/demo/neil-young.html 24/192 Music Downloads ...and why they make no sense] for more details. <br />
<br />
=== What are the licensing requirements? ===<br />
<br />
The reference Opus source code is released under a three-clause BSD license, which is a very permissive Open Source license. Commercial use and distribution (including in proprietary software) is permitted, provided that some basic conditions specified in the license are met. <br />
<br />
Opus is also covered by some patents, for which royalty-free usage rights are granted, under conditions that the authors believe are compatible with most (all?) open source licenses, including the GPL (v2 and v3). See the [http://www.opus-codec.org/license/ licensing page] for details.<br />
<br />
=== Why make Opus free? ===<br />
<br />
On the Internet, protocol and codec standards are part of the common infrastructure everyone builds upon. Most of the value of a high quality standard is the innovation and interoperation provided by the systems built on top of it. When a few parties have monopoly rights to monetize a standard, that infrastructure stops being so common—everyone else has more reason to use their own solution instead, increasing cost and reducing efficiency. Imagine a road system where each type of car could only drive on its own manufacturer's pavement. We all benefit from living in a world where all the roads are connected. This is why Opus, unlike many codecs, is free.<br />
<br />
=== Is the SILK part of Opus compatible with the SILK implementation shipped in Skype? ===<br />
<br />
No. The SILK codec, as submitted by Skype to the IETF, was heavily modified as part of its integration within Opus. The modifications are significant enough that it is not possible to just write a "translator" and even sharing code between Opus and the "old SILK" would be highly non-trivial.<br />
<br />
=== Why not keep the SILK and CELT codecs separate? ===<br />
<br />
Opus is more than just two independent codecs with a switch. In addition to a linear prediction "SILK mode" and a MDCT "CELT mode" it has a "hybrid mode," where speech frequencies up to 8 kHz are encoded with LP while those above 8 kHz are encoded with MDCT. This is what allows Opus to have such high speech quality around 32 kb/s. Another advantage of the integration is the ability to switch between these modes seamlessly, without any "glitch" and without any out-of-band signalling.<br />
<br />
=== Now that Opus is standardized, will its development stop, or can it be further improved? ===<br />
<br />
Unlike most ITU-T codecs, Opus is only defined in terms of its decoder. The encoder can keep evolving as long as the bitstream it produces can be decoded by the reference decoder. This is what made it possible for MP3 encoders to improve far beyond the original l3enc and the dist10 reference implementation. Although it is unlikely that Opus encoders will see such spectacular evolution, we certainly hope that future encoders will become much better than the reference encoder. In fact, the 1.1 libopus release significantly improves on the reference encoder's quality.<br />
<br />
=== Will all future Opus releases comply with the [http://tools.ietf.org/html/rfc6716 Opus specification]? ===<br />
<br />
Yes.<br />
<br />
=== In what ways is Opus optimized for the Internet? ===<br />
<br />
Opus being optimized for the Internet obviously means that it has good packet loss robustness and concealment, but it goes further. One of the first things we've been asked when designing Opus was to make the rate '''really''' adaptable because we never know what kind of rates will be available. This not only meant having a wide range of bitrates, but also being able to vary in small increments. This is why Opus scales from about 6 kb/s to 512 kb/s, in increments of 0.4 kb/s (one byte with 20 ms frames). The reason Opus can have more than 1200 possible bitrates spending 11 bits signalling the bitrate is because UDP already encodes the packet size. One last aspect is that Opus is simple to transport over RTP, as can be seen from [http://tools.ietf.org/html/draft-spittka-payload-rtp-opus Opus RTP payload format]. For example, it's possible to decode RTP packets without having even seen the SDP or any out-of-band signalling. <br />
<br />
=== What applications for Android can play Opus? ===<br />
<br />
Right now, there are just a few but that list is fast growing. Please reference [http://android.stackexchange.com/q/37970/7425 this question on android.stackexchange.com]. Feel free to suggest other applications.<br />
<br />
=== When will the next version be released? ===<br />
<br />
When it's done. Seriously. We do not know. Opus is not a large project with a fixed release schedule. That being said, our pre-releases and even the git repository are generally pretty stable and given proper testing (which you should always do anyway), are safe to distribute. Just be aware that the API of new features (that have never been included in a stable release) could potentially still change.<br />
<br />
== Opus for Software developers ==<br />
<br />
=== On what platforms does Opus run? ===<br />
<br />
The Opus code base is written in C89 and should run on the vast majority of recent (and not so recent) CPUs. A few of the platforms on which Opus has been tested and is known to run include x86, x86-64, ARM, Itanium, Blackfin, and SPARC.<br />
<br />
=== Is there a fixed-point implementation? ===<br />
<br />
Yes; the fixed-point and floating-point decoder and encoder implementations are part of the same code base. The code defaults to float, so you need to configure with --enable-fixed-point (or defining FIXED_POINT if not using the configure script) to build the code for fixed-point.<br />
<br />
=== Which implementation should I use? ===<br />
<br />
While the implementation in RFC 6716 is what ''defines'' the standard, it is likely not the best and most up-to-date implementation. The [http://opus-codec.org/ Opus] website was set up for the purpose of continually improving the implementation— in terms of speed, encoding quality, device compatibility, etc— while still conforming to the standard. All Opus implementations are compatible by definition.<br />
<br />
=== How is supporting Opus different from supporting Speex/G.711/MP3? ===<br />
<br />
Opus has variable frame durations which can change on the fly, so an Opus decoder needs to be ready to accept packets with durations that are any multiple of 2.5ms up to a maximum of 120ms. <br />
<br />
The opus encoder and decoder do not need to have matched sampling rates or channel counts. It is recommended to always just decode at the highest rate the hardware supports (e.g. 48kHz stereo) so the user gets the full quality of whatever the far end is sending.<br />
<br />
=== My application doesn't work. Can anyone help me? ===<br />
<br />
It's possible to get help, but before doing so, there are a few basic things to try:<br />
<br />
* Implement the application with uncompressed audio instead of Opus. If it still doesn't work, then the problem isn't related to Opus.<br />
* Read the [http://www.opus-codec.org/docs/ documentation].<br />
* Read the opus_demo.c source code to see how to use the encoder and decoder.<br />
<br />
If you still can't solve the problem, the best option is to ask for help on the [http://lists.xiph.org/mailman/listinfo/opus mailing list].<br />
<br />
=== How do I report a bug? ===<br />
<br />
If you think you have found a bug in Opus (and not in your application), please [https://trac.xiph.org/newticket?component=Opus file a bug report]. Please include a way for us to reproduce the problem. The best way to do this is to provide an input file, along with the opusenc/opusdec/opus_demo command line that causes the bug to occur. If the bug cannot be triggered by the command line tools, please provide a simple patch or C file that can help reproduce it. Please also provide any other relevant information, such as OS, CPU, build options, etc. Also, don't hesitate to also contact us on the [http://lists.xiph.org/mailman/listinfo/opus mailing list] or on [irc://irc.freenode.net/opus IRC].<br />
<br />
=== What is Opus Custom? ===<br />
<br />
Opus Custom is an '''optional''' part of the Opus standard that allows for sampling rates other than 8, 12, 16, 24, or 48 kHz and frame sizes other than multiples of 2.5 ms. Opus Custom requires additional out-of-band signalling that Opus does not normally require and disables many of Opus' coding modes. Also, because it is an optional part of the specification, using Opus Custom may lead to compatibility problems. For these reasons, its use is discouraged outside of very specific applications, e.g.:<br />
* ultra low delay applications where synchronization with the soundcard buffer is important. <br />
* low-power embedded applications where compatibility with others is not important.<br />
<br />
For almost all other types of applications, Opus Custom should not be used.<br />
<br />
=== How do I use 44.1 kHz or some other sampling rate not directly supported by Opus? ===<br />
<br />
Tools which read or write Opus should interoperate with other sampling rates by transparently performing sample rate conversion behind the scenes whenever necessary. In particular, software developers should not use Opus Custom for 44.1 kHz support, except in the very specific circumstances outlined above.<br />
<br />
Note that it's generally preferable for a decoder to output at 48kHz even when you know the original input was 44.1kHz, not only because you can skip resampling but also because many inexpensive audio interfaces have poor quality output for 44.1k.<br />
<br />
The opus-tools package source code contains a small, high quality, high performance, BSD licensed resampler which can be used where resampling is required.<br />
<br />
=== Forward Error correction (FEC) doesn't appear to do anything! HELP! ===<br />
<br />
The inband FEC feature of Opus helps reduce the harm of packet loss by encoding some information about the prior packet.<br />
<br />
In order to make use of inband FEC the decoder must delay its output by at least one frame so that it can call the decoder with the decode_fec argument on the ''next'' frame in order to reconstruct the missed frame. This works best if it's integrated with a jitter buffer.<br />
<br />
FEC is only used by the encoder under certain conditions: the feature must be enabled via the OPUS_SET_INBAND_FEC CTL, the encoder must be told to expect loss via the OPUS_SET_PACKET_LOSS_PERC CTL, and the codec must be operated in any of the linear prediction or Hybrid modes. Frame durations of <10ms and very high bitrates will use the MDCT modes, where FEC is not available.<br />
<br />
Even when FEC is not used, telling the encoder about the expected level of loss will help it make more intelligent decisions. By default the implementation assumes there is no loss.<br />
<br />
=== I can't use malloc or much stack on my embedded platform. How do I make Opus work? ===<br />
<br />
A normal build of libopus only uses malloc/free in the _create() and _destroy() calls, so Opus is safe for realtime use so long as the codec state is pre-created.<br />
<br />
In order to build Opus without any reference to malloc/free at all use init() calls rather than the create() calls in your application and compile with <tt>CFLAGS="-DOVERRIDE_OPUS_ALLOC -DOVERRIDE_OPUS_FREE -D'opus_alloc(x)=NULL' -D'opus_free(x)=NULL' "</tt> you will get a build which does not use malloc/free.<br />
<br />
If libopus is built with -DNONTHREADSAFE_PSEUDOSTACK (instead of VAR_ARRAYS, or USE_ALLOCA) it will use a user provided block of heap instead of stack for many things resulting in much lower the stack usage. However this makes the resulting library non-threadsafe and is not recommend on anything except limited embedded platforms.<br />
<br />
=== How can I ensure that my software interoperates with other software implementing Opus? ===<br />
<br />
For applications using Ogg files, there are some [http://people.xiph.org/~greg/opus_testvectors/ Ogg Opus testvectors] to test decoders and you can test encoders with opusdec. For RTP applications, the opusrtp tool can be useful. In general, here's a list of specific issues to check:<br />
* Can your application handle all frame sizes, including changing the frame size from frame to frame?<br />
* Does your application properly react to lost packet by calling the decoder with a NULL packet?<br />
<br />
=== What is the complexity of Opus? ===<br />
<br />
The complexity of Opus varies by a large amount based on the settings used. It depends on the mode, audio bandwidth, number of channels, and even a "complexity knob" that can trade complexity for quality. It will run easily on any recent PC or smartphone. For slower embedded CPUs/DSPs, the amount of CPU required will vary depending on the configuration and the exact CPU, so you will need to experiment. Do not expect Opus to run on really slow devices like 8-bit micro-controllers.<br />
<br />
=== Opus is using too much CPU for my application. What can I do? ===<br />
<br />
First don't panic and don't start writing assembly just yet. It's possible that you're just not using the right set of options. If you're targeting an embedded/mobile platform, chances are the fixed-point build will be faster, so make sure you're using --enable-fixed-point or defining FIXED_POINT in the build system. Opus also has a complexity option that can trade quality for complexity. The default is highest quality and highest complexity. You can control this using OPUS_SET_COMPLEXITY() (see doc for details). If all else fails and you need to optimize the Opus code, see the next question.<br />
<br />
=== I would like to optimize Opus. Where should I start? ===<br />
<br />
Please [http://www.opus-codec.org/contact/ contact us] before you start, or at least before you get too far. This will help coordinate the optimization effort and generally reduce the probability of wasting your time on duplicated effort or generally going on the wrong path. <br />
<br />
=== Does Opus have an echo canceller like Speex does? ===<br />
<br />
Echo cancellation is completely independent from codecs. You can use any echo canceller (including the one from libspeexdsp) along with Opus. That being said, among the free acoustic echo cancelers (AEC) we're aware of, the best is probably the Google AEC from the [https://code.google.com/p/webrtc/ WebRTC codebase].</div>Gmaxwellhttps://wiki.xiph.org/index.php?title=Ghost&diff=14323Ghost2013-11-13T07:00:39Z<p>Gmaxwell: Reverted edits by Domtheo (talk) to last revision by DOS386</p>
<hr />
<div>{{historical}}<br />
This page is meant to track ideas about low-delay, high-quality audio coding. The work has just started, so don't expect anything in the near future (or at all for that matter).<br />
<br />
== Signal types ==<br />
<br />
There are many signal types that can be found:<br />
* Sinusoids<br />
** A few pure (or nearly pure) tones<br />
* Harmonic<br />
** Periodic waveforms (e.g. voice)<br />
** Many (sometimes closely spaced) harmonics<br />
* Shapred noise<br />
** Signals that are (or are indistinguishable from) filtered (coloured) white noise<br />
* Transients<br />
** Whatever doesn’t fit above I guess<br />
<br />
== Signal analysis ==<br />
<br />
=== Sinusoidal ===<br />
<br />
Good when most of the energy is contained in a few sinusoids. May be problematic for very harmonic signals, e.g. a male voice may have close to a hundred harmonics in the full audio band.<br />
<br />
=== Pitch ===<br />
<br />
Good for harmonic signals. Hard to estimate and code when extra sinusoids and noise are present. At 48 kHz, no need for fractional pitch or anything like that, but sub-band pitch analysis or multi-tap gain is a good idea. Also, there needs to be a way to remove the effect of sinusoids and noise. Even then removing the "noise" also means removing all excitation to the pitch predictor, so that's a problem.<br />
<br />
=== MDCT ===<br />
<br />
Very general. Can code anything, but not very good at anything. High delay (2x frame size). Could put several "MDCT frames" in each codec frame to make latency smaller.<br />
<br />
=== Wavelets ===<br />
<br />
Just a fancy name for sub-bands with non-uniform width. Probably similar to having an MDCT with few sub-bands, except that that the sub-bands could follow (roughly) the critical bands. <br />
<br />
=== LPC + stochastic cb ===<br />
<br />
Like CELP with no pitch. Could be used to code the noisy part of the signal with low bit-rate. Would need to figure out how to preserve the energy of the noise when going with 1/2 bit per sample and less.<br />
<br />
== Codec Structure Ideas ==<br />
<br />
=== Sinusoidal + wavelet ===<br />
<br />
* Preemphasis<br />
* Extract as many sinusoids as possible<br />
* Wavelet transform <br />
* Code wavelet coefs using VQ<br />
<br />
=== Sinusoidal, pitch and noise ===<br />
<br />
* Preemphasis<br />
* Joint pitch + sinusoidal estimation<br />
* LPC analysis<br />
* CELP-like coding of the residual (mainly noise)<br />
<br />
== Estimation Ideas ==<br />
<br />
=== Sinusoid Estimation ===<br />
<br />
Very hard to do properly, especially with reasonable complexity and low delay. Some ideas:<br />
<br />
==== Least-square type matching ====<br />
<br />
Step one: estimate sinusoid frequencies.<br />
<br />
Tried so far:<br />
* MUSIC fails on non-trivial signals and very complex, although there's an AES paper that recommends first whitening the noise part of the signal before applying the algo. Haven't tried that so far.<br />
* ESPRIT fails on non-trivial signals and very complex (see above for possible solution)<br />
* LPC would probably work, but requires an insane order -> impractical, plus it tends to be numerically unstable anyway.<br />
* FFT poor resolution, but that's all we have left so far. There's an AES paper that describes a sort of time-domain phase unwrapping that could help.<br />
<br />
Step two: what to match<br />
<br />
Step three: solving<br />
<br />
Looks like it's possible to solve an NxM least square problem in O(N*M) time using an iterative algorithm as long as the system matrix is near-orthogonal. If we want to solve '''Ax'''='''b''' and '''A'''^h*'''A''' ~= I, then we start with '''x'''(0)='''A'''^h*'''b''' and then:<br />
<br />
:'''x'''(N+1) = '''x'''(N) + '''A'''^h*('''b'''-'''A'''*'''x'''(N))<br />
<br />
==== Phase lock loop (PLL) ====<br />
<br />
== Quantization Ideas ==<br />
After the sinusoids have been extracted they have to be quantized. The possible ways are<br />
* Sort the sinusoids according to energy and transmit only a finite number or only ones with a specific energy or above. The indices of the sinusoids before rearranging will have to be sent.<br />
** I think it's worth checking which is most efficient. Sorting the sinusoids will help quantizing the amplitude, but make it harder to encode frequency. [[User:Jmspeex|Jmspeex]] 05:45, 28 June 2006 (PDT)<br />
* Use the psycho acoustic properties and remove all the sinusoids, which will be masked by other tones.<br />
** Of course, we don't want to encode perceptually irrelevant sinusoids. Actually, we want the resolution (in amplitude, phase and probably frequency) to scale with the amplitude-to-mask ratio or something like that. [[User:Jmspeex|Jmspeex]] 05:45, 28 June 2006 (PDT)<br />
* After removing perceptually irrelevant and low-energy tones the energy in each critical bands has to be adjusted to match with the initial energy. <br />
** Possibly -- I don't know much on that topic. Monty probably has valuable experience. [[User:Jmspeex|Jmspeex]] 05:45, 28 June 2006 (PDT)<br />
* Time-differential coding of sinusoids across frames can be used<br />
** Definitely. This is very important if we plan on using short frames. It would be important to minimize inter-frame redundancy, but still make it possible to recover from packet loss. For that, we could either use a leaky predictor (like the pitch in CELP) or use key-frames (like a video codec). [[User:Jmspeex|Jmspeex]] 05:45, 28 June 2006 (PDT)<br />
<br />
==== Quantization of frequencies====<br />
* Quantize frequencies of a few selected sinusoids and recreate other values using interpolation.<br />
** How would you do that? (maybe I'm not following here) [[User:Jmspeex|Jmspeex]] 05:45, 28 June 2006 (PDT)<br />
==== Quantization of Amplitudes ====<br />
* Model the energy curve of the sinusoids – for instance using an exponential curve<br />
** Exponential decay might be a good way to do inter-frame prediction. [[User:Jmspeex|Jmspeex]] 05:45, 28 June 2006 (PDT)<br />
* Quantize amplitudes of a few selected sinusoids and recreate other values using interpolation.<br />
** Possibly, but probably not at first (hard problem). [[User:Jmspeex|Jmspeex]] 05:45, 28 June 2006 (PDT)<br />
==== Quantization of phase and modulation parameters ====<br />
* Can be scalar quantized with the number of bits allocated being proportional to the energy of the sinusoid<br />
** Yes. Also, this is something that can be predicted very well across frames. It's not even necessary to make that one robust to losses, because as long as the phase is continuous, no one will notice [[User:Jmspeex|Jmspeex]] 05:45, 28 June 2006 (PDT)<br />
==== Quantization of indices ====<br />
==== Quantization of energy gains in critical bands ====<br />
<br />
=== Excitation similarity weighting ===<br />
The idea behind the ESW technique is to select sinusoids such that each new sinusoid added will provide a maximum incremental gain in matching between the auditory excitation pattern associated with the original signal and the auditory excitation pattern associated with the modeled signal. In order to accomplish this goal, an iterative process is proposed in which each sinusoid extracted during conventional analysis is assigned an excitation similarity weight. During each iteration, the sinusoid having the largest weight is added to the modeled representation. New sinusoids are accumulated until some constrain is exhausted, for example, a bit budget. The algorithm tends to converge as the number of modeled sinusoids increases<br />
<br />
-- Not sure I understand here. Any reference? [[User:Jmspeex|Jmspeex]] 05:45, 28 June 2006 (PDT)<br />
<br />
=== Trajectory tracking ===<br />
Once the meaningful sinusoidal peaks and their parameters have been estimated, the peaks are tracked together into inter-frame trajectories. At each frame, a peak continuation algorithm tries to connect the sinusoidal peak into the already existing trajectories at the previous frame, resulting into a smooth curve of frequencies and amplitudes. The continuation was tested with two algorithms: the traditional one which uses only the parameters of the sinusoids to obtain smooth trajectories and one original method which synthesizes the possible continuations inside certain deviation limits and compares them to the original signal. There is also other systems which use more advanced methods, for example the Hidden Markov Models to track the trajectories.<br />
Sinusoidal trajectories contain all the information needed for the reconstruction of the harmonic parts of input signals: amplitudes, frequencies and phases of each trajectory at each frame. To avoid discontinuities at frame boundaries, the amplitudes, frequencies and phases are interpolated from frame to frame. <br />
*Amplitudes are linearly interpolated<br />
* Phase interpolated with cubic polynomials<br />
<br />
-- Any reference? [[User:Jmspeex|Jmspeex]] 05:45, 28 June 2006 (PDT)</div>Gmaxwellhttps://wiki.xiph.org/index.php?title=OggOpus&diff=14321OggOpus2013-11-13T06:59:34Z<p>Gmaxwell: Reverted edits by Domtheo (talk) to last revision by Rillian</p>
<hr />
<div>'''Superceeded by [http://tools.ietf.org/html/draft-terriberry-oggopus the ietf draft].'''<br />
<br />
<br />
== Ogg Mapping for Opus ==<br />
<br />
The IETF Opus codec is a low-latency audio codec optimized for both voice and general-purpose audio. See the [http://tools.ietf.org/html/draft-ietf-codec-opus Opus Specification] for technical details.<br />
<br />
Almost everything about Opus is either fixed or dynamically switchable, so most of the usual ID and setup header parameters in the header packets of an Ogg encapsulation aren't needed. In particular, bitrate, packet duration, mono/stereo flags, and coding modes are all dynamically switchable from packet to packet. The first one or two bytes in each data packet, the start of the 'TOC sequence' that defines the layout of the packet, specifies all of these parameters for that particular packet. See Section 3 of the Opus Specification for the exact format of the TOC sequence.<br />
<br />
The remaining parameters that must be signaled are<br />
<br />
* The magic number for stream identification,<br />
* The stream count and coupling for multichannel audio, and<br />
* Any metadata or tags.<br />
<br />
=== Content Type ===<br />
<br />
The recommended mime-type for Ogg Opus files is '''audio/ogg''', defined in [http://www.ietf.org/rfc/rfc5334.txt RFC 5334].<br />
<br />
If more specificity is desired, one can distinguish Opus files as 'audio/ogg; codecs=opus'.<br />
<br />
The recommended filename extension for Ogg Opus files is '''.opus'''.<br />
<br />
=== Packet Organization ===<br />
<br />
Opus is framed in a continuous logical [http://www.xiph.org/ogg/doc/framing.html Ogg stream]. <br />
<br />
There are two mandatory headers. The granule position of the pages containing these headers MUST be zero.<br />
<br />
The first packet in the logical Ogg stream MUST contain the identification header, which uniquely identifies a stream as Opus audio. It MUST begin with the 8 bytes "OpusHead". It MUST be placed alone in the first page of the logical Ogg stream. This page MUST have the ’beginning of stream’ flag set.<br />
<br />
The second Opus packet MUST contain the comment header. It must begin with the 8 bytes "OpusTags". It MAY span one or more pages, beginning on the second page of the logical stream. However many pages it spans, the comment header packet MUST finish the page on which it ends.<br />
<br />
All subsequent pages are audio data pages and the packets they contain are audio data packets. The first audio page SHOULD NOT have the 'continued packet' flag set (which would indicate the first audio packet is continued from a previous page). Packets MUST be placed into Ogg pages in order until the end of stream. Audio packets MAY span page boundaries. A decoder MUST treat a zero-byte audio packet as if it were an Opus packet with an illegal TOC sequence. The last page SHOULD have the 'end of stream' flag set, but implementations should be prepared to deal with truncated streams which do not have a page marked 'end of stream'. The final packet SHOULD complete on the last page, i.e., the final lacing value should be less than 255. There MUST NOT be any more pages in an Opus logical stream after a page marked 'end of stream'.<br />
<br />
=== Granule Position ===<br />
<br />
The granule position of an audio page encodes the total number of PCM samples in the stream up to and including the last fully-decodable sample from the last packet ''completed'' on that page. A page that is entirely spanned by a single packet (that completes on a subsequent page) has no granule position, and the granule position field MUST be set to the special value ’-1’ in two's complement.<br />
<br />
The granule position of an audio page is in units of PCM audio samples at a fixed rate of 48 kHz (per channel; a stereo stream’s granule position does not increment at twice the speed of a mono stream). It is possible to run a decoder at other sampling rates, but the format and this specification always count samples assuming a 48 kHz decoding rate.<br />
<br />
The duration of an Opus packet may be any multiple of 2.5 ms, up to a maximum of 120 ms. This duration is encoded in the TOC sequence at the beginning of each packet. The number of samples returned by a decoder corresponds to this duration exactly, even for the first few packets. For example, a 20 ms packet fed to a decoder running at 48 kHz will always return 960 samples. A demuxer can parse these TOC sequences to work backwards or forwards from a packet with a known granule position (i.e., the last packet completed on some page) in order to assign granule positions to every packet, or even every individual sample. The one exception is the last page in the stream, as described below.<br />
<br />
All other pages with completed packets after the first MUST have a granule position equal to the number of samples contained in packets that complete on that page plus the granule position of the most recent page with completed packets. This guarantees that a demuxer can assign individual packets the same granule position when working forwards as when working backwards. There must not be any gaps. In order to support capturing a stream that uses discontinuous transmission (DTX), an encoder SHOULD emit packets that explicitly request the use of Packet Loss Concealment (PLC) (i.e., with a frame length of 0, as defined in Section 3.2.1 of the Opus Specification) in place of the packets that were not transmitted.<br />
<br />
There is some amount of latency introduced during the decoding process, to allow for overlap in the MDCT modes, stereo mixing in the LP modes, and resampling, and the encoder will introduce even more latency (though the exact amount is not specified). Therefore the first few samples produced by the decoder do not correspond to any real, input audio, but are instead composed of padding inserted by the encoder to compensate for this latency. These samples must be stored and decoded, as Opus is an asymptotically convergent predictive codec, meaning the decoded contents of each frame depend on the recent history of decoder inputs. A 'pre-skip' field in the ID header signals the number of samples which should be skipped at the beginning of the stream. This provides sufficient history to the decoder so that it has already converged before the stream's output begins. It may also be used to perform sample-accurate cropping of existing encoded streams. This amount need not be a multiple of 2.5 ms, may be smaller than a single packet, or may span the contents of several packets.<br />
<br />
The PCM sample position is determined from the granule position using the formula<br />
<br />
'PCM sample position' = 'granule position' - 'pre-skip' .<br />
<br />
For example, if the granule position of the first page is 59971, and the pre-skip is 11971, then the PCM sample position of the last decoded sample from the first page is 48000. This may be converted into a playback time using the formula<br />
<br />
'PCM sample position'<br />
'playback time' = --------------------- .<br />
48000.0<br />
<br />
The initial PCM sample position before any samples are played is normally '0'. In this case, the PCM sample position of the first audio sample to be played starts at '1', because it marks the time on the clock ''after'' that sample has been played, and a stream that is exactly one second long has a final PCM sample position of '48000', as in the example here.<br />
<br />
Vorbis streams use a granule position smaller than the number of audio samples contained in the first page to indicate that some of those samples must be trimmed from the output. However, to do so it requires that the first page contains exactly two packets, in order to allow the decoder to perform PCM position adjustments before needing to return any PCM data. Opus uses the pre-skip mechanism for this purpose instead, since the encoder may introduce more than a single packet's worth of latency, and since very large packets in streams with a very large number of channels may not fit on a single page.<br />
<br />
The page with the 'end of stream' flag set MAY have a granule position that indicates the page contains less audio data than would normally be returned by decoding up through the final packet. This is used to end the stream somewhere other than an even frame boundary. The granule position of the most recent audio page with completed packets is used to make this determination, or '0' is used if there were no previous audio pages with a completed packet. The difference between these granule positions indicates how many samples to keep after decoding the packets that completed on the final page. The remaining samples are discarded. The number of discarded samples SHOULD be smaller than the number decoded from the last packet.<br />
<br />
The granule position of the first audio page with a completed packet MAY be larger than the number of samples contained in packets that complete on that page, however it MUST NOT be smaller, unless that page has the 'end of stream' flag set. Allowing a granule position larger than the number of samples allows the beginning of a stream to be cropped without rewriting the granule position of all the remaining pages. This means that the PCM sample position just before the first sample to be played may be larger than '0', but the PCM sample position relative to '0' should still be used for the purposes of synchronization when multiplexing with other logical streams. This does not affect the behavior of pre-skip: exactly 'pre-skip' samples should be skipped from the beginning of the decoded output, even if the initial PCM sample position is greater than zero.<br />
<br />
On the other hand, a granule position that is smaller than the number of decoded samples prevents a demuxer from working backwards to assign each packet or each individual sample a valid granule position, since granule positions must be non-negative. A decoder MUST reject as invalid any stream where the granule position is smaller than the number of samples contained in packets that complete on the first page with a completed packet, unless that page has the 'end of stream' flag set. It MAY defer this action until it decodes the last packet completed on that page. If that page has the 'end of stream' flag set, a demuxer can work forwards from the granule position '0', but MUST reject as invalid any stream where the granule position is smaller than the 'pre-skip' amount. This would indicate that more samples should be skipped from the initial decoded output than exist in the stream.<br />
<br />
==== ID Header ====<br />
<br />
0 1 2 3<br />
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1<br />
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+<br />
| 'O' | 'p' | 'u' | 's' |<br />
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+<br />
| 'H' | 'e' | 'a' | 'd' |<br />
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+<br />
| version = 1 | channel count | pre-skip |<br />
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+<br />
| original input sample rate in Hz |<br />
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+<br />
| output gain Q7.8 in dB | channel map | |<br />
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ :<br />
| |<br />
: optional channel mapping table... :<br />
| |<br />
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+<br />
<br />
Brief description of each field:<br />
<br />
- Magic signature: "OpusHead" (64 bits)<br />
- Version number (8 bits unsigned): 0x01 for this spec<br />
- Channel count 'c' (8 bits unsigned): MUST be > 0<br />
- Pre-skip (16 bits unsigned, little endian)<br />
- Input sample rate (32 bits unsigned, little endian): informational only<br />
- Output gain (16 bits, little endian, signed Q7.8 in dB) to apply when<br />
decoding<br />
- Channel mapping family (8 bits unsigned)<br />
-- 0 = one stream: mono or L,R stereo<br />
-- 1 = channels in vorbis spec order: mono or L,R stereo or ... or FL,C,FR,RL,RR,LFE, ...<br />
-- 2..254 = reserved (treat as 255)<br />
-- 255 = no defined channel meaning<br />
If channel mapping family > 0<br />
- Stream count 'N' (8 bits unsigned): MUST be > 0<br />
- Two-channel stream count 'M' (8 bits unsigned): MUST satisfy M <= N, M+N <= 255<br />
- Channel mapping (8*c bits)<br />
-- one stream index (8 bits unsigned) per channel (255 means silent throughout the file)<br />
<br />
<br />
Detailed definition of each field:<br />
<br />
* '''Magic signature'''<br />
The magic signature "OpusHead" allows codec identification and is human readable. Starting with 'Op' helps distinguish it from data packets, as this is an invalid TOC sequence.<br />
<br />
* '''Version'''<br />
The version number MUST always be '1' for this version of the encapsulation specification.<br />
<br />
Implementations SHOULD treat streams where the upper four bits of the version number match a recognized specification as backwards-compatible with that specification. That is, the version number can be considered split into "major" and "minor" version sub-fields, with changes to the "minor" sub-field in the lower four bits signaling compatible changes. For example, a decoder implementing this specification SHOULD accept any stream with a version number 15 or less, and SHOULD assume any stream with a version number 16 or greater is incompatible. The initial version '1' was chosen to keep implementations from relying on this byte as a null terminator for the OpusHead string.<br />
<br />
* '''Channel count''' 'c'<br />
The number of channels byte specifies the number of output channels (1...255) for this Ogg Opus stream.<br />
<br />
* '''Pre-skip'''<br />
This is the number of samples (at 48 kHz) to discard from the decoder output when starting playback, and also the number to subtract from a page's granule position to calculate its PCM sample position.<br />
<br />
When constructing cropped Ogg Opus streams, a pre-skip of at least 3840 samples (80 ms) is RECOMMENDED to ensure complete convergence.<br />
<br />
* '''Input sample rate'''<br />
This is ''not'' the sample rate to use for playback of the encoded data.<br />
<br />
Opus has a handful of coding modes, with internal audio bandwidths of 4, 6, 8, 12, and 20 kHz. Each packet in the stream may have a different audio bandwidth. Regardless of the audio bandwidth, the reference decoder supports decoding any stream at a sample rate of 8, 12, 16, 24, or 48 kHz. The original sample rate of the encoder input is not preserved by the lossy compression.<br />
<br />
An Ogg Opus player SHOULD select the playback sample rate according to the following procedure:<br />
* If the hardware supports 48 kHz playback, decode at 48 kHz,<br />
* else if the hardware's highest available sample rate is a supported rate, decode at this sample rate,<br />
* else if the hardware's highest available sample rate is less than 48 kHz, decode at the next higher supported rate and resample,<br />
* else decode at 48 kHz and resample.<br />
<br />
However, the 'input sample rate' field allows the encoder to pass the sample rate of the original input stream as metadata. This may be useful when the user requires the output sample rate to match the input sample rate. For example, a non-player decoder writing PCM format to disk might choose to resample the output audio back to the original input rate to reduce surprise to the user, who might reasonably expect to get back a file with the same sample rate as the one they fed to the encoder.<br />
<br />
A value of zero indicates 'unspecified'. Encoders SHOULD write the actual input rate or zero, but decoder implementations which do something with this field SHOULD take care to behave sanely if given crazy values (e.g. don't <br />
actually upsample the output to 10 MHz if requested).<br />
<br />
* '''Output gain'''<br />
This is a gain to be applied by the decoder. Virtually all players and media frameworks should apply it by default. If a player chooses to apply any volume adjustment or gain modification, such as the R128_TRACK_GAIN or a user-facing volume knob, the adjustment MUST be applied ''in addition'' to this output gain in order to achieve playback at the desired volume.<br />
<br />
An encoder SHOULD set the output gain to zero, and instead apply any gain prior to encoding, when this is possible and does not conflict with the user's wishes. The output gain should only be nonzero when the gain is adjusted after encoding, or when the user wishes to adjust the gain for playback while preserving the ability to recover the original signal amplitude.<br />
<br />
Although the output gain has enormous range (+/- 128 dB, enough to amplify inaudible sounds to the threshold of physical pain), most applications can only reasonably use a small portion of this range around zero. The large range serves in part to ensure that gain can always be losslessly transferred between OpusHead and R128_TRACK_GAIN (see below) without saturating.<br />
<br />
The gain is the 20 log<sub>10</sub> ratio of output to input sample values to be applied to the decoder output. E.g. <code>sample *= pow(10, header.gain/(20.*256))</code> where header.gain is the raw 16 bit Q7.8 value from the header.<br />
<br />
* '''Channel mapping family'''<br />
This byte indicates the order and semantic meaning of the various channels encoded in each Opus packet. <br />
<br />
Each possible value of this byte indicates a ''mapping family'', which defines a set of allowed numbers of channels, and the ordered set of channel names for each allowed number of channels. Currently there are three defined mapping families, although more may be added:<br />
<br />
* Family 0 (RTP mapping)<br />
** Allowed numbers of channels: 1 or 2<br />
** 1 channel: monophonic (mono)<br />
** 2 channels: stereo (left, right)<br />
** '''Special mapping''': this channel mapping value also indicates that the contents consists of a single Opus stream that is stereo if and only if c==2, with stream index 0 mapped to channel 0, and (if stereo) stream index 1 mapped to channel 1. When the channel mapping byte has this value, no further fields are present in OpusHead.<br />
* Family 1 ([http://www.xiph.org/vorbis/doc/Vorbis_I_spec.html#x1-800004.3.9 Vorbis channel order])<br />
** Allowed numbers of channels: 1 ... 8<br />
** Channel meanings depend on the number of channels, see the Vorbis mapping for details.<br />
* Family 255 (no defined channel meaning)<br />
** Allowed numbers of channels: 1...255<br />
** Channels are unidentified. General-purpose players SHOULD NOT attempt to play these streams, and offline decoders MAY deinterleave the output into separate PCM files, one per channel. Decoders SHOULD NOT produce output for channels mapped to stream index 255 (pure silence) unless they have no other way to indicate the index of non-silent channels.<br />
<br />
The remaining channel mapping families (2...254) are reserved. A decoder encountering a reserved mapping byte should act as though the mapping byte is 255.<br />
<br />
An Ogg Opus player MUST play any Ogg Opus stream with a channel mapping family of 0 or 1, even if the number of channels does not match the physically connected audio hardware. Players SHOULD perform channel mixing to increase or reduce the number of channels as needed.<br />
<br />
* '''Stream count''' 'N'<br />
This field indicates the total number of streams so the decoder can correctly parse the packed Opus packets inside the Ogg packet.<br />
<br />
For channel mapping family 0, this value defaults to 1, and is not coded.<br />
<br />
A multi-channel Opus file is composed of one or more individual Opus streams, each of which produce one or two channels of decoded data. Each Ogg packet contains one Opus packet from each stream. The first N-1 Opus packets are packed using the self-delimiting framing from Appendix B of the Opus Specification. The remaining Opus packet is packed using the regular, undelimited framing from Section 3 of the Opus Specification. All the Opus packets in a single Ogg packet MUST be constrained to produce the same number of decoded samples. A decoder SHOULD treat any Opus packet whose duration is different from that of the first Opus packet in an Ogg packet as if it were an Opus packet with an illegal TOC sequence.<br />
<br />
* '''Two-channel stream count''' 'M'<br />
Describes the number of streams whose decoders should be configured to produce two channels. This must be no larger than the number of total streams.<br />
<br />
For channel mapping family 0, this value defaults to c-1 (i.e., 0 for mono and 1 for stereo), and is not coded.<br />
<br />
Each packet in an Opus stream has an internal channel count of 1 or 2, which can change from packet to packet. This is selected by the encoder depending on the bitrate and the contents being encoded. The original channel count of the encoder input is not preserved by the lossy compression.<br />
<br />
Regardless of the internal channel count, any Opus stream may be decoded as mono (a single channel) or stereo (two channels) by appropriate initialization of the decoder. The "two-channel stream count" field indicates that the first M Opus decoders should be initialized in stereo mode, and the remaining N-M decoders should be initialized in mono mode. The total number of decoded channels (M+N) MUST be no larger than 255, as there is no way to index more channels than that in the channel mapping.<br />
<br />
* '''Channel mapping'''<br />
Contains one index per output channel indicating which decoded channel should be used. If the index is less than 2*M, the output MUST be taken from decoding stream (index/2) as stereo and selecting the left channel if index is even, and the right channel if index is odd. If the index is 2*M or larger, the output MUST be taken from decoding stream (index-M) as mono. As a special case, an index of 255 means that the corresponding output channel MUST contain pure silence.<br />
<br />
For channel mapping family 0, the first index defaults to 0, and if c==2, the second index defaults to 1. Neither index is coded.<br />
<br />
The number of output channels (c) is not constrained to match the number of decoded channels (M+N). A single index MAY appear multiple times, i.e., the same decoded channel may be mapped to multiple output channels. Some decoded channels might not be assigned to any output channel, as well.<br />
<br />
==== Comment Header ====<br />
<br />
- 8 byte 'OpusTags' magic signature (64 bits)<br />
- The remaining data follows the vorbis-comment header design used in OggVorbis (without the "framing-bit"), OggTheora, and Speex:<br />
* Vendor string (always present).<br />
** 4-byte little-endian length field, followed by length bytes of UTF-8 vendor string.<br />
* TAG=value metadata strings (zero or more).<br />
** 4-byte little-endian string count.<br />
** Count strings consisting of 4-byte little-endian length and length bytes of UTF-8 string in "tag=value" form.<br />
<br />
One new comment field is introduced for Ogg Opus:<br />
R128_TRACK_GAIN=-573 <br />
representing the volume shift needed to normalize the track's volume. The gain is a Q7.8 fixed point number in dB, as in the OpusHead "output gain" field. This field is similar to the [[VorbisComment#Replay_Gain|REPLAYGAIN_TRACK_GAIN field in Vorbis]], although the normal volume reference is the [http://tech.ebu.ch/loudness EBU-R128] standard.<br />
<br />
An Ogg Opus file MUST NOT have more than one such field, and if present its value MUST be an integer from -32768 to +32767 inclusive, represented in ASCII with no whitespace. If present, it MUST correctly represent the R128 normalization gain (relative to the OpusHead output gain). If a player chooses to make use of the TRACK_GAIN, it MUST be applied ''in addition'' to the OpusHead output gain. If an encoder populates the TRACK_GAIN field, and the output gain is not otherwise constrained or specified, the encoder SHOULD write the R128 gain into the OpusHead output gain and write "R128_TRACK_GAIN=0". If a tool modifies the OpusHead "output gain" field, it MUST also update or remove the R128_TRACK_GAIN comment field.<br />
<br />
There is no comment field corresponding to Replaygain's ALBUM_GAIN; that information should instead be stored in the OpusHead 'output gain' field.<br />
<br />
To avoid confusion with multiple normalization schemes, an OpusTags packet SHOULD NOT contain any of the REPLAYGAIN_TRACK_GAIN, REPLAYGAIN_TRACK_PEAK, REPLAYGAIN_ALBUM_GAIN, or REPLAYGAIN_ALBUM_PEAK fields.<br />
<br />
== Other Implementation Notes ==<br />
<br />
When seeking within an Ogg Opus stream, the decoder should start decoding (and discarding the output) at least 3840 samples (80 ms) prior to the seek point in order to ensure that the output audio is correct at the seek point.<br />
<br />
Technically valid Opus packets can be arbitrarily large due to the padding format, although the amount of non-padding data they can contain is bounded. These packets may be spread over a similarly enormous number of Ogg pages. Encoders SHOULD use no more padding than required to make a variable bitrate (VBR) stream constant bitrate (CBR). Decoders SHOULD avoid attempting to allocate excessive amounts of memory when presented with a very large packet. The presence of an extremely large packet in the stream could indicate a potential memory exhaustion attack or stream corruption. Decoders should reject a packet that is too large to process, and print a warning message.<br />
<br />
In an Ogg Opus stream, the largest possible valid packet that does not use padding has a size of (61,298*N - 2) bytes, or about 60 kB per Opus stream. With 255 streams, this is 15,630,988 bytes (14.9 MB) and can span up to 61,298 Ogg pages, all but one of which will have a granulepos of -1. This is of course a very extreme packet, consisting of 255 streams, each containing 120 ms of audio encoded as 2.5 ms frames, each frame using the maximum possible number of bytes (1275) and stored in the least efficient manner allowed (a VBR code 3 Opus packet). Even in such a packet, most of the data will be zeros, as 2.5 ms frames, which are required to run in the MDCT mode, cannot actually use all 1275 bytes. The largest packet consisting entirely of useful data is (15,326*N - 2) bytes, or about 15 kB per stream. This corresponds to 120 ms of audio encoded as 10 ms frames in either LP or Hybrid mode, but at a data rate of over 1 Mbps, which makes little sense for the quality achieved. A more reasonable limit is (7,664*N - 2) bytes, or about 7.5 kB per stream. This corresponds to 120 ms of audio encoded as 20 ms stereo MDCT-mode frames, with a total bitrate just under 511 kbps (not counting the Ogg encapsulation overhead). With N=8, the maximum useful number of streams for the channel meanings currently defined by mapping family 1, this gives a maximum packet size of 61,310 bytes, or just under 60 kB. This is still quite conservative, as it assumes each output channel is taken from one decoded channel of a stereo packet. An implementation could reasonably choose any of these numbers for its internal limits.<br />
<br />
== Test Vectors ==<br />
<br />
* [[OggOpus/testvectors|Planned test vectors for OggOpus]]<br />
* Opus test vectors</div>Gmaxwellhttps://wiki.xiph.org/index.php?title=Vorbis&diff=14152Vorbis2013-05-20T07:43:06Z<p>Gmaxwell: Reverted edits by Michael2013 (talk) to last revision by Martin.leese</p>
<hr />
<div>'''Vorbis''' is a patent-clear, fully open, general purpose audio encoding format standard that rivals or even surpasses the 'upcoming' generation of proprietary codecs ([[Wikipedia:Advanced Audio Coding|AAC]] and [[Wikipedia:TwinVQ|TwinVQ]], also known as VQF). There is no raw Vorbis stream defined, instead the Vorbis codec is typically used in the [[Ogg]] container format for audio files. Because for a long time the Ogg container was quasi exclusive for Vorbis people often refer to it as 'Ogg Vorbis'. Later the FLAC audio codec as well as the video codecs Theora and Dirac began to be used inside Ogg too. In 2010 the [[WebM]] format was defined using the Vorbis codec inside the WebM container.<br />
<br />
libvorbis, a BSD-licensed source implementation of Vorbis as a library is available; See the [http://xiph.org/vorbis/ Ogg Vorbis page] for documentation, downloads and distribution terms.<br />
<br />
Many hard- and software players support Ogg Vorbis; see [http://www.vorbis.com/ vorbis.com] or the links below for a list of all the players we know about.<br />
<br />
== More information ==<br />
<br />
* [[Vorbis Hardware]]: List of hardware-players supporting Ogg Vorbis<br />
* [[Vorbis Software Players]]: List of media players that can play Ogg Vorbis<br />
* [[Vorbis Software Encoders]]: List of libvorbis frontends<br />
* [[Vorbis Decoders]]: List of decoders (e.g. Xiph, Tremor, JOrbis, etc)<br />
* [[Vorbis Encoders]]: List of encoders (e.g. Xiph, aoTuV, GT, vorbis-java)<br />
* [[Vorbis-tools]]: Reference tools maintained by Xiph.org<br />
* [[Games that use Vorbis]]: List of games using Ogg Vorbis<br />
* [[VorbisStreams]]: Stations streaming with the [[Vorbis]] codec<br />
* [[VorbisCasts]]: Audiocasts publishing Ogg [[Vorbis]] feeds<br />
<br />
== External links ==<br />
<br />
* [http://www.vorbis.com/ Vorbis.com]<br />
* [[Wikipedia: Vorbis]]<br />
* [http://www.rjamorim.com/test/multiformat128/results.html 128kbps public listening test]<br />
* [http://www.hydrogenaudio.org/forums/index.php?showtopic=35438 80kbps personal listening test]<br />
* [http://www.hydrogenaudio.org/forums/index.php?showtopic=36465 180kbps personal listening test with classical music]<br />
* [http://www.maresweb.de/listening-tests/mf-128-1/results.htm 128kbps public listening test]<br />
<br />
[[Category:Vorbis]]</div>Gmaxwellhttps://wiki.xiph.org/index.php?title=MediaWiki:Spam-blacklist&diff=14145MediaWiki:Spam-blacklist2013-05-15T02:49:04Z<p>Gmaxwell: </p>
<hr />
<div> # External URLs matching this list will be blocked when added to a page.<br />
# This list affects only this wiki; refer also to the global blacklist.<br />
# For documentation see http://www.mediawiki.org/wiki/Extension:SpamBlacklist<br />
#<!-- leave this line exactly as it is --> <pre><br />
#<br />
# Syntax is as follows:<br />
# * Everything from a "#" character to the end of the line is a comment<br />
# * Every non-blank line is a regex fragment which will only match hosts inside URLs<br />
hotel-discount\.com<br />
paydayloans-trust\.co\.uk<br />
mostrawildt\.com<br />
wikin\.com<br />
infinitycommerce\.co\.uk<br />
senuke-xcr-discount\.com<br />
mooncityz\.com<br />
gcagint\.com<br />
groupcow\.com<br />
synqk\.com<br />
organicdata\.com\.au<br />
cameronmorgan\.co\.uk<br />
singleme\.com<br />
Menuggs\.org<br />
casinosdiary\.com<br />
abercrombieaustralia\.com<br />
weightsbenchtraining\.co\.uk<br />
thedegreeexperts\.com<br />
xtremeonline\.com\.au<br />
xstretchmarks\.com<br />
\.casinobonus24\.com<br />
\.mydietarea\.com<br />
\.swiftmoney\.org\.uk<br />
\.bringexbackblog\.com<br />
registry-repair-tools\.net<br />
automobile-insurance\.com<br />
bestentrypoint\.com<br />
banansearch\.com<br />
\.pavtube\.com<br />
\.videos-phone\.net<br />
\.chatixdating\.com<br />
\.teensay\.com<br />
\.cheappoolproducts\.com<br />
\.lease-a-seo\.com<br />
\.totalscreenrecorder\.com<br />
\.mychristianheels\.com<br />
\.mbtshoesupply\.com<br />
\.healthmuscle\.com<br />
\.official-canadian-pharmacy\.org<br />
\.customessaywritinghelp\.com<br />
\.boostbrand\.org<br />
\.promoteland\.com<br />
\.uk-dissertation\.com<br />
\b1000cores\.com<br />
\b100anosgalo\.blogspot\.com<br />
\b100cal\.ex-br\.com <br />
\b100diasdesandero\.blogspot\.com <br />
\b11onze\.com <br />
\b123imoveis\.com\.br <br />
\b123people\.it<br />
\b13studiohost\.com<br />
\b1clique\.blogspot\.com<br />
\b2hand\.googet\.eu<br />
\b2jump2\.com<br />
\b4shared\.com<br />
\b4shared\.com\/file<br />
\b55chan\.org<br />
\b91rock\.com\.br<br />
\baapaaa\.blogspot\.com<br />
\babctorre\.xpg\.com\.br<br />
\babdieldamon\.wordpress\.com <br />
\baberturas-de-novelas\.blogspot\.com<br />
\babreloja\.com<br />
\babrolhos\.net<br />
\bacademiadovinho\.com\.br<br />
\bacademiagraciebutanta\.com\.br/<br />
\bacademiarafaelleitao\.blogspot\.com<br />
\bacaminhodaonde\.blogspot\.com<br />
\bacao-humana\.blogspot\.com<br />
\bacheibr\.com<br />
\bacidosnucleicos\.110mb\.com <br />
\badhentai\.blogspot\.com<br />
\badministracaoegestao\.com\.br<br />
\badororomances\.com<br />
\baevolut\.com<br />
\bafazenda\.blogger\.com\.br<br />
\bafricanamericantravelagency\.com <br />
\bafricarte\.it<br />
\bag4\.com\.br<br />
\bageanbrasil\.com\.br<br />
\bagenciaar\.com\.br<br />
\bagenciasolo\.com\.br<br />
\bagenciaspin\.com<br />
\bagoravale\.com<br />
\bagoravale\.com\.br<br />
\bagoravale\.net<br />
\bagoravale\.org<br />
\bagribusinessNews\.com <br />
\bagrogemeos\.com\.br<br />
\bagruta\.com\.br<br />
\baguasemendadas\.com<br />
\bahsforum\.com<br />
\baideialibertaria\.blogspot\.com<br />
\bairsoftbrasil\.com<br />
\balabrasil\.com <br />
\balbacete\.com\.br <br />
\balemanja\.org <br />
\balephradiestesia\.com\.br<br />
\balexandre\.eletrica\.ufu\.br<br />
\balgumapoesia\.com\.br<br />
\balimentacaosaudavel\.net<br />
\baliviodaalma\.com\.br<br />
\ballcenter\.com\.br<br />
\ballservice\.cnt\.br<br />
\ballsexhub\.com<br />
\balojamentos-online\.com <br />
\balojamiento\.cl<br />
\baltamiroborges\.blogspot\.com<br />
\balternativamedicina\.com<br />
\balvinhopatriota\.com\.br<br />
\bamanda-rossi\.blogspot\.com<br />
\bamazon\.ca<br />
\bamazon\.co\.jp<br />
\bamazon\.co\.uk<br />
\bamazon\.com\/gp\/product<br />
\bamazon\.de<br />
\bamazon\.fr<br />
\bambienteinteiro\.org\.br<br />
\bamericanas\.com\.br\/AcomProd<br />
\bamericanas\.com\.br\/cgi\-bin<br />
\bamericanas\.com\.br\/cgi-bin<br />
\bamericanas\.com\.br\/prod<br />
\bamigo\.kit\.net<br />
\bamigoskids\.blogspot\.com<br />
\bamilcorretora\.com\.br<br />
\bamoisatkmaisnick\.blogspot\.com<br />
\bamoresexogratis\.com<br />
\bamostrasgratis\.org<br />
\ban\.locaweb\.com\.br\/Webindependente<br />
\banalistati\.com<br />
\banamacedoescritora\.blogs\.sapo\.pt<br />
\bandreabrasilmadrid\.es <br />
\bandremafei\.com<br />
\bandrologia\.cjb\.net<br />
\bangelfire\.com\/dc/evangelhoespirita<br />
\banimavita\.com\.br<br />
\banimetnt\.com\.br<br />
\banmtv\.com\.br<br />
\bannamarya\.com\.br<br />
\banticensura\.blogspot\.com<br />
\banunciautos\.com\.br<br />
\banunciosgv\.com<br />
\bapagaodatelefonica\.vai\.la<br />
\bapfertilidade\.org <br />
\bapi\.ning\.com<br />
\bappartamentiischia\.it<br />
\bappliedwingchun\.com\.br<br />
\barabesq\.com\.br<br />
\barabian\.vila\.bol\.com\.br<br />
\barabian\.vilabol\.com\.br<br />
\barabians\.vila\.bol\.com\.br<br />
\barabians\.vilabol\.com\.br<br />
\baracaju-se\.com\.br <br />
\barcondicionado-split\.com<br />
\barenatibia\.com <br />
\bargentina\.ar<br />
\bargentinatolet\.com <br />
\bargentinawinetours\.com<br />
\bargentour\.com<br />
\bargilaviva\.blogspot\.com<br />
\barqueologiaegipcia\.zip\.net<br />
\barquitectura\-sustentavel\.blogspot\.com<br />
\barquitectura-sustentavel\.blogspot\.com<br />
\barquivosbt\.blogspot\.com<br />
\barroxe\.net<br />
\bartbr\.com\.br<br />
\bartedb\.com\.br<br />
\bartenet\.com\.br<br />
\bartesmarciaishoje\.blogspot\.com<br />
\barthonline\.com\.br\/clouds/<br />
\barts\.lojadeluxo\.com<br />
\bas\-chiquititas\.blogspot\.com<br />
\basdf\.com\.br<br />
\basenergiasrenovaveis\.blogspot\.com<br />
\basonrisanordica\.com<br />
\basterdomus\.com\.br<br />
\bastore\.amazon\.com<br />
\bathoscompanny\.com\.br<br />
\batitlan\.net<br />
\batividadesfisicas\.com\.br<br />
\batmaneditora\.com\.br <br />
\batortonycorreia\.bloguepessoal\.com<br />
\baudiencia\.zip\.net<br />
\baudienciabrasileiradetv.wordpress.com<br />
\baudienciadatv\.wordpress\.com<br />
\baudienciadetv\.blogspot\.com<br />
\baudienciaemdestaque\.blogspot\.com<br />
\baudiolivro\.net\.br<br />
\baulalamontera\.com<br />
\baustria-travel\.biz<br />
\bautolatinaclube\.cjb\.net<br />
\bautosp\.com\.br<br />
\bavengedsevenfold\-portugal\.blogspot\.com<br />
\baverdadesobreagnosis\.com\.br<br />
\bavrilbandaids\.com\/forums<br />
\bavrillavigne-pics\.com<br />
\bavril-media\.blogspot\.com<br />
\bavrilmidia\.com\/forum<br />
\bawkwardish\.com<br />
\bbabywallpaper\.com\.br<br />
\bbaixartudogratis\.info<br />
\bbaixartudogratis\.info<br />
\bbalduran\.com\.br<br />
\bbandvoip\.com\.br<br />
\bbanheiraspa\.com\.br<br />
\bbaraogeraldo\.com\.br<br />
\bbarcelos\.com<br />
\bbarcoavista\.blogspot\.com<br />
\bbarrabravas\.net<br />
\bbarradosahy\.net<br />
\bbatalhadosguararapes\.com\.br<br />
\bbatomdamoda\.webnode\.com\.br<br />
\bbazardaspalavras\.blogspot\.com<br />
\bbazarpop\.com\.br<br />
\bbeatrixmonteiro_fas.blogs\.sapo\.pt<br />
\bbeatriz_monteiro_faclube\.blogs.\sapo\.pt<br />
\bbeatrizmonteiro_faclube\.blogs.\sapo\.pt<br />
\bbebidaboa\.com\.br<br />
\bbelem-pa\.com\.br<br />
\bbelezapt\.com<br />
\bbelohorizonte-mg\.com\.br<br />
\bbemmequercestas\.com<br />
\bben10thevideogame\.com<br />
\bben10toys\.net<br />
\bben10toys\.net\/Backup\/images<br />
\bben10ultimatealien3\.blogspot\.com<br />
\bbeneklee\.com<br />
\bbenzisobrenomes\.com<br />
\bbethynha\.com\.br<br />
\bbgojogos\.blog\.terra\.com\.br<br />
\bbhdog\.com\.br<br />
\bbiagra\.com\.br <br />
\bbibliaonline\.com\.br<br />
\bbibliaonline\.iguga\.com <br />
\bbibliojunior\.ufsc\.br<br />
\bbigmarkett\.com<br />
\bbigshowdownloads\.blogspot\.com<br />
\bbio-combustivel\.blogspot\.com<br />
\bbiografia\.wiki\.br<br />
\bbioinfo\.com\.br<br />
\bbiomech\.com\.br<br />
\bbipol-art\.com<br />
\bbisotto\.com\.br<br />
\bbizarriceslol\.com<br />
\bblackminton\.pt<br />
\bblog.antonioplanet\.net<br />
\bblogaritmox\.blogspot\.com<br />
\bblogcmmi\.com\.br<br />
\bblogdamostra\.blog\.uol\.com\.br<br />
\bblogdoconsignado\.com\.br<br />
\bblogdohiellevy\.com\.br<br />
\bblogfajuta\.blogspot\.com<br />
\bblogdorasta\.wordpress\.com<br />
\bblog-escoteiro\.blogspot\.com<br />
\bbloglouco\.com<br />
\bblogs\.abril\.com\.br\/novidadesdatv<br />
\bblogsobrenovelas\.blogspot\.com <br />
\bblumenau-sc\.com\.br<br />
\bbm-beatrizmonteiro\.blogs\.sapo\.pt<br />
\bbneinoach\.com\.br<br />
\bboavista-rr\.com\.br<br />
\bbodybuildingxl\.com<br />
\bboingdragon\.com <br />
\bbombinhas\.com<br />
\bboxtv\.hd1\.com\.br<br />
\bbr\.desert-operations\.com\/?recruiter=41b1<br />
\bbr\.geocities\.com\/amandinha_band888\/links\/tiburon_coupe_anteriores2\.html<br />
\bbr\.geocities\.com\/khentzu/<br />
\bbr2\.biz<br />
\bbrasaoweb\.com<br />
\bbrasilcombate\.com\.br<br />
\bbrasilcombate\.com\.br<br />
\bbrasildemochila\.com<br />
\bbrasildestinos\.com\.br<br />
\bbrasilfas\.blogspot\.com<br />
\bbrasiliacac\.com<br />
\bbrasilimperial\.org\.br\/verdade3.htm<br />
\bbrasilinformacao\.com\.br<br />
\bbrasilturismo\.com<br />
\bbrazilcartoon\.com<br />
\bbrazilgallery\.com\.br<br />
\bbrejas\.com\.br <br />
\bbrekground\.com\/wiiground<br />
\bbrincando\.no\.sapo\.pt<br />
\bbrinquedosdepapel\.com\.br<br />
\bbrofficeparaleigos\.blogspot\.com<br />
\bbronquite\.com<br />
\bbruxaria\.org<br />
\bbrvida\.org<br />
\bbssilveira.blogspot.com<br />
\bbulledebeaute\.wordpress\.com<br />
\bburionline\.wordpress\.com<br />
\bbuscamp3\.com\.br<br />
\bbuscaporsaude\.com\.br<br />
\bbuxput\.com <br />
\bbwin\.com <br />
\bbwin\.site\.vu <br />
\bcabalahoje\.blogspot\.com<br />
\bcabanhabutia\.com\.br<br />
\bcabecadecuia\.com<br />
\bcabofrio-rj\.com\.br<br />
\bcachacagabriela\.com\.br<br />
\bcaipira\-sp\.com\.br<br />
\bcajamarnet\.com\.br<br />
\bcalcatrilhos\.henyah\.com<br />
\bcalcule\.net<br />
\bcamaragibeonline\.com<br />
\bcamarotedasestrelas\.com\.br<br />
\bcamboriu\.org<br />
\bcambralha1\.blogspot\.com<br />
\bcamillacastro\.org<br />
\bcamillacastro\.org\/angelinajolie/<br />
\bcamiloaparecido\.blog\.terra\.com\.br <br />
\bcaminhositaipu\.com\.br<br />
\bcampogrande-ms\.com\.br <br />
\bcanalfreak\.com\.br<br />
\bcanalmatriz\.zip\.net<br />
\bcanalmax\.com\.br<br />
\bcanarilalmada\.com<br />
\bcanchim\.com\.br<br />
\bcandycandyanns\.iespana\.es<br />
\bcanilchinador\.com\.br<br />
\bcanilpequenoencanto\.webng\.com <br />
\bcanilvilabrasil\.com\.br<br />
\bcanoas-rs\.com\.br<br />
\bcaonanet\.blogspot\.com<br />
\bcarcasse\.com<br />
\bcardiologia\.com\.br<br />
\bcarlinha\.com\.br<br />
\bcarloscostaaqui\.blogspot\.com<br />
\bcarlosfran\.com<br />
\bcarnaporto2010\.com\.br<br />
\bcarnevalli\.googlepages\.com<br />
\bcarrosderua\.com\.br<br />
\bcartasdecredito\.com\.br <br />
\bcartoesonline\.com\.br<br />
\bcartuningrevolution\.com <br />
\bcasadanutricao\.com\.br<br />
\bcasadasprimas\.wordpress\.com <br />
\bcasadastiras\.blogspot\.com<br />
\bcasamentobrasil\.com\.br<br />
\bcasasnolago\.com\.br<br />
\bcasinoglamour\.com<br />
\bcastlelords\.blogspot\.com<br />
\bcastlelords\.net <br />
\bcauas\.blogspot\.com<br />
\bcavaleiroconde\.blogspot\.com<br />
\bcavalosarabes\.vilabol\.uol\.com\.br<br />
\bccdb\.gea\.nom\.br<br />
\bcdjapan\.co\.jp<br />
\bceliaco\.com\.br<br />
\bcelsovenicius\.com\/<br />
\bcenatecbrasil\.com\.br<br />
\bcenterpokemon\.blogspot\.com<br />
\bcentraldosexo\.com<br />
\bcentraliza\.com\.br<br />
\bcentralparaiso\.com<br />
\bcentric\.tv\.br<br />
\bcentrodemoda\.com<br />
\bcentrofilosoficodokungfu\.com\.br<br />
\bcertidex\.com\.br<br />
\bcervejasdomundo\.com<br />
\bcescapi\.com<br />
\bceucabrscanoas\.com\.br\/documents\/blog_2\.php<br />
\bcfgigolo\.com<br />
\bchanzon\.com<br />
\bchaos\.com\/product<br />
\bcharles\.art\.br<br />
\bcharmed\-news\.blogspot\.com<br />
\bcharmedgallery\.blogspot\.com<br />
\bchaves\.blogs\.sapo\.pt<br />
\bchavesantiga\.blogs\.sapo\.pt<br />
\bcheckupgeriatrico\.com\.br <br />
\bchihuahua\.vet\.br<br />
\bchiquititas\-online\.pt\.vc<br />
\bchiquititassic\.blogs\.sapo\.pt<br />
\bchrislimatop\.com\.br<br />
\bchrome-center\.net<br />
\bchuteperfeito\.com\.br<br />
\bciberdata\.com<br />
\bciberespaconaescola\.blogspot\.com<br />
\bcidade\.alterosa\.net<br />
\bcidadebelojardim\.blogspot\.com<br />
\bcidadedebocaina\.com <br />
\bcidade-lagoa\.com<br />
\bcidade-lisboa\.com<br />
\bcidadespaulistas\.com\.br<br />
\bcidadewebrock\.com\.br<br />
\bcimento\.org<br />
\bcimentonline\.com\.br<br />
\bcincoquartosdelaranja\.blogspot\.com<br />
\bcindylauperbrasil\.com<br />
\bcinemabizarre-brasil\.go-board\.com\/forum\.htm <br />
\bcinemacomrapadura\.com\.br\/filmes\/imgs\/<br />
\bcircolivenetifainors\.blogspot\.com<br />
\bcircuitodosamba\.net<br />
\bcirurgia\.com\.br<br />
\bcirurgia\-plastica\.com<br />
\bclangamesbr\.net<br />
\bclansnqp\.com<br />
\bclaradilucenna\.blogspot\.com<br />
\bclassificados\.wegoo\.com\.br<br />
\bclassificadosregional\.com\.br <br />
\bclicador\.com<br />
\bclickgalera\.com\.br<br />
\bclickglobinho\.zip\.net<br />
\bclickjogos\.uol\.com\.br<br />
\bclicktvglobinho\.blogspot\.com<br />
\bclickviagens\.com<br />
\bclicrbs\.com\.br\/kzuka<br />
\bclinicadedermatologia\.com\.br<br />
\bclinicaleger\.com\.br<br />
\bclinicamedicambdoctor\.blogspot\.com<br />
\bclone\.aguiar\.googlepages\.com<br />
\bclubedariqueza\.com\.br<br />
\bclubedascelebridades\.com<br />
\bclubedologusepointer\.com\.br<br />
\bclubedosbeberroes\.com\.br<br />
\bclube-morangos\.com<br />
\bclubesafobrasil\.com<br />
\bclubevencedor\.com\.br<br />
\bclubpinguimcp\.blogspot\.com<br />
\bcobolware\.com<br />
\bcocadaboa\.com\.br<br />
\bcodigofonte\.com\.br<br />
\bcoelhodafonseca\.com\.br<br />
\bcoisasdoenio\.blogspot\.com <br />
\bcoisasinteressantes\.com\.br <br />
\bcolocanoidolos\.blogspot\.com<br />
\bcoluna\.com<br />
\bcomlines\.com\.br<br />
\bcommonpurpose\.org<br />
\bcomobaixar\.org<br />
\bcomofazerumcurriculum\.com<br />
\bcomosairdoaluguel\.zip\.net<br />
\bcomprarcreatina\.org<br />
\bcomprasnasantaifigenia\.com\.br<br />
\bcomunidadefb\.com\.br<br />
\bcomunidades\.net<br />
\bconceitozen\.com\.br<br />
\bconectiomg\.com\.br<br />
\bconexaodinheiro\.com<br />
\bconfrariadechaves\.net<br />
\bconfrariadecinema\.com\.br<br />
\bconheca-me\.com <br />
\bconheceroislam\.com\.br <br />
\bconnectionworld\.org<br />
\bconocereislaverdad\.org<br />
\bconselheira\.virtual\.zip\.net<br />
\bconsultadetaro\.com<br />
\bconsultarpagerank\.com\.br<br />
\bconsultarpagerrank\.com\.br<br />
\bconsultorio\.com\.br<br />
\bcontabilbr\.com<br />
\bcontadoresgratis\.web-kit\.org <br />
\bcontaouro\.com\.br<br />
\bcontedesign\.com\.br<br />
\bcontente\.blogspot\.com<br />
\bconteudoesportivo\.com\.br<br />
\bcontextojuridico\.blogspot\.com<br />
\bcontraditorium\.com<br />
\bcontrapontoeditora\.com\.br<br />
\bcooperativismodecredito\.blogspot\.com<br />
\bcooppr\.med\.br<br />
\bcoroascaseiras\.net<br />
\bcorreiocarioca\.com\.br<br />
\bcorreionatalino\.com\.br<br />
\bcortesepenteados\.com\.br<br />
\bcosmeticosharimar\.blogspot\.com/<br />
\bcosmetologiaeestetica\.com\.br<br />
\bcosplaybr\.com\.br<br />
\bcostaverdenoticias\.com<br />
\bcpcpbr\.tk<br />
\bcpf\.adv\.br<br />
\bcrazyshake\.net<br />
\bcrazyvideo\.blog\.terra\.com\.br<br />
\bcrazyvideo\.no\.comunidades\.net<br />
\bcreatuforo\.com<br />
\bcredito-info\.com<br />
\bcriacionismoevidencias\.blogspot\.com <br />
\bcriandocalopsitas\.webs\.com<br />
\bcriefuturos\.com\.br<br />
\bcristianor7\.com<br />
\bcristianoronaldofan\.blogs\.sapo\.pt<br />
\bcrm2\.com\.br<br />
\bcsonlinebr\.net<br />
\bctviva\.com\.br<br />
\bculturach\.com\.br<br />
\bcupim\.net\.br<br />
\bcursos24horas\.com\.br <br />
\bcursoseaulas\.com\.br<br />
\bcursosnocd\.com\.br<br />
\bcwhostnet\.com<br />
\bcyanidehappinesstraduzidos\.blogspot\.com<br />
\bcybercook\.com\.br<br />
\bcygets\.googlepages\.com\/teste_digitacao_concurso<br />
\bdabaixadaaomonumental\.blogspot\.com<br />
\bdabusca\.blogspot\.com<br />
\bdanceadois\.com\.br<br />
\bdancecom\.com\.br<br />
\bdanielcoelho\.com\.br<br />
\bdantasplanosdesaude\.com\.br<br />
\bda-pay\.com<br />
\bdashofer\.pt<br />
\bdatasul\.com\.br\/franquias<br />
\bdatasulecm\.com\.br<br />
\bdauri\.com\.br<br />
\bdbzmangalevels\.homestead\.com<br />
\bddl\.name/<br />
\bdebate\.com\.br<br />
\bdedetizacao\.bio\.br<br />
\bdefesabrasil\.com<br />
\bdelta-cafes\.pt<br />
\bdemocracia-fraudada\.com<br />
\bdentistas\.com\.br<br />
\bdepilacao-definitiva\.blogspot\.com<br />
\bdeputadocorauci\.com\.br<br />
\bdesign\.com\.br<br />
\bdesignatento\.com<br />
\bdesignbr\.ning\.com<br />
\bdesigndictionary\.co\.uk <br />
\bdestruindopalavras\.wordpress\.com<br />
\bdetetiveparticular\.hpgvip\.ig\.com\.br<br />
\bdetetive-particular\.org <br />
\bdetetive--particular\.org<br />
\bdetetiveparticular-saopaulo\.com<br />
\bdetetiveparticularsaopaulo\.hpgvip\.ig\.com\.br <br />
\bdetetivesnobrasil\.com\.br<br />
\bdevaneiosdesintericos\.blogspot\.com<br />
\bdeveloperslinux\.com <br />
\bdiariodosartistas\.com<br />
\bdiariosantee\.com\.br<br />
\bdicas-de-presente\.com<br />
\bdicionariodesimbolos\.com\.br<br />
\bdicionario-portugues\.com<br />
\bdictionary\.valodas\.com<br />
\bdieta-certa\.com<br />
\bdietafacil\.awardspace\.com<br />
\bdigicurso\.com <br />
\bdigidelta-software\.com<br />
\bdigipronto\.com\.br<br />
\bdigitrace\-portugal\.com<br />
\bdignidadevascaina\.com<br />
\bdigorest\.com<br />
\bdigshop\.com\.br<br />
\bdiplomaticsociety\.org<br />
\bdireitodoestado\.com\.br<br />
\bdiretodehollywood\.com<br />
\bdiscadorpreditivo\.com\.br<br />
\bdistintivos\.com\.br<br />
\bdisturbiodopanico\.com\.br<br />
\bditudo\.etc\.br<br />
\bditudo\.wiki\.br<br />
\bdivulgaemails\.com<br />
\bdjban\.com\.br<br />
\bdmfer\.com\.br<br />
\bdoencasealimentos\.com<br />
\bdonzeladedomremy\.webs\.com<br />
\bdormiu\.com\.br<br />
\bdorperportoazul\.com\.br <br />
\bdownload\.mus\.br<br />
\bdownloadcurriculum\.com<br />
\bdragaobranco\.com\.br<br />
\bdreamingdolls\.net<br />
\bdr-organico\.com\.br<br />
\bdstudium\.com<br />
\bduasasas\.com<br />
\bdubitando\.no\.sapo\.pt<br />
\bdublanet\.com\.br<br />
\bducker\.com\.br<br />
\bdurmamelhor\.com<br />
\bdvdbarato\.net<br />
\bdvdja\.com\.br<br />
\bdw-world\.de\/dw\/0,2142,2594,00.html<br />
\beasylanguages\.com<br />
\becogenesys\.com\.br<br />
\becognitiva\.blogspot\.com<br />
\becologiaurbana\.com\.br<br />
\becomm\.com\.br<br />
\beconomiacriativa\.blogspot\.com\.br<br />
\beconomiadacultural\.blogspot\.com\.br<br />
\bedemdma\.cjb\.net<br />
\beditoraelim\.com\.br<br />
\bedmrocky\.blogspot\.com<br />
\beduardabreda\.ucoz\.com<br />
\beducacaodeinfancia\.com <br />
\befeitogarage\.com\.br <br />
\begregoralfa\.republika\.pl<br />
\behelp\.eti\.br<br />
\behsportugal\.com<br />
\bejp\.com\.sapo\.pt<br />
\belbestia\.blogspot\.com<br />
\beldorado\.tur\.br<br />
\belegance\.bona-xira\.net<br />
\beleicoesceara\.com\.br<br />
\belevabrasil\.com\.br<br />
\belevadoresmais\.com\.br<br />
\bembarcados\.com\.br<br />
\bembriologiahumana\.com\.br <br />
\bemprego\.destaca\.com\.br<br />
\bemprestimo-info\.com<br />
\bemsaovicente\.com\.br<br />
\bemsintese\.com\.br<br />
\bemtr\.com\.br<br />
\bencena\.pt<br />
\benoises\.wordpress\.com<br />
\bentrevistamarcosmion\.blogspot\.com<br />
\bentrevistamionmarcos\.blogspot\.com<br />
\benxadrismoecultura\.blogspot\.com<br />
\bepel\.eu <br />
\bequipa-design\.com <br />
\berickastler\.com<br />
\berickerico\.blogspot\.com<br />
\bernandijunior\.com\.br<br />
\bervadaninha\.sarava\.org<br />
\bescforum\.net<br />
\bescortvip\.com\.br<br />
\bescritoriodearte\.com <br />
\besnips\.com\/web<br />
\bespacofitnessacademia\.com<br />
\besporrozine\.blogspot\.com<br />
\besportes\.820am\.com\.br<br />
\besquinadotempo\.com\.br<br />
\bestagionet\.com\.br<br />
\bestudandoparaoexamedaordem\.blogspot\.com<br />
\bestudoreligioso\.wordpress\.com<br />
\besyurl\.com<br />
\beuacheifacil\.com\.br<br />
\beubiologia\.xpg\.com\.br<br />
\beutodeferias\.com\.br<br />
\bexamehosting\.com<br />
\bexbancario\.blog\.br<br />
\bexcelencia\.com\.br<br />
\bexplorevale\.com\.br<br />
\bexplosaoderecrutamento\.empreenderonline\.com<br />
\bezboard\.com<br />
\bf1incridible\.blogspot\.com<br />
\bfabiofettuccia\.zip\.net<br />
\bfaclube_beatrizmonteiro\.blogs\.sapo\.pt<br />
\bfailblog\.org<br />
\bfainors\.com<br />
\bfalajacone\.blogspot\.com<br />
\bfalandoemprojetos\.com<br />
\bfalker\.com.br<br />
\bfamiliarotaria\.com\.br<br />
\bfamosas\.wiki\.br<br />
\bfamosasdespidas\.com<br />
\bfamosos\.dimensionebrasile\.com<br />
\bfantasyproducoes\.com<br />
\bfaraos\.org<br />
\bfatorambiental\.com\.br<br />
\bfbfsistemas\.com<br />
\bfeiraodaweb\.com\.br<br />
\bfeiticos\.150m\.com<br />
\bfelipegoncalvesoficial\.blogspot\.com<br />
\bfellipelli\.com\.br<br />
\bferomonios\.com<br />
\bferramentasweb\.com\.br <br />
\bfestadonatal\.wetpaint\.com<br />
\bfhrpromocional\.com\.br<br />
\bficacomigo\.net<br />
\bfifamanager\.com\.pt<br />
\bfiles\.wordpress\.com<br />
\bfilipux\.blig\.ig\.com\.br<br />
\bfilmesportugueses\.com<br />
\bfilosofiaetecnologia\.com\.br<br />
\bfinancasparavida\.com\.br<br />
\bfisiozone\.com<br />
\bfitmorumbi\.com\.br/<br />
\bflaasa\.blogspot\.com<br />
\bflickr\.com\/photos\/vitor107<br />
\bflogao\.com\.br\/avaianosempre <br />
\bflorais\.com\.br<br />
\bfloresnaweb\.com<br />
\bfloriano-gescon\.blogspot\.com<br />
\bfloridabrasil\.com<br />
\bfloripa360\.com\.br<br />
\bfnquimica\.com<br />
\bfocadoemvoce\.com<br />
\bfocushost\.com\.br<br />
\bfogaoshop\.com\.br<br />
\bfonoaudiologia\.com\.br<br />
\bfonoaudiologia\.ourtoolbar\.com<br />
\bfootbook\.com\.br<br />
\bfootbrasil\.net<br />
\bformosafest\.com\.br<br />
\bforo\.telenovela-world\.com<br />
\bforo\.telenovela\-world\.com<br />
\bfortalezaradical\.blogspot\.com<br />
\bfortalezas\.org<br />
\bforum\.alavigne\.com\.br<br />
\bforum\.imasters\.uol\.com\.br<br />
\bforum\.mymetro\.ru<br />
\bforum\.nwbrasil\.com<br />
\bforumaqui\.net<br />
\bforumbrasil\.net<br />
\bforumchaves\.com\.br <br />
\bforumeiro\.org<br />
\bforumeiros\.com<br />
\bforumfotografia\.net <br />
\bforum-livre\.com<br />
\bforumnow\.com\.br<br />
\bforumpratodos\.com<br />
\bforums\.abs\-cbn\.com<br />
\bforums\.abs-cbn\.com<br />
\bforums\.hardwarezone\.com\.sg<br />
\bforums\.techarena\.in<br />
\bfotodosurf\.com\.br <br />
\bfotolog\.com\/faloplastia<br />
\bfotolog\.terra\.com\.br<br />
\bfreehoxt\.com<br />
\bfreelancers\.googet\.eu<br />
\bfreesamplesblog\.com<br />
\bfreewebs\.com\/advogadossalvadorbahia<br />
\bfreewebs\.com\/thecheetahgirlsbr<br />
\bfrequencia\.eu<br />
\bfresnorock\.com/<br />
\bfromplanetasperger\.blogspot\.com<br />
\bfuiaoinfernoevoltei\.blogspot\.com<br />
\bFullCarTuning\.com <br />
\bfunctionpointmodeler\.com<br />
\bfunctionpointmodeler\.de<br />
\bfundacaoatitude\.com\.br<br />
\bfundos\.com <br />
\bfundoverde\.com\.br <br />
\bfuracaomexicano\.com<br />
\bfuriaps2\.blogspot\.com<br />
\bfusca\.mobi<br />
\bfuscadorock\.blogspot\.com<br />
\bfutcc\.com\/images<br />
\bfutebol\.nocelular\.biz <br />
\bfutebolefixe\.blogspot\.com<br />
\bfutemoney\.blogspot\.com<br />
\bfutnet\.com\.br <br />
\bfuturomelhor\.wordpress\.com<br />
\bfxcast\.com/<br />
\bgabrielortiz\.com<br />
\bgagocoutinho\.wordpress\.com<br />
\bgalapagocruise\.com<br />
\bgaleradofundao\.org<br />
\bgalodigital\.com\.br<br />
\bgamd\.com\.br<br />
\bgamehall\.uol\.com\.br<br />
\bgames\.cartoonnetworkhq\.com\/downloadGame\.php<br />
\bgangdomoinho\.net<br />
\bgarotacomtecnologia\.blogspot\.com<br />
\bgaypride\.com\.br<br />
\bgenealogiabrasileira\.org<br />
\bgeocities.com\/gurnemanzbr\/astrid<br />
\bgeocities\.com\/cirurgiaplasticaestetica<br />
\bgeocities\.com\/pajero_full_200891<br />
\bgeocities\.com\/spiritistgospel <br />
\bgeocities\.com\/valternascimento<br />
\bgeoconcursos\.geotrack\.com\.br<br />
\bgeorreferenciamentoincra\.com\.br<br />
\bgeotecnologias\.wordpress\.com\/<br />
\bgermany-travel-guide\.info<br />
\bgestaocondominial\.spaces\.live\.com<br />
\bgiardinicas\.blogspot\.com<br />
\bginecologia-online\.com\.br<br />
\bgladiatus\.com\.pt\/game<br />
\bgladiatus\.com\/game<br />
\bgloboeletronicos\.com\.br<br />
\bglobominastvdigital\.com<br />
\bglosk\.com<br />
\bgnosesul\.com\.br<br />
\bgnosisonline\.org<br />
\bgoaguu\.googlepages\.com<br />
\bgoa-property\.net<br />
\bgolo-digital\.blogspot\.com<br />
\bgolo-online\.blogspot\.com<br />
\bgo-night\.com<br />
\bgooglewavedicas\.wordpress\.com<br />
\bgoolervier\.blogspot\.com<br />
\bgorgonzola\.se <br />
\bgorpa\.com\.br<br />
\bgosmametalica\.blogspot\.com<br />
\bgotroot\.com\.br<br />
\bgportal\.hu<br />
\bgpxonline\.com\.br<br />
\bgraciejiujitsufabioleopoldo\.com\/site\/<br />
\bgraffiti\.keusta\.net<br />
\bgraffiti\.org\.br<br />
\bgramadoecanela\.com\.br <br />
\bgrancorazon\.org<br />
\bgrandefraternidadebranca\.com\.br<br />
\bgratishost\.com\.br<br />
\bgriaule\.com<br />
\bgriaulebiometrics\.com<br />
\bgrupoyes\.com\.br<br />
\bgrupoyes\.com\.br\/Cursos\.aspx<br />
\bgsbrazil\.net<br />
\bguesthouseinitaly\.com<br />
\bgugol-downloads\.blogspot\.com<br />
\bguiabrasiladventure\.com<br />
\bguiabsb\.com\.br<br />
\bguiacastor\.com<br />
\bguiacurso\.com\.br<br />
\bguiadacopa\.net<br />
\bguiadaembalagem\.com\.br<br />
\bguiadaobra\.net <br />
\bguiadapesca\.com\.br<br />
\bguiadeatibaia\.com<br />
\bguiadeinvestimento\.com\.br<br />
\bguiadeitupeva\.com\.br<br />
\bguiadelrei\.com\.br<br />
\bguiademidia\.com\.br<br />
\bguiademongagua\.com\.br<br />
\bguiadocftv\.com\.br<br />
\bguiadoparaguai\.com\.br<br />
\bguiamongagua\.com\.br<br />
\bguiamorrao\.com\.br<br />
\bguilhermeabreu\.com\.br<br />
\bgunnersbrasil\.com<br />
\bgunsnrosesbrasil\.com<br />
\bgwebtools\.com <br />
\bgword\.com\.br<br />
\bh1loeqbb7bsndivgoj\.usercash\.com<br />
\bhabto\.com\.br<br />
\bhackerofdark\.blogspot\.com<br />
\bhacktolive\.org<br />
\bhaicaizen\.blogspot\.com<br />
\bhatada\.com\.br<br />
\bhavilla\.com\.br<br />
\bhelenablavatsky\.com\.br<br />
\bhellinger\.com\.br<br />
\bhesjapanese\.com <br />
\bhi5\.com<br />
\bhigh-supplies\.com<br />
\bhistoriadetudo\.com<br />
\bhistoriaimagem\.com\.br<br />
\bhistoriaserankings\.blogspot\.com<br />
\bhitany-fx\.blogs\.sapo\.pt<br />
\bhmscacambas\.com\.br<br />
\bhmv\.com\.hk\/product<br />
\bhogfriends\.net<br />
\bhospedar-se\.com <br />
\bhostercom\.com\.br<br />
\bhot100brasil\.com<br />
\bhotblowjobs\.com <br />
\bhotcheats\.org <br />
\bhotel13outubro\.com<br />
\bhotmailive\.blogspot\.com<br />
\bhotsurfers\.com\.br<br />
\bhotvnews\.wordpress\.com<br />
\bhtmlstaff\.org<br />
\bhttp-guia\.blogspot\.com<br />
\bhumanitarianlion\.com<br />
\bhumanomatica\.blogspot\.com<br />
\bhunterxhunter\.otaku\.com\.br<br />
\bianfavorite\.com<br />
\bibaladas\.com\.br<br />
\bibem\.org\/artigos\/acrobat<br />
\bibem\.org\/Hom_DPG<br />
\bibrasao\.com<br />
\bic\.vila\.bol\.com\.br<br />
\bic\.vilabol\.com\.br<br />
\bicm\.k6\.com\.br<br />
\bidealgarve\.com <br />
\bideas\.live\.com <br />
\bideia-atlantico\.pt<br />
\bideia3\.com\.br<br />
\bideiasedinheiro\.blogspot\.com<br />
\bidolomaniacos\.blogspot\.com<br />
\bidoloshome\.com<br />
\bigrejaparatodos\.com\.br<br />
\biguablogger\.blogspot\.com<br />
\bihateyoujulia\.com<br />
\bilha-dos-amores\.com <br />
\bilhaguriri\.com<br />
\bilhaguriri\.net<br />
\billuminatiarchives\.org<br />
\bim2\.com\.br<br />
\bimages\.amazon\.com<br />
\bimages\.orkut\.com<br />
\bimageshack\.us<br />
\bimageshack\.us<br />
\bimarketing\.com\.br<br />
\bimg\.photobucket\.com\/albums<br />
\bimhep\.com\.br<br />
\bimobiliariamercatto\.com.br<br />
\bimobilien\.com\.br<br />
\bimplantedentarios\.blogspot\.com<br />
\binacreditavel\.com\.br<br />
\bindicetj\.com<br />
\binesrodena\.blogspot\.com<br />
\binfo-caimbras\.org<br />
\binfofranchising\.pt<br />
\binfortronicabh\.blogspot\.com<br />
\binfovasco\.com<br />
\binfowaysi\.com<br />
\binibio\.xpg\.com\.br<br />
\binovabrasil\.blogspot\.com<br />
\binovadigital\.com<br />
\binsetotec\.com\.br <br />
\binsidernews\.com\.br<br />
\binstitutohellinger\.com\.br<br />
\binstitutouniao\.com\.br\/artigos/sindromedopanico.asp<br />
\bintecabsp\.wordpress\.com<br />
\binteligenciavirtual\.com<br />
\binterblogs\.com\.br\/homerofonseca<br />
\bIntercambioCultural\.com\.br<br />
\bintercambiocultural\.com\.br<br />
\bIntercambioCultural\.org<br />
\bintercambiocultural\.org <br />
\binternetpaulista\.com <br />
\binvasao\.com\.br<br />
\binvest\.fok\.com\.br<br />
\binvestbolsa\.com<br />
\bipetitions\.com<br />
\biphonept\.blogspot\.com<br />
\bisa-te-kiero-mais\.blogspot\.com<br />
\biscoach\.com<br />
\bisfreepop\.com\/series<br />
\bismep\.com\.br <br />
\bitanhaemonline\.com<br />
\bitanhaemvirtual\.com\.br<br />
\bitanhem\.blogspot\.com<br />
\bitapevacity\.com\.br<br />
\bitvibopedatv\.wordpress\.com<br />
\biwl\.com\.br<br />
\bjakeefred\.blogspot\.com<br />
\bjapaneselanguage\.da\.ru<br />
\bjaunews\.net<br />
\bjaymepanerai\.blogspot\.com<br />
\bjcmrpgart\.blogspot\.com<br />
\bjdnamidia\.com\.br<br />
\bjesusvira\.com\.br<br />
\bjogaki\.net<br />
\bjogodebuzios\.com\.br<br />
\bjogos-e-brincadeiras\.blogspot\.com<br />
\bjogosolimpicospequim\.com<br />
\bjogosvideos\.com<br />
\bjoiasweb\.com<br />
\bjonatasanches\.blogspot\.com<br />
\bjornadanasestrelas\.com<br />
\bjornalclubpenguinhoje\.blogspot\.com<br />
\bjornaldoe-commerce\.com <br />
\bjornalismo-desportivo\.blogspot\.com<br />
\bjornaloeco\.com\.br<br />
\bjosemanuelperez\.es\/wikipedia\/pt<br />
\bjoveminvest\.com\.br <br />
\bjubaia\.com\.br<br />
\bjulianoaudiencia\.zip\.net<br />
\bjunkie\.zonesp\.com<br />
\bjurisprudenciaemrevista\.org <br />
\bkachorro\.xpg\.com\.br<br />
\bkarapintadas\.wordpress\.com<br />
\bkatatau\.com<br />
\bkeequeenalive\.web\.pt<br />
\bkevinhaddock\.com<br />
\bkidicas\.com<br />
\bkikiat\.com<br />
\bkiminda\.wordpress\.com<br />
\bkissboots\.blogspot\.com<br />
\bkitline43\.com<br />
\bkitmaladiretaoverdadeiro001\.com<br />
\bkitpipa\.com<br />
\bkoinoo\.ning\.com<br />
\bkombu\.de<br />
\bkombucha\.hotel-br.\com<br />
\bkraazydragonball\.com<br />
\bkriyayoga-mahavatarbabaji\.com<br />
\bkuthribeirooficial\.blogspot\.com<br />
\bkxk\.me<br />
\bkyliept\.forumeiro\.com<br />
\bkyocerasolar\.com\.br<br />
\bl2gp\.com<br />
\bl2ouro\.com<br />
\blabgeo\.blogspot\.com<br />
\blabirinto\.wiki\.br<br />
\blacchiappasogni\.tk<br />
\blageado\.com\.br<br />
\blagosmilitar\.blogspot\.com<br />
\blajepor\.com\.br<br />
\blasmanzanasdulces\.wordpress\.com<br />
\blastfm\.com\/event<br />
\blastfm\.pt\/event<br />
\blatinasex\.741\.com<br />
\blattesnet\.com\.br<br />
\blayart\.com\.br<br />
\blecachalot\.xmb\.com\.br<br />
\bleechesturkey\.com<br />
\blegendanimes\.com<br />
\blelecasapeca\.blogger\.com\.br<br />
\blendas-fantasia\.blogspot\.com<br />
\blfsapatos\.com\.br<br />
\blibertarianismo\.com<br />
\blicitamais\.com\.br<br />
\blife-stream\.webs\.com<br />
\blinerecordsshop\.com\.br<br />
\blingua-ingles\.blogspot\.com<br />
\blinhabase\.com\.br<br />
\blinhasnaareia\.com<br />
\blinkinparker\.webs\.com<br />
\blinkjb<br />
\blinkjb\.vilabol\.uol\.com\.br<br />
\blinknacional\.com\.br<br />
\blinkvitrine\.com\.br<br />
\blistadebrinquedos\.com<br />
\blistadelivros-doney\.blogspot\.com<br />
\blistapratica\.com<br />
\blitoraldesantacatarina\.com<br />
\blitoralnorters\.com\.br<br />
\bliverig\.wordpress\.com<br />
\blivestream\.com\.br<br />
\blivrariasaraiva\.com\.br\/produto<br />
\blivrogastronomico\.do\.sapo\.pt <br />
\blivromidp\.jorgecardoso\.eu<br />
\blixaoblog\.blogspot\.com<br />
\blogobr\.wordpress\.com<br />
\blojaconrad\.com\.br\/produto\.asp<br />
\blojasdobairro\.com<br />
\blondon-underground\.blogspot\.com<br />
\blosmandalas\.blogspot\.com<br />
\blrg\.ufsc\.br\/\~westphal<br />
\blucenaseguros\.com\.br <br />
\bbluebonnet\.com\.br<br />
\bluizjabour\.com<br />
\bluizmeira\.com<br />
\blusoproduction\.fr<br />
\bluta-capoeira\.blogspot\.com<br />
\blutopelobrasil\.com\.br<br />
\bluzespirita\.com<br />
\bluzespirita\.org<br />
\blvxsinistrae\.blogspot\.com<br />
\blyricshosting\.com<br />
\bmacore\.com\.br<br />
\bmacrocimento\.com\.br<br />
\bmademan\.com<br />
\bmagextreme\.blogspot\.com<br />
\bmagianegra\.org\.br <br />
\bmagiasebarbaridades\.blogspot\.com<br />
\bmagicaboutyou\.blogspot\.com <br />
\bmagistertempli\.blogspot\.com<br />
\bmaionesefastfood\.com<br />
\bmaisabc\.com\.br<br />
\bmaisbrasilia\.com<br />
\bmaissaude\.eu<br />
\bmaladiretaemails\.com<br />
\bmalamutedealaska\.com<br />
\bmalapronta\.com\.br<br />
\bmandalas\.art\.br<br />
\bmandalas\.skyrock\.com<br />
\bmandihost\.com\.br<br />
\bmangasjbc\.uol\.com\.br<br />
\bmantiqueiraimoveis\.com\.br<br />
\bmanutdbr\.com<br />
\bmapaguia\.com.br<br />
\bmapia\.com\.br<br />
\bmaqgoo\.com <br />
\bmaquiagememoda\.com\.br<br />
\bmarciopereira\.com\.br<br />
\bmarcocassol\.com\.br<br />
\bmarcosmionentrevista\.blogspot\.com<br />
\bmarcosrivelles\.zip\.net<br />
\bmarcosturbo\.com\.br<br />
\bmarduc\.blogspot\.com<br />
\bmarketingdeguerrilha\.wordpress\.com<br />
\bmarketingmadeinbrasil\.zip\.net <br />
\bmarlonstein\.com<br />
\bmarseille360\.schnurstracks\.de<br />
\bmashupkeyword\.com<br />
\bmasiero\.com\.br<br />
\bmassadouniverso\.blogspot\.com<br />
\bmatrixcaesdeguarda\.com\.br<br />
\bmaxtemporada\.com\.br<br />
\bmaysamonjardimoficial\.blogspot\.com<br />
\bmc2h2o\.blogspot\.com<br />
\bmcrbullet-oficial\.com<br />
\bmecatronica\.webng\.com<br />
\bmediatraffic\.de<br />
\bmedicarepoints\.pt<br />
\bmedicinadotorax\.com\.br/<br />
\bmedicinaealimentacao\.com <br />
\bmedicinanet\.com\.br<br />
\bmedicinatradicionalchinesa\.com<br />
\bmeditacao\.biz<br />
\bmeditacaotranscendental\.blogspot\.com<br />
\bmeditacaotranscendental\.com <br />
\bmegaideas\.net<br />
\bmeginformatica\.com\.br<br />
\bmeiobit\.pop\.com\.br<br />
\bmemoriasdofront\.blogspot\.com<br />
\bmemurl.com<br />
\bmenuespecial\.com\.br<br />
\bmercadohorse\.com<br />
\bmerrychristmas\.no\.sapo\.pt<br />
\bmerrychristmashny\.no\.sapo\.pt<br />
\bmestreseo\.com\.br<br />
\bmetafisico\.net<br />
\bmetalgearpt\.awardspace\.com<br />
\bmetricimperial\.com <br />
\bmetro-subway-train-list\.com<br />
\bmeubox\.com\.br<br />
\bmeumomento\.com<br />
\bmeutaperoa\.com\.br <br />
\bmeuvitoria\.com<br />
\bmicaretas\.oipapai\.com\.br<br />
\bmictmr\.blogspot\.com<br />
\bmideos\.com<br />
\bmidiaclipping\.blogspot\.com<br />
\bmiguel-montenegro\.com<br />
\bminasclassificados\.com<br />
\bminhaaudiencia\.wordpress\.com<br />
\bminhacidadetem\.com\.br<br />
\bminhaconexao\.com\.br<br />
\bminhavida\.com\.br<br />
\bminimomultiplo\.com<br />
\bminitrem\.com<br />
\bminutodebarulho\.blogspot\.com<br />
\bmionmarcoscocadaboa\.blogspot\.com<br />
\bmissesemmanchete\.blogspot\.com<br />
\bmix\.phoneclub\.com\.br<br />
\bmjacksonart\.com <br />
\bmkarmageddon\.com<br />
\bmktg2\.net<br />
\bmktportugal\.com<br />
\bmnecho\.com <br />
\bmoananui\.wordpress\.com<br />
\bmochileiros\.com<br />
\bmodemdownloads\.net<br />
\bmoedas\.com<br />
\bmonografiaexpressa\.com<br />
\bmonografiapratica\.com<br />
\bmonografiaurgente\.com <br />
\bmorangos5serie\.blogs\.sapo\.pt<br />
\bmorangos-com-acucar\.com<br />
\bmorraderir\.com\.br<br />
\bmortesubita\.org<br />
\bmoscoso\.biz <br />
\bmouralacerda\.com\.br<br />
\bmovimentosestudantis\.blogspot\.com<br />
\bmovimentovotonulo\.blogspot\.com<br />
\bmsbesporte\.blogspot\.com<br />
\bmtv\.com\.br\/vivaovinil<br />
\bmtv\.uol\.com\.br\/vivaovinil<br />
\bmuestrasgratis\.es<br />
\bmulticreditos\.com<br />
\bmultigolb\.wordpress\.com<br />
\bmultiply.com\/blog<br />
\bmultiply.com\/journal<br />
\bmultiply.com\/links<br />
\bmultiply.com\/photos<br />
\bmultiply.com\/reviews<br />
\bmultiply.com\/tag<br />
\bmultiply.com\/video<br />
\bmultserv\.com\.br<br />
\bmundobariloche\.com\.br<br />
\bmundocruzeiros\.com\.br<br />
\bmundodatvaberta\.blogspot\.com<br />
\bmundodeclubpenguin\.blogspot\.com<br />
\bmundodomarketing\.com\.br<br />
\bmundodosincompreendidos\.blogspot\.com<br />
\bmundoeducacaofisica\.com<br />
\bmundopratico\.blogspot\.com<br />
\bmundoseo\.com\.br<br />
\bmupasales\.dominiotemporario\.com<br />
\bmuselius\.com<br />
\bmuseudosexo\.com\.br<br />
\bmuseuvirt\.com\.br<br />
\bmusicaseclipes\.com<br />
\bmuv.\com\.br <br />
\bmuzaminastear\.com\.br<br />
\bmybesthotel\.eu<br />
\bmyspace\.com\/bandanovadinastia<br />
\bmyspace\.com\/gaiteirosdealcochete<br />
\bmyspace\.com\/idolos<br />
\bmyvuvuzela\.blogspot\.com<br />
\bnacaocatolica\.com\.br<br />
\bnanetcomcdc\.blogspot\.com<br />
\bnanuqueinforma\.com/<br />
\bnaozero\.com\.br<br />
\bnarutodb\.com<br />
\bnarutomx\.free\.fr<br />
\bnarutoplayers\.com<br />
\bnatalf\.no\.sapo\.pt<br />
\bncpdtoo\.info <br />
\bncriacaodesites\.com<br />
\bnedvarticles\.narod\.ru<br />
\bnegocioextra\.com<br />
\bnetauthor\.org<br />
\bnetcampos\.com <br />
\bnethbc\.com<br />
\bnetronic\.com\.br<br />
\bnewagetokyo\.com<br />
\bnewdigitalsouth\.org<br />
\bnewronio\.espm\.br<br />
\bnfedobrasil\.com\.br<br />
\bning\.com<br />
\bnintendomania-gs\.blogspot\.com<br />
\bnintendowiiblog\.org <br />
\bnirvana\.com\.sapo\.pt<br />
\bnitarq\.blogspot\.com<br />
\bniteroitv\.com\.br<br />
\bnitrofl.webs\.com\.br<br />
\bnoh\.com\.br<br />
\bnoiabr\.ueuo\.com<br />
\bnoisnatira\.blogspot\.com <br />
\bnoivacarioca\.com\.br<br />
\bnoivasdeportugal\.com<br />
\bnomadismocelular\.wordpress\.com<br />
\bnomundodosfamosos\.zip\.net<br />
\bnonnux\.com<br />
\bnordestefree\.blogspot\.com<br />
\bnoskirebr\.com<br />
\bnoticiasdatvbrasileira\.blogspot\.com<br />
\bnoticiasmusicais\.radioativohits\.com<br />
\bnotlong\.com<br />
\bnoturnafm\.com\.br<br />
\bnovafriburgoturismo\.com\.br<br />
\bnovatec\.com\.br<br />
\bnovevolts\.blogspot\.com<br />
\bnovodaiblog\.blogspot\.com<br />
\bnsonline\.com\.br<br />
\bnsrbr\.com<br />
\bnucleodeoportunidades\.net<br />
\boanodogolfinho\.com<br />
\bobabox\.com <br />
\bobaepitacio\.com\.br<br />
\bobesidadeinfo\.com <br />
\bobjetivoguarulhos\.com\.br<br />
\boblogtv\.blogspot\.com<br />
\bobrasileirinho\.com\.br<br />
\bobrigadas2010\.megaideas\.net<br />
\bocachacier\.com\.br<br />
\bocanal\.wordpress\.com<br />
\bocantinhodosdeprimidos\.blogspot\.com<br />
\bodontologiaconcursos\.com\.br<br />
\bofileumgay\.blogspot\.com<br />
\boilondres\.com\.br<br />
\boipapai\.com\.br<br />
\boitentona\.com\.br<br />
\bojovem\.net<br />
\bokardecista\.blogspot\.com<br />
\bolharaspie\.blogspot\.com<br />
\bolhareconomico\.cjb\.net<br />
\bolharobscuro\.com<br />
\bomdl\.com\.br<br />
\bomelhordecapao\.com\.br<br />
\bomelhordobairro\.com\.br<br />
\bomelhordocerrado\.com\.br<br />
\boncopediatria\.org<br />
\bondatuga\.com<br />
\bondeanda\.multiply\.com<br />
\bondeestagenebra\.blogspot\.com<br />
\bonibusemdebate\.fotopages\.com<br />
\bonlypop\.blogspot\.com<br />
\boparanasondasdoradio\.ufpa\.br\/livro.htm<br />
\bopartidolivre\.blogspot\.com<br />
\bopersan\.com\.br<br />
\bopiniaoenoticia\.com\.br<br />
\bopiniaoipiau\.com\.br<br />
\boportunidadesanhembi\.com\.br<br />
\bordemdotemploiluminista\.blogspot\.com<br />
\bordemlivre\.org<br />
\borganizacionais\.com\.br<br />
\borganizandoeventos\.com\.br<br />
\borixas\.sites\.sapo\.pt<br />
\borladeatalaia\.com\.br<br />
\borlandocalado\.flogbrasil\.terra\.com\.br<br />
\bosbaladeiros\.com\.br<br />
\boseriestvz.broguiz.com <br />
\bosmelancias\.com\.br<br />
\bosmutantescdcc\.blogspot\.com<br />
\bosmutantesnanet\.blogspot\.com<br />
\botbr\.com\.br<br />
\botemponaopara\.wordpress\.com<br />
\botserv\.com\.br<br />
\bousar\.net<br />
\boysfirsttime\.com<br />
\bpagmenos\.net<br />
\bpaixaoautomovel\.blogspot\.com<br />
\bpakaas\.com\.br<br />
\bpalatando\.com<br />
\bpalavras-arquitectura\.com<br />
\bpamonhart\.com\.br<br />
\bpandajogosgratis\.com<br />
\bpandamovies\.com <br />
\bpantanalecoturismo\.tur\.br<br />
\bpapaleguaspt\.blogspot\.com<br />
\bpaqueralegal\.com<br />
\bparanapiacabaecotur\.com<br />
\bparasempremiguelfalabella\.blogspot\.com<br />
\bparquesepracasdecuritiba\.com\.br<br />
\bpartidolivre\.org\.br<br />
\bpassageirodomundo\.blogspot\.com<br />
\bpath\.to/b677<br />
\bpath\.to\/e6b3\/ <br />
\bpatriciafelinaa\.blogspot\.com<br />
\bpauloandreissa\.com<br />
\bpaulobeck\.blogspot\.com<br />
\bpcclinic\.pt<br />
\bpcs\.k6\.com\.br<br />
\bpcsist\.com\.br<br />
\bpeaceoneday\.org<br />
\bpedalativo\.com<br />
\bpediatria\.com.\br<br />
\bpedrodoria\.com\.br<br />
\bpedro-rossi-clube-da-esquina\.blogspot\.com<br />
\bpegamais\.com\.br<br />
\bpennichollo\.blogspot\.com<br />
\bpensamentopositivo\.com\.br<br />
\bpepe\.org\.br<br />
\bpescaemsintra\.com<br />
\bpesqueirafutebolclube2008\.blogspot\.com <br />
\bpet\.di\.ufpb\.br\/ferramentadct<br />
\bpetsecia\.com<br />
\bphotobucket\.com <br />
\bphotobucket\.com\/albums<br />
\bphysicalgym\.com\.br\/site\/<br />
\bpiadasonline\.com\.br<br />
\bpiauinauta\.blogspot\.com<br />
\bpiauionline\.com\.br<br />
\bpicodogaviao\.com\.br<br />
\bpicodogaviao\.esp\.br<br />
\bpieceextremo\.blogspot\.com<br />
\bpierdeipanema\.com\.br<br />
\bpimentanegra\.blogspot\.com<br />
\bpimentelonline\.com<br />
\bpinblogger\.weblogger\.com\.br <br />
\bpindavale\.com<br />
\bpindavale\.com\.br<br />
\bpindavale\.net<br />
\bpindavale\.org <br />
\bpingon\.com\.br<br />
\bpiritubaclick\.com\.br<br />
\bpiroalquimista\.vilabol\.uol\.com\.br<br />
\bpisodegranito\.com<br />
\bplanetabodyboard\.com<br />
\bplanetatv\.wordpress\.com<br />
\bplanetavet\.com<br />
\bplanodesaude\.biz<br />
\bplanotatico\.com<br />
\bplano-verao\.com<br />
\bplantiodireto\.com\.br<br />
\bplasmalcd\.110mb\.com <br />
\bplasticos.hdfree\.com\.br<br />
\bplugcidade\.com\.br<br />
\bpndt\.com\.br<br />
\bpobreotario\.blogspot\.com<br />
\bpodermasculino\.com\.br<br />
\bpodiatryworldwide\.com <br />
\bpokemondarkay\.blogspot\.com<br />
\bpokenewsonline\.blogspot\.com<br />
\bpolegar\.k6\.com\.br<br />
\bpontagrossa\.com\.br<br />
\bpontagrossacvb\.com\.br<br />
\bpontoperdido\.blogspot\.com<br />
\bpopart-esfh\.com<br />
\bpornotube\.com<br />
\bporntune\.net<br />
\bportabilidade\.com\.br<br />
\bportal1000\.com\.br<br />
\bportalacontece\.com\.br<br />
\bportaladm\.adm\.br<br />
\bportalafricanista\.blogspot\.com<br />
\bportalararipina\.blogspot\.com<br />
\bportalcapelinha\.com\.br<br />
\bportaldaspousadas\.net<br />
\bportaldecontabilidade\.com\.br<br />
\bportaldehospedagem\.com\.br<br />
\bportaldopajeu\.com<br />
\bportalegrecidadepostal\.blogspot\.com<br />
\bportalglobinho\.rg3\.net<br />
\bportalico\.com\.br<br />
\bportalilheus\.xpg\.com\.br<br />
\bportaljarinu\.com\.br<br />
\bportalligtv\.com\.br<br />
\bportaloceania\.com<br />
\bportalparaisense\.com\.br<br />
\bportalpiraju\.com<br />
\bportalpornoportugues\.pt\.vu<br />
\bportalsmallville\.net<br />
\bportalssvip\.com<br />
\bportaltributario\.com\.br<br />
\bportugacard\.com<br />
\bportugalempresarial\.com <br />
\bpotimvale\.blogspot\.com<br />
\bpousadajubaia\.com\.br<br />
\bpousadariopreto\.com\.br<br />
\bpousadascomcharme\.com\.br<br />
\bprainhadeburitama\.com\.br<br />
\bpranos\.com\.br<br />
\bpreditivo\.com\.br<br />
\bprestacao\.com<br />
\bpriestknack\.com<br />
\bprintax\.com\.br<br />
\bpriscilalino\.com\.br<br />
\bprodulz\.com\.br<br />
\bproduto\.mercadolivre\.com\.br<br />
\bprofcardy\.com\/calculadoras/<br />
\bprofessorprojeto\.blogspot\.com<br />
\bprofkbrito\.zip\.net<br />
\bprogramabrasil\.org<br />
\bprojectodinheiro\.pt<br />
\bprojectos\-arquitectos\.blogspot\.com<br />
\bprojectos-arquitectos\.blogspot\.com<br />
\bprojetogenoma\.com\.br<br />
\bpro-laudo\.com\.br<br />
\bpromocoes\.biz<br />
\bprosementes\.com\.br<br />
\bprovadetran\.com\.br<br />
\bpsymania\.com<br />
\bpt\.wikipedia\.org\.br<br />
\bpt\.shvoong\.com\/how-to\/writing<br />
\bptairsoft\.org<br />
\bptpassatempos\.com<br />
\bptwebsite\.com<br />
\bpubsender\.com<br />
\bpunkshop\.com\.br <br />
\bpuppyclick\.com<br />
\bputadaloucura\.com<br />
\bputarianatv\.com<br />
\bputsblog\.com<br />
\bqaudiencia\.blogspot\.com<br />
\bqeenmedia\.com\.ar<br />
\bqi\.com\.br<br />
\bqibla\.com\.br<br />
\bquadrante\-natural\.pt<br />
\bqualasuabossa\.com\.br<br />
\bqualjogo\.com <br />
\bqualpeca\.com<br />
\bqudrante\-natural\.pt <br />
\bqueroficarrico\.net<br />
\bquerosaude10\.blogspot\.com<br />
\bquickgoldfacts\.blogspot\.com<br />
\bquintabiologica\.info<br />
\bradiestesia\.br\.tripod\.com<br />
\bradiobaseurgente\.blogspot\.com<br />
\bradioharekrishna\.blog\.br<br />
\bradiomec\.com\.br<br />
\bradiowebavivamentojovem\.com<br />
\braeiro\.com<br />
\brankbrasil\.com\.br<br />
\brapidshare.com\/files\/<br />
\braultabajara\.blogspot\.com<br />
\brayervas\.com\.br<br />
\brbgestao\.com\.br<br />
\brcpsoftware\.com\.br<br />
\brd1audiencia\.com<br />
\brd1audienciadatv\.wordpress\.com<br />
\brd1audienciadatv\.wordpress\.com<br />
\brecblog\.com\.br<br />
\breceitaculinaria.\com\.br<br />
\brecibosverdes\.com<br />
\breciclaconnosco\.blogspot\.com <br />
\breciclareviver\.rg3\.net<br />
\breconcavonoticias\.com<br />
\brede-brasil-tv\.blogspot\.com<br />
\bredefile\.com<br />
\bredeisatkm\.blogspot\.com<br />
\bredmadox\.com\.br <br />
\bredtube\.com<br />
\breflexoesdeumlouco\.blogspot\.com<br />
\breflexoesdigitais\.com\.br<br />
\bregeneration\.com\.br<br />
\breidobrasfoot\.blogspot\.com<br />
\breiki\.portais\.org<br />
\breikimawashi\.com<br />
\breikiuniverso\.org<br />
\breinodeoxala\.com\/videoteca<br />
\brelojesweb\.imitable\.com<br />
\bremade\.com\.br <br />
\brendaweb\.weebly\.com<br />
\brenerlopes\.zip\.net<br />
\brenter\.com\.br<br />
\brenzogracie\.com\/<br />
\breportervelazquez\.blogspot\.com<br />
\breservas\.net<br />
\bresidentevilwork\.blogspot\.com<br />
\brestauranteocaipira\.com\.br<br />
\bresumodanoticia\.blogspot\.com<br />
\bresumodasnovelas\.net<br />
\bresumododia\.wordpress\.com<br />
\bresumos\.net<br />
\breto-europa\.ning\.com<br />
\bretratoiberico\.com<br />
\bretratto\.com<br />
\brevistadatv\.blogspot\.com<br />
\brevistasgratis\.ws<br />
\brevoclim\.zip\.net<br />
\breybiannchi\.4shared\.com<br />
\brhorigami\.com<br />
\briodejaneiro-copacabana\.com\.br<br />
\briodejaneirophotoguide\.com<br />
\brioferias\.com<br />
\brio-rj\.com\.br<br />
\brmrconsultoria\.v10\.com\.br<br />
\brobertexto\.com<br />
\brobitexplore\.com<br />
\brockbrasiliadesde64\.blogspot\.com<br />
\brockybalboa\.com\.br<br />
\brockybalboa\.com\.br<br />
\brodolfo\.typepad\.com<br />
\brodrigofneves\.blogspot\.com<br />
\brommopaula\.blogspot\.com<br />
\bromuloesbt\.blogspot\.com<br />
\brose-mcgowan-brasil\.blogspot\.com<br />
\brotadoromanico\.com<br />
\broteirodelavras\.com <br />
\broteirostelevisao\.blogspot\.com<br />
\broxclan\.net<br />
\brpgdesafios\.com\.br<br />
\brplanetagospel\.blogspot\.com<br />
\brppnweb\.com<br />
\bruadasflores\.com<br />
\brugby\.esp\.br<br />
\bsalaodetuning\.com\.br<br />
\bsalto12\.blogspot\.com<br />
\bsanbara\.com\.br<br />
\bsandramouraramos\.blogspot\.com<br />
\bsandrasantos\.com<br />
\bsandrinha\.com\.br<br />
\bsanguesuga\.com <br />
\bsantainquisicaocatolica\.blogspot\.com<br />
\bsantoantoniodopinhal\.com\.br<br />
\bsantosreporter\.blogspot\.com<br />
\bsaopaulobairros\.com\.br<br />
\bsaopaulocenter\.com\.br <br />
\bsatere\.com<br />
\bsaturei\.com<br />
\bsaudedofuturo\.wordpress\.com<br />
\bschwarzenegger\.it<br />
\bscrapbookbrasil\.com<br />
\bscrapjackie\.locaweb\.com\.br<br />
\bscribd\.com\/download<br />
\bscribd\.com\/group<br />
\bscribd\.com\/people<br />
\bscribd\.com\/profile<br />
\bscribd\.com\/word<br />
\bscriptline\.net/<br />
\bsegurosguia\.com<br />
\bseinstrumentos\.com\.br<br />
\bsejavegetariano\.com\.br<br />
\bsekstv\.info<br />
\bsemreligiao\.com\.br<br />
\bsenha1234\.blogspot\.com<br />
\bsenhoradeoliveira\.blig\.com\.br<br />
\bseomaster\.com\.br<br />
\bsergioprata\.com\.br<br />
\bseries-etc\.blogspot\.com<br />
\bsexxxchurch\.com<br />
\bsg7net.\com\.br<br />
\bsgospel\.com<br />
\bshareapic\.net<br />
\bshemalesexstar\.com<br />
\bshowdelance\.com\.br<br />
\bsicchiquititas\.blogs\.sapo\.pt<br />
\bsigmasociety\.com<br />
\bsimonepedacos\.multiply\.com<br />
\bsimplyjolie2008\.blogspot\.com<br />
\bsimpozio\.ufsc\.br<br />
\bsimsbrasil\.com\.br<br />
\bsite\.oiyes\.com\.br<br />
\bsite\.voila\.fr\/chezmirage/<br />
\bsitegratisgratis\.com\.br <br />
\bsitemeu\.net<br />
\bsites\.google\.com/site/gagocoutinhocom<br />
\bsites\.google\.com/site/top100brazil/Home/<br />
\bsites\.google\.com/site/vermelhovelho<br />
\bsitesdesites\.webnode\.com\.br<br />
\bsitiomarado\.forumeiro\.com<br />
\bskindoctornyc\.com<br />
\bskydrive\.live\.com\/self\.aspx<br />
\bskyscrapercity\.com<br />
\bslam\.regeneration\.com\.br<br />
\bslamdunk\.suprasolucoes\.com<br />
\bslideshare\.net<br />
\bsms\.ie\.ma <br />
\bsmswebo\.com <br />
\bsoarquitetura\.com\.br<br />
\bsobrelivros\.com\.br<br />
\bsobresites.com\/taro<br />
\bsobresites\.com\/biblioteconomia<br />
\bsocarnavaldepoa\.webs\.com<br />
\bsociedadedosblogueiros\.blogspot\.com<br />
\bsocomedia\.oipapai\.com\.br<br />
\bsoevami\.blogspot\.com<br />
\bsofatv\.net<br />
\bsoftfacil\.net<br />
\bsofttoys\.com\.br<br />
\bsolabm\.com\.br<br />
\bsoletrando\.com\.br<br />
\bsolucoesageis\.com\.br <br />
\bsomenoise\.com\.br<br />
\bsomudancasmg\.com\.br<br />
\bsoprodoator\.com<br />
\bsosdividas\.com\.br<br />
\bsoteropolitanosculturaafro\.wordpress\.com<br />
\bsouthernhides\.com\.ar<br />
\bsouturista\.com\.br<br />
\bspacejovem\.com<br />
\bspeedbrazil\.blogspot\.com <br />
\bspeedhost\.com\.br <br />
\bspellrpg\.com\.br<br />
\bspirituc\.com<br />
\bsportdigital\.net <br />
\bsportingapoio\.com<br />
\bspringer\.com\.br<br />
\bspvilas\.com\.br <br />
\bstadiumzone\.net<br />
\bstalloneforever\.blogspot\.com<br />
\bstamadvies\.nl<br />
\bstarmedica\.blogspot\.com<br />
\bstartrekbrasil\.com\.br<br />
\bstatisticum\.org<br />
\bstatuscompany\.com\.br<br />
\bsteinerimoveis\.com\.br<br />
\bstelling\.cc<br />
\bstifler\.com\.br<br />
\bstreetdogstudio\.com<br />
\bstudiopreview\.com\.br<br />
\bstyleua\.com<br />
\bsuamente\.com\.br<br />
\bsuamenteseuguia\.blog\.com<br />
\bsubcor\.multiply\.com<br />
\bsubxtreme\.net<br />
\bsudoku\.mundopt\.com <br />
\bsudokunine\.com<br />
\bsuperblog93\.blogspot\.com<br />
\bsuper-congresso\.com\.br<br />
\bsupergrana\.com<br />
\bsupermemoria\.com\.br<br />
\bsupernatural\-fans\.tk<br />
\bsuper-nutricao\.com\.br<br />
\bsuprasolucoes\.com<br />
\bsuprasolucoes\.com\/redireciona\.asp<br />
\bsurfa\.com\.br\/blog\/2010\/08\/rj-arpoador<br />
\btag\.com\.pt<br />
\btaginvest\.com\.br<br />
\btaichibrasileiro\.blogspot\.com<br />
\btaichipailin\.com\.br<br />
\btalentmanager\.pt<br />
\btalk\.livedaily\.com<br />
\btaoismo\.org <br />
\btargetw\.com<br />
\btarzia-tattoo\.com<br />
\btatianavianna\.com\.br/<br />
\btechseg\.com <br />
\btechtuga\.net <br />
\btecmais\.com <br />
\btecnopt\.com<br />
\btek\.sapo\.pt<br />
\btekoha\.org<br />
\btelecestas\.com\.br<br />
\bteleco\.com\.br<br />
\btelenovelasbr\.blogspot\.com<br />
\btelevisionado\.wordpress\.com<br />
\btelevisionnews\.wordpress\.com<br />
\btemplodeapolo\.net<br />
\bteobaldobs\.blogspot\.com<br />
\bterminologia\.com\.br <br />
\bterraforum\.com\.br<br />
\bTerrasdaMantiqueira\.com<br />
\btertdow\.blogspot\.com<br />
\btestdriveonline\.com\.br<br />
\bteusite\.net <br />
\btevenoticias\.wordpress\.com<br />
\btheazoresislands\.blogspot\.com<br />
\bthebestthingscomeinthree\.pt\.vu/<br />
\bthe-englishstudio\.com\.br<br />
\bthemaozoleum\.com <br />
\bthinkball\.com\.br<br />
\bthinkfn\.com<br />
\bthinkfnwiki\.com<br />
\bthinnetworks\.com\.br<br />
\bthumblogger\.com <br />
\bthundersuplementos\.com\.br<br />
\btibbisuluk\.com <br />
\btintazul\.com\.pt<br />
\btinypic\.com<br />
\btiopatinhas\.1br\.net<br />
\btiplan\.com\.br <br />
\btodocanal\.wordpress\.com<br />
\btokiohotel\.com\.br<br />
\btokiohotelbrasil\.com<br />
\btokufriends\.com<br />
\btonycorreia\.com\.br<br />
\btoolssites\.com\.br<br />
\btop100equestrian\.com<br />
\btopsexywomen\.com<br />
\btorrentsparabaixar\.blogspot\.com<br />
\btotalmentecharmed\.spaceblog\.com\.br<br />
\btownbridgecom\.com<br />
\btrabalhoescolares\.blogspot\.com<br />
\btraditionalvalues\.org<br />
\btraditionalvalues\.org\/urban\/nine\.php<br />
\btraineemeup\.blogspot\.com<br />
\btransformatec\.com\.br<br />
\btravian\.(?:pt|com\.br)/\?uc=<br />
\btribodatrilha\.com<br />
\btrilhadoslobos\.com\.br<br />
\btrombeteiro\.com<br />
\btudo-sobre-a-tv\.blogs\.sapo\.pt<br />
\btudosobrecdc\.blogspot\.com<br />
\btudosobrecharmed\.blogspot\.com<br />
\btudosobreufologia2010\.blogspot\/.com<br />
\btudotemos\.com\.br <br />
\btunigup.rg3\.net<br />
\bturismobahia\.com\.br<br />
\bturismoholambra\.com\.br<br />
\bturismonovale\.com <br />
\bturismonovale\.com\.br<br />
\btvaqui\.com\.br<br />
\btvbrasilaudiencia\.zip\.net<br />
\btvcontacto\.wordpress\.com<br />
\btvdigitalnopc\.com<br />
\btvfoco\.com\.br<br />
\btvlivre\.org<br />
\btvmundo\.wordpress\.com<br />
\btvtuga\.tv<br />
\btwitter\.com\/analistati<br />
\btwitter\.com\/vini_rio<br />
\btwitter\.com\/weloveisatkmas<br />
\btwitterbrasil\.org<br />
\bucrania\-mozambique\.blogspot\.com<br />
\bufotvonline\.com\.br<br />
\buhdtv\.com\.br <br />
\bultimatesonic\.wordpress\.com<br />
\bumbanda\.blogs\.sapo\.pt<br />
\buniagua\.org.\br<br />
\buniblog\.com\.br<br />
\bunitedphotopress\.com<br />
\buniversalistas\.blogspot\.com<br />
\buniversalposterz\.com<br />
\buniversoanyeviny\.com\.br<br />
\buniversoben10\.blogspot\.com<br />
\buo\.com\.br<br />
\buppw\.org <br />
\burbanawebsite\.com\.br<br />
\burban-rivals\.com/\?sponsor=<br />
\busercash\.com/\?r=<br />
\buvaonline\.uva\.br<br />
\bvagalume\.uol\.com\.br<br />
\bvagasti\.v10\.com<br />
\bvalegastronomia\.com <br />
\bvalegastronomia\.com\.br<br />
\bvalegastronomia\.net <br />
\bvalegastronomia\.org<br />
\bvalinor\.com\.br\/forum\/<br />
\bvalinor\.com\.br\/viewtopic\.php\?<br />
\bvejalourdes\.com\.br<br />
\bveleirodingue\.freeboat.\com\.br<br />
\bvendasnaweb\.com\.br<br />
\bventurosanet\.com<br />
\bveredaestreita\.org<br />
\bveredaestreita\.org\/2008/<br />
\bveredasbrasil\.com\.br<br />
\bviagemlegal\.com<br />
\bviagensbariloche\.com\.br<br />
\bviagens-belgica\.info <br />
\bviagensdubai\.com\.br<br />
\bviagens-grecia\.info<br />
\bviagens-noruega\.info<br />
\bviagens-republica-checa\.info<br />
\bviaiguassu\.com<br />
\bviajarapuntadeleste\.com\.ar<br />
\bviajoporargentina\.com<br />
\bviciodeviajar\.blogspot\.com<br />
\bvidavaitorta\.blogspot\.com<br />
\bvideo\.google\.com\/videoplay\?<br />
\bvideocliper\.com<br />
\bvideolog\.tv<br />
\bvideolog\.uol\.com\.br <br />
\bvideos\.etc\.br<br />
\bvideosmusica\.tv<br />
\bvidyayoga\.org<br />
\bvilacriativa\.com\.br<br />
\bvilanovenseblog\.blogspot\.com<br />
\bvimeo\.com<br />
\bvini.rio\.vila\.bol\.com\.br<br />
\bvini.rio\.vilabol\.com\.br<br />
\bvirouviral\.com<br />
\bvisitasonline\.com<br />
\bvisitearacaju\.com\.br<br />
\bvisitepontagrossa\.com\.br<br />
\bvisitesaopaulo\.com <br />
\bvisualmedia\.com\.br<br />
\bvitoriagrande\.com <br />
\bvitorsousaalbufeira\.blogspot\.com <br />
\bvitrinepublicitaria\.net<br />
\bvjez\.com<br />
\bvoceselembra\.blogspot\.com<br />
\bvoipbra\.com\.br<br />
\bvolta\.mirc\.vilabol\.uol\.com\.br<br />
\bvoltamirc\.co\.nr<br />
\bvoltamirc\.rg3\.net<br />
\bvoltamirc\.web44\.net <br />
\bvoos-info\.com <br />
\bwallpapers\.regeneration\.com\.br<br />
\bwaoIndia\.com<br />
\bwarriors-of-wrestling\.blogspot\.com<br />
\bwata-eh-legal\.blogspot\.com<br />
\bwaysforus\.org<br />
\bwebcaldas\.com\.br<br />
\bwebcarcenter\.com\.br<br />
\bwebcolinas\.com<br />
\bwebimoveisnointerior\.com\.br<br />
\bwebland\.ppg\.br<br />
\bwebmap\.in<br />
\bwebmove\.com\.br<br />
\bwebng\.com\/itatiaia<br />
\bwebsoccerclub\.com <br />
\bwebtemplarios\.forumup\.com <br />
\bweshow\.com<br />
\bwicca-ipatinga\.blogspot\.com<br />
\bwikipedia\.artudi\.org<br />
\bwikipediaqueixas\.blogspot\.com<br />
\bwikisus\.net<br />
\bwindowsvistadicasemgeral\.com<br />
\bwordpress-genial\.com<br />
\bworld7\.monstersgame\.com\.pt<br />
\bworldcruises1\.blogspot.\com<br />
\bworldpressphoto\.nl <br />
\bwurdulaks\.blogspot\.com<br />
\bwwwrichardgoterra\.blogspot\.com<br />
\bx-dsg\.com<br />
\bx-flog\.com\.br<br />
\bxgamesnet\.blogspot\.com<br />
\bxgoogle\.com\.br/blog\/2008\/04\/26\/download-de-psych<br />
\bxn--musculao-xza3b\.com<br />
\bXoppi\.com <br />
\by2kdesign\.com<br />
\byenidizayn\.com<br />
\byogaclick\.com\.br<br />
\byogavaidika\.com<br />
\byoungandhealthy\.ca<br />
\byoupiee\.com\.br<br />
\byouporn\.com<br />
\byoutube\.com\/results\?<br />
\byoutube\.com\/v\/<br />
\byoutube\.com\/view_play_list\?<br />
\byoutube\.com\/watch\?<br />
\byoutube\.com\/watch\?v<br />
\bz10.invisionfree\.com<br />
\bz6\.invisionfree\.com<br />
\bzamarian\.com\.br<br />
\bzanottofederal1555\.com\.br/<br />
\bzapbox\.com\.br<br />
\bzapenglish\.com<br />
\bziggi\.com\.br\/downloads<br />
\bzoonadocelular\.com <br />
\bzoonose\.com\.br<br />
\bzymboo\.com<br />
\.myjerseys\.org<br />
\.weddingdressebay\.com<br />
#</pre> <!-- leave this line exactly as it is --></div>Gmaxwellhttps://wiki.xiph.org/index.php?title=MediaWiki:Spam-blacklist&diff=14140MediaWiki:Spam-blacklist2013-05-13T04:08:00Z<p>Gmaxwell: spam: paydayloans-trust\.co\.uk</p>
<hr />
<div> # External URLs matching this list will be blocked when added to a page.<br />
# This list affects only this wiki; refer also to the global blacklist.<br />
# For documentation see http://www.mediawiki.org/wiki/Extension:SpamBlacklist<br />
#<!-- leave this line exactly as it is --> <pre><br />
#<br />
# Syntax is as follows:<br />
# * Everything from a "#" character to the end of the line is a comment<br />
# * Every non-blank line is a regex fragment which will only match hosts inside URLs<br />
paydayloans-trust\.co\.uk<br />
mostrawildt\.com<br />
wikin\.com<br />
infinitycommerce\.co\.uk<br />
senuke-xcr-discount\.com<br />
mooncityz\.com<br />
gcagint\.com<br />
groupcow\.com<br />
synqk\.com<br />
organicdata\.com\.au<br />
cameronmorgan\.co\.uk<br />
singleme\.com<br />
Menuggs\.org<br />
casinosdiary\.com<br />
abercrombieaustralia\.com<br />
weightsbenchtraining\.co\.uk<br />
thedegreeexperts\.com<br />
xtremeonline\.com\.au<br />
xstretchmarks\.com<br />
\.casinobonus24\.com<br />
\.mydietarea\.com<br />
\.swiftmoney\.org\.uk<br />
\.bringexbackblog\.com<br />
registry-repair-tools\.net<br />
automobile-insurance\.com<br />
bestentrypoint\.com<br />
banansearch\.com<br />
\.pavtube\.com<br />
\.videos-phone\.net<br />
\.chatixdating\.com<br />
\.teensay\.com<br />
\.cheappoolproducts\.com<br />
\.lease-a-seo\.com<br />
\.totalscreenrecorder\.com<br />
\.mychristianheels\.com<br />
\.mbtshoesupply\.com<br />
\.healthmuscle\.com<br />
\.official-canadian-pharmacy\.org<br />
\.customessaywritinghelp\.com<br />
\.boostbrand\.org<br />
\.promoteland\.com<br />
\.uk-dissertation\.com<br />
\b1000cores\.com<br />
\b100anosgalo\.blogspot\.com<br />
\b100cal\.ex-br\.com <br />
\b100diasdesandero\.blogspot\.com <br />
\b11onze\.com <br />
\b123imoveis\.com\.br <br />
\b123people\.it<br />
\b13studiohost\.com<br />
\b1clique\.blogspot\.com<br />
\b2hand\.googet\.eu<br />
\b2jump2\.com<br />
\b4shared\.com<br />
\b4shared\.com\/file<br />
\b55chan\.org<br />
\b91rock\.com\.br<br />
\baapaaa\.blogspot\.com<br />
\babctorre\.xpg\.com\.br<br />
\babdieldamon\.wordpress\.com <br />
\baberturas-de-novelas\.blogspot\.com<br />
\babreloja\.com<br />
\babrolhos\.net<br />
\bacademiadovinho\.com\.br<br />
\bacademiagraciebutanta\.com\.br/<br />
\bacademiarafaelleitao\.blogspot\.com<br />
\bacaminhodaonde\.blogspot\.com<br />
\bacao-humana\.blogspot\.com<br />
\bacheibr\.com<br />
\bacidosnucleicos\.110mb\.com <br />
\badhentai\.blogspot\.com<br />
\badministracaoegestao\.com\.br<br />
\badororomances\.com<br />
\baevolut\.com<br />
\bafazenda\.blogger\.com\.br<br />
\bafricanamericantravelagency\.com <br />
\bafricarte\.it<br />
\bag4\.com\.br<br />
\bageanbrasil\.com\.br<br />
\bagenciaar\.com\.br<br />
\bagenciasolo\.com\.br<br />
\bagenciaspin\.com<br />
\bagoravale\.com<br />
\bagoravale\.com\.br<br />
\bagoravale\.net<br />
\bagoravale\.org<br />
\bagribusinessNews\.com <br />
\bagrogemeos\.com\.br<br />
\bagruta\.com\.br<br />
\baguasemendadas\.com<br />
\bahsforum\.com<br />
\baideialibertaria\.blogspot\.com<br />
\bairsoftbrasil\.com<br />
\balabrasil\.com <br />
\balbacete\.com\.br <br />
\balemanja\.org <br />
\balephradiestesia\.com\.br<br />
\balexandre\.eletrica\.ufu\.br<br />
\balgumapoesia\.com\.br<br />
\balimentacaosaudavel\.net<br />
\baliviodaalma\.com\.br<br />
\ballcenter\.com\.br<br />
\ballservice\.cnt\.br<br />
\ballsexhub\.com<br />
\balojamentos-online\.com <br />
\balojamiento\.cl<br />
\baltamiroborges\.blogspot\.com<br />
\balternativamedicina\.com<br />
\balvinhopatriota\.com\.br<br />
\bamanda-rossi\.blogspot\.com<br />
\bamazon\.ca<br />
\bamazon\.co\.jp<br />
\bamazon\.co\.uk<br />
\bamazon\.com\/gp\/product<br />
\bamazon\.de<br />
\bamazon\.fr<br />
\bambienteinteiro\.org\.br<br />
\bamericanas\.com\.br\/AcomProd<br />
\bamericanas\.com\.br\/cgi\-bin<br />
\bamericanas\.com\.br\/cgi-bin<br />
\bamericanas\.com\.br\/prod<br />
\bamigo\.kit\.net<br />
\bamigoskids\.blogspot\.com<br />
\bamilcorretora\.com\.br<br />
\bamoisatkmaisnick\.blogspot\.com<br />
\bamoresexogratis\.com<br />
\bamostrasgratis\.org<br />
\ban\.locaweb\.com\.br\/Webindependente<br />
\banalistati\.com<br />
\banamacedoescritora\.blogs\.sapo\.pt<br />
\bandreabrasilmadrid\.es <br />
\bandremafei\.com<br />
\bandrologia\.cjb\.net<br />
\bangelfire\.com\/dc/evangelhoespirita<br />
\banimavita\.com\.br<br />
\banimetnt\.com\.br<br />
\banmtv\.com\.br<br />
\bannamarya\.com\.br<br />
\banticensura\.blogspot\.com<br />
\banunciautos\.com\.br<br />
\banunciosgv\.com<br />
\bapagaodatelefonica\.vai\.la<br />
\bapfertilidade\.org <br />
\bapi\.ning\.com<br />
\bappartamentiischia\.it<br />
\bappliedwingchun\.com\.br<br />
\barabesq\.com\.br<br />
\barabian\.vila\.bol\.com\.br<br />
\barabian\.vilabol\.com\.br<br />
\barabians\.vila\.bol\.com\.br<br />
\barabians\.vilabol\.com\.br<br />
\baracaju-se\.com\.br <br />
\barcondicionado-split\.com<br />
\barenatibia\.com <br />
\bargentina\.ar<br />
\bargentinatolet\.com <br />
\bargentinawinetours\.com<br />
\bargentour\.com<br />
\bargilaviva\.blogspot\.com<br />
\barqueologiaegipcia\.zip\.net<br />
\barquitectura\-sustentavel\.blogspot\.com<br />
\barquitectura-sustentavel\.blogspot\.com<br />
\barquivosbt\.blogspot\.com<br />
\barroxe\.net<br />
\bartbr\.com\.br<br />
\bartedb\.com\.br<br />
\bartenet\.com\.br<br />
\bartesmarciaishoje\.blogspot\.com<br />
\barthonline\.com\.br\/clouds/<br />
\barts\.lojadeluxo\.com<br />
\bas\-chiquititas\.blogspot\.com<br />
\basdf\.com\.br<br />
\basenergiasrenovaveis\.blogspot\.com<br />
\basonrisanordica\.com<br />
\basterdomus\.com\.br<br />
\bastore\.amazon\.com<br />
\bathoscompanny\.com\.br<br />
\batitlan\.net<br />
\batividadesfisicas\.com\.br<br />
\batmaneditora\.com\.br <br />
\batortonycorreia\.bloguepessoal\.com<br />
\baudiencia\.zip\.net<br />
\baudienciabrasileiradetv.wordpress.com<br />
\baudienciadatv\.wordpress\.com<br />
\baudienciadetv\.blogspot\.com<br />
\baudienciaemdestaque\.blogspot\.com<br />
\baudiolivro\.net\.br<br />
\baulalamontera\.com<br />
\baustria-travel\.biz<br />
\bautolatinaclube\.cjb\.net<br />
\bautosp\.com\.br<br />
\bavengedsevenfold\-portugal\.blogspot\.com<br />
\baverdadesobreagnosis\.com\.br<br />
\bavrilbandaids\.com\/forums<br />
\bavrillavigne-pics\.com<br />
\bavril-media\.blogspot\.com<br />
\bavrilmidia\.com\/forum<br />
\bawkwardish\.com<br />
\bbabywallpaper\.com\.br<br />
\bbaixartudogratis\.info<br />
\bbaixartudogratis\.info<br />
\bbalduran\.com\.br<br />
\bbandvoip\.com\.br<br />
\bbanheiraspa\.com\.br<br />
\bbaraogeraldo\.com\.br<br />
\bbarcelos\.com<br />
\bbarcoavista\.blogspot\.com<br />
\bbarrabravas\.net<br />
\bbarradosahy\.net<br />
\bbatalhadosguararapes\.com\.br<br />
\bbatomdamoda\.webnode\.com\.br<br />
\bbazardaspalavras\.blogspot\.com<br />
\bbazarpop\.com\.br<br />
\bbeatrixmonteiro_fas.blogs\.sapo\.pt<br />
\bbeatriz_monteiro_faclube\.blogs.\sapo\.pt<br />
\bbeatrizmonteiro_faclube\.blogs.\sapo\.pt<br />
\bbebidaboa\.com\.br<br />
\bbelem-pa\.com\.br<br />
\bbelezapt\.com<br />
\bbelohorizonte-mg\.com\.br<br />
\bbemmequercestas\.com<br />
\bben10thevideogame\.com<br />
\bben10toys\.net<br />
\bben10toys\.net\/Backup\/images<br />
\bben10ultimatealien3\.blogspot\.com<br />
\bbeneklee\.com<br />
\bbenzisobrenomes\.com<br />
\bbethynha\.com\.br<br />
\bbgojogos\.blog\.terra\.com\.br<br />
\bbhdog\.com\.br<br />
\bbiagra\.com\.br <br />
\bbibliaonline\.com\.br<br />
\bbibliaonline\.iguga\.com <br />
\bbibliojunior\.ufsc\.br<br />
\bbigmarkett\.com<br />
\bbigshowdownloads\.blogspot\.com<br />
\bbio-combustivel\.blogspot\.com<br />
\bbiografia\.wiki\.br<br />
\bbioinfo\.com\.br<br />
\bbiomech\.com\.br<br />
\bbipol-art\.com<br />
\bbisotto\.com\.br<br />
\bbizarriceslol\.com<br />
\bblackminton\.pt<br />
\bblog.antonioplanet\.net<br />
\bblogaritmox\.blogspot\.com<br />
\bblogcmmi\.com\.br<br />
\bblogdamostra\.blog\.uol\.com\.br<br />
\bblogdoconsignado\.com\.br<br />
\bblogdohiellevy\.com\.br<br />
\bblogfajuta\.blogspot\.com<br />
\bblogdorasta\.wordpress\.com<br />
\bblog-escoteiro\.blogspot\.com<br />
\bbloglouco\.com<br />
\bblogs\.abril\.com\.br\/novidadesdatv<br />
\bblogsobrenovelas\.blogspot\.com <br />
\bblumenau-sc\.com\.br<br />
\bbm-beatrizmonteiro\.blogs\.sapo\.pt<br />
\bbneinoach\.com\.br<br />
\bboavista-rr\.com\.br<br />
\bbodybuildingxl\.com<br />
\bboingdragon\.com <br />
\bbombinhas\.com<br />
\bboxtv\.hd1\.com\.br<br />
\bbr\.desert-operations\.com\/?recruiter=41b1<br />
\bbr\.geocities\.com\/amandinha_band888\/links\/tiburon_coupe_anteriores2\.html<br />
\bbr\.geocities\.com\/khentzu/<br />
\bbr2\.biz<br />
\bbrasaoweb\.com<br />
\bbrasilcombate\.com\.br<br />
\bbrasilcombate\.com\.br<br />
\bbrasildemochila\.com<br />
\bbrasildestinos\.com\.br<br />
\bbrasilfas\.blogspot\.com<br />
\bbrasiliacac\.com<br />
\bbrasilimperial\.org\.br\/verdade3.htm<br />
\bbrasilinformacao\.com\.br<br />
\bbrasilturismo\.com<br />
\bbrazilcartoon\.com<br />
\bbrazilgallery\.com\.br<br />
\bbrejas\.com\.br <br />
\bbrekground\.com\/wiiground<br />
\bbrincando\.no\.sapo\.pt<br />
\bbrinquedosdepapel\.com\.br<br />
\bbrofficeparaleigos\.blogspot\.com<br />
\bbronquite\.com<br />
\bbruxaria\.org<br />
\bbrvida\.org<br />
\bbssilveira.blogspot.com<br />
\bbulledebeaute\.wordpress\.com<br />
\bburionline\.wordpress\.com<br />
\bbuscamp3\.com\.br<br />
\bbuscaporsaude\.com\.br<br />
\bbuxput\.com <br />
\bbwin\.com <br />
\bbwin\.site\.vu <br />
\bcabalahoje\.blogspot\.com<br />
\bcabanhabutia\.com\.br<br />
\bcabecadecuia\.com<br />
\bcabofrio-rj\.com\.br<br />
\bcachacagabriela\.com\.br<br />
\bcaipira\-sp\.com\.br<br />
\bcajamarnet\.com\.br<br />
\bcalcatrilhos\.henyah\.com<br />
\bcalcule\.net<br />
\bcamaragibeonline\.com<br />
\bcamarotedasestrelas\.com\.br<br />
\bcamboriu\.org<br />
\bcambralha1\.blogspot\.com<br />
\bcamillacastro\.org<br />
\bcamillacastro\.org\/angelinajolie/<br />
\bcamiloaparecido\.blog\.terra\.com\.br <br />
\bcaminhositaipu\.com\.br<br />
\bcampogrande-ms\.com\.br <br />
\bcanalfreak\.com\.br<br />
\bcanalmatriz\.zip\.net<br />
\bcanalmax\.com\.br<br />
\bcanarilalmada\.com<br />
\bcanchim\.com\.br<br />
\bcandycandyanns\.iespana\.es<br />
\bcanilchinador\.com\.br<br />
\bcanilpequenoencanto\.webng\.com <br />
\bcanilvilabrasil\.com\.br<br />
\bcanoas-rs\.com\.br<br />
\bcaonanet\.blogspot\.com<br />
\bcarcasse\.com<br />
\bcardiologia\.com\.br<br />
\bcarlinha\.com\.br<br />
\bcarloscostaaqui\.blogspot\.com<br />
\bcarlosfran\.com<br />
\bcarnaporto2010\.com\.br<br />
\bcarnevalli\.googlepages\.com<br />
\bcarrosderua\.com\.br<br />
\bcartasdecredito\.com\.br <br />
\bcartoesonline\.com\.br<br />
\bcartuningrevolution\.com <br />
\bcasadanutricao\.com\.br<br />
\bcasadasprimas\.wordpress\.com <br />
\bcasadastiras\.blogspot\.com<br />
\bcasamentobrasil\.com\.br<br />
\bcasasnolago\.com\.br<br />
\bcasinoglamour\.com<br />
\bcastlelords\.blogspot\.com<br />
\bcastlelords\.net <br />
\bcauas\.blogspot\.com<br />
\bcavaleiroconde\.blogspot\.com<br />
\bcavalosarabes\.vilabol\.uol\.com\.br<br />
\bccdb\.gea\.nom\.br<br />
\bcdjapan\.co\.jp<br />
\bceliaco\.com\.br<br />
\bcelsovenicius\.com\/<br />
\bcenatecbrasil\.com\.br<br />
\bcenterpokemon\.blogspot\.com<br />
\bcentraldosexo\.com<br />
\bcentraliza\.com\.br<br />
\bcentralparaiso\.com<br />
\bcentric\.tv\.br<br />
\bcentrodemoda\.com<br />
\bcentrofilosoficodokungfu\.com\.br<br />
\bcertidex\.com\.br<br />
\bcervejasdomundo\.com<br />
\bcescapi\.com<br />
\bceucabrscanoas\.com\.br\/documents\/blog_2\.php<br />
\bcfgigolo\.com<br />
\bchanzon\.com<br />
\bchaos\.com\/product<br />
\bcharles\.art\.br<br />
\bcharmed\-news\.blogspot\.com<br />
\bcharmedgallery\.blogspot\.com<br />
\bchaves\.blogs\.sapo\.pt<br />
\bchavesantiga\.blogs\.sapo\.pt<br />
\bcheckupgeriatrico\.com\.br <br />
\bchihuahua\.vet\.br<br />
\bchiquititas\-online\.pt\.vc<br />
\bchiquititassic\.blogs\.sapo\.pt<br />
\bchrislimatop\.com\.br<br />
\bchrome-center\.net<br />
\bchuteperfeito\.com\.br<br />
\bciberdata\.com<br />
\bciberespaconaescola\.blogspot\.com<br />
\bcidade\.alterosa\.net<br />
\bcidadebelojardim\.blogspot\.com<br />
\bcidadedebocaina\.com <br />
\bcidade-lagoa\.com<br />
\bcidade-lisboa\.com<br />
\bcidadespaulistas\.com\.br<br />
\bcidadewebrock\.com\.br<br />
\bcimento\.org<br />
\bcimentonline\.com\.br<br />
\bcincoquartosdelaranja\.blogspot\.com<br />
\bcindylauperbrasil\.com<br />
\bcinemabizarre-brasil\.go-board\.com\/forum\.htm <br />
\bcinemacomrapadura\.com\.br\/filmes\/imgs\/<br />
\bcircolivenetifainors\.blogspot\.com<br />
\bcircuitodosamba\.net<br />
\bcirurgia\.com\.br<br />
\bcirurgia\-plastica\.com<br />
\bclangamesbr\.net<br />
\bclansnqp\.com<br />
\bclaradilucenna\.blogspot\.com<br />
\bclassificados\.wegoo\.com\.br<br />
\bclassificadosregional\.com\.br <br />
\bclicador\.com<br />
\bclickgalera\.com\.br<br />
\bclickglobinho\.zip\.net<br />
\bclickjogos\.uol\.com\.br<br />
\bclicktvglobinho\.blogspot\.com<br />
\bclickviagens\.com<br />
\bclicrbs\.com\.br\/kzuka<br />
\bclinicadedermatologia\.com\.br<br />
\bclinicaleger\.com\.br<br />
\bclinicamedicambdoctor\.blogspot\.com<br />
\bclone\.aguiar\.googlepages\.com<br />
\bclubedariqueza\.com\.br<br />
\bclubedascelebridades\.com<br />
\bclubedologusepointer\.com\.br<br />
\bclubedosbeberroes\.com\.br<br />
\bclube-morangos\.com<br />
\bclubesafobrasil\.com<br />
\bclubevencedor\.com\.br<br />
\bclubpinguimcp\.blogspot\.com<br />
\bcobolware\.com<br />
\bcocadaboa\.com\.br<br />
\bcodigofonte\.com\.br<br />
\bcoelhodafonseca\.com\.br<br />
\bcoisasdoenio\.blogspot\.com <br />
\bcoisasinteressantes\.com\.br <br />
\bcolocanoidolos\.blogspot\.com<br />
\bcoluna\.com<br />
\bcomlines\.com\.br<br />
\bcommonpurpose\.org<br />
\bcomobaixar\.org<br />
\bcomofazerumcurriculum\.com<br />
\bcomosairdoaluguel\.zip\.net<br />
\bcomprarcreatina\.org<br />
\bcomprasnasantaifigenia\.com\.br<br />
\bcomunidadefb\.com\.br<br />
\bcomunidades\.net<br />
\bconceitozen\.com\.br<br />
\bconectiomg\.com\.br<br />
\bconexaodinheiro\.com<br />
\bconfrariadechaves\.net<br />
\bconfrariadecinema\.com\.br<br />
\bconheca-me\.com <br />
\bconheceroislam\.com\.br <br />
\bconnectionworld\.org<br />
\bconocereislaverdad\.org<br />
\bconselheira\.virtual\.zip\.net<br />
\bconsultadetaro\.com<br />
\bconsultarpagerank\.com\.br<br />
\bconsultarpagerrank\.com\.br<br />
\bconsultorio\.com\.br<br />
\bcontabilbr\.com<br />
\bcontadoresgratis\.web-kit\.org <br />
\bcontaouro\.com\.br<br />
\bcontedesign\.com\.br<br />
\bcontente\.blogspot\.com<br />
\bconteudoesportivo\.com\.br<br />
\bcontextojuridico\.blogspot\.com<br />
\bcontraditorium\.com<br />
\bcontrapontoeditora\.com\.br<br />
\bcooperativismodecredito\.blogspot\.com<br />
\bcooppr\.med\.br<br />
\bcoroascaseiras\.net<br />
\bcorreiocarioca\.com\.br<br />
\bcorreionatalino\.com\.br<br />
\bcortesepenteados\.com\.br<br />
\bcosmeticosharimar\.blogspot\.com/<br />
\bcosmetologiaeestetica\.com\.br<br />
\bcosplaybr\.com\.br<br />
\bcostaverdenoticias\.com<br />
\bcpcpbr\.tk<br />
\bcpf\.adv\.br<br />
\bcrazyshake\.net<br />
\bcrazyvideo\.blog\.terra\.com\.br<br />
\bcrazyvideo\.no\.comunidades\.net<br />
\bcreatuforo\.com<br />
\bcredito-info\.com<br />
\bcriacionismoevidencias\.blogspot\.com <br />
\bcriandocalopsitas\.webs\.com<br />
\bcriefuturos\.com\.br<br />
\bcristianor7\.com<br />
\bcristianoronaldofan\.blogs\.sapo\.pt<br />
\bcrm2\.com\.br<br />
\bcsonlinebr\.net<br />
\bctviva\.com\.br<br />
\bculturach\.com\.br<br />
\bcupim\.net\.br<br />
\bcursos24horas\.com\.br <br />
\bcursoseaulas\.com\.br<br />
\bcursosnocd\.com\.br<br />
\bcwhostnet\.com<br />
\bcyanidehappinesstraduzidos\.blogspot\.com<br />
\bcybercook\.com\.br<br />
\bcygets\.googlepages\.com\/teste_digitacao_concurso<br />
\bdabaixadaaomonumental\.blogspot\.com<br />
\bdabusca\.blogspot\.com<br />
\bdanceadois\.com\.br<br />
\bdancecom\.com\.br<br />
\bdanielcoelho\.com\.br<br />
\bdantasplanosdesaude\.com\.br<br />
\bda-pay\.com<br />
\bdashofer\.pt<br />
\bdatasul\.com\.br\/franquias<br />
\bdatasulecm\.com\.br<br />
\bdauri\.com\.br<br />
\bdbzmangalevels\.homestead\.com<br />
\bddl\.name/<br />
\bdebate\.com\.br<br />
\bdedetizacao\.bio\.br<br />
\bdefesabrasil\.com<br />
\bdelta-cafes\.pt<br />
\bdemocracia-fraudada\.com<br />
\bdentistas\.com\.br<br />
\bdepilacao-definitiva\.blogspot\.com<br />
\bdeputadocorauci\.com\.br<br />
\bdesign\.com\.br<br />
\bdesignatento\.com<br />
\bdesignbr\.ning\.com<br />
\bdesigndictionary\.co\.uk <br />
\bdestruindopalavras\.wordpress\.com<br />
\bdetetiveparticular\.hpgvip\.ig\.com\.br<br />
\bdetetive-particular\.org <br />
\bdetetive--particular\.org<br />
\bdetetiveparticular-saopaulo\.com<br />
\bdetetiveparticularsaopaulo\.hpgvip\.ig\.com\.br <br />
\bdetetivesnobrasil\.com\.br<br />
\bdevaneiosdesintericos\.blogspot\.com<br />
\bdeveloperslinux\.com <br />
\bdiariodosartistas\.com<br />
\bdiariosantee\.com\.br<br />
\bdicas-de-presente\.com<br />
\bdicionariodesimbolos\.com\.br<br />
\bdicionario-portugues\.com<br />
\bdictionary\.valodas\.com<br />
\bdieta-certa\.com<br />
\bdietafacil\.awardspace\.com<br />
\bdigicurso\.com <br />
\bdigidelta-software\.com<br />
\bdigipronto\.com\.br<br />
\bdigitrace\-portugal\.com<br />
\bdignidadevascaina\.com<br />
\bdigorest\.com<br />
\bdigshop\.com\.br<br />
\bdiplomaticsociety\.org<br />
\bdireitodoestado\.com\.br<br />
\bdiretodehollywood\.com<br />
\bdiscadorpreditivo\.com\.br<br />
\bdistintivos\.com\.br<br />
\bdisturbiodopanico\.com\.br<br />
\bditudo\.etc\.br<br />
\bditudo\.wiki\.br<br />
\bdivulgaemails\.com<br />
\bdjban\.com\.br<br />
\bdmfer\.com\.br<br />
\bdoencasealimentos\.com<br />
\bdonzeladedomremy\.webs\.com<br />
\bdormiu\.com\.br<br />
\bdorperportoazul\.com\.br <br />
\bdownload\.mus\.br<br />
\bdownloadcurriculum\.com<br />
\bdragaobranco\.com\.br<br />
\bdreamingdolls\.net<br />
\bdr-organico\.com\.br<br />
\bdstudium\.com<br />
\bduasasas\.com<br />
\bdubitando\.no\.sapo\.pt<br />
\bdublanet\.com\.br<br />
\bducker\.com\.br<br />
\bdurmamelhor\.com<br />
\bdvdbarato\.net<br />
\bdvdja\.com\.br<br />
\bdw-world\.de\/dw\/0,2142,2594,00.html<br />
\beasylanguages\.com<br />
\becogenesys\.com\.br<br />
\becognitiva\.blogspot\.com<br />
\becologiaurbana\.com\.br<br />
\becomm\.com\.br<br />
\beconomiacriativa\.blogspot\.com\.br<br />
\beconomiadacultural\.blogspot\.com\.br<br />
\bedemdma\.cjb\.net<br />
\beditoraelim\.com\.br<br />
\bedmrocky\.blogspot\.com<br />
\beduardabreda\.ucoz\.com<br />
\beducacaodeinfancia\.com <br />
\befeitogarage\.com\.br <br />
\begregoralfa\.republika\.pl<br />
\behelp\.eti\.br<br />
\behsportugal\.com<br />
\bejp\.com\.sapo\.pt<br />
\belbestia\.blogspot\.com<br />
\beldorado\.tur\.br<br />
\belegance\.bona-xira\.net<br />
\beleicoesceara\.com\.br<br />
\belevabrasil\.com\.br<br />
\belevadoresmais\.com\.br<br />
\bembarcados\.com\.br<br />
\bembriologiahumana\.com\.br <br />
\bemprego\.destaca\.com\.br<br />
\bemprestimo-info\.com<br />
\bemsaovicente\.com\.br<br />
\bemsintese\.com\.br<br />
\bemtr\.com\.br<br />
\bencena\.pt<br />
\benoises\.wordpress\.com<br />
\bentrevistamarcosmion\.blogspot\.com<br />
\bentrevistamionmarcos\.blogspot\.com<br />
\benxadrismoecultura\.blogspot\.com<br />
\bepel\.eu <br />
\bequipa-design\.com <br />
\berickastler\.com<br />
\berickerico\.blogspot\.com<br />
\bernandijunior\.com\.br<br />
\bervadaninha\.sarava\.org<br />
\bescforum\.net<br />
\bescortvip\.com\.br<br />
\bescritoriodearte\.com <br />
\besnips\.com\/web<br />
\bespacofitnessacademia\.com<br />
\besporrozine\.blogspot\.com<br />
\besportes\.820am\.com\.br<br />
\besquinadotempo\.com\.br<br />
\bestagionet\.com\.br<br />
\bestudandoparaoexamedaordem\.blogspot\.com<br />
\bestudoreligioso\.wordpress\.com<br />
\besyurl\.com<br />
\beuacheifacil\.com\.br<br />
\beubiologia\.xpg\.com\.br<br />
\beutodeferias\.com\.br<br />
\bexamehosting\.com<br />
\bexbancario\.blog\.br<br />
\bexcelencia\.com\.br<br />
\bexplorevale\.com\.br<br />
\bexplosaoderecrutamento\.empreenderonline\.com<br />
\bezboard\.com<br />
\bf1incridible\.blogspot\.com<br />
\bfabiofettuccia\.zip\.net<br />
\bfaclube_beatrizmonteiro\.blogs\.sapo\.pt<br />
\bfailblog\.org<br />
\bfainors\.com<br />
\bfalajacone\.blogspot\.com<br />
\bfalandoemprojetos\.com<br />
\bfalker\.com.br<br />
\bfamiliarotaria\.com\.br<br />
\bfamosas\.wiki\.br<br />
\bfamosasdespidas\.com<br />
\bfamosos\.dimensionebrasile\.com<br />
\bfantasyproducoes\.com<br />
\bfaraos\.org<br />
\bfatorambiental\.com\.br<br />
\bfbfsistemas\.com<br />
\bfeiraodaweb\.com\.br<br />
\bfeiticos\.150m\.com<br />
\bfelipegoncalvesoficial\.blogspot\.com<br />
\bfellipelli\.com\.br<br />
\bferomonios\.com<br />
\bferramentasweb\.com\.br <br />
\bfestadonatal\.wetpaint\.com<br />
\bfhrpromocional\.com\.br<br />
\bficacomigo\.net<br />
\bfifamanager\.com\.pt<br />
\bfiles\.wordpress\.com<br />
\bfilipux\.blig\.ig\.com\.br<br />
\bfilmesportugueses\.com<br />
\bfilosofiaetecnologia\.com\.br<br />
\bfinancasparavida\.com\.br<br />
\bfisiozone\.com<br />
\bfitmorumbi\.com\.br/<br />
\bflaasa\.blogspot\.com<br />
\bflickr\.com\/photos\/vitor107<br />
\bflogao\.com\.br\/avaianosempre <br />
\bflorais\.com\.br<br />
\bfloresnaweb\.com<br />
\bfloriano-gescon\.blogspot\.com<br />
\bfloridabrasil\.com<br />
\bfloripa360\.com\.br<br />
\bfnquimica\.com<br />
\bfocadoemvoce\.com<br />
\bfocushost\.com\.br<br />
\bfogaoshop\.com\.br<br />
\bfonoaudiologia\.com\.br<br />
\bfonoaudiologia\.ourtoolbar\.com<br />
\bfootbook\.com\.br<br />
\bfootbrasil\.net<br />
\bformosafest\.com\.br<br />
\bforo\.telenovela-world\.com<br />
\bforo\.telenovela\-world\.com<br />
\bfortalezaradical\.blogspot\.com<br />
\bfortalezas\.org<br />
\bforum\.alavigne\.com\.br<br />
\bforum\.imasters\.uol\.com\.br<br />
\bforum\.mymetro\.ru<br />
\bforum\.nwbrasil\.com<br />
\bforumaqui\.net<br />
\bforumbrasil\.net<br />
\bforumchaves\.com\.br <br />
\bforumeiro\.org<br />
\bforumeiros\.com<br />
\bforumfotografia\.net <br />
\bforum-livre\.com<br />
\bforumnow\.com\.br<br />
\bforumpratodos\.com<br />
\bforums\.abs\-cbn\.com<br />
\bforums\.abs-cbn\.com<br />
\bforums\.hardwarezone\.com\.sg<br />
\bforums\.techarena\.in<br />
\bfotodosurf\.com\.br <br />
\bfotolog\.com\/faloplastia<br />
\bfotolog\.terra\.com\.br<br />
\bfreehoxt\.com<br />
\bfreelancers\.googet\.eu<br />
\bfreesamplesblog\.com<br />
\bfreewebs\.com\/advogadossalvadorbahia<br />
\bfreewebs\.com\/thecheetahgirlsbr<br />
\bfrequencia\.eu<br />
\bfresnorock\.com/<br />
\bfromplanetasperger\.blogspot\.com<br />
\bfuiaoinfernoevoltei\.blogspot\.com<br />
\bFullCarTuning\.com <br />
\bfunctionpointmodeler\.com<br />
\bfunctionpointmodeler\.de<br />
\bfundacaoatitude\.com\.br<br />
\bfundos\.com <br />
\bfundoverde\.com\.br <br />
\bfuracaomexicano\.com<br />
\bfuriaps2\.blogspot\.com<br />
\bfusca\.mobi<br />
\bfuscadorock\.blogspot\.com<br />
\bfutcc\.com\/images<br />
\bfutebol\.nocelular\.biz <br />
\bfutebolefixe\.blogspot\.com<br />
\bfutemoney\.blogspot\.com<br />
\bfutnet\.com\.br <br />
\bfuturomelhor\.wordpress\.com<br />
\bfxcast\.com/<br />
\bgabrielortiz\.com<br />
\bgagocoutinho\.wordpress\.com<br />
\bgalapagocruise\.com<br />
\bgaleradofundao\.org<br />
\bgalodigital\.com\.br<br />
\bgamd\.com\.br<br />
\bgamehall\.uol\.com\.br<br />
\bgames\.cartoonnetworkhq\.com\/downloadGame\.php<br />
\bgangdomoinho\.net<br />
\bgarotacomtecnologia\.blogspot\.com<br />
\bgaypride\.com\.br<br />
\bgenealogiabrasileira\.org<br />
\bgeocities.com\/gurnemanzbr\/astrid<br />
\bgeocities\.com\/cirurgiaplasticaestetica<br />
\bgeocities\.com\/pajero_full_200891<br />
\bgeocities\.com\/spiritistgospel <br />
\bgeocities\.com\/valternascimento<br />
\bgeoconcursos\.geotrack\.com\.br<br />
\bgeorreferenciamentoincra\.com\.br<br />
\bgeotecnologias\.wordpress\.com\/<br />
\bgermany-travel-guide\.info<br />
\bgestaocondominial\.spaces\.live\.com<br />
\bgiardinicas\.blogspot\.com<br />
\bginecologia-online\.com\.br<br />
\bgladiatus\.com\.pt\/game<br />
\bgladiatus\.com\/game<br />
\bgloboeletronicos\.com\.br<br />
\bglobominastvdigital\.com<br />
\bglosk\.com<br />
\bgnosesul\.com\.br<br />
\bgnosisonline\.org<br />
\bgoaguu\.googlepages\.com<br />
\bgoa-property\.net<br />
\bgolo-digital\.blogspot\.com<br />
\bgolo-online\.blogspot\.com<br />
\bgo-night\.com<br />
\bgooglewavedicas\.wordpress\.com<br />
\bgoolervier\.blogspot\.com<br />
\bgorgonzola\.se <br />
\bgorpa\.com\.br<br />
\bgosmametalica\.blogspot\.com<br />
\bgotroot\.com\.br<br />
\bgportal\.hu<br />
\bgpxonline\.com\.br<br />
\bgraciejiujitsufabioleopoldo\.com\/site\/<br />
\bgraffiti\.keusta\.net<br />
\bgraffiti\.org\.br<br />
\bgramadoecanela\.com\.br <br />
\bgrancorazon\.org<br />
\bgrandefraternidadebranca\.com\.br<br />
\bgratishost\.com\.br<br />
\bgriaule\.com<br />
\bgriaulebiometrics\.com<br />
\bgrupoyes\.com\.br<br />
\bgrupoyes\.com\.br\/Cursos\.aspx<br />
\bgsbrazil\.net<br />
\bguesthouseinitaly\.com<br />
\bgugol-downloads\.blogspot\.com<br />
\bguiabrasiladventure\.com<br />
\bguiabsb\.com\.br<br />
\bguiacastor\.com<br />
\bguiacurso\.com\.br<br />
\bguiadacopa\.net<br />
\bguiadaembalagem\.com\.br<br />
\bguiadaobra\.net <br />
\bguiadapesca\.com\.br<br />
\bguiadeatibaia\.com<br />
\bguiadeinvestimento\.com\.br<br />
\bguiadeitupeva\.com\.br<br />
\bguiadelrei\.com\.br<br />
\bguiademidia\.com\.br<br />
\bguiademongagua\.com\.br<br />
\bguiadocftv\.com\.br<br />
\bguiadoparaguai\.com\.br<br />
\bguiamongagua\.com\.br<br />
\bguiamorrao\.com\.br<br />
\bguilhermeabreu\.com\.br<br />
\bgunnersbrasil\.com<br />
\bgunsnrosesbrasil\.com<br />
\bgwebtools\.com <br />
\bgword\.com\.br<br />
\bh1loeqbb7bsndivgoj\.usercash\.com<br />
\bhabto\.com\.br<br />
\bhackerofdark\.blogspot\.com<br />
\bhacktolive\.org<br />
\bhaicaizen\.blogspot\.com<br />
\bhatada\.com\.br<br />
\bhavilla\.com\.br<br />
\bhelenablavatsky\.com\.br<br />
\bhellinger\.com\.br<br />
\bhesjapanese\.com <br />
\bhi5\.com<br />
\bhigh-supplies\.com<br />
\bhistoriadetudo\.com<br />
\bhistoriaimagem\.com\.br<br />
\bhistoriaserankings\.blogspot\.com<br />
\bhitany-fx\.blogs\.sapo\.pt<br />
\bhmscacambas\.com\.br<br />
\bhmv\.com\.hk\/product<br />
\bhogfriends\.net<br />
\bhospedar-se\.com <br />
\bhostercom\.com\.br<br />
\bhot100brasil\.com<br />
\bhotblowjobs\.com <br />
\bhotcheats\.org <br />
\bhotel13outubro\.com<br />
\bhotmailive\.blogspot\.com<br />
\bhotsurfers\.com\.br<br />
\bhotvnews\.wordpress\.com<br />
\bhtmlstaff\.org<br />
\bhttp-guia\.blogspot\.com<br />
\bhumanitarianlion\.com<br />
\bhumanomatica\.blogspot\.com<br />
\bhunterxhunter\.otaku\.com\.br<br />
\bianfavorite\.com<br />
\bibaladas\.com\.br<br />
\bibem\.org\/artigos\/acrobat<br />
\bibem\.org\/Hom_DPG<br />
\bibrasao\.com<br />
\bic\.vila\.bol\.com\.br<br />
\bic\.vilabol\.com\.br<br />
\bicm\.k6\.com\.br<br />
\bidealgarve\.com <br />
\bideas\.live\.com <br />
\bideia-atlantico\.pt<br />
\bideia3\.com\.br<br />
\bideiasedinheiro\.blogspot\.com<br />
\bidolomaniacos\.blogspot\.com<br />
\bidoloshome\.com<br />
\bigrejaparatodos\.com\.br<br />
\biguablogger\.blogspot\.com<br />
\bihateyoujulia\.com<br />
\bilha-dos-amores\.com <br />
\bilhaguriri\.com<br />
\bilhaguriri\.net<br />
\billuminatiarchives\.org<br />
\bim2\.com\.br<br />
\bimages\.amazon\.com<br />
\bimages\.orkut\.com<br />
\bimageshack\.us<br />
\bimageshack\.us<br />
\bimarketing\.com\.br<br />
\bimg\.photobucket\.com\/albums<br />
\bimhep\.com\.br<br />
\bimobiliariamercatto\.com.br<br />
\bimobilien\.com\.br<br />
\bimplantedentarios\.blogspot\.com<br />
\binacreditavel\.com\.br<br />
\bindicetj\.com<br />
\binesrodena\.blogspot\.com<br />
\binfo-caimbras\.org<br />
\binfofranchising\.pt<br />
\binfortronicabh\.blogspot\.com<br />
\binfovasco\.com<br />
\binfowaysi\.com<br />
\binibio\.xpg\.com\.br<br />
\binovabrasil\.blogspot\.com<br />
\binovadigital\.com<br />
\binsetotec\.com\.br <br />
\binsidernews\.com\.br<br />
\binstitutohellinger\.com\.br<br />
\binstitutouniao\.com\.br\/artigos/sindromedopanico.asp<br />
\bintecabsp\.wordpress\.com<br />
\binteligenciavirtual\.com<br />
\binterblogs\.com\.br\/homerofonseca<br />
\bIntercambioCultural\.com\.br<br />
\bintercambiocultural\.com\.br<br />
\bIntercambioCultural\.org<br />
\bintercambiocultural\.org <br />
\binternetpaulista\.com <br />
\binvasao\.com\.br<br />
\binvest\.fok\.com\.br<br />
\binvestbolsa\.com<br />
\bipetitions\.com<br />
\biphonept\.blogspot\.com<br />
\bisa-te-kiero-mais\.blogspot\.com<br />
\biscoach\.com<br />
\bisfreepop\.com\/series<br />
\bismep\.com\.br <br />
\bitanhaemonline\.com<br />
\bitanhaemvirtual\.com\.br<br />
\bitanhem\.blogspot\.com<br />
\bitapevacity\.com\.br<br />
\bitvibopedatv\.wordpress\.com<br />
\biwl\.com\.br<br />
\bjakeefred\.blogspot\.com<br />
\bjapaneselanguage\.da\.ru<br />
\bjaunews\.net<br />
\bjaymepanerai\.blogspot\.com<br />
\bjcmrpgart\.blogspot\.com<br />
\bjdnamidia\.com\.br<br />
\bjesusvira\.com\.br<br />
\bjogaki\.net<br />
\bjogodebuzios\.com\.br<br />
\bjogos-e-brincadeiras\.blogspot\.com<br />
\bjogosolimpicospequim\.com<br />
\bjogosvideos\.com<br />
\bjoiasweb\.com<br />
\bjonatasanches\.blogspot\.com<br />
\bjornadanasestrelas\.com<br />
\bjornalclubpenguinhoje\.blogspot\.com<br />
\bjornaldoe-commerce\.com <br />
\bjornalismo-desportivo\.blogspot\.com<br />
\bjornaloeco\.com\.br<br />
\bjosemanuelperez\.es\/wikipedia\/pt<br />
\bjoveminvest\.com\.br <br />
\bjubaia\.com\.br<br />
\bjulianoaudiencia\.zip\.net<br />
\bjunkie\.zonesp\.com<br />
\bjurisprudenciaemrevista\.org <br />
\bkachorro\.xpg\.com\.br<br />
\bkarapintadas\.wordpress\.com<br />
\bkatatau\.com<br />
\bkeequeenalive\.web\.pt<br />
\bkevinhaddock\.com<br />
\bkidicas\.com<br />
\bkikiat\.com<br />
\bkiminda\.wordpress\.com<br />
\bkissboots\.blogspot\.com<br />
\bkitline43\.com<br />
\bkitmaladiretaoverdadeiro001\.com<br />
\bkitpipa\.com<br />
\bkoinoo\.ning\.com<br />
\bkombu\.de<br />
\bkombucha\.hotel-br.\com<br />
\bkraazydragonball\.com<br />
\bkriyayoga-mahavatarbabaji\.com<br />
\bkuthribeirooficial\.blogspot\.com<br />
\bkxk\.me<br />
\bkyliept\.forumeiro\.com<br />
\bkyocerasolar\.com\.br<br />
\bl2gp\.com<br />
\bl2ouro\.com<br />
\blabgeo\.blogspot\.com<br />
\blabirinto\.wiki\.br<br />
\blacchiappasogni\.tk<br />
\blageado\.com\.br<br />
\blagosmilitar\.blogspot\.com<br />
\blajepor\.com\.br<br />
\blasmanzanasdulces\.wordpress\.com<br />
\blastfm\.com\/event<br />
\blastfm\.pt\/event<br />
\blatinasex\.741\.com<br />
\blattesnet\.com\.br<br />
\blayart\.com\.br<br />
\blecachalot\.xmb\.com\.br<br />
\bleechesturkey\.com<br />
\blegendanimes\.com<br />
\blelecasapeca\.blogger\.com\.br<br />
\blendas-fantasia\.blogspot\.com<br />
\blfsapatos\.com\.br<br />
\blibertarianismo\.com<br />
\blicitamais\.com\.br<br />
\blife-stream\.webs\.com<br />
\blinerecordsshop\.com\.br<br />
\blingua-ingles\.blogspot\.com<br />
\blinhabase\.com\.br<br />
\blinhasnaareia\.com<br />
\blinkinparker\.webs\.com<br />
\blinkjb<br />
\blinkjb\.vilabol\.uol\.com\.br<br />
\blinknacional\.com\.br<br />
\blinkvitrine\.com\.br<br />
\blistadebrinquedos\.com<br />
\blistadelivros-doney\.blogspot\.com<br />
\blistapratica\.com<br />
\blitoraldesantacatarina\.com<br />
\blitoralnorters\.com\.br<br />
\bliverig\.wordpress\.com<br />
\blivestream\.com\.br<br />
\blivrariasaraiva\.com\.br\/produto<br />
\blivrogastronomico\.do\.sapo\.pt <br />
\blivromidp\.jorgecardoso\.eu<br />
\blixaoblog\.blogspot\.com<br />
\blogobr\.wordpress\.com<br />
\blojaconrad\.com\.br\/produto\.asp<br />
\blojasdobairro\.com<br />
\blondon-underground\.blogspot\.com<br />
\blosmandalas\.blogspot\.com<br />
\blrg\.ufsc\.br\/\~westphal<br />
\blucenaseguros\.com\.br <br />
\bbluebonnet\.com\.br<br />
\bluizjabour\.com<br />
\bluizmeira\.com<br />
\blusoproduction\.fr<br />
\bluta-capoeira\.blogspot\.com<br />
\blutopelobrasil\.com\.br<br />
\bluzespirita\.com<br />
\bluzespirita\.org<br />
\blvxsinistrae\.blogspot\.com<br />
\blyricshosting\.com<br />
\bmacore\.com\.br<br />
\bmacrocimento\.com\.br<br />
\bmademan\.com<br />
\bmagextreme\.blogspot\.com<br />
\bmagianegra\.org\.br <br />
\bmagiasebarbaridades\.blogspot\.com<br />
\bmagicaboutyou\.blogspot\.com <br />
\bmagistertempli\.blogspot\.com<br />
\bmaionesefastfood\.com<br />
\bmaisabc\.com\.br<br />
\bmaisbrasilia\.com<br />
\bmaissaude\.eu<br />
\bmaladiretaemails\.com<br />
\bmalamutedealaska\.com<br />
\bmalapronta\.com\.br<br />
\bmandalas\.art\.br<br />
\bmandalas\.skyrock\.com<br />
\bmandihost\.com\.br<br />
\bmangasjbc\.uol\.com\.br<br />
\bmantiqueiraimoveis\.com\.br<br />
\bmanutdbr\.com<br />
\bmapaguia\.com.br<br />
\bmapia\.com\.br<br />
\bmaqgoo\.com <br />
\bmaquiagememoda\.com\.br<br />
\bmarciopereira\.com\.br<br />
\bmarcocassol\.com\.br<br />
\bmarcosmionentrevista\.blogspot\.com<br />
\bmarcosrivelles\.zip\.net<br />
\bmarcosturbo\.com\.br<br />
\bmarduc\.blogspot\.com<br />
\bmarketingdeguerrilha\.wordpress\.com<br />
\bmarketingmadeinbrasil\.zip\.net <br />
\bmarlonstein\.com<br />
\bmarseille360\.schnurstracks\.de<br />
\bmashupkeyword\.com<br />
\bmasiero\.com\.br<br />
\bmassadouniverso\.blogspot\.com<br />
\bmatrixcaesdeguarda\.com\.br<br />
\bmaxtemporada\.com\.br<br />
\bmaysamonjardimoficial\.blogspot\.com<br />
\bmc2h2o\.blogspot\.com<br />
\bmcrbullet-oficial\.com<br />
\bmecatronica\.webng\.com<br />
\bmediatraffic\.de<br />
\bmedicarepoints\.pt<br />
\bmedicinadotorax\.com\.br/<br />
\bmedicinaealimentacao\.com <br />
\bmedicinanet\.com\.br<br />
\bmedicinatradicionalchinesa\.com<br />
\bmeditacao\.biz<br />
\bmeditacaotranscendental\.blogspot\.com<br />
\bmeditacaotranscendental\.com <br />
\bmegaideas\.net<br />
\bmeginformatica\.com\.br<br />
\bmeiobit\.pop\.com\.br<br />
\bmemoriasdofront\.blogspot\.com<br />
\bmemurl.com<br />
\bmenuespecial\.com\.br<br />
\bmercadohorse\.com<br />
\bmerrychristmas\.no\.sapo\.pt<br />
\bmerrychristmashny\.no\.sapo\.pt<br />
\bmestreseo\.com\.br<br />
\bmetafisico\.net<br />
\bmetalgearpt\.awardspace\.com<br />
\bmetricimperial\.com <br />
\bmetro-subway-train-list\.com<br />
\bmeubox\.com\.br<br />
\bmeumomento\.com<br />
\bmeutaperoa\.com\.br <br />
\bmeuvitoria\.com<br />
\bmicaretas\.oipapai\.com\.br<br />
\bmictmr\.blogspot\.com<br />
\bmideos\.com<br />
\bmidiaclipping\.blogspot\.com<br />
\bmiguel-montenegro\.com<br />
\bminasclassificados\.com<br />
\bminhaaudiencia\.wordpress\.com<br />
\bminhacidadetem\.com\.br<br />
\bminhaconexao\.com\.br<br />
\bminhavida\.com\.br<br />
\bminimomultiplo\.com<br />
\bminitrem\.com<br />
\bminutodebarulho\.blogspot\.com<br />
\bmionmarcoscocadaboa\.blogspot\.com<br />
\bmissesemmanchete\.blogspot\.com<br />
\bmix\.phoneclub\.com\.br<br />
\bmjacksonart\.com <br />
\bmkarmageddon\.com<br />
\bmktg2\.net<br />
\bmktportugal\.com<br />
\bmnecho\.com <br />
\bmoananui\.wordpress\.com<br />
\bmochileiros\.com<br />
\bmodemdownloads\.net<br />
\bmoedas\.com<br />
\bmonografiaexpressa\.com<br />
\bmonografiapratica\.com<br />
\bmonografiaurgente\.com <br />
\bmorangos5serie\.blogs\.sapo\.pt<br />
\bmorangos-com-acucar\.com<br />
\bmorraderir\.com\.br<br />
\bmortesubita\.org<br />
\bmoscoso\.biz <br />
\bmouralacerda\.com\.br<br />
\bmovimentosestudantis\.blogspot\.com<br />
\bmovimentovotonulo\.blogspot\.com<br />
\bmsbesporte\.blogspot\.com<br />
\bmtv\.com\.br\/vivaovinil<br />
\bmtv\.uol\.com\.br\/vivaovinil<br />
\bmuestrasgratis\.es<br />
\bmulticreditos\.com<br />
\bmultigolb\.wordpress\.com<br />
\bmultiply.com\/blog<br />
\bmultiply.com\/journal<br />
\bmultiply.com\/links<br />
\bmultiply.com\/photos<br />
\bmultiply.com\/reviews<br />
\bmultiply.com\/tag<br />
\bmultiply.com\/video<br />
\bmultserv\.com\.br<br />
\bmundobariloche\.com\.br<br />
\bmundocruzeiros\.com\.br<br />
\bmundodatvaberta\.blogspot\.com<br />
\bmundodeclubpenguin\.blogspot\.com<br />
\bmundodomarketing\.com\.br<br />
\bmundodosincompreendidos\.blogspot\.com<br />
\bmundoeducacaofisica\.com<br />
\bmundopratico\.blogspot\.com<br />
\bmundoseo\.com\.br<br />
\bmupasales\.dominiotemporario\.com<br />
\bmuselius\.com<br />
\bmuseudosexo\.com\.br<br />
\bmuseuvirt\.com\.br<br />
\bmusicaseclipes\.com<br />
\bmuv.\com\.br <br />
\bmuzaminastear\.com\.br<br />
\bmybesthotel\.eu<br />
\bmyspace\.com\/bandanovadinastia<br />
\bmyspace\.com\/gaiteirosdealcochete<br />
\bmyspace\.com\/idolos<br />
\bmyvuvuzela\.blogspot\.com<br />
\bnacaocatolica\.com\.br<br />
\bnanetcomcdc\.blogspot\.com<br />
\bnanuqueinforma\.com/<br />
\bnaozero\.com\.br<br />
\bnarutodb\.com<br />
\bnarutomx\.free\.fr<br />
\bnarutoplayers\.com<br />
\bnatalf\.no\.sapo\.pt<br />
\bncpdtoo\.info <br />
\bncriacaodesites\.com<br />
\bnedvarticles\.narod\.ru<br />
\bnegocioextra\.com<br />
\bnetauthor\.org<br />
\bnetcampos\.com <br />
\bnethbc\.com<br />
\bnetronic\.com\.br<br />
\bnewagetokyo\.com<br />
\bnewdigitalsouth\.org<br />
\bnewronio\.espm\.br<br />
\bnfedobrasil\.com\.br<br />
\bning\.com<br />
\bnintendomania-gs\.blogspot\.com<br />
\bnintendowiiblog\.org <br />
\bnirvana\.com\.sapo\.pt<br />
\bnitarq\.blogspot\.com<br />
\bniteroitv\.com\.br<br />
\bnitrofl.webs\.com\.br<br />
\bnoh\.com\.br<br />
\bnoiabr\.ueuo\.com<br />
\bnoisnatira\.blogspot\.com <br />
\bnoivacarioca\.com\.br<br />
\bnoivasdeportugal\.com<br />
\bnomadismocelular\.wordpress\.com<br />
\bnomundodosfamosos\.zip\.net<br />
\bnonnux\.com<br />
\bnordestefree\.blogspot\.com<br />
\bnoskirebr\.com<br />
\bnoticiasdatvbrasileira\.blogspot\.com<br />
\bnoticiasmusicais\.radioativohits\.com<br />
\bnotlong\.com<br />
\bnoturnafm\.com\.br<br />
\bnovafriburgoturismo\.com\.br<br />
\bnovatec\.com\.br<br />
\bnovevolts\.blogspot\.com<br />
\bnovodaiblog\.blogspot\.com<br />
\bnsonline\.com\.br<br />
\bnsrbr\.com<br />
\bnucleodeoportunidades\.net<br />
\boanodogolfinho\.com<br />
\bobabox\.com <br />
\bobaepitacio\.com\.br<br />
\bobesidadeinfo\.com <br />
\bobjetivoguarulhos\.com\.br<br />
\boblogtv\.blogspot\.com<br />
\bobrasileirinho\.com\.br<br />
\bobrigadas2010\.megaideas\.net<br />
\bocachacier\.com\.br<br />
\bocanal\.wordpress\.com<br />
\bocantinhodosdeprimidos\.blogspot\.com<br />
\bodontologiaconcursos\.com\.br<br />
\bofileumgay\.blogspot\.com<br />
\boilondres\.com\.br<br />
\boipapai\.com\.br<br />
\boitentona\.com\.br<br />
\bojovem\.net<br />
\bokardecista\.blogspot\.com<br />
\bolharaspie\.blogspot\.com<br />
\bolhareconomico\.cjb\.net<br />
\bolharobscuro\.com<br />
\bomdl\.com\.br<br />
\bomelhordecapao\.com\.br<br />
\bomelhordobairro\.com\.br<br />
\bomelhordocerrado\.com\.br<br />
\boncopediatria\.org<br />
\bondatuga\.com<br />
\bondeanda\.multiply\.com<br />
\bondeestagenebra\.blogspot\.com<br />
\bonibusemdebate\.fotopages\.com<br />
\bonlypop\.blogspot\.com<br />
\boparanasondasdoradio\.ufpa\.br\/livro.htm<br />
\bopartidolivre\.blogspot\.com<br />
\bopersan\.com\.br<br />
\bopiniaoenoticia\.com\.br<br />
\bopiniaoipiau\.com\.br<br />
\boportunidadesanhembi\.com\.br<br />
\bordemdotemploiluminista\.blogspot\.com<br />
\bordemlivre\.org<br />
\borganizacionais\.com\.br<br />
\borganizandoeventos\.com\.br<br />
\borixas\.sites\.sapo\.pt<br />
\borladeatalaia\.com\.br<br />
\borlandocalado\.flogbrasil\.terra\.com\.br<br />
\bosbaladeiros\.com\.br<br />
\boseriestvz.broguiz.com <br />
\bosmelancias\.com\.br<br />
\bosmutantescdcc\.blogspot\.com<br />
\bosmutantesnanet\.blogspot\.com<br />
\botbr\.com\.br<br />
\botemponaopara\.wordpress\.com<br />
\botserv\.com\.br<br />
\bousar\.net<br />
\boysfirsttime\.com<br />
\bpagmenos\.net<br />
\bpaixaoautomovel\.blogspot\.com<br />
\bpakaas\.com\.br<br />
\bpalatando\.com<br />
\bpalavras-arquitectura\.com<br />
\bpamonhart\.com\.br<br />
\bpandajogosgratis\.com<br />
\bpandamovies\.com <br />
\bpantanalecoturismo\.tur\.br<br />
\bpapaleguaspt\.blogspot\.com<br />
\bpaqueralegal\.com<br />
\bparanapiacabaecotur\.com<br />
\bparasempremiguelfalabella\.blogspot\.com<br />
\bparquesepracasdecuritiba\.com\.br<br />
\bpartidolivre\.org\.br<br />
\bpassageirodomundo\.blogspot\.com<br />
\bpath\.to/b677<br />
\bpath\.to\/e6b3\/ <br />
\bpatriciafelinaa\.blogspot\.com<br />
\bpauloandreissa\.com<br />
\bpaulobeck\.blogspot\.com<br />
\bpcclinic\.pt<br />
\bpcs\.k6\.com\.br<br />
\bpcsist\.com\.br<br />
\bpeaceoneday\.org<br />
\bpedalativo\.com<br />
\bpediatria\.com.\br<br />
\bpedrodoria\.com\.br<br />
\bpedro-rossi-clube-da-esquina\.blogspot\.com<br />
\bpegamais\.com\.br<br />
\bpennichollo\.blogspot\.com<br />
\bpensamentopositivo\.com\.br<br />
\bpepe\.org\.br<br />
\bpescaemsintra\.com<br />
\bpesqueirafutebolclube2008\.blogspot\.com <br />
\bpet\.di\.ufpb\.br\/ferramentadct<br />
\bpetsecia\.com<br />
\bphotobucket\.com <br />
\bphotobucket\.com\/albums<br />
\bphysicalgym\.com\.br\/site\/<br />
\bpiadasonline\.com\.br<br />
\bpiauinauta\.blogspot\.com<br />
\bpiauionline\.com\.br<br />
\bpicodogaviao\.com\.br<br />
\bpicodogaviao\.esp\.br<br />
\bpieceextremo\.blogspot\.com<br />
\bpierdeipanema\.com\.br<br />
\bpimentanegra\.blogspot\.com<br />
\bpimentelonline\.com<br />
\bpinblogger\.weblogger\.com\.br <br />
\bpindavale\.com<br />
\bpindavale\.com\.br<br />
\bpindavale\.net<br />
\bpindavale\.org <br />
\bpingon\.com\.br<br />
\bpiritubaclick\.com\.br<br />
\bpiroalquimista\.vilabol\.uol\.com\.br<br />
\bpisodegranito\.com<br />
\bplanetabodyboard\.com<br />
\bplanetatv\.wordpress\.com<br />
\bplanetavet\.com<br />
\bplanodesaude\.biz<br />
\bplanotatico\.com<br />
\bplano-verao\.com<br />
\bplantiodireto\.com\.br<br />
\bplasmalcd\.110mb\.com <br />
\bplasticos.hdfree\.com\.br<br />
\bplugcidade\.com\.br<br />
\bpndt\.com\.br<br />
\bpobreotario\.blogspot\.com<br />
\bpodermasculino\.com\.br<br />
\bpodiatryworldwide\.com <br />
\bpokemondarkay\.blogspot\.com<br />
\bpokenewsonline\.blogspot\.com<br />
\bpolegar\.k6\.com\.br<br />
\bpontagrossa\.com\.br<br />
\bpontagrossacvb\.com\.br<br />
\bpontoperdido\.blogspot\.com<br />
\bpopart-esfh\.com<br />
\bpornotube\.com<br />
\bporntune\.net<br />
\bportabilidade\.com\.br<br />
\bportal1000\.com\.br<br />
\bportalacontece\.com\.br<br />
\bportaladm\.adm\.br<br />
\bportalafricanista\.blogspot\.com<br />
\bportalararipina\.blogspot\.com<br />
\bportalcapelinha\.com\.br<br />
\bportaldaspousadas\.net<br />
\bportaldecontabilidade\.com\.br<br />
\bportaldehospedagem\.com\.br<br />
\bportaldopajeu\.com<br />
\bportalegrecidadepostal\.blogspot\.com<br />
\bportalglobinho\.rg3\.net<br />
\bportalico\.com\.br<br />
\bportalilheus\.xpg\.com\.br<br />
\bportaljarinu\.com\.br<br />
\bportalligtv\.com\.br<br />
\bportaloceania\.com<br />
\bportalparaisense\.com\.br<br />
\bportalpiraju\.com<br />
\bportalpornoportugues\.pt\.vu<br />
\bportalsmallville\.net<br />
\bportalssvip\.com<br />
\bportaltributario\.com\.br<br />
\bportugacard\.com<br />
\bportugalempresarial\.com <br />
\bpotimvale\.blogspot\.com<br />
\bpousadajubaia\.com\.br<br />
\bpousadariopreto\.com\.br<br />
\bpousadascomcharme\.com\.br<br />
\bprainhadeburitama\.com\.br<br />
\bpranos\.com\.br<br />
\bpreditivo\.com\.br<br />
\bprestacao\.com<br />
\bpriestknack\.com<br />
\bprintax\.com\.br<br />
\bpriscilalino\.com\.br<br />
\bprodulz\.com\.br<br />
\bproduto\.mercadolivre\.com\.br<br />
\bprofcardy\.com\/calculadoras/<br />
\bprofessorprojeto\.blogspot\.com<br />
\bprofkbrito\.zip\.net<br />
\bprogramabrasil\.org<br />
\bprojectodinheiro\.pt<br />
\bprojectos\-arquitectos\.blogspot\.com<br />
\bprojectos-arquitectos\.blogspot\.com<br />
\bprojetogenoma\.com\.br<br />
\bpro-laudo\.com\.br<br />
\bpromocoes\.biz<br />
\bprosementes\.com\.br<br />
\bprovadetran\.com\.br<br />
\bpsymania\.com<br />
\bpt\.wikipedia\.org\.br<br />
\bpt\.shvoong\.com\/how-to\/writing<br />
\bptairsoft\.org<br />
\bptpassatempos\.com<br />
\bptwebsite\.com<br />
\bpubsender\.com<br />
\bpunkshop\.com\.br <br />
\bpuppyclick\.com<br />
\bputadaloucura\.com<br />
\bputarianatv\.com<br />
\bputsblog\.com<br />
\bqaudiencia\.blogspot\.com<br />
\bqeenmedia\.com\.ar<br />
\bqi\.com\.br<br />
\bqibla\.com\.br<br />
\bquadrante\-natural\.pt<br />
\bqualasuabossa\.com\.br<br />
\bqualjogo\.com <br />
\bqualpeca\.com<br />
\bqudrante\-natural\.pt <br />
\bqueroficarrico\.net<br />
\bquerosaude10\.blogspot\.com<br />
\bquickgoldfacts\.blogspot\.com<br />
\bquintabiologica\.info<br />
\bradiestesia\.br\.tripod\.com<br />
\bradiobaseurgente\.blogspot\.com<br />
\bradioharekrishna\.blog\.br<br />
\bradiomec\.com\.br<br />
\bradiowebavivamentojovem\.com<br />
\braeiro\.com<br />
\brankbrasil\.com\.br<br />
\brapidshare.com\/files\/<br />
\braultabajara\.blogspot\.com<br />
\brayervas\.com\.br<br />
\brbgestao\.com\.br<br />
\brcpsoftware\.com\.br<br />
\brd1audiencia\.com<br />
\brd1audienciadatv\.wordpress\.com<br />
\brd1audienciadatv\.wordpress\.com<br />
\brecblog\.com\.br<br />
\breceitaculinaria.\com\.br<br />
\brecibosverdes\.com<br />
\breciclaconnosco\.blogspot\.com <br />
\breciclareviver\.rg3\.net<br />
\breconcavonoticias\.com<br />
\brede-brasil-tv\.blogspot\.com<br />
\bredefile\.com<br />
\bredeisatkm\.blogspot\.com<br />
\bredmadox\.com\.br <br />
\bredtube\.com<br />
\breflexoesdeumlouco\.blogspot\.com<br />
\breflexoesdigitais\.com\.br<br />
\bregeneration\.com\.br<br />
\breidobrasfoot\.blogspot\.com<br />
\breiki\.portais\.org<br />
\breikimawashi\.com<br />
\breikiuniverso\.org<br />
\breinodeoxala\.com\/videoteca<br />
\brelojesweb\.imitable\.com<br />
\bremade\.com\.br <br />
\brendaweb\.weebly\.com<br />
\brenerlopes\.zip\.net<br />
\brenter\.com\.br<br />
\brenzogracie\.com\/<br />
\breportervelazquez\.blogspot\.com<br />
\breservas\.net<br />
\bresidentevilwork\.blogspot\.com<br />
\brestauranteocaipira\.com\.br<br />
\bresumodanoticia\.blogspot\.com<br />
\bresumodasnovelas\.net<br />
\bresumododia\.wordpress\.com<br />
\bresumos\.net<br />
\breto-europa\.ning\.com<br />
\bretratoiberico\.com<br />
\bretratto\.com<br />
\brevistadatv\.blogspot\.com<br />
\brevistasgratis\.ws<br />
\brevoclim\.zip\.net<br />
\breybiannchi\.4shared\.com<br />
\brhorigami\.com<br />
\briodejaneiro-copacabana\.com\.br<br />
\briodejaneirophotoguide\.com<br />
\brioferias\.com<br />
\brio-rj\.com\.br<br />
\brmrconsultoria\.v10\.com\.br<br />
\brobertexto\.com<br />
\brobitexplore\.com<br />
\brockbrasiliadesde64\.blogspot\.com<br />
\brockybalboa\.com\.br<br />
\brockybalboa\.com\.br<br />
\brodolfo\.typepad\.com<br />
\brodrigofneves\.blogspot\.com<br />
\brommopaula\.blogspot\.com<br />
\bromuloesbt\.blogspot\.com<br />
\brose-mcgowan-brasil\.blogspot\.com<br />
\brotadoromanico\.com<br />
\broteirodelavras\.com <br />
\broteirostelevisao\.blogspot\.com<br />
\broxclan\.net<br />
\brpgdesafios\.com\.br<br />
\brplanetagospel\.blogspot\.com<br />
\brppnweb\.com<br />
\bruadasflores\.com<br />
\brugby\.esp\.br<br />
\bsalaodetuning\.com\.br<br />
\bsalto12\.blogspot\.com<br />
\bsanbara\.com\.br<br />
\bsandramouraramos\.blogspot\.com<br />
\bsandrasantos\.com<br />
\bsandrinha\.com\.br<br />
\bsanguesuga\.com <br />
\bsantainquisicaocatolica\.blogspot\.com<br />
\bsantoantoniodopinhal\.com\.br<br />
\bsantosreporter\.blogspot\.com<br />
\bsaopaulobairros\.com\.br<br />
\bsaopaulocenter\.com\.br <br />
\bsatere\.com<br />
\bsaturei\.com<br />
\bsaudedofuturo\.wordpress\.com<br />
\bschwarzenegger\.it<br />
\bscrapbookbrasil\.com<br />
\bscrapjackie\.locaweb\.com\.br<br />
\bscribd\.com\/download<br />
\bscribd\.com\/group<br />
\bscribd\.com\/people<br />
\bscribd\.com\/profile<br />
\bscribd\.com\/word<br />
\bscriptline\.net/<br />
\bsegurosguia\.com<br />
\bseinstrumentos\.com\.br<br />
\bsejavegetariano\.com\.br<br />
\bsekstv\.info<br />
\bsemreligiao\.com\.br<br />
\bsenha1234\.blogspot\.com<br />
\bsenhoradeoliveira\.blig\.com\.br<br />
\bseomaster\.com\.br<br />
\bsergioprata\.com\.br<br />
\bseries-etc\.blogspot\.com<br />
\bsexxxchurch\.com<br />
\bsg7net.\com\.br<br />
\bsgospel\.com<br />
\bshareapic\.net<br />
\bshemalesexstar\.com<br />
\bshowdelance\.com\.br<br />
\bsicchiquititas\.blogs\.sapo\.pt<br />
\bsigmasociety\.com<br />
\bsimonepedacos\.multiply\.com<br />
\bsimplyjolie2008\.blogspot\.com<br />
\bsimpozio\.ufsc\.br<br />
\bsimsbrasil\.com\.br<br />
\bsite\.oiyes\.com\.br<br />
\bsite\.voila\.fr\/chezmirage/<br />
\bsitegratisgratis\.com\.br <br />
\bsitemeu\.net<br />
\bsites\.google\.com/site/gagocoutinhocom<br />
\bsites\.google\.com/site/top100brazil/Home/<br />
\bsites\.google\.com/site/vermelhovelho<br />
\bsitesdesites\.webnode\.com\.br<br />
\bsitiomarado\.forumeiro\.com<br />
\bskindoctornyc\.com<br />
\bskydrive\.live\.com\/self\.aspx<br />
\bskyscrapercity\.com<br />
\bslam\.regeneration\.com\.br<br />
\bslamdunk\.suprasolucoes\.com<br />
\bslideshare\.net<br />
\bsms\.ie\.ma <br />
\bsmswebo\.com <br />
\bsoarquitetura\.com\.br<br />
\bsobrelivros\.com\.br<br />
\bsobresites.com\/taro<br />
\bsobresites\.com\/biblioteconomia<br />
\bsocarnavaldepoa\.webs\.com<br />
\bsociedadedosblogueiros\.blogspot\.com<br />
\bsocomedia\.oipapai\.com\.br<br />
\bsoevami\.blogspot\.com<br />
\bsofatv\.net<br />
\bsoftfacil\.net<br />
\bsofttoys\.com\.br<br />
\bsolabm\.com\.br<br />
\bsoletrando\.com\.br<br />
\bsolucoesageis\.com\.br <br />
\bsomenoise\.com\.br<br />
\bsomudancasmg\.com\.br<br />
\bsoprodoator\.com<br />
\bsosdividas\.com\.br<br />
\bsoteropolitanosculturaafro\.wordpress\.com<br />
\bsouthernhides\.com\.ar<br />
\bsouturista\.com\.br<br />
\bspacejovem\.com<br />
\bspeedbrazil\.blogspot\.com <br />
\bspeedhost\.com\.br <br />
\bspellrpg\.com\.br<br />
\bspirituc\.com<br />
\bsportdigital\.net <br />
\bsportingapoio\.com<br />
\bspringer\.com\.br<br />
\bspvilas\.com\.br <br />
\bstadiumzone\.net<br />
\bstalloneforever\.blogspot\.com<br />
\bstamadvies\.nl<br />
\bstarmedica\.blogspot\.com<br />
\bstartrekbrasil\.com\.br<br />
\bstatisticum\.org<br />
\bstatuscompany\.com\.br<br />
\bsteinerimoveis\.com\.br<br />
\bstelling\.cc<br />
\bstifler\.com\.br<br />
\bstreetdogstudio\.com<br />
\bstudiopreview\.com\.br<br />
\bstyleua\.com<br />
\bsuamente\.com\.br<br />
\bsuamenteseuguia\.blog\.com<br />
\bsubcor\.multiply\.com<br />
\bsubxtreme\.net<br />
\bsudoku\.mundopt\.com <br />
\bsudokunine\.com<br />
\bsuperblog93\.blogspot\.com<br />
\bsuper-congresso\.com\.br<br />
\bsupergrana\.com<br />
\bsupermemoria\.com\.br<br />
\bsupernatural\-fans\.tk<br />
\bsuper-nutricao\.com\.br<br />
\bsuprasolucoes\.com<br />
\bsuprasolucoes\.com\/redireciona\.asp<br />
\bsurfa\.com\.br\/blog\/2010\/08\/rj-arpoador<br />
\btag\.com\.pt<br />
\btaginvest\.com\.br<br />
\btaichibrasileiro\.blogspot\.com<br />
\btaichipailin\.com\.br<br />
\btalentmanager\.pt<br />
\btalk\.livedaily\.com<br />
\btaoismo\.org <br />
\btargetw\.com<br />
\btarzia-tattoo\.com<br />
\btatianavianna\.com\.br/<br />
\btechseg\.com <br />
\btechtuga\.net <br />
\btecmais\.com <br />
\btecnopt\.com<br />
\btek\.sapo\.pt<br />
\btekoha\.org<br />
\btelecestas\.com\.br<br />
\bteleco\.com\.br<br />
\btelenovelasbr\.blogspot\.com<br />
\btelevisionado\.wordpress\.com<br />
\btelevisionnews\.wordpress\.com<br />
\btemplodeapolo\.net<br />
\bteobaldobs\.blogspot\.com<br />
\bterminologia\.com\.br <br />
\bterraforum\.com\.br<br />
\bTerrasdaMantiqueira\.com<br />
\btertdow\.blogspot\.com<br />
\btestdriveonline\.com\.br<br />
\bteusite\.net <br />
\btevenoticias\.wordpress\.com<br />
\btheazoresislands\.blogspot\.com<br />
\bthebestthingscomeinthree\.pt\.vu/<br />
\bthe-englishstudio\.com\.br<br />
\bthemaozoleum\.com <br />
\bthinkball\.com\.br<br />
\bthinkfn\.com<br />
\bthinkfnwiki\.com<br />
\bthinnetworks\.com\.br<br />
\bthumblogger\.com <br />
\bthundersuplementos\.com\.br<br />
\btibbisuluk\.com <br />
\btintazul\.com\.pt<br />
\btinypic\.com<br />
\btiopatinhas\.1br\.net<br />
\btiplan\.com\.br <br />
\btodocanal\.wordpress\.com<br />
\btokiohotel\.com\.br<br />
\btokiohotelbrasil\.com<br />
\btokufriends\.com<br />
\btonycorreia\.com\.br<br />
\btoolssites\.com\.br<br />
\btop100equestrian\.com<br />
\btopsexywomen\.com<br />
\btorrentsparabaixar\.blogspot\.com<br />
\btotalmentecharmed\.spaceblog\.com\.br<br />
\btownbridgecom\.com<br />
\btrabalhoescolares\.blogspot\.com<br />
\btraditionalvalues\.org<br />
\btraditionalvalues\.org\/urban\/nine\.php<br />
\btraineemeup\.blogspot\.com<br />
\btransformatec\.com\.br<br />
\btravian\.(?:pt|com\.br)/\?uc=<br />
\btribodatrilha\.com<br />
\btrilhadoslobos\.com\.br<br />
\btrombeteiro\.com<br />
\btudo-sobre-a-tv\.blogs\.sapo\.pt<br />
\btudosobrecdc\.blogspot\.com<br />
\btudosobrecharmed\.blogspot\.com<br />
\btudosobreufologia2010\.blogspot\/.com<br />
\btudotemos\.com\.br <br />
\btunigup.rg3\.net<br />
\bturismobahia\.com\.br<br />
\bturismoholambra\.com\.br<br />
\bturismonovale\.com <br />
\bturismonovale\.com\.br<br />
\btvaqui\.com\.br<br />
\btvbrasilaudiencia\.zip\.net<br />
\btvcontacto\.wordpress\.com<br />
\btvdigitalnopc\.com<br />
\btvfoco\.com\.br<br />
\btvlivre\.org<br />
\btvmundo\.wordpress\.com<br />
\btvtuga\.tv<br />
\btwitter\.com\/analistati<br />
\btwitter\.com\/vini_rio<br />
\btwitter\.com\/weloveisatkmas<br />
\btwitterbrasil\.org<br />
\bucrania\-mozambique\.blogspot\.com<br />
\bufotvonline\.com\.br<br />
\buhdtv\.com\.br <br />
\bultimatesonic\.wordpress\.com<br />
\bumbanda\.blogs\.sapo\.pt<br />
\buniagua\.org.\br<br />
\buniblog\.com\.br<br />
\bunitedphotopress\.com<br />
\buniversalistas\.blogspot\.com<br />
\buniversalposterz\.com<br />
\buniversoanyeviny\.com\.br<br />
\buniversoben10\.blogspot\.com<br />
\buo\.com\.br<br />
\buppw\.org <br />
\burbanawebsite\.com\.br<br />
\burban-rivals\.com/\?sponsor=<br />
\busercash\.com/\?r=<br />
\buvaonline\.uva\.br<br />
\bvagalume\.uol\.com\.br<br />
\bvagasti\.v10\.com<br />
\bvalegastronomia\.com <br />
\bvalegastronomia\.com\.br<br />
\bvalegastronomia\.net <br />
\bvalegastronomia\.org<br />
\bvalinor\.com\.br\/forum\/<br />
\bvalinor\.com\.br\/viewtopic\.php\?<br />
\bvejalourdes\.com\.br<br />
\bveleirodingue\.freeboat.\com\.br<br />
\bvendasnaweb\.com\.br<br />
\bventurosanet\.com<br />
\bveredaestreita\.org<br />
\bveredaestreita\.org\/2008/<br />
\bveredasbrasil\.com\.br<br />
\bviagemlegal\.com<br />
\bviagensbariloche\.com\.br<br />
\bviagens-belgica\.info <br />
\bviagensdubai\.com\.br<br />
\bviagens-grecia\.info<br />
\bviagens-noruega\.info<br />
\bviagens-republica-checa\.info<br />
\bviaiguassu\.com<br />
\bviajarapuntadeleste\.com\.ar<br />
\bviajoporargentina\.com<br />
\bviciodeviajar\.blogspot\.com<br />
\bvidavaitorta\.blogspot\.com<br />
\bvideo\.google\.com\/videoplay\?<br />
\bvideocliper\.com<br />
\bvideolog\.tv<br />
\bvideolog\.uol\.com\.br <br />
\bvideos\.etc\.br<br />
\bvideosmusica\.tv<br />
\bvidyayoga\.org<br />
\bvilacriativa\.com\.br<br />
\bvilanovenseblog\.blogspot\.com<br />
\bvimeo\.com<br />
\bvini.rio\.vila\.bol\.com\.br<br />
\bvini.rio\.vilabol\.com\.br<br />
\bvirouviral\.com<br />
\bvisitasonline\.com<br />
\bvisitearacaju\.com\.br<br />
\bvisitepontagrossa\.com\.br<br />
\bvisitesaopaulo\.com <br />
\bvisualmedia\.com\.br<br />
\bvitoriagrande\.com <br />
\bvitorsousaalbufeira\.blogspot\.com <br />
\bvitrinepublicitaria\.net<br />
\bvjez\.com<br />
\bvoceselembra\.blogspot\.com<br />
\bvoipbra\.com\.br<br />
\bvolta\.mirc\.vilabol\.uol\.com\.br<br />
\bvoltamirc\.co\.nr<br />
\bvoltamirc\.rg3\.net<br />
\bvoltamirc\.web44\.net <br />
\bvoos-info\.com <br />
\bwallpapers\.regeneration\.com\.br<br />
\bwaoIndia\.com<br />
\bwarriors-of-wrestling\.blogspot\.com<br />
\bwata-eh-legal\.blogspot\.com<br />
\bwaysforus\.org<br />
\bwebcaldas\.com\.br<br />
\bwebcarcenter\.com\.br<br />
\bwebcolinas\.com<br />
\bwebimoveisnointerior\.com\.br<br />
\bwebland\.ppg\.br<br />
\bwebmap\.in<br />
\bwebmove\.com\.br<br />
\bwebng\.com\/itatiaia<br />
\bwebsoccerclub\.com <br />
\bwebtemplarios\.forumup\.com <br />
\bweshow\.com<br />
\bwicca-ipatinga\.blogspot\.com<br />
\bwikipedia\.artudi\.org<br />
\bwikipediaqueixas\.blogspot\.com<br />
\bwikisus\.net<br />
\bwindowsvistadicasemgeral\.com<br />
\bwordpress-genial\.com<br />
\bworld7\.monstersgame\.com\.pt<br />
\bworldcruises1\.blogspot.\com<br />
\bworldpressphoto\.nl <br />
\bwurdulaks\.blogspot\.com<br />
\bwwwrichardgoterra\.blogspot\.com<br />
\bx-dsg\.com<br />
\bx-flog\.com\.br<br />
\bxgamesnet\.blogspot\.com<br />
\bxgoogle\.com\.br/blog\/2008\/04\/26\/download-de-psych<br />
\bxn--musculao-xza3b\.com<br />
\bXoppi\.com <br />
\by2kdesign\.com<br />
\byenidizayn\.com<br />
\byogaclick\.com\.br<br />
\byogavaidika\.com<br />
\byoungandhealthy\.ca<br />
\byoupiee\.com\.br<br />
\byouporn\.com<br />
\byoutube\.com\/results\?<br />
\byoutube\.com\/v\/<br />
\byoutube\.com\/view_play_list\?<br />
\byoutube\.com\/watch\?<br />
\byoutube\.com\/watch\?v<br />
\bz10.invisionfree\.com<br />
\bz6\.invisionfree\.com<br />
\bzamarian\.com\.br<br />
\bzanottofederal1555\.com\.br/<br />
\bzapbox\.com\.br<br />
\bzapenglish\.com<br />
\bziggi\.com\.br\/downloads<br />
\bzoonadocelular\.com <br />
\bzoonose\.com\.br<br />
\bzymboo\.com<br />
\.myjerseys\.org<br />
\.weddingdressebay\.com<br />
#</pre> <!-- leave this line exactly as it is --></div>Gmaxwellhttps://wiki.xiph.org/index.php?title=MediaWiki:Spam-blacklist&diff=14127MediaWiki:Spam-blacklist2013-05-11T09:50:36Z<p>Gmaxwell: </p>
<hr />
<div> # External URLs matching this list will be blocked when added to a page.<br />
# This list affects only this wiki; refer also to the global blacklist.<br />
# For documentation see http://www.mediawiki.org/wiki/Extension:SpamBlacklist<br />
#<!-- leave this line exactly as it is --> <pre><br />
#<br />
# Syntax is as follows:<br />
# * Everything from a "#" character to the end of the line is a comment<br />
# * Every non-blank line is a regex fragment which will only match hosts inside URLs<br />
mostrawildt\.com<br />
wikin\.com<br />
infinitycommerce\.co\.uk<br />
senuke-xcr-discount\.com<br />
mooncityz\.com<br />
gcagint\.com<br />
groupcow\.com<br />
synqk\.com<br />
organicdata\.com\.au<br />
cameronmorgan\.co\.uk<br />
singleme\.com<br />
Menuggs\.org<br />
casinosdiary\.com<br />
abercrombieaustralia\.com<br />
weightsbenchtraining\.co\.uk<br />
thedegreeexperts\.com<br />
xtremeonline\.com\.au<br />
xstretchmarks\.com<br />
\.casinobonus24\.com<br />
\.mydietarea\.com<br />
\.swiftmoney\.org\.uk<br />
\.bringexbackblog\.com<br />
registry-repair-tools\.net<br />
automobile-insurance\.com<br />
bestentrypoint\.com<br />
banansearch\.com<br />
\.pavtube\.com<br />
\.videos-phone\.net<br />
\.chatixdating\.com<br />
\.teensay\.com<br />
\.cheappoolproducts\.com<br />
\.lease-a-seo\.com<br />
\.totalscreenrecorder\.com<br />
\.mychristianheels\.com<br />
\.mbtshoesupply\.com<br />
\.healthmuscle\.com<br />
\.official-canadian-pharmacy\.org<br />
\.customessaywritinghelp\.com<br />
\.boostbrand\.org<br />
\.promoteland\.com<br />
\.uk-dissertation\.com<br />
\b1000cores\.com<br />
\b100anosgalo\.blogspot\.com<br />
\b100cal\.ex-br\.com <br />
\b100diasdesandero\.blogspot\.com <br />
\b11onze\.com <br />
\b123imoveis\.com\.br <br />
\b123people\.it<br />
\b13studiohost\.com<br />
\b1clique\.blogspot\.com<br />
\b2hand\.googet\.eu<br />
\b2jump2\.com<br />
\b4shared\.com<br />
\b4shared\.com\/file<br />
\b55chan\.org<br />
\b91rock\.com\.br<br />
\baapaaa\.blogspot\.com<br />
\babctorre\.xpg\.com\.br<br />
\babdieldamon\.wordpress\.com <br />
\baberturas-de-novelas\.blogspot\.com<br />
\babreloja\.com<br />
\babrolhos\.net<br />
\bacademiadovinho\.com\.br<br />
\bacademiagraciebutanta\.com\.br/<br />
\bacademiarafaelleitao\.blogspot\.com<br />
\bacaminhodaonde\.blogspot\.com<br />
\bacao-humana\.blogspot\.com<br />
\bacheibr\.com<br />
\bacidosnucleicos\.110mb\.com <br />
\badhentai\.blogspot\.com<br />
\badministracaoegestao\.com\.br<br />
\badororomances\.com<br />
\baevolut\.com<br />
\bafazenda\.blogger\.com\.br<br />
\bafricanamericantravelagency\.com <br />
\bafricarte\.it<br />
\bag4\.com\.br<br />
\bageanbrasil\.com\.br<br />
\bagenciaar\.com\.br<br />
\bagenciasolo\.com\.br<br />
\bagenciaspin\.com<br />
\bagoravale\.com<br />
\bagoravale\.com\.br<br />
\bagoravale\.net<br />
\bagoravale\.org<br />
\bagribusinessNews\.com <br />
\bagrogemeos\.com\.br<br />
\bagruta\.com\.br<br />
\baguasemendadas\.com<br />
\bahsforum\.com<br />
\baideialibertaria\.blogspot\.com<br />
\bairsoftbrasil\.com<br />
\balabrasil\.com <br />
\balbacete\.com\.br <br />
\balemanja\.org <br />
\balephradiestesia\.com\.br<br />
\balexandre\.eletrica\.ufu\.br<br />
\balgumapoesia\.com\.br<br />
\balimentacaosaudavel\.net<br />
\baliviodaalma\.com\.br<br />
\ballcenter\.com\.br<br />
\ballservice\.cnt\.br<br />
\ballsexhub\.com<br />
\balojamentos-online\.com <br />
\balojamiento\.cl<br />
\baltamiroborges\.blogspot\.com<br />
\balternativamedicina\.com<br />
\balvinhopatriota\.com\.br<br />
\bamanda-rossi\.blogspot\.com<br />
\bamazon\.ca<br />
\bamazon\.co\.jp<br />
\bamazon\.co\.uk<br />
\bamazon\.com\/gp\/product<br />
\bamazon\.de<br />
\bamazon\.fr<br />
\bambienteinteiro\.org\.br<br />
\bamericanas\.com\.br\/AcomProd<br />
\bamericanas\.com\.br\/cgi\-bin<br />
\bamericanas\.com\.br\/cgi-bin<br />
\bamericanas\.com\.br\/prod<br />
\bamigo\.kit\.net<br />
\bamigoskids\.blogspot\.com<br />
\bamilcorretora\.com\.br<br />
\bamoisatkmaisnick\.blogspot\.com<br />
\bamoresexogratis\.com<br />
\bamostrasgratis\.org<br />
\ban\.locaweb\.com\.br\/Webindependente<br />
\banalistati\.com<br />
\banamacedoescritora\.blogs\.sapo\.pt<br />
\bandreabrasilmadrid\.es <br />
\bandremafei\.com<br />
\bandrologia\.cjb\.net<br />
\bangelfire\.com\/dc/evangelhoespirita<br />
\banimavita\.com\.br<br />
\banimetnt\.com\.br<br />
\banmtv\.com\.br<br />
\bannamarya\.com\.br<br />
\banticensura\.blogspot\.com<br />
\banunciautos\.com\.br<br />
\banunciosgv\.com<br />
\bapagaodatelefonica\.vai\.la<br />
\bapfertilidade\.org <br />
\bapi\.ning\.com<br />
\bappartamentiischia\.it<br />
\bappliedwingchun\.com\.br<br />
\barabesq\.com\.br<br />
\barabian\.vila\.bol\.com\.br<br />
\barabian\.vilabol\.com\.br<br />
\barabians\.vila\.bol\.com\.br<br />
\barabians\.vilabol\.com\.br<br />
\baracaju-se\.com\.br <br />
\barcondicionado-split\.com<br />
\barenatibia\.com <br />
\bargentina\.ar<br />
\bargentinatolet\.com <br />
\bargentinawinetours\.com<br />
\bargentour\.com<br />
\bargilaviva\.blogspot\.com<br />
\barqueologiaegipcia\.zip\.net<br />
\barquitectura\-sustentavel\.blogspot\.com<br />
\barquitectura-sustentavel\.blogspot\.com<br />
\barquivosbt\.blogspot\.com<br />
\barroxe\.net<br />
\bartbr\.com\.br<br />
\bartedb\.com\.br<br />
\bartenet\.com\.br<br />
\bartesmarciaishoje\.blogspot\.com<br />
\barthonline\.com\.br\/clouds/<br />
\barts\.lojadeluxo\.com<br />
\bas\-chiquititas\.blogspot\.com<br />
\basdf\.com\.br<br />
\basenergiasrenovaveis\.blogspot\.com<br />
\basonrisanordica\.com<br />
\basterdomus\.com\.br<br />
\bastore\.amazon\.com<br />
\bathoscompanny\.com\.br<br />
\batitlan\.net<br />
\batividadesfisicas\.com\.br<br />
\batmaneditora\.com\.br <br />
\batortonycorreia\.bloguepessoal\.com<br />
\baudiencia\.zip\.net<br />
\baudienciabrasileiradetv.wordpress.com<br />
\baudienciadatv\.wordpress\.com<br />
\baudienciadetv\.blogspot\.com<br />
\baudienciaemdestaque\.blogspot\.com<br />
\baudiolivro\.net\.br<br />
\baulalamontera\.com<br />
\baustria-travel\.biz<br />
\bautolatinaclube\.cjb\.net<br />
\bautosp\.com\.br<br />
\bavengedsevenfold\-portugal\.blogspot\.com<br />
\baverdadesobreagnosis\.com\.br<br />
\bavrilbandaids\.com\/forums<br />
\bavrillavigne-pics\.com<br />
\bavril-media\.blogspot\.com<br />
\bavrilmidia\.com\/forum<br />
\bawkwardish\.com<br />
\bbabywallpaper\.com\.br<br />
\bbaixartudogratis\.info<br />
\bbaixartudogratis\.info<br />
\bbalduran\.com\.br<br />
\bbandvoip\.com\.br<br />
\bbanheiraspa\.com\.br<br />
\bbaraogeraldo\.com\.br<br />
\bbarcelos\.com<br />
\bbarcoavista\.blogspot\.com<br />
\bbarrabravas\.net<br />
\bbarradosahy\.net<br />
\bbatalhadosguararapes\.com\.br<br />
\bbatomdamoda\.webnode\.com\.br<br />
\bbazardaspalavras\.blogspot\.com<br />
\bbazarpop\.com\.br<br />
\bbeatrixmonteiro_fas.blogs\.sapo\.pt<br />
\bbeatriz_monteiro_faclube\.blogs.\sapo\.pt<br />
\bbeatrizmonteiro_faclube\.blogs.\sapo\.pt<br />
\bbebidaboa\.com\.br<br />
\bbelem-pa\.com\.br<br />
\bbelezapt\.com<br />
\bbelohorizonte-mg\.com\.br<br />
\bbemmequercestas\.com<br />
\bben10thevideogame\.com<br />
\bben10toys\.net<br />
\bben10toys\.net\/Backup\/images<br />
\bben10ultimatealien3\.blogspot\.com<br />
\bbeneklee\.com<br />
\bbenzisobrenomes\.com<br />
\bbethynha\.com\.br<br />
\bbgojogos\.blog\.terra\.com\.br<br />
\bbhdog\.com\.br<br />
\bbiagra\.com\.br <br />
\bbibliaonline\.com\.br<br />
\bbibliaonline\.iguga\.com <br />
\bbibliojunior\.ufsc\.br<br />
\bbigmarkett\.com<br />
\bbigshowdownloads\.blogspot\.com<br />
\bbio-combustivel\.blogspot\.com<br />
\bbiografia\.wiki\.br<br />
\bbioinfo\.com\.br<br />
\bbiomech\.com\.br<br />
\bbipol-art\.com<br />
\bbisotto\.com\.br<br />
\bbizarriceslol\.com<br />
\bblackminton\.pt<br />
\bblog.antonioplanet\.net<br />
\bblogaritmox\.blogspot\.com<br />
\bblogcmmi\.com\.br<br />
\bblogdamostra\.blog\.uol\.com\.br<br />
\bblogdoconsignado\.com\.br<br />
\bblogdohiellevy\.com\.br<br />
\bblogfajuta\.blogspot\.com<br />
\bblogdorasta\.wordpress\.com<br />
\bblog-escoteiro\.blogspot\.com<br />
\bbloglouco\.com<br />
\bblogs\.abril\.com\.br\/novidadesdatv<br />
\bblogsobrenovelas\.blogspot\.com <br />
\bblumenau-sc\.com\.br<br />
\bbm-beatrizmonteiro\.blogs\.sapo\.pt<br />
\bbneinoach\.com\.br<br />
\bboavista-rr\.com\.br<br />
\bbodybuildingxl\.com<br />
\bboingdragon\.com <br />
\bbombinhas\.com<br />
\bboxtv\.hd1\.com\.br<br />
\bbr\.desert-operations\.com\/?recruiter=41b1<br />
\bbr\.geocities\.com\/amandinha_band888\/links\/tiburon_coupe_anteriores2\.html<br />
\bbr\.geocities\.com\/khentzu/<br />
\bbr2\.biz<br />
\bbrasaoweb\.com<br />
\bbrasilcombate\.com\.br<br />
\bbrasilcombate\.com\.br<br />
\bbrasildemochila\.com<br />
\bbrasildestinos\.com\.br<br />
\bbrasilfas\.blogspot\.com<br />
\bbrasiliacac\.com<br />
\bbrasilimperial\.org\.br\/verdade3.htm<br />
\bbrasilinformacao\.com\.br<br />
\bbrasilturismo\.com<br />
\bbrazilcartoon\.com<br />
\bbrazilgallery\.com\.br<br />
\bbrejas\.com\.br <br />
\bbrekground\.com\/wiiground<br />
\bbrincando\.no\.sapo\.pt<br />
\bbrinquedosdepapel\.com\.br<br />
\bbrofficeparaleigos\.blogspot\.com<br />
\bbronquite\.com<br />
\bbruxaria\.org<br />
\bbrvida\.org<br />
\bbssilveira.blogspot.com<br />
\bbulledebeaute\.wordpress\.com<br />
\bburionline\.wordpress\.com<br />
\bbuscamp3\.com\.br<br />
\bbuscaporsaude\.com\.br<br />
\bbuxput\.com <br />
\bbwin\.com <br />
\bbwin\.site\.vu <br />
\bcabalahoje\.blogspot\.com<br />
\bcabanhabutia\.com\.br<br />
\bcabecadecuia\.com<br />
\bcabofrio-rj\.com\.br<br />
\bcachacagabriela\.com\.br<br />
\bcaipira\-sp\.com\.br<br />
\bcajamarnet\.com\.br<br />
\bcalcatrilhos\.henyah\.com<br />
\bcalcule\.net<br />
\bcamaragibeonline\.com<br />
\bcamarotedasestrelas\.com\.br<br />
\bcamboriu\.org<br />
\bcambralha1\.blogspot\.com<br />
\bcamillacastro\.org<br />
\bcamillacastro\.org\/angelinajolie/<br />
\bcamiloaparecido\.blog\.terra\.com\.br <br />
\bcaminhositaipu\.com\.br<br />
\bcampogrande-ms\.com\.br <br />
\bcanalfreak\.com\.br<br />
\bcanalmatriz\.zip\.net<br />
\bcanalmax\.com\.br<br />
\bcanarilalmada\.com<br />
\bcanchim\.com\.br<br />
\bcandycandyanns\.iespana\.es<br />
\bcanilchinador\.com\.br<br />
\bcanilpequenoencanto\.webng\.com <br />
\bcanilvilabrasil\.com\.br<br />
\bcanoas-rs\.com\.br<br />
\bcaonanet\.blogspot\.com<br />
\bcarcasse\.com<br />
\bcardiologia\.com\.br<br />
\bcarlinha\.com\.br<br />
\bcarloscostaaqui\.blogspot\.com<br />
\bcarlosfran\.com<br />
\bcarnaporto2010\.com\.br<br />
\bcarnevalli\.googlepages\.com<br />
\bcarrosderua\.com\.br<br />
\bcartasdecredito\.com\.br <br />
\bcartoesonline\.com\.br<br />
\bcartuningrevolution\.com <br />
\bcasadanutricao\.com\.br<br />
\bcasadasprimas\.wordpress\.com <br />
\bcasadastiras\.blogspot\.com<br />
\bcasamentobrasil\.com\.br<br />
\bcasasnolago\.com\.br<br />
\bcasinoglamour\.com<br />
\bcastlelords\.blogspot\.com<br />
\bcastlelords\.net <br />
\bcauas\.blogspot\.com<br />
\bcavaleiroconde\.blogspot\.com<br />
\bcavalosarabes\.vilabol\.uol\.com\.br<br />
\bccdb\.gea\.nom\.br<br />
\bcdjapan\.co\.jp<br />
\bceliaco\.com\.br<br />
\bcelsovenicius\.com\/<br />
\bcenatecbrasil\.com\.br<br />
\bcenterpokemon\.blogspot\.com<br />
\bcentraldosexo\.com<br />
\bcentraliza\.com\.br<br />
\bcentralparaiso\.com<br />
\bcentric\.tv\.br<br />
\bcentrodemoda\.com<br />
\bcentrofilosoficodokungfu\.com\.br<br />
\bcertidex\.com\.br<br />
\bcervejasdomundo\.com<br />
\bcescapi\.com<br />
\bceucabrscanoas\.com\.br\/documents\/blog_2\.php<br />
\bcfgigolo\.com<br />
\bchanzon\.com<br />
\bchaos\.com\/product<br />
\bcharles\.art\.br<br />
\bcharmed\-news\.blogspot\.com<br />
\bcharmedgallery\.blogspot\.com<br />
\bchaves\.blogs\.sapo\.pt<br />
\bchavesantiga\.blogs\.sapo\.pt<br />
\bcheckupgeriatrico\.com\.br <br />
\bchihuahua\.vet\.br<br />
\bchiquititas\-online\.pt\.vc<br />
\bchiquititassic\.blogs\.sapo\.pt<br />
\bchrislimatop\.com\.br<br />
\bchrome-center\.net<br />
\bchuteperfeito\.com\.br<br />
\bciberdata\.com<br />
\bciberespaconaescola\.blogspot\.com<br />
\bcidade\.alterosa\.net<br />
\bcidadebelojardim\.blogspot\.com<br />
\bcidadedebocaina\.com <br />
\bcidade-lagoa\.com<br />
\bcidade-lisboa\.com<br />
\bcidadespaulistas\.com\.br<br />
\bcidadewebrock\.com\.br<br />
\bcimento\.org<br />
\bcimentonline\.com\.br<br />
\bcincoquartosdelaranja\.blogspot\.com<br />
\bcindylauperbrasil\.com<br />
\bcinemabizarre-brasil\.go-board\.com\/forum\.htm <br />
\bcinemacomrapadura\.com\.br\/filmes\/imgs\/<br />
\bcircolivenetifainors\.blogspot\.com<br />
\bcircuitodosamba\.net<br />
\bcirurgia\.com\.br<br />
\bcirurgia\-plastica\.com<br />
\bclangamesbr\.net<br />
\bclansnqp\.com<br />
\bclaradilucenna\.blogspot\.com<br />
\bclassificados\.wegoo\.com\.br<br />
\bclassificadosregional\.com\.br <br />
\bclicador\.com<br />
\bclickgalera\.com\.br<br />
\bclickglobinho\.zip\.net<br />
\bclickjogos\.uol\.com\.br<br />
\bclicktvglobinho\.blogspot\.com<br />
\bclickviagens\.com<br />
\bclicrbs\.com\.br\/kzuka<br />
\bclinicadedermatologia\.com\.br<br />
\bclinicaleger\.com\.br<br />
\bclinicamedicambdoctor\.blogspot\.com<br />
\bclone\.aguiar\.googlepages\.com<br />
\bclubedariqueza\.com\.br<br />
\bclubedascelebridades\.com<br />
\bclubedologusepointer\.com\.br<br />
\bclubedosbeberroes\.com\.br<br />
\bclube-morangos\.com<br />
\bclubesafobrasil\.com<br />
\bclubevencedor\.com\.br<br />
\bclubpinguimcp\.blogspot\.com<br />
\bcobolware\.com<br />
\bcocadaboa\.com\.br<br />
\bcodigofonte\.com\.br<br />
\bcoelhodafonseca\.com\.br<br />
\bcoisasdoenio\.blogspot\.com <br />
\bcoisasinteressantes\.com\.br <br />
\bcolocanoidolos\.blogspot\.com<br />
\bcoluna\.com<br />
\bcomlines\.com\.br<br />
\bcommonpurpose\.org<br />
\bcomobaixar\.org<br />
\bcomofazerumcurriculum\.com<br />
\bcomosairdoaluguel\.zip\.net<br />
\bcomprarcreatina\.org<br />
\bcomprasnasantaifigenia\.com\.br<br />
\bcomunidadefb\.com\.br<br />
\bcomunidades\.net<br />
\bconceitozen\.com\.br<br />
\bconectiomg\.com\.br<br />
\bconexaodinheiro\.com<br />
\bconfrariadechaves\.net<br />
\bconfrariadecinema\.com\.br<br />
\bconheca-me\.com <br />
\bconheceroislam\.com\.br <br />
\bconnectionworld\.org<br />
\bconocereislaverdad\.org<br />
\bconselheira\.virtual\.zip\.net<br />
\bconsultadetaro\.com<br />
\bconsultarpagerank\.com\.br<br />
\bconsultarpagerrank\.com\.br<br />
\bconsultorio\.com\.br<br />
\bcontabilbr\.com<br />
\bcontadoresgratis\.web-kit\.org <br />
\bcontaouro\.com\.br<br />
\bcontedesign\.com\.br<br />
\bcontente\.blogspot\.com<br />
\bconteudoesportivo\.com\.br<br />
\bcontextojuridico\.blogspot\.com<br />
\bcontraditorium\.com<br />
\bcontrapontoeditora\.com\.br<br />
\bcooperativismodecredito\.blogspot\.com<br />
\bcooppr\.med\.br<br />
\bcoroascaseiras\.net<br />
\bcorreiocarioca\.com\.br<br />
\bcorreionatalino\.com\.br<br />
\bcortesepenteados\.com\.br<br />
\bcosmeticosharimar\.blogspot\.com/<br />
\bcosmetologiaeestetica\.com\.br<br />
\bcosplaybr\.com\.br<br />
\bcostaverdenoticias\.com<br />
\bcpcpbr\.tk<br />
\bcpf\.adv\.br<br />
\bcrazyshake\.net<br />
\bcrazyvideo\.blog\.terra\.com\.br<br />
\bcrazyvideo\.no\.comunidades\.net<br />
\bcreatuforo\.com<br />
\bcredito-info\.com<br />
\bcriacionismoevidencias\.blogspot\.com <br />
\bcriandocalopsitas\.webs\.com<br />
\bcriefuturos\.com\.br<br />
\bcristianor7\.com<br />
\bcristianoronaldofan\.blogs\.sapo\.pt<br />
\bcrm2\.com\.br<br />
\bcsonlinebr\.net<br />
\bctviva\.com\.br<br />
\bculturach\.com\.br<br />
\bcupim\.net\.br<br />
\bcursos24horas\.com\.br <br />
\bcursoseaulas\.com\.br<br />
\bcursosnocd\.com\.br<br />
\bcwhostnet\.com<br />
\bcyanidehappinesstraduzidos\.blogspot\.com<br />
\bcybercook\.com\.br<br />
\bcygets\.googlepages\.com\/teste_digitacao_concurso<br />
\bdabaixadaaomonumental\.blogspot\.com<br />
\bdabusca\.blogspot\.com<br />
\bdanceadois\.com\.br<br />
\bdancecom\.com\.br<br />
\bdanielcoelho\.com\.br<br />
\bdantasplanosdesaude\.com\.br<br />
\bda-pay\.com<br />
\bdashofer\.pt<br />
\bdatasul\.com\.br\/franquias<br />
\bdatasulecm\.com\.br<br />
\bdauri\.com\.br<br />
\bdbzmangalevels\.homestead\.com<br />
\bddl\.name/<br />
\bdebate\.com\.br<br />
\bdedetizacao\.bio\.br<br />
\bdefesabrasil\.com<br />
\bdelta-cafes\.pt<br />
\bdemocracia-fraudada\.com<br />
\bdentistas\.com\.br<br />
\bdepilacao-definitiva\.blogspot\.com<br />
\bdeputadocorauci\.com\.br<br />
\bdesign\.com\.br<br />
\bdesignatento\.com<br />
\bdesignbr\.ning\.com<br />
\bdesigndictionary\.co\.uk <br />
\bdestruindopalavras\.wordpress\.com<br />
\bdetetiveparticular\.hpgvip\.ig\.com\.br<br />
\bdetetive-particular\.org <br />
\bdetetive--particular\.org<br />
\bdetetiveparticular-saopaulo\.com<br />
\bdetetiveparticularsaopaulo\.hpgvip\.ig\.com\.br <br />
\bdetetivesnobrasil\.com\.br<br />
\bdevaneiosdesintericos\.blogspot\.com<br />
\bdeveloperslinux\.com <br />
\bdiariodosartistas\.com<br />
\bdiariosantee\.com\.br<br />
\bdicas-de-presente\.com<br />
\bdicionariodesimbolos\.com\.br<br />
\bdicionario-portugues\.com<br />
\bdictionary\.valodas\.com<br />
\bdieta-certa\.com<br />
\bdietafacil\.awardspace\.com<br />
\bdigicurso\.com <br />
\bdigidelta-software\.com<br />
\bdigipronto\.com\.br<br />
\bdigitrace\-portugal\.com<br />
\bdignidadevascaina\.com<br />
\bdigorest\.com<br />
\bdigshop\.com\.br<br />
\bdiplomaticsociety\.org<br />
\bdireitodoestado\.com\.br<br />
\bdiretodehollywood\.com<br />
\bdiscadorpreditivo\.com\.br<br />
\bdistintivos\.com\.br<br />
\bdisturbiodopanico\.com\.br<br />
\bditudo\.etc\.br<br />
\bditudo\.wiki\.br<br />
\bdivulgaemails\.com<br />
\bdjban\.com\.br<br />
\bdmfer\.com\.br<br />
\bdoencasealimentos\.com<br />
\bdonzeladedomremy\.webs\.com<br />
\bdormiu\.com\.br<br />
\bdorperportoazul\.com\.br <br />
\bdownload\.mus\.br<br />
\bdownloadcurriculum\.com<br />
\bdragaobranco\.com\.br<br />
\bdreamingdolls\.net<br />
\bdr-organico\.com\.br<br />
\bdstudium\.com<br />
\bduasasas\.com<br />
\bdubitando\.no\.sapo\.pt<br />
\bdublanet\.com\.br<br />
\bducker\.com\.br<br />
\bdurmamelhor\.com<br />
\bdvdbarato\.net<br />
\bdvdja\.com\.br<br />
\bdw-world\.de\/dw\/0,2142,2594,00.html<br />
\beasylanguages\.com<br />
\becogenesys\.com\.br<br />
\becognitiva\.blogspot\.com<br />
\becologiaurbana\.com\.br<br />
\becomm\.com\.br<br />
\beconomiacriativa\.blogspot\.com\.br<br />
\beconomiadacultural\.blogspot\.com\.br<br />
\bedemdma\.cjb\.net<br />
\beditoraelim\.com\.br<br />
\bedmrocky\.blogspot\.com<br />
\beduardabreda\.ucoz\.com<br />
\beducacaodeinfancia\.com <br />
\befeitogarage\.com\.br <br />
\begregoralfa\.republika\.pl<br />
\behelp\.eti\.br<br />
\behsportugal\.com<br />
\bejp\.com\.sapo\.pt<br />
\belbestia\.blogspot\.com<br />
\beldorado\.tur\.br<br />
\belegance\.bona-xira\.net<br />
\beleicoesceara\.com\.br<br />
\belevabrasil\.com\.br<br />
\belevadoresmais\.com\.br<br />
\bembarcados\.com\.br<br />
\bembriologiahumana\.com\.br <br />
\bemprego\.destaca\.com\.br<br />
\bemprestimo-info\.com<br />
\bemsaovicente\.com\.br<br />
\bemsintese\.com\.br<br />
\bemtr\.com\.br<br />
\bencena\.pt<br />
\benoises\.wordpress\.com<br />
\bentrevistamarcosmion\.blogspot\.com<br />
\bentrevistamionmarcos\.blogspot\.com<br />
\benxadrismoecultura\.blogspot\.com<br />
\bepel\.eu <br />
\bequipa-design\.com <br />
\berickastler\.com<br />
\berickerico\.blogspot\.com<br />
\bernandijunior\.com\.br<br />
\bervadaninha\.sarava\.org<br />
\bescforum\.net<br />
\bescortvip\.com\.br<br />
\bescritoriodearte\.com <br />
\besnips\.com\/web<br />
\bespacofitnessacademia\.com<br />
\besporrozine\.blogspot\.com<br />
\besportes\.820am\.com\.br<br />
\besquinadotempo\.com\.br<br />
\bestagionet\.com\.br<br />
\bestudandoparaoexamedaordem\.blogspot\.com<br />
\bestudoreligioso\.wordpress\.com<br />
\besyurl\.com<br />
\beuacheifacil\.com\.br<br />
\beubiologia\.xpg\.com\.br<br />
\beutodeferias\.com\.br<br />
\bexamehosting\.com<br />
\bexbancario\.blog\.br<br />
\bexcelencia\.com\.br<br />
\bexplorevale\.com\.br<br />
\bexplosaoderecrutamento\.empreenderonline\.com<br />
\bezboard\.com<br />
\bf1incridible\.blogspot\.com<br />
\bfabiofettuccia\.zip\.net<br />
\bfaclube_beatrizmonteiro\.blogs\.sapo\.pt<br />
\bfailblog\.org<br />
\bfainors\.com<br />
\bfalajacone\.blogspot\.com<br />
\bfalandoemprojetos\.com<br />
\bfalker\.com.br<br />
\bfamiliarotaria\.com\.br<br />
\bfamosas\.wiki\.br<br />
\bfamosasdespidas\.com<br />
\bfamosos\.dimensionebrasile\.com<br />
\bfantasyproducoes\.com<br />
\bfaraos\.org<br />
\bfatorambiental\.com\.br<br />
\bfbfsistemas\.com<br />
\bfeiraodaweb\.com\.br<br />
\bfeiticos\.150m\.com<br />
\bfelipegoncalvesoficial\.blogspot\.com<br />
\bfellipelli\.com\.br<br />
\bferomonios\.com<br />
\bferramentasweb\.com\.br <br />
\bfestadonatal\.wetpaint\.com<br />
\bfhrpromocional\.com\.br<br />
\bficacomigo\.net<br />
\bfifamanager\.com\.pt<br />
\bfiles\.wordpress\.com<br />
\bfilipux\.blig\.ig\.com\.br<br />
\bfilmesportugueses\.com<br />
\bfilosofiaetecnologia\.com\.br<br />
\bfinancasparavida\.com\.br<br />
\bfisiozone\.com<br />
\bfitmorumbi\.com\.br/<br />
\bflaasa\.blogspot\.com<br />
\bflickr\.com\/photos\/vitor107<br />
\bflogao\.com\.br\/avaianosempre <br />
\bflorais\.com\.br<br />
\bfloresnaweb\.com<br />
\bfloriano-gescon\.blogspot\.com<br />
\bfloridabrasil\.com<br />
\bfloripa360\.com\.br<br />
\bfnquimica\.com<br />
\bfocadoemvoce\.com<br />
\bfocushost\.com\.br<br />
\bfogaoshop\.com\.br<br />
\bfonoaudiologia\.com\.br<br />
\bfonoaudiologia\.ourtoolbar\.com<br />
\bfootbook\.com\.br<br />
\bfootbrasil\.net<br />
\bformosafest\.com\.br<br />
\bforo\.telenovela-world\.com<br />
\bforo\.telenovela\-world\.com<br />
\bfortalezaradical\.blogspot\.com<br />
\bfortalezas\.org<br />
\bforum\.alavigne\.com\.br<br />
\bforum\.imasters\.uol\.com\.br<br />
\bforum\.mymetro\.ru<br />
\bforum\.nwbrasil\.com<br />
\bforumaqui\.net<br />
\bforumbrasil\.net<br />
\bforumchaves\.com\.br <br />
\bforumeiro\.org<br />
\bforumeiros\.com<br />
\bforumfotografia\.net <br />
\bforum-livre\.com<br />
\bforumnow\.com\.br<br />
\bforumpratodos\.com<br />
\bforums\.abs\-cbn\.com<br />
\bforums\.abs-cbn\.com<br />
\bforums\.hardwarezone\.com\.sg<br />
\bforums\.techarena\.in<br />
\bfotodosurf\.com\.br <br />
\bfotolog\.com\/faloplastia<br />
\bfotolog\.terra\.com\.br<br />
\bfreehoxt\.com<br />
\bfreelancers\.googet\.eu<br />
\bfreesamplesblog\.com<br />
\bfreewebs\.com\/advogadossalvadorbahia<br />
\bfreewebs\.com\/thecheetahgirlsbr<br />
\bfrequencia\.eu<br />
\bfresnorock\.com/<br />
\bfromplanetasperger\.blogspot\.com<br />
\bfuiaoinfernoevoltei\.blogspot\.com<br />
\bFullCarTuning\.com <br />
\bfunctionpointmodeler\.com<br />
\bfunctionpointmodeler\.de<br />
\bfundacaoatitude\.com\.br<br />
\bfundos\.com <br />
\bfundoverde\.com\.br <br />
\bfuracaomexicano\.com<br />
\bfuriaps2\.blogspot\.com<br />
\bfusca\.mobi<br />
\bfuscadorock\.blogspot\.com<br />
\bfutcc\.com\/images<br />
\bfutebol\.nocelular\.biz <br />
\bfutebolefixe\.blogspot\.com<br />
\bfutemoney\.blogspot\.com<br />
\bfutnet\.com\.br <br />
\bfuturomelhor\.wordpress\.com<br />
\bfxcast\.com/<br />
\bgabrielortiz\.com<br />
\bgagocoutinho\.wordpress\.com<br />
\bgalapagocruise\.com<br />
\bgaleradofundao\.org<br />
\bgalodigital\.com\.br<br />
\bgamd\.com\.br<br />
\bgamehall\.uol\.com\.br<br />
\bgames\.cartoonnetworkhq\.com\/downloadGame\.php<br />
\bgangdomoinho\.net<br />
\bgarotacomtecnologia\.blogspot\.com<br />
\bgaypride\.com\.br<br />
\bgenealogiabrasileira\.org<br />
\bgeocities.com\/gurnemanzbr\/astrid<br />
\bgeocities\.com\/cirurgiaplasticaestetica<br />
\bgeocities\.com\/pajero_full_200891<br />
\bgeocities\.com\/spiritistgospel <br />
\bgeocities\.com\/valternascimento<br />
\bgeoconcursos\.geotrack\.com\.br<br />
\bgeorreferenciamentoincra\.com\.br<br />
\bgeotecnologias\.wordpress\.com\/<br />
\bgermany-travel-guide\.info<br />
\bgestaocondominial\.spaces\.live\.com<br />
\bgiardinicas\.blogspot\.com<br />
\bginecologia-online\.com\.br<br />
\bgladiatus\.com\.pt\/game<br />
\bgladiatus\.com\/game<br />
\bgloboeletronicos\.com\.br<br />
\bglobominastvdigital\.com<br />
\bglosk\.com<br />
\bgnosesul\.com\.br<br />
\bgnosisonline\.org<br />
\bgoaguu\.googlepages\.com<br />
\bgoa-property\.net<br />
\bgolo-digital\.blogspot\.com<br />
\bgolo-online\.blogspot\.com<br />
\bgo-night\.com<br />
\bgooglewavedicas\.wordpress\.com<br />
\bgoolervier\.blogspot\.com<br />
\bgorgonzola\.se <br />
\bgorpa\.com\.br<br />
\bgosmametalica\.blogspot\.com<br />
\bgotroot\.com\.br<br />
\bgportal\.hu<br />
\bgpxonline\.com\.br<br />
\bgraciejiujitsufabioleopoldo\.com\/site\/<br />
\bgraffiti\.keusta\.net<br />
\bgraffiti\.org\.br<br />
\bgramadoecanela\.com\.br <br />
\bgrancorazon\.org<br />
\bgrandefraternidadebranca\.com\.br<br />
\bgratishost\.com\.br<br />
\bgriaule\.com<br />
\bgriaulebiometrics\.com<br />
\bgrupoyes\.com\.br<br />
\bgrupoyes\.com\.br\/Cursos\.aspx<br />
\bgsbrazil\.net<br />
\bguesthouseinitaly\.com<br />
\bgugol-downloads\.blogspot\.com<br />
\bguiabrasiladventure\.com<br />
\bguiabsb\.com\.br<br />
\bguiacastor\.com<br />
\bguiacurso\.com\.br<br />
\bguiadacopa\.net<br />
\bguiadaembalagem\.com\.br<br />
\bguiadaobra\.net <br />
\bguiadapesca\.com\.br<br />
\bguiadeatibaia\.com<br />
\bguiadeinvestimento\.com\.br<br />
\bguiadeitupeva\.com\.br<br />
\bguiadelrei\.com\.br<br />
\bguiademidia\.com\.br<br />
\bguiademongagua\.com\.br<br />
\bguiadocftv\.com\.br<br />
\bguiadoparaguai\.com\.br<br />
\bguiamongagua\.com\.br<br />
\bguiamorrao\.com\.br<br />
\bguilhermeabreu\.com\.br<br />
\bgunnersbrasil\.com<br />
\bgunsnrosesbrasil\.com<br />
\bgwebtools\.com <br />
\bgword\.com\.br<br />
\bh1loeqbb7bsndivgoj\.usercash\.com<br />
\bhabto\.com\.br<br />
\bhackerofdark\.blogspot\.com<br />
\bhacktolive\.org<br />
\bhaicaizen\.blogspot\.com<br />
\bhatada\.com\.br<br />
\bhavilla\.com\.br<br />
\bhelenablavatsky\.com\.br<br />
\bhellinger\.com\.br<br />
\bhesjapanese\.com <br />
\bhi5\.com<br />
\bhigh-supplies\.com<br />
\bhistoriadetudo\.com<br />
\bhistoriaimagem\.com\.br<br />
\bhistoriaserankings\.blogspot\.com<br />
\bhitany-fx\.blogs\.sapo\.pt<br />
\bhmscacambas\.com\.br<br />
\bhmv\.com\.hk\/product<br />
\bhogfriends\.net<br />
\bhospedar-se\.com <br />
\bhostercom\.com\.br<br />
\bhot100brasil\.com<br />
\bhotblowjobs\.com <br />
\bhotcheats\.org <br />
\bhotel13outubro\.com<br />
\bhotmailive\.blogspot\.com<br />
\bhotsurfers\.com\.br<br />
\bhotvnews\.wordpress\.com<br />
\bhtmlstaff\.org<br />
\bhttp-guia\.blogspot\.com<br />
\bhumanitarianlion\.com<br />
\bhumanomatica\.blogspot\.com<br />
\bhunterxhunter\.otaku\.com\.br<br />
\bianfavorite\.com<br />
\bibaladas\.com\.br<br />
\bibem\.org\/artigos\/acrobat<br />
\bibem\.org\/Hom_DPG<br />
\bibrasao\.com<br />
\bic\.vila\.bol\.com\.br<br />
\bic\.vilabol\.com\.br<br />
\bicm\.k6\.com\.br<br />
\bidealgarve\.com <br />
\bideas\.live\.com <br />
\bideia-atlantico\.pt<br />
\bideia3\.com\.br<br />
\bideiasedinheiro\.blogspot\.com<br />
\bidolomaniacos\.blogspot\.com<br />
\bidoloshome\.com<br />
\bigrejaparatodos\.com\.br<br />
\biguablogger\.blogspot\.com<br />
\bihateyoujulia\.com<br />
\bilha-dos-amores\.com <br />
\bilhaguriri\.com<br />
\bilhaguriri\.net<br />
\billuminatiarchives\.org<br />
\bim2\.com\.br<br />
\bimages\.amazon\.com<br />
\bimages\.orkut\.com<br />
\bimageshack\.us<br />
\bimageshack\.us<br />
\bimarketing\.com\.br<br />
\bimg\.photobucket\.com\/albums<br />
\bimhep\.com\.br<br />
\bimobiliariamercatto\.com.br<br />
\bimobilien\.com\.br<br />
\bimplantedentarios\.blogspot\.com<br />
\binacreditavel\.com\.br<br />
\bindicetj\.com<br />
\binesrodena\.blogspot\.com<br />
\binfo-caimbras\.org<br />
\binfofranchising\.pt<br />
\binfortronicabh\.blogspot\.com<br />
\binfovasco\.com<br />
\binfowaysi\.com<br />
\binibio\.xpg\.com\.br<br />
\binovabrasil\.blogspot\.com<br />
\binovadigital\.com<br />
\binsetotec\.com\.br <br />
\binsidernews\.com\.br<br />
\binstitutohellinger\.com\.br<br />
\binstitutouniao\.com\.br\/artigos/sindromedopanico.asp<br />
\bintecabsp\.wordpress\.com<br />
\binteligenciavirtual\.com<br />
\binterblogs\.com\.br\/homerofonseca<br />
\bIntercambioCultural\.com\.br<br />
\bintercambiocultural\.com\.br<br />
\bIntercambioCultural\.org<br />
\bintercambiocultural\.org <br />
\binternetpaulista\.com <br />
\binvasao\.com\.br<br />
\binvest\.fok\.com\.br<br />
\binvestbolsa\.com<br />
\bipetitions\.com<br />
\biphonept\.blogspot\.com<br />
\bisa-te-kiero-mais\.blogspot\.com<br />
\biscoach\.com<br />
\bisfreepop\.com\/series<br />
\bismep\.com\.br <br />
\bitanhaemonline\.com<br />
\bitanhaemvirtual\.com\.br<br />
\bitanhem\.blogspot\.com<br />
\bitapevacity\.com\.br<br />
\bitvibopedatv\.wordpress\.com<br />
\biwl\.com\.br<br />
\bjakeefred\.blogspot\.com<br />
\bjapaneselanguage\.da\.ru<br />
\bjaunews\.net<br />
\bjaymepanerai\.blogspot\.com<br />
\bjcmrpgart\.blogspot\.com<br />
\bjdnamidia\.com\.br<br />
\bjesusvira\.com\.br<br />
\bjogaki\.net<br />
\bjogodebuzios\.com\.br<br />
\bjogos-e-brincadeiras\.blogspot\.com<br />
\bjogosolimpicospequim\.com<br />
\bjogosvideos\.com<br />
\bjoiasweb\.com<br />
\bjonatasanches\.blogspot\.com<br />
\bjornadanasestrelas\.com<br />
\bjornalclubpenguinhoje\.blogspot\.com<br />
\bjornaldoe-commerce\.com <br />
\bjornalismo-desportivo\.blogspot\.com<br />
\bjornaloeco\.com\.br<br />
\bjosemanuelperez\.es\/wikipedia\/pt<br />
\bjoveminvest\.com\.br <br />
\bjubaia\.com\.br<br />
\bjulianoaudiencia\.zip\.net<br />
\bjunkie\.zonesp\.com<br />
\bjurisprudenciaemrevista\.org <br />
\bkachorro\.xpg\.com\.br<br />
\bkarapintadas\.wordpress\.com<br />
\bkatatau\.com<br />
\bkeequeenalive\.web\.pt<br />
\bkevinhaddock\.com<br />
\bkidicas\.com<br />
\bkikiat\.com<br />
\bkiminda\.wordpress\.com<br />
\bkissboots\.blogspot\.com<br />
\bkitline43\.com<br />
\bkitmaladiretaoverdadeiro001\.com<br />
\bkitpipa\.com<br />
\bkoinoo\.ning\.com<br />
\bkombu\.de<br />
\bkombucha\.hotel-br.\com<br />
\bkraazydragonball\.com<br />
\bkriyayoga-mahavatarbabaji\.com<br />
\bkuthribeirooficial\.blogspot\.com<br />
\bkxk\.me<br />
\bkyliept\.forumeiro\.com<br />
\bkyocerasolar\.com\.br<br />
\bl2gp\.com<br />
\bl2ouro\.com<br />
\blabgeo\.blogspot\.com<br />
\blabirinto\.wiki\.br<br />
\blacchiappasogni\.tk<br />
\blageado\.com\.br<br />
\blagosmilitar\.blogspot\.com<br />
\blajepor\.com\.br<br />
\blasmanzanasdulces\.wordpress\.com<br />
\blastfm\.com\/event<br />
\blastfm\.pt\/event<br />
\blatinasex\.741\.com<br />
\blattesnet\.com\.br<br />
\blayart\.com\.br<br />
\blecachalot\.xmb\.com\.br<br />
\bleechesturkey\.com<br />
\blegendanimes\.com<br />
\blelecasapeca\.blogger\.com\.br<br />
\blendas-fantasia\.blogspot\.com<br />
\blfsapatos\.com\.br<br />
\blibertarianismo\.com<br />
\blicitamais\.com\.br<br />
\blife-stream\.webs\.com<br />
\blinerecordsshop\.com\.br<br />
\blingua-ingles\.blogspot\.com<br />
\blinhabase\.com\.br<br />
\blinhasnaareia\.com<br />
\blinkinparker\.webs\.com<br />
\blinkjb<br />
\blinkjb\.vilabol\.uol\.com\.br<br />
\blinknacional\.com\.br<br />
\blinkvitrine\.com\.br<br />
\blistadebrinquedos\.com<br />
\blistadelivros-doney\.blogspot\.com<br />
\blistapratica\.com<br />
\blitoraldesantacatarina\.com<br />
\blitoralnorters\.com\.br<br />
\bliverig\.wordpress\.com<br />
\blivestream\.com\.br<br />
\blivrariasaraiva\.com\.br\/produto<br />
\blivrogastronomico\.do\.sapo\.pt <br />
\blivromidp\.jorgecardoso\.eu<br />
\blixaoblog\.blogspot\.com<br />
\blogobr\.wordpress\.com<br />
\blojaconrad\.com\.br\/produto\.asp<br />
\blojasdobairro\.com<br />
\blondon-underground\.blogspot\.com<br />
\blosmandalas\.blogspot\.com<br />
\blrg\.ufsc\.br\/\~westphal<br />
\blucenaseguros\.com\.br <br />
\bbluebonnet\.com\.br<br />
\bluizjabour\.com<br />
\bluizmeira\.com<br />
\blusoproduction\.fr<br />
\bluta-capoeira\.blogspot\.com<br />
\blutopelobrasil\.com\.br<br />
\bluzespirita\.com<br />
\bluzespirita\.org<br />
\blvxsinistrae\.blogspot\.com<br />
\blyricshosting\.com<br />
\bmacore\.com\.br<br />
\bmacrocimento\.com\.br<br />
\bmademan\.com<br />
\bmagextreme\.blogspot\.com<br />
\bmagianegra\.org\.br <br />
\bmagiasebarbaridades\.blogspot\.com<br />
\bmagicaboutyou\.blogspot\.com <br />
\bmagistertempli\.blogspot\.com<br />
\bmaionesefastfood\.com<br />
\bmaisabc\.com\.br<br />
\bmaisbrasilia\.com<br />
\bmaissaude\.eu<br />
\bmaladiretaemails\.com<br />
\bmalamutedealaska\.com<br />
\bmalapronta\.com\.br<br />
\bmandalas\.art\.br<br />
\bmandalas\.skyrock\.com<br />
\bmandihost\.com\.br<br />
\bmangasjbc\.uol\.com\.br<br />
\bmantiqueiraimoveis\.com\.br<br />
\bmanutdbr\.com<br />
\bmapaguia\.com.br<br />
\bmapia\.com\.br<br />
\bmaqgoo\.com <br />
\bmaquiagememoda\.com\.br<br />
\bmarciopereira\.com\.br<br />
\bmarcocassol\.com\.br<br />
\bmarcosmionentrevista\.blogspot\.com<br />
\bmarcosrivelles\.zip\.net<br />
\bmarcosturbo\.com\.br<br />
\bmarduc\.blogspot\.com<br />
\bmarketingdeguerrilha\.wordpress\.com<br />
\bmarketingmadeinbrasil\.zip\.net <br />
\bmarlonstein\.com<br />
\bmarseille360\.schnurstracks\.de<br />
\bmashupkeyword\.com<br />
\bmasiero\.com\.br<br />
\bmassadouniverso\.blogspot\.com<br />
\bmatrixcaesdeguarda\.com\.br<br />
\bmaxtemporada\.com\.br<br />
\bmaysamonjardimoficial\.blogspot\.com<br />
\bmc2h2o\.blogspot\.com<br />
\bmcrbullet-oficial\.com<br />
\bmecatronica\.webng\.com<br />
\bmediatraffic\.de<br />
\bmedicarepoints\.pt<br />
\bmedicinadotorax\.com\.br/<br />
\bmedicinaealimentacao\.com <br />
\bmedicinanet\.com\.br<br />
\bmedicinatradicionalchinesa\.com<br />
\bmeditacao\.biz<br />
\bmeditacaotranscendental\.blogspot\.com<br />
\bmeditacaotranscendental\.com <br />
\bmegaideas\.net<br />
\bmeginformatica\.com\.br<br />
\bmeiobit\.pop\.com\.br<br />
\bmemoriasdofront\.blogspot\.com<br />
\bmemurl.com<br />
\bmenuespecial\.com\.br<br />
\bmercadohorse\.com<br />
\bmerrychristmas\.no\.sapo\.pt<br />
\bmerrychristmashny\.no\.sapo\.pt<br />
\bmestreseo\.com\.br<br />
\bmetafisico\.net<br />
\bmetalgearpt\.awardspace\.com<br />
\bmetricimperial\.com <br />
\bmetro-subway-train-list\.com<br />
\bmeubox\.com\.br<br />
\bmeumomento\.com<br />
\bmeutaperoa\.com\.br <br />
\bmeuvitoria\.com<br />
\bmicaretas\.oipapai\.com\.br<br />
\bmictmr\.blogspot\.com<br />
\bmideos\.com<br />
\bmidiaclipping\.blogspot\.com<br />
\bmiguel-montenegro\.com<br />
\bminasclassificados\.com<br />
\bminhaaudiencia\.wordpress\.com<br />
\bminhacidadetem\.com\.br<br />
\bminhaconexao\.com\.br<br />
\bminhavida\.com\.br<br />
\bminimomultiplo\.com<br />
\bminitrem\.com<br />
\bminutodebarulho\.blogspot\.com<br />
\bmionmarcoscocadaboa\.blogspot\.com<br />
\bmissesemmanchete\.blogspot\.com<br />
\bmix\.phoneclub\.com\.br<br />
\bmjacksonart\.com <br />
\bmkarmageddon\.com<br />
\bmktg2\.net<br />
\bmktportugal\.com<br />
\bmnecho\.com <br />
\bmoananui\.wordpress\.com<br />
\bmochileiros\.com<br />
\bmodemdownloads\.net<br />
\bmoedas\.com<br />
\bmonografiaexpressa\.com<br />
\bmonografiapratica\.com<br />
\bmonografiaurgente\.com <br />
\bmorangos5serie\.blogs\.sapo\.pt<br />
\bmorangos-com-acucar\.com<br />
\bmorraderir\.com\.br<br />
\bmortesubita\.org<br />
\bmoscoso\.biz <br />
\bmouralacerda\.com\.br<br />
\bmovimentosestudantis\.blogspot\.com<br />
\bmovimentovotonulo\.blogspot\.com<br />
\bmsbesporte\.blogspot\.com<br />
\bmtv\.com\.br\/vivaovinil<br />
\bmtv\.uol\.com\.br\/vivaovinil<br />
\bmuestrasgratis\.es<br />
\bmulticreditos\.com<br />
\bmultigolb\.wordpress\.com<br />
\bmultiply.com\/blog<br />
\bmultiply.com\/journal<br />
\bmultiply.com\/links<br />
\bmultiply.com\/photos<br />
\bmultiply.com\/reviews<br />
\bmultiply.com\/tag<br />
\bmultiply.com\/video<br />
\bmultserv\.com\.br<br />
\bmundobariloche\.com\.br<br />
\bmundocruzeiros\.com\.br<br />
\bmundodatvaberta\.blogspot\.com<br />
\bmundodeclubpenguin\.blogspot\.com<br />
\bmundodomarketing\.com\.br<br />
\bmundodosincompreendidos\.blogspot\.com<br />
\bmundoeducacaofisica\.com<br />
\bmundopratico\.blogspot\.com<br />
\bmundoseo\.com\.br<br />
\bmupasales\.dominiotemporario\.com<br />
\bmuselius\.com<br />
\bmuseudosexo\.com\.br<br />
\bmuseuvirt\.com\.br<br />
\bmusicaseclipes\.com<br />
\bmuv.\com\.br <br />
\bmuzaminastear\.com\.br<br />
\bmybesthotel\.eu<br />
\bmyspace\.com\/bandanovadinastia<br />
\bmyspace\.com\/gaiteirosdealcochete<br />
\bmyspace\.com\/idolos<br />
\bmyvuvuzela\.blogspot\.com<br />
\bnacaocatolica\.com\.br<br />
\bnanetcomcdc\.blogspot\.com<br />
\bnanuqueinforma\.com/<br />
\bnaozero\.com\.br<br />
\bnarutodb\.com<br />
\bnarutomx\.free\.fr<br />
\bnarutoplayers\.com<br />
\bnatalf\.no\.sapo\.pt<br />
\bncpdtoo\.info <br />
\bncriacaodesites\.com<br />
\bnedvarticles\.narod\.ru<br />
\bnegocioextra\.com<br />
\bnetauthor\.org<br />
\bnetcampos\.com <br />
\bnethbc\.com<br />
\bnetronic\.com\.br<br />
\bnewagetokyo\.com<br />
\bnewdigitalsouth\.org<br />
\bnewronio\.espm\.br<br />
\bnfedobrasil\.com\.br<br />
\bning\.com<br />
\bnintendomania-gs\.blogspot\.com<br />
\bnintendowiiblog\.org <br />
\bnirvana\.com\.sapo\.pt<br />
\bnitarq\.blogspot\.com<br />
\bniteroitv\.com\.br<br />
\bnitrofl.webs\.com\.br<br />
\bnoh\.com\.br<br />
\bnoiabr\.ueuo\.com<br />
\bnoisnatira\.blogspot\.com <br />
\bnoivacarioca\.com\.br<br />
\bnoivasdeportugal\.com<br />
\bnomadismocelular\.wordpress\.com<br />
\bnomundodosfamosos\.zip\.net<br />
\bnonnux\.com<br />
\bnordestefree\.blogspot\.com<br />
\bnoskirebr\.com<br />
\bnoticiasdatvbrasileira\.blogspot\.com<br />
\bnoticiasmusicais\.radioativohits\.com<br />
\bnotlong\.com<br />
\bnoturnafm\.com\.br<br />
\bnovafriburgoturismo\.com\.br<br />
\bnovatec\.com\.br<br />
\bnovevolts\.blogspot\.com<br />
\bnovodaiblog\.blogspot\.com<br />
\bnsonline\.com\.br<br />
\bnsrbr\.com<br />
\bnucleodeoportunidades\.net<br />
\boanodogolfinho\.com<br />
\bobabox\.com <br />
\bobaepitacio\.com\.br<br />
\bobesidadeinfo\.com <br />
\bobjetivoguarulhos\.com\.br<br />
\boblogtv\.blogspot\.com<br />
\bobrasileirinho\.com\.br<br />
\bobrigadas2010\.megaideas\.net<br />
\bocachacier\.com\.br<br />
\bocanal\.wordpress\.com<br />
\bocantinhodosdeprimidos\.blogspot\.com<br />
\bodontologiaconcursos\.com\.br<br />
\bofileumgay\.blogspot\.com<br />
\boilondres\.com\.br<br />
\boipapai\.com\.br<br />
\boitentona\.com\.br<br />
\bojovem\.net<br />
\bokardecista\.blogspot\.com<br />
\bolharaspie\.blogspot\.com<br />
\bolhareconomico\.cjb\.net<br />
\bolharobscuro\.com<br />
\bomdl\.com\.br<br />
\bomelhordecapao\.com\.br<br />
\bomelhordobairro\.com\.br<br />
\bomelhordocerrado\.com\.br<br />
\boncopediatria\.org<br />
\bondatuga\.com<br />
\bondeanda\.multiply\.com<br />
\bondeestagenebra\.blogspot\.com<br />
\bonibusemdebate\.fotopages\.com<br />
\bonlypop\.blogspot\.com<br />
\boparanasondasdoradio\.ufpa\.br\/livro.htm<br />
\bopartidolivre\.blogspot\.com<br />
\bopersan\.com\.br<br />
\bopiniaoenoticia\.com\.br<br />
\bopiniaoipiau\.com\.br<br />
\boportunidadesanhembi\.com\.br<br />
\bordemdotemploiluminista\.blogspot\.com<br />
\bordemlivre\.org<br />
\borganizacionais\.com\.br<br />
\borganizandoeventos\.com\.br<br />
\borixas\.sites\.sapo\.pt<br />
\borladeatalaia\.com\.br<br />
\borlandocalado\.flogbrasil\.terra\.com\.br<br />
\bosbaladeiros\.com\.br<br />
\boseriestvz.broguiz.com <br />
\bosmelancias\.com\.br<br />
\bosmutantescdcc\.blogspot\.com<br />
\bosmutantesnanet\.blogspot\.com<br />
\botbr\.com\.br<br />
\botemponaopara\.wordpress\.com<br />
\botserv\.com\.br<br />
\bousar\.net<br />
\boysfirsttime\.com<br />
\bpagmenos\.net<br />
\bpaixaoautomovel\.blogspot\.com<br />
\bpakaas\.com\.br<br />
\bpalatando\.com<br />
\bpalavras-arquitectura\.com<br />
\bpamonhart\.com\.br<br />
\bpandajogosgratis\.com<br />
\bpandamovies\.com <br />
\bpantanalecoturismo\.tur\.br<br />
\bpapaleguaspt\.blogspot\.com<br />
\bpaqueralegal\.com<br />
\bparanapiacabaecotur\.com<br />
\bparasempremiguelfalabella\.blogspot\.com<br />
\bparquesepracasdecuritiba\.com\.br<br />
\bpartidolivre\.org\.br<br />
\bpassageirodomundo\.blogspot\.com<br />
\bpath\.to/b677<br />
\bpath\.to\/e6b3\/ <br />
\bpatriciafelinaa\.blogspot\.com<br />
\bpauloandreissa\.com<br />
\bpaulobeck\.blogspot\.com<br />
\bpcclinic\.pt<br />
\bpcs\.k6\.com\.br<br />
\bpcsist\.com\.br<br />
\bpeaceoneday\.org<br />
\bpedalativo\.com<br />
\bpediatria\.com.\br<br />
\bpedrodoria\.com\.br<br />
\bpedro-rossi-clube-da-esquina\.blogspot\.com<br />
\bpegamais\.com\.br<br />
\bpennichollo\.blogspot\.com<br />
\bpensamentopositivo\.com\.br<br />
\bpepe\.org\.br<br />
\bpescaemsintra\.com<br />
\bpesqueirafutebolclube2008\.blogspot\.com <br />
\bpet\.di\.ufpb\.br\/ferramentadct<br />
\bpetsecia\.com<br />
\bphotobucket\.com <br />
\bphotobucket\.com\/albums<br />
\bphysicalgym\.com\.br\/site\/<br />
\bpiadasonline\.com\.br<br />
\bpiauinauta\.blogspot\.com<br />
\bpiauionline\.com\.br<br />
\bpicodogaviao\.com\.br<br />
\bpicodogaviao\.esp\.br<br />
\bpieceextremo\.blogspot\.com<br />
\bpierdeipanema\.com\.br<br />
\bpimentanegra\.blogspot\.com<br />
\bpimentelonline\.com<br />
\bpinblogger\.weblogger\.com\.br <br />
\bpindavale\.com<br />
\bpindavale\.com\.br<br />
\bpindavale\.net<br />
\bpindavale\.org <br />
\bpingon\.com\.br<br />
\bpiritubaclick\.com\.br<br />
\bpiroalquimista\.vilabol\.uol\.com\.br<br />
\bpisodegranito\.com<br />
\bplanetabodyboard\.com<br />
\bplanetatv\.wordpress\.com<br />
\bplanetavet\.com<br />
\bplanodesaude\.biz<br />
\bplanotatico\.com<br />
\bplano-verao\.com<br />
\bplantiodireto\.com\.br<br />
\bplasmalcd\.110mb\.com <br />
\bplasticos.hdfree\.com\.br<br />
\bplugcidade\.com\.br<br />
\bpndt\.com\.br<br />
\bpobreotario\.blogspot\.com<br />
\bpodermasculino\.com\.br<br />
\bpodiatryworldwide\.com <br />
\bpokemondarkay\.blogspot\.com<br />
\bpokenewsonline\.blogspot\.com<br />
\bpolegar\.k6\.com\.br<br />
\bpontagrossa\.com\.br<br />
\bpontagrossacvb\.com\.br<br />
\bpontoperdido\.blogspot\.com<br />
\bpopart-esfh\.com<br />
\bpornotube\.com<br />
\bporntune\.net<br />
\bportabilidade\.com\.br<br />
\bportal1000\.com\.br<br />
\bportalacontece\.com\.br<br />
\bportaladm\.adm\.br<br />
\bportalafricanista\.blogspot\.com<br />
\bportalararipina\.blogspot\.com<br />
\bportalcapelinha\.com\.br<br />
\bportaldaspousadas\.net<br />
\bportaldecontabilidade\.com\.br<br />
\bportaldehospedagem\.com\.br<br />
\bportaldopajeu\.com<br />
\bportalegrecidadepostal\.blogspot\.com<br />
\bportalglobinho\.rg3\.net<br />
\bportalico\.com\.br<br />
\bportalilheus\.xpg\.com\.br<br />
\bportaljarinu\.com\.br<br />
\bportalligtv\.com\.br<br />
\bportaloceania\.com<br />
\bportalparaisense\.com\.br<br />
\bportalpiraju\.com<br />
\bportalpornoportugues\.pt\.vu<br />
\bportalsmallville\.net<br />
\bportalssvip\.com<br />
\bportaltributario\.com\.br<br />
\bportugacard\.com<br />
\bportugalempresarial\.com <br />
\bpotimvale\.blogspot\.com<br />
\bpousadajubaia\.com\.br<br />
\bpousadariopreto\.com\.br<br />
\bpousadascomcharme\.com\.br<br />
\bprainhadeburitama\.com\.br<br />
\bpranos\.com\.br<br />
\bpreditivo\.com\.br<br />
\bprestacao\.com<br />
\bpriestknack\.com<br />
\bprintax\.com\.br<br />
\bpriscilalino\.com\.br<br />
\bprodulz\.com\.br<br />
\bproduto\.mercadolivre\.com\.br<br />
\bprofcardy\.com\/calculadoras/<br />
\bprofessorprojeto\.blogspot\.com<br />
\bprofkbrito\.zip\.net<br />
\bprogramabrasil\.org<br />
\bprojectodinheiro\.pt<br />
\bprojectos\-arquitectos\.blogspot\.com<br />
\bprojectos-arquitectos\.blogspot\.com<br />
\bprojetogenoma\.com\.br<br />
\bpro-laudo\.com\.br<br />
\bpromocoes\.biz<br />
\bprosementes\.com\.br<br />
\bprovadetran\.com\.br<br />
\bpsymania\.com<br />
\bpt\.wikipedia\.org\.br<br />
\bpt\.shvoong\.com\/how-to\/writing<br />
\bptairsoft\.org<br />
\bptpassatempos\.com<br />
\bptwebsite\.com<br />
\bpubsender\.com<br />
\bpunkshop\.com\.br <br />
\bpuppyclick\.com<br />
\bputadaloucura\.com<br />
\bputarianatv\.com<br />
\bputsblog\.com<br />
\bqaudiencia\.blogspot\.com<br />
\bqeenmedia\.com\.ar<br />
\bqi\.com\.br<br />
\bqibla\.com\.br<br />
\bquadrante\-natural\.pt<br />
\bqualasuabossa\.com\.br<br />
\bqualjogo\.com <br />
\bqualpeca\.com<br />
\bqudrante\-natural\.pt <br />
\bqueroficarrico\.net<br />
\bquerosaude10\.blogspot\.com<br />
\bquickgoldfacts\.blogspot\.com<br />
\bquintabiologica\.info<br />
\bradiestesia\.br\.tripod\.com<br />
\bradiobaseurgente\.blogspot\.com<br />
\bradioharekrishna\.blog\.br<br />
\bradiomec\.com\.br<br />
\bradiowebavivamentojovem\.com<br />
\braeiro\.com<br />
\brankbrasil\.com\.br<br />
\brapidshare.com\/files\/<br />
\braultabajara\.blogspot\.com<br />
\brayervas\.com\.br<br />
\brbgestao\.com\.br<br />
\brcpsoftware\.com\.br<br />
\brd1audiencia\.com<br />
\brd1audienciadatv\.wordpress\.com<br />
\brd1audienciadatv\.wordpress\.com<br />
\brecblog\.com\.br<br />
\breceitaculinaria.\com\.br<br />
\brecibosverdes\.com<br />
\breciclaconnosco\.blogspot\.com <br />
\breciclareviver\.rg3\.net<br />
\breconcavonoticias\.com<br />
\brede-brasil-tv\.blogspot\.com<br />
\bredefile\.com<br />
\bredeisatkm\.blogspot\.com<br />
\bredmadox\.com\.br <br />
\bredtube\.com<br />
\breflexoesdeumlouco\.blogspot\.com<br />
\breflexoesdigitais\.com\.br<br />
\bregeneration\.com\.br<br />
\breidobrasfoot\.blogspot\.com<br />
\breiki\.portais\.org<br />
\breikimawashi\.com<br />
\breikiuniverso\.org<br />
\breinodeoxala\.com\/videoteca<br />
\brelojesweb\.imitable\.com<br />
\bremade\.com\.br <br />
\brendaweb\.weebly\.com<br />
\brenerlopes\.zip\.net<br />
\brenter\.com\.br<br />
\brenzogracie\.com\/<br />
\breportervelazquez\.blogspot\.com<br />
\breservas\.net<br />
\bresidentevilwork\.blogspot\.com<br />
\brestauranteocaipira\.com\.br<br />
\bresumodanoticia\.blogspot\.com<br />
\bresumodasnovelas\.net<br />
\bresumododia\.wordpress\.com<br />
\bresumos\.net<br />
\breto-europa\.ning\.com<br />
\bretratoiberico\.com<br />
\bretratto\.com<br />
\brevistadatv\.blogspot\.com<br />
\brevistasgratis\.ws<br />
\brevoclim\.zip\.net<br />
\breybiannchi\.4shared\.com<br />
\brhorigami\.com<br />
\briodejaneiro-copacabana\.com\.br<br />
\briodejaneirophotoguide\.com<br />
\brioferias\.com<br />
\brio-rj\.com\.br<br />
\brmrconsultoria\.v10\.com\.br<br />
\brobertexto\.com<br />
\brobitexplore\.com<br />
\brockbrasiliadesde64\.blogspot\.com<br />
\brockybalboa\.com\.br<br />
\brockybalboa\.com\.br<br />
\brodolfo\.typepad\.com<br />
\brodrigofneves\.blogspot\.com<br />
\brommopaula\.blogspot\.com<br />
\bromuloesbt\.blogspot\.com<br />
\brose-mcgowan-brasil\.blogspot\.com<br />
\brotadoromanico\.com<br />
\broteirodelavras\.com <br />
\broteirostelevisao\.blogspot\.com<br />
\broxclan\.net<br />
\brpgdesafios\.com\.br<br />
\brplanetagospel\.blogspot\.com<br />
\brppnweb\.com<br />
\bruadasflores\.com<br />
\brugby\.esp\.br<br />
\bsalaodetuning\.com\.br<br />
\bsalto12\.blogspot\.com<br />
\bsanbara\.com\.br<br />
\bsandramouraramos\.blogspot\.com<br />
\bsandrasantos\.com<br />
\bsandrinha\.com\.br<br />
\bsanguesuga\.com <br />
\bsantainquisicaocatolica\.blogspot\.com<br />
\bsantoantoniodopinhal\.com\.br<br />
\bsantosreporter\.blogspot\.com<br />
\bsaopaulobairros\.com\.br<br />
\bsaopaulocenter\.com\.br <br />
\bsatere\.com<br />
\bsaturei\.com<br />
\bsaudedofuturo\.wordpress\.com<br />
\bschwarzenegger\.it<br />
\bscrapbookbrasil\.com<br />
\bscrapjackie\.locaweb\.com\.br<br />
\bscribd\.com\/download<br />
\bscribd\.com\/group<br />
\bscribd\.com\/people<br />
\bscribd\.com\/profile<br />
\bscribd\.com\/word<br />
\bscriptline\.net/<br />
\bsegurosguia\.com<br />
\bseinstrumentos\.com\.br<br />
\bsejavegetariano\.com\.br<br />
\bsekstv\.info<br />
\bsemreligiao\.com\.br<br />
\bsenha1234\.blogspot\.com<br />
\bsenhoradeoliveira\.blig\.com\.br<br />
\bseomaster\.com\.br<br />
\bsergioprata\.com\.br<br />
\bseries-etc\.blogspot\.com<br />
\bsexxxchurch\.com<br />
\bsg7net.\com\.br<br />
\bsgospel\.com<br />
\bshareapic\.net<br />
\bshemalesexstar\.com<br />
\bshowdelance\.com\.br<br />
\bsicchiquititas\.blogs\.sapo\.pt<br />
\bsigmasociety\.com<br />
\bsimonepedacos\.multiply\.com<br />
\bsimplyjolie2008\.blogspot\.com<br />
\bsimpozio\.ufsc\.br<br />
\bsimsbrasil\.com\.br<br />
\bsite\.oiyes\.com\.br<br />
\bsite\.voila\.fr\/chezmirage/<br />
\bsitegratisgratis\.com\.br <br />
\bsitemeu\.net<br />
\bsites\.google\.com/site/gagocoutinhocom<br />
\bsites\.google\.com/site/top100brazil/Home/<br />
\bsites\.google\.com/site/vermelhovelho<br />
\bsitesdesites\.webnode\.com\.br<br />
\bsitiomarado\.forumeiro\.com<br />
\bskindoctornyc\.com<br />
\bskydrive\.live\.com\/self\.aspx<br />
\bskyscrapercity\.com<br />
\bslam\.regeneration\.com\.br<br />
\bslamdunk\.suprasolucoes\.com<br />
\bslideshare\.net<br />
\bsms\.ie\.ma <br />
\bsmswebo\.com <br />
\bsoarquitetura\.com\.br<br />
\bsobrelivros\.com\.br<br />
\bsobresites.com\/taro<br />
\bsobresites\.com\/biblioteconomia<br />
\bsocarnavaldepoa\.webs\.com<br />
\bsociedadedosblogueiros\.blogspot\.com<br />
\bsocomedia\.oipapai\.com\.br<br />
\bsoevami\.blogspot\.com<br />
\bsofatv\.net<br />
\bsoftfacil\.net<br />
\bsofttoys\.com\.br<br />
\bsolabm\.com\.br<br />
\bsoletrando\.com\.br<br />
\bsolucoesageis\.com\.br <br />
\bsomenoise\.com\.br<br />
\bsomudancasmg\.com\.br<br />
\bsoprodoator\.com<br />
\bsosdividas\.com\.br<br />
\bsoteropolitanosculturaafro\.wordpress\.com<br />
\bsouthernhides\.com\.ar<br />
\bsouturista\.com\.br<br />
\bspacejovem\.com<br />
\bspeedbrazil\.blogspot\.com <br />
\bspeedhost\.com\.br <br />
\bspellrpg\.com\.br<br />
\bspirituc\.com<br />
\bsportdigital\.net <br />
\bsportingapoio\.com<br />
\bspringer\.com\.br<br />
\bspvilas\.com\.br <br />
\bstadiumzone\.net<br />
\bstalloneforever\.blogspot\.com<br />
\bstamadvies\.nl<br />
\bstarmedica\.blogspot\.com<br />
\bstartrekbrasil\.com\.br<br />
\bstatisticum\.org<br />
\bstatuscompany\.com\.br<br />
\bsteinerimoveis\.com\.br<br />
\bstelling\.cc<br />
\bstifler\.com\.br<br />
\bstreetdogstudio\.com<br />
\bstudiopreview\.com\.br<br />
\bstyleua\.com<br />
\bsuamente\.com\.br<br />
\bsuamenteseuguia\.blog\.com<br />
\bsubcor\.multiply\.com<br />
\bsubxtreme\.net<br />
\bsudoku\.mundopt\.com <br />
\bsudokunine\.com<br />
\bsuperblog93\.blogspot\.com<br />
\bsuper-congresso\.com\.br<br />
\bsupergrana\.com<br />
\bsupermemoria\.com\.br<br />
\bsupernatural\-fans\.tk<br />
\bsuper-nutricao\.com\.br<br />
\bsuprasolucoes\.com<br />
\bsuprasolucoes\.com\/redireciona\.asp<br />
\bsurfa\.com\.br\/blog\/2010\/08\/rj-arpoador<br />
\btag\.com\.pt<br />
\btaginvest\.com\.br<br />
\btaichibrasileiro\.blogspot\.com<br />
\btaichipailin\.com\.br<br />
\btalentmanager\.pt<br />
\btalk\.livedaily\.com<br />
\btaoismo\.org <br />
\btargetw\.com<br />
\btarzia-tattoo\.com<br />
\btatianavianna\.com\.br/<br />
\btechseg\.com <br />
\btechtuga\.net <br />
\btecmais\.com <br />
\btecnopt\.com<br />
\btek\.sapo\.pt<br />
\btekoha\.org<br />
\btelecestas\.com\.br<br />
\bteleco\.com\.br<br />
\btelenovelasbr\.blogspot\.com<br />
\btelevisionado\.wordpress\.com<br />
\btelevisionnews\.wordpress\.com<br />
\btemplodeapolo\.net<br />
\bteobaldobs\.blogspot\.com<br />
\bterminologia\.com\.br <br />
\bterraforum\.com\.br<br />
\bTerrasdaMantiqueira\.com<br />
\btertdow\.blogspot\.com<br />
\btestdriveonline\.com\.br<br />
\bteusite\.net <br />
\btevenoticias\.wordpress\.com<br />
\btheazoresislands\.blogspot\.com<br />
\bthebestthingscomeinthree\.pt\.vu/<br />
\bthe-englishstudio\.com\.br<br />
\bthemaozoleum\.com <br />
\bthinkball\.com\.br<br />
\bthinkfn\.com<br />
\bthinkfnwiki\.com<br />
\bthinnetworks\.com\.br<br />
\bthumblogger\.com <br />
\bthundersuplementos\.com\.br<br />
\btibbisuluk\.com <br />
\btintazul\.com\.pt<br />
\btinypic\.com<br />
\btiopatinhas\.1br\.net<br />
\btiplan\.com\.br <br />
\btodocanal\.wordpress\.com<br />
\btokiohotel\.com\.br<br />
\btokiohotelbrasil\.com<br />
\btokufriends\.com<br />
\btonycorreia\.com\.br<br />
\btoolssites\.com\.br<br />
\btop100equestrian\.com<br />
\btopsexywomen\.com<br />
\btorrentsparabaixar\.blogspot\.com<br />
\btotalmentecharmed\.spaceblog\.com\.br<br />
\btownbridgecom\.com<br />
\btrabalhoescolares\.blogspot\.com<br />
\btraditionalvalues\.org<br />
\btraditionalvalues\.org\/urban\/nine\.php<br />
\btraineemeup\.blogspot\.com<br />
\btransformatec\.com\.br<br />
\btravian\.(?:pt|com\.br)/\?uc=<br />
\btribodatrilha\.com<br />
\btrilhadoslobos\.com\.br<br />
\btrombeteiro\.com<br />
\btudo-sobre-a-tv\.blogs\.sapo\.pt<br />
\btudosobrecdc\.blogspot\.com<br />
\btudosobrecharmed\.blogspot\.com<br />
\btudosobreufologia2010\.blogspot\/.com<br />
\btudotemos\.com\.br <br />
\btunigup.rg3\.net<br />
\bturismobahia\.com\.br<br />
\bturismoholambra\.com\.br<br />
\bturismonovale\.com <br />
\bturismonovale\.com\.br<br />
\btvaqui\.com\.br<br />
\btvbrasilaudiencia\.zip\.net<br />
\btvcontacto\.wordpress\.com<br />
\btvdigitalnopc\.com<br />
\btvfoco\.com\.br<br />
\btvlivre\.org<br />
\btvmundo\.wordpress\.com<br />
\btvtuga\.tv<br />
\btwitter\.com\/analistati<br />
\btwitter\.com\/vini_rio<br />
\btwitter\.com\/weloveisatkmas<br />
\btwitterbrasil\.org<br />
\bucrania\-mozambique\.blogspot\.com<br />
\bufotvonline\.com\.br<br />
\buhdtv\.com\.br <br />
\bultimatesonic\.wordpress\.com<br />
\bumbanda\.blogs\.sapo\.pt<br />
\buniagua\.org.\br<br />
\buniblog\.com\.br<br />
\bunitedphotopress\.com<br />
\buniversalistas\.blogspot\.com<br />
\buniversalposterz\.com<br />
\buniversoanyeviny\.com\.br<br />
\buniversoben10\.blogspot\.com<br />
\buo\.com\.br<br />
\buppw\.org <br />
\burbanawebsite\.com\.br<br />
\burban-rivals\.com/\?sponsor=<br />
\busercash\.com/\?r=<br />
\buvaonline\.uva\.br<br />
\bvagalume\.uol\.com\.br<br />
\bvagasti\.v10\.com<br />
\bvalegastronomia\.com <br />
\bvalegastronomia\.com\.br<br />
\bvalegastronomia\.net <br />
\bvalegastronomia\.org<br />
\bvalinor\.com\.br\/forum\/<br />
\bvalinor\.com\.br\/viewtopic\.php\?<br />
\bvejalourdes\.com\.br<br />
\bveleirodingue\.freeboat.\com\.br<br />
\bvendasnaweb\.com\.br<br />
\bventurosanet\.com<br />
\bveredaestreita\.org<br />
\bveredaestreita\.org\/2008/<br />
\bveredasbrasil\.com\.br<br />
\bviagemlegal\.com<br />
\bviagensbariloche\.com\.br<br />
\bviagens-belgica\.info <br />
\bviagensdubai\.com\.br<br />
\bviagens-grecia\.info<br />
\bviagens-noruega\.info<br />
\bviagens-republica-checa\.info<br />
\bviaiguassu\.com<br />
\bviajarapuntadeleste\.com\.ar<br />
\bviajoporargentina\.com<br />
\bviciodeviajar\.blogspot\.com<br />
\bvidavaitorta\.blogspot\.com<br />
\bvideo\.google\.com\/videoplay\?<br />
\bvideocliper\.com<br />
\bvideolog\.tv<br />
\bvideolog\.uol\.com\.br <br />
\bvideos\.etc\.br<br />
\bvideosmusica\.tv<br />
\bvidyayoga\.org<br />
\bvilacriativa\.com\.br<br />
\bvilanovenseblog\.blogspot\.com<br />
\bvimeo\.com<br />
\bvini.rio\.vila\.bol\.com\.br<br />
\bvini.rio\.vilabol\.com\.br<br />
\bvirouviral\.com<br />
\bvisitasonline\.com<br />
\bvisitearacaju\.com\.br<br />
\bvisitepontagrossa\.com\.br<br />
\bvisitesaopaulo\.com <br />
\bvisualmedia\.com\.br<br />
\bvitoriagrande\.com <br />
\bvitorsousaalbufeira\.blogspot\.com <br />
\bvitrinepublicitaria\.net<br />
\bvjez\.com<br />
\bvoceselembra\.blogspot\.com<br />
\bvoipbra\.com\.br<br />
\bvolta\.mirc\.vilabol\.uol\.com\.br<br />
\bvoltamirc\.co\.nr<br />
\bvoltamirc\.rg3\.net<br />
\bvoltamirc\.web44\.net <br />
\bvoos-info\.com <br />
\bwallpapers\.regeneration\.com\.br<br />
\bwaoIndia\.com<br />
\bwarriors-of-wrestling\.blogspot\.com<br />
\bwata-eh-legal\.blogspot\.com<br />
\bwaysforus\.org<br />
\bwebcaldas\.com\.br<br />
\bwebcarcenter\.com\.br<br />
\bwebcolinas\.com<br />
\bwebimoveisnointerior\.com\.br<br />
\bwebland\.ppg\.br<br />
\bwebmap\.in<br />
\bwebmove\.com\.br<br />
\bwebng\.com\/itatiaia<br />
\bwebsoccerclub\.com <br />
\bwebtemplarios\.forumup\.com <br />
\bweshow\.com<br />
\bwicca-ipatinga\.blogspot\.com<br />
\bwikipedia\.artudi\.org<br />
\bwikipediaqueixas\.blogspot\.com<br />
\bwikisus\.net<br />
\bwindowsvistadicasemgeral\.com<br />
\bwordpress-genial\.com<br />
\bworld7\.monstersgame\.com\.pt<br />
\bworldcruises1\.blogspot.\com<br />
\bworldpressphoto\.nl <br />
\bwurdulaks\.blogspot\.com<br />
\bwwwrichardgoterra\.blogspot\.com<br />
\bx-dsg\.com<br />
\bx-flog\.com\.br<br />
\bxgamesnet\.blogspot\.com<br />
\bxgoogle\.com\.br/blog\/2008\/04\/26\/download-de-psych<br />
\bxn--musculao-xza3b\.com<br />
\bXoppi\.com <br />
\by2kdesign\.com<br />
\byenidizayn\.com<br />
\byogaclick\.com\.br<br />
\byogavaidika\.com<br />
\byoungandhealthy\.ca<br />
\byoupiee\.com\.br<br />
\byouporn\.com<br />
\byoutube\.com\/results\?<br />
\byoutube\.com\/v\/<br />
\byoutube\.com\/view_play_list\?<br />
\byoutube\.com\/watch\?<br />
\byoutube\.com\/watch\?v<br />
\bz10.invisionfree\.com<br />
\bz6\.invisionfree\.com<br />
\bzamarian\.com\.br<br />
\bzanottofederal1555\.com\.br/<br />
\bzapbox\.com\.br<br />
\bzapenglish\.com<br />
\bziggi\.com\.br\/downloads<br />
\bzoonadocelular\.com <br />
\bzoonose\.com\.br<br />
\bzymboo\.com<br />
\.myjerseys\.org<br />
\.weddingdressebay\.com<br />
#</pre> <!-- leave this line exactly as it is --></div>Gmaxwellhttps://wiki.xiph.org/index.php?title=MediaWiki:Spam-blacklist&diff=14123MediaWiki:Spam-blacklist2013-05-07T06:52:15Z<p>Gmaxwell: no moar</p>
<hr />
<div> # External URLs matching this list will be blocked when added to a page.<br />
# This list affects only this wiki; refer also to the global blacklist.<br />
# For documentation see http://www.mediawiki.org/wiki/Extension:SpamBlacklist<br />
#<!-- leave this line exactly as it is --> <pre><br />
#<br />
# Syntax is as follows:<br />
# * Everything from a "#" character to the end of the line is a comment<br />
# * Every non-blank line is a regex fragment which will only match hosts inside URLs<br />
wikin\.com<br />
infinitycommerce\.co\.uk<br />
senuke-xcr-discount\.com<br />
mooncityz\.com<br />
gcagint\.com<br />
groupcow\.com<br />
synqk\.com<br />
organicdata\.com\.au<br />
cameronmorgan\.co\.uk<br />
singleme\.com<br />
Menuggs\.org<br />
casinosdiary\.com<br />
abercrombieaustralia\.com<br />
weightsbenchtraining\.co\.uk<br />
thedegreeexperts\.com<br />
xtremeonline\.com\.au<br />
xstretchmarks\.com<br />
\.casinobonus24\.com<br />
\.mydietarea\.com<br />
\.swiftmoney\.org\.uk<br />
\.bringexbackblog\.com<br />
registry-repair-tools\.net<br />
automobile-insurance\.com<br />
bestentrypoint\.com<br />
banansearch\.com<br />
\.pavtube\.com<br />
\.videos-phone\.net<br />
\.chatixdating\.com<br />
\.teensay\.com<br />
\.cheappoolproducts\.com<br />
\.lease-a-seo\.com<br />
\.totalscreenrecorder\.com<br />
\.mychristianheels\.com<br />
\.mbtshoesupply\.com<br />
\.healthmuscle\.com<br />
\.official-canadian-pharmacy\.org<br />
\.customessaywritinghelp\.com<br />
\.boostbrand\.org<br />
\.promoteland\.com<br />
\.uk-dissertation\.com<br />
\b1000cores\.com<br />
\b100anosgalo\.blogspot\.com<br />
\b100cal\.ex-br\.com <br />
\b100diasdesandero\.blogspot\.com <br />
\b11onze\.com <br />
\b123imoveis\.com\.br <br />
\b123people\.it<br />
\b13studiohost\.com<br />
\b1clique\.blogspot\.com<br />
\b2hand\.googet\.eu<br />
\b2jump2\.com<br />
\b4shared\.com<br />
\b4shared\.com\/file<br />
\b55chan\.org<br />
\b91rock\.com\.br<br />
\baapaaa\.blogspot\.com<br />
\babctorre\.xpg\.com\.br<br />
\babdieldamon\.wordpress\.com <br />
\baberturas-de-novelas\.blogspot\.com<br />
\babreloja\.com<br />
\babrolhos\.net<br />
\bacademiadovinho\.com\.br<br />
\bacademiagraciebutanta\.com\.br/<br />
\bacademiarafaelleitao\.blogspot\.com<br />
\bacaminhodaonde\.blogspot\.com<br />
\bacao-humana\.blogspot\.com<br />
\bacheibr\.com<br />
\bacidosnucleicos\.110mb\.com <br />
\badhentai\.blogspot\.com<br />
\badministracaoegestao\.com\.br<br />
\badororomances\.com<br />
\baevolut\.com<br />
\bafazenda\.blogger\.com\.br<br />
\bafricanamericantravelagency\.com <br />
\bafricarte\.it<br />
\bag4\.com\.br<br />
\bageanbrasil\.com\.br<br />
\bagenciaar\.com\.br<br />
\bagenciasolo\.com\.br<br />
\bagenciaspin\.com<br />
\bagoravale\.com<br />
\bagoravale\.com\.br<br />
\bagoravale\.net<br />
\bagoravale\.org<br />
\bagribusinessNews\.com <br />
\bagrogemeos\.com\.br<br />
\bagruta\.com\.br<br />
\baguasemendadas\.com<br />
\bahsforum\.com<br />
\baideialibertaria\.blogspot\.com<br />
\bairsoftbrasil\.com<br />
\balabrasil\.com <br />
\balbacete\.com\.br <br />
\balemanja\.org <br />
\balephradiestesia\.com\.br<br />
\balexandre\.eletrica\.ufu\.br<br />
\balgumapoesia\.com\.br<br />
\balimentacaosaudavel\.net<br />
\baliviodaalma\.com\.br<br />
\ballcenter\.com\.br<br />
\ballservice\.cnt\.br<br />
\ballsexhub\.com<br />
\balojamentos-online\.com <br />
\balojamiento\.cl<br />
\baltamiroborges\.blogspot\.com<br />
\balternativamedicina\.com<br />
\balvinhopatriota\.com\.br<br />
\bamanda-rossi\.blogspot\.com<br />
\bamazon\.ca<br />
\bamazon\.co\.jp<br />
\bamazon\.co\.uk<br />
\bamazon\.com\/gp\/product<br />
\bamazon\.de<br />
\bamazon\.fr<br />
\bambienteinteiro\.org\.br<br />
\bamericanas\.com\.br\/AcomProd<br />
\bamericanas\.com\.br\/cgi\-bin<br />
\bamericanas\.com\.br\/cgi-bin<br />
\bamericanas\.com\.br\/prod<br />
\bamigo\.kit\.net<br />
\bamigoskids\.blogspot\.com<br />
\bamilcorretora\.com\.br<br />
\bamoisatkmaisnick\.blogspot\.com<br />
\bamoresexogratis\.com<br />
\bamostrasgratis\.org<br />
\ban\.locaweb\.com\.br\/Webindependente<br />
\banalistati\.com<br />
\banamacedoescritora\.blogs\.sapo\.pt<br />
\bandreabrasilmadrid\.es <br />
\bandremafei\.com<br />
\bandrologia\.cjb\.net<br />
\bangelfire\.com\/dc/evangelhoespirita<br />
\banimavita\.com\.br<br />
\banimetnt\.com\.br<br />
\banmtv\.com\.br<br />
\bannamarya\.com\.br<br />
\banticensura\.blogspot\.com<br />
\banunciautos\.com\.br<br />
\banunciosgv\.com<br />
\bapagaodatelefonica\.vai\.la<br />
\bapfertilidade\.org <br />
\bapi\.ning\.com<br />
\bappartamentiischia\.it<br />
\bappliedwingchun\.com\.br<br />
\barabesq\.com\.br<br />
\barabian\.vila\.bol\.com\.br<br />
\barabian\.vilabol\.com\.br<br />
\barabians\.vila\.bol\.com\.br<br />
\barabians\.vilabol\.com\.br<br />
\baracaju-se\.com\.br <br />
\barcondicionado-split\.com<br />
\barenatibia\.com <br />
\bargentina\.ar<br />
\bargentinatolet\.com <br />
\bargentinawinetours\.com<br />
\bargentour\.com<br />
\bargilaviva\.blogspot\.com<br />
\barqueologiaegipcia\.zip\.net<br />
\barquitectura\-sustentavel\.blogspot\.com<br />
\barquitectura-sustentavel\.blogspot\.com<br />
\barquivosbt\.blogspot\.com<br />
\barroxe\.net<br />
\bartbr\.com\.br<br />
\bartedb\.com\.br<br />
\bartenet\.com\.br<br />
\bartesmarciaishoje\.blogspot\.com<br />
\barthonline\.com\.br\/clouds/<br />
\barts\.lojadeluxo\.com<br />
\bas\-chiquititas\.blogspot\.com<br />
\basdf\.com\.br<br />
\basenergiasrenovaveis\.blogspot\.com<br />
\basonrisanordica\.com<br />
\basterdomus\.com\.br<br />
\bastore\.amazon\.com<br />
\bathoscompanny\.com\.br<br />
\batitlan\.net<br />
\batividadesfisicas\.com\.br<br />
\batmaneditora\.com\.br <br />
\batortonycorreia\.bloguepessoal\.com<br />
\baudiencia\.zip\.net<br />
\baudienciabrasileiradetv.wordpress.com<br />
\baudienciadatv\.wordpress\.com<br />
\baudienciadetv\.blogspot\.com<br />
\baudienciaemdestaque\.blogspot\.com<br />
\baudiolivro\.net\.br<br />
\baulalamontera\.com<br />
\baustria-travel\.biz<br />
\bautolatinaclube\.cjb\.net<br />
\bautosp\.com\.br<br />
\bavengedsevenfold\-portugal\.blogspot\.com<br />
\baverdadesobreagnosis\.com\.br<br />
\bavrilbandaids\.com\/forums<br />
\bavrillavigne-pics\.com<br />
\bavril-media\.blogspot\.com<br />
\bavrilmidia\.com\/forum<br />
\bawkwardish\.com<br />
\bbabywallpaper\.com\.br<br />
\bbaixartudogratis\.info<br />
\bbaixartudogratis\.info<br />
\bbalduran\.com\.br<br />
\bbandvoip\.com\.br<br />
\bbanheiraspa\.com\.br<br />
\bbaraogeraldo\.com\.br<br />
\bbarcelos\.com<br />
\bbarcoavista\.blogspot\.com<br />
\bbarrabravas\.net<br />
\bbarradosahy\.net<br />
\bbatalhadosguararapes\.com\.br<br />
\bbatomdamoda\.webnode\.com\.br<br />
\bbazardaspalavras\.blogspot\.com<br />
\bbazarpop\.com\.br<br />
\bbeatrixmonteiro_fas.blogs\.sapo\.pt<br />
\bbeatriz_monteiro_faclube\.blogs.\sapo\.pt<br />
\bbeatrizmonteiro_faclube\.blogs.\sapo\.pt<br />
\bbebidaboa\.com\.br<br />
\bbelem-pa\.com\.br<br />
\bbelezapt\.com<br />
\bbelohorizonte-mg\.com\.br<br />
\bbemmequercestas\.com<br />
\bben10thevideogame\.com<br />
\bben10toys\.net<br />
\bben10toys\.net\/Backup\/images<br />
\bben10ultimatealien3\.blogspot\.com<br />
\bbeneklee\.com<br />
\bbenzisobrenomes\.com<br />
\bbethynha\.com\.br<br />
\bbgojogos\.blog\.terra\.com\.br<br />
\bbhdog\.com\.br<br />
\bbiagra\.com\.br <br />
\bbibliaonline\.com\.br<br />
\bbibliaonline\.iguga\.com <br />
\bbibliojunior\.ufsc\.br<br />
\bbigmarkett\.com<br />
\bbigshowdownloads\.blogspot\.com<br />
\bbio-combustivel\.blogspot\.com<br />
\bbiografia\.wiki\.br<br />
\bbioinfo\.com\.br<br />
\bbiomech\.com\.br<br />
\bbipol-art\.com<br />
\bbisotto\.com\.br<br />
\bbizarriceslol\.com<br />
\bblackminton\.pt<br />
\bblog.antonioplanet\.net<br />
\bblogaritmox\.blogspot\.com<br />
\bblogcmmi\.com\.br<br />
\bblogdamostra\.blog\.uol\.com\.br<br />
\bblogdoconsignado\.com\.br<br />
\bblogdohiellevy\.com\.br<br />
\bblogfajuta\.blogspot\.com<br />
\bblogdorasta\.wordpress\.com<br />
\bblog-escoteiro\.blogspot\.com<br />
\bbloglouco\.com<br />
\bblogs\.abril\.com\.br\/novidadesdatv<br />
\bblogsobrenovelas\.blogspot\.com <br />
\bblumenau-sc\.com\.br<br />
\bbm-beatrizmonteiro\.blogs\.sapo\.pt<br />
\bbneinoach\.com\.br<br />
\bboavista-rr\.com\.br<br />
\bbodybuildingxl\.com<br />
\bboingdragon\.com <br />
\bbombinhas\.com<br />
\bboxtv\.hd1\.com\.br<br />
\bbr\.desert-operations\.com\/?recruiter=41b1<br />
\bbr\.geocities\.com\/amandinha_band888\/links\/tiburon_coupe_anteriores2\.html<br />
\bbr\.geocities\.com\/khentzu/<br />
\bbr2\.biz<br />
\bbrasaoweb\.com<br />
\bbrasilcombate\.com\.br<br />
\bbrasilcombate\.com\.br<br />
\bbrasildemochila\.com<br />
\bbrasildestinos\.com\.br<br />
\bbrasilfas\.blogspot\.com<br />
\bbrasiliacac\.com<br />
\bbrasilimperial\.org\.br\/verdade3.htm<br />
\bbrasilinformacao\.com\.br<br />
\bbrasilturismo\.com<br />
\bbrazilcartoon\.com<br />
\bbrazilgallery\.com\.br<br />
\bbrejas\.com\.br <br />
\bbrekground\.com\/wiiground<br />
\bbrincando\.no\.sapo\.pt<br />
\bbrinquedosdepapel\.com\.br<br />
\bbrofficeparaleigos\.blogspot\.com<br />
\bbronquite\.com<br />
\bbruxaria\.org<br />
\bbrvida\.org<br />
\bbssilveira.blogspot.com<br />
\bbulledebeaute\.wordpress\.com<br />
\bburionline\.wordpress\.com<br />
\bbuscamp3\.com\.br<br />
\bbuscaporsaude\.com\.br<br />
\bbuxput\.com <br />
\bbwin\.com <br />
\bbwin\.site\.vu <br />
\bcabalahoje\.blogspot\.com<br />
\bcabanhabutia\.com\.br<br />
\bcabecadecuia\.com<br />
\bcabofrio-rj\.com\.br<br />
\bcachacagabriela\.com\.br<br />
\bcaipira\-sp\.com\.br<br />
\bcajamarnet\.com\.br<br />
\bcalcatrilhos\.henyah\.com<br />
\bcalcule\.net<br />
\bcamaragibeonline\.com<br />
\bcamarotedasestrelas\.com\.br<br />
\bcamboriu\.org<br />
\bcambralha1\.blogspot\.com<br />
\bcamillacastro\.org<br />
\bcamillacastro\.org\/angelinajolie/<br />
\bcamiloaparecido\.blog\.terra\.com\.br <br />
\bcaminhositaipu\.com\.br<br />
\bcampogrande-ms\.com\.br <br />
\bcanalfreak\.com\.br<br />
\bcanalmatriz\.zip\.net<br />
\bcanalmax\.com\.br<br />
\bcanarilalmada\.com<br />
\bcanchim\.com\.br<br />
\bcandycandyanns\.iespana\.es<br />
\bcanilchinador\.com\.br<br />
\bcanilpequenoencanto\.webng\.com <br />
\bcanilvilabrasil\.com\.br<br />
\bcanoas-rs\.com\.br<br />
\bcaonanet\.blogspot\.com<br />
\bcarcasse\.com<br />
\bcardiologia\.com\.br<br />
\bcarlinha\.com\.br<br />
\bcarloscostaaqui\.blogspot\.com<br />
\bcarlosfran\.com<br />
\bcarnaporto2010\.com\.br<br />
\bcarnevalli\.googlepages\.com<br />
\bcarrosderua\.com\.br<br />
\bcartasdecredito\.com\.br <br />
\bcartoesonline\.com\.br<br />
\bcartuningrevolution\.com <br />
\bcasadanutricao\.com\.br<br />
\bcasadasprimas\.wordpress\.com <br />
\bcasadastiras\.blogspot\.com<br />
\bcasamentobrasil\.com\.br<br />
\bcasasnolago\.com\.br<br />
\bcasinoglamour\.com<br />
\bcastlelords\.blogspot\.com<br />
\bcastlelords\.net <br />
\bcauas\.blogspot\.com<br />
\bcavaleiroconde\.blogspot\.com<br />
\bcavalosarabes\.vilabol\.uol\.com\.br<br />
\bccdb\.gea\.nom\.br<br />
\bcdjapan\.co\.jp<br />
\bceliaco\.com\.br<br />
\bcelsovenicius\.com\/<br />
\bcenatecbrasil\.com\.br<br />
\bcenterpokemon\.blogspot\.com<br />
\bcentraldosexo\.com<br />
\bcentraliza\.com\.br<br />
\bcentralparaiso\.com<br />
\bcentric\.tv\.br<br />
\bcentrodemoda\.com<br />
\bcentrofilosoficodokungfu\.com\.br<br />
\bcertidex\.com\.br<br />
\bcervejasdomundo\.com<br />
\bcescapi\.com<br />
\bceucabrscanoas\.com\.br\/documents\/blog_2\.php<br />
\bcfgigolo\.com<br />
\bchanzon\.com<br />
\bchaos\.com\/product<br />
\bcharles\.art\.br<br />
\bcharmed\-news\.blogspot\.com<br />
\bcharmedgallery\.blogspot\.com<br />
\bchaves\.blogs\.sapo\.pt<br />
\bchavesantiga\.blogs\.sapo\.pt<br />
\bcheckupgeriatrico\.com\.br <br />
\bchihuahua\.vet\.br<br />
\bchiquititas\-online\.pt\.vc<br />
\bchiquititassic\.blogs\.sapo\.pt<br />
\bchrislimatop\.com\.br<br />
\bchrome-center\.net<br />
\bchuteperfeito\.com\.br<br />
\bciberdata\.com<br />
\bciberespaconaescola\.blogspot\.com<br />
\bcidade\.alterosa\.net<br />
\bcidadebelojardim\.blogspot\.com<br />
\bcidadedebocaina\.com <br />
\bcidade-lagoa\.com<br />
\bcidade-lisboa\.com<br />
\bcidadespaulistas\.com\.br<br />
\bcidadewebrock\.com\.br<br />
\bcimento\.org<br />
\bcimentonline\.com\.br<br />
\bcincoquartosdelaranja\.blogspot\.com<br />
\bcindylauperbrasil\.com<br />
\bcinemabizarre-brasil\.go-board\.com\/forum\.htm <br />
\bcinemacomrapadura\.com\.br\/filmes\/imgs\/<br />
\bcircolivenetifainors\.blogspot\.com<br />
\bcircuitodosamba\.net<br />
\bcirurgia\.com\.br<br />
\bcirurgia\-plastica\.com<br />
\bclangamesbr\.net<br />
\bclansnqp\.com<br />
\bclaradilucenna\.blogspot\.com<br />
\bclassificados\.wegoo\.com\.br<br />
\bclassificadosregional\.com\.br <br />
\bclicador\.com<br />
\bclickgalera\.com\.br<br />
\bclickglobinho\.zip\.net<br />
\bclickjogos\.uol\.com\.br<br />
\bclicktvglobinho\.blogspot\.com<br />
\bclickviagens\.com<br />
\bclicrbs\.com\.br\/kzuka<br />
\bclinicadedermatologia\.com\.br<br />
\bclinicaleger\.com\.br<br />
\bclinicamedicambdoctor\.blogspot\.com<br />
\bclone\.aguiar\.googlepages\.com<br />
\bclubedariqueza\.com\.br<br />
\bclubedascelebridades\.com<br />
\bclubedologusepointer\.com\.br<br />
\bclubedosbeberroes\.com\.br<br />
\bclube-morangos\.com<br />
\bclubesafobrasil\.com<br />
\bclubevencedor\.com\.br<br />
\bclubpinguimcp\.blogspot\.com<br />
\bcobolware\.com<br />
\bcocadaboa\.com\.br<br />
\bcodigofonte\.com\.br<br />
\bcoelhodafonseca\.com\.br<br />
\bcoisasdoenio\.blogspot\.com <br />
\bcoisasinteressantes\.com\.br <br />
\bcolocanoidolos\.blogspot\.com<br />
\bcoluna\.com<br />
\bcomlines\.com\.br<br />
\bcommonpurpose\.org<br />
\bcomobaixar\.org<br />
\bcomofazerumcurriculum\.com<br />
\bcomosairdoaluguel\.zip\.net<br />
\bcomprarcreatina\.org<br />
\bcomprasnasantaifigenia\.com\.br<br />
\bcomunidadefb\.com\.br<br />
\bcomunidades\.net<br />
\bconceitozen\.com\.br<br />
\bconectiomg\.com\.br<br />
\bconexaodinheiro\.com<br />
\bconfrariadechaves\.net<br />
\bconfrariadecinema\.com\.br<br />
\bconheca-me\.com <br />
\bconheceroislam\.com\.br <br />
\bconnectionworld\.org<br />
\bconocereislaverdad\.org<br />
\bconselheira\.virtual\.zip\.net<br />
\bconsultadetaro\.com<br />
\bconsultarpagerank\.com\.br<br />
\bconsultarpagerrank\.com\.br<br />
\bconsultorio\.com\.br<br />
\bcontabilbr\.com<br />
\bcontadoresgratis\.web-kit\.org <br />
\bcontaouro\.com\.br<br />
\bcontedesign\.com\.br<br />
\bcontente\.blogspot\.com<br />
\bconteudoesportivo\.com\.br<br />
\bcontextojuridico\.blogspot\.com<br />
\bcontraditorium\.com<br />
\bcontrapontoeditora\.com\.br<br />
\bcooperativismodecredito\.blogspot\.com<br />
\bcooppr\.med\.br<br />
\bcoroascaseiras\.net<br />
\bcorreiocarioca\.com\.br<br />
\bcorreionatalino\.com\.br<br />
\bcortesepenteados\.com\.br<br />
\bcosmeticosharimar\.blogspot\.com/<br />
\bcosmetologiaeestetica\.com\.br<br />
\bcosplaybr\.com\.br<br />
\bcostaverdenoticias\.com<br />
\bcpcpbr\.tk<br />
\bcpf\.adv\.br<br />
\bcrazyshake\.net<br />
\bcrazyvideo\.blog\.terra\.com\.br<br />
\bcrazyvideo\.no\.comunidades\.net<br />
\bcreatuforo\.com<br />
\bcredito-info\.com<br />
\bcriacionismoevidencias\.blogspot\.com <br />
\bcriandocalopsitas\.webs\.com<br />
\bcriefuturos\.com\.br<br />
\bcristianor7\.com<br />
\bcristianoronaldofan\.blogs\.sapo\.pt<br />
\bcrm2\.com\.br<br />
\bcsonlinebr\.net<br />
\bctviva\.com\.br<br />
\bculturach\.com\.br<br />
\bcupim\.net\.br<br />
\bcursos24horas\.com\.br <br />
\bcursoseaulas\.com\.br<br />
\bcursosnocd\.com\.br<br />
\bcwhostnet\.com<br />
\bcyanidehappinesstraduzidos\.blogspot\.com<br />
\bcybercook\.com\.br<br />
\bcygets\.googlepages\.com\/teste_digitacao_concurso<br />
\bdabaixadaaomonumental\.blogspot\.com<br />
\bdabusca\.blogspot\.com<br />
\bdanceadois\.com\.br<br />
\bdancecom\.com\.br<br />
\bdanielcoelho\.com\.br<br />
\bdantasplanosdesaude\.com\.br<br />
\bda-pay\.com<br />
\bdashofer\.pt<br />
\bdatasul\.com\.br\/franquias<br />
\bdatasulecm\.com\.br<br />
\bdauri\.com\.br<br />
\bdbzmangalevels\.homestead\.com<br />
\bddl\.name/<br />
\bdebate\.com\.br<br />
\bdedetizacao\.bio\.br<br />
\bdefesabrasil\.com<br />
\bdelta-cafes\.pt<br />
\bdemocracia-fraudada\.com<br />
\bdentistas\.com\.br<br />
\bdepilacao-definitiva\.blogspot\.com<br />
\bdeputadocorauci\.com\.br<br />
\bdesign\.com\.br<br />
\bdesignatento\.com<br />
\bdesignbr\.ning\.com<br />
\bdesigndictionary\.co\.uk <br />
\bdestruindopalavras\.wordpress\.com<br />
\bdetetiveparticular\.hpgvip\.ig\.com\.br<br />
\bdetetive-particular\.org <br />
\bdetetive--particular\.org<br />
\bdetetiveparticular-saopaulo\.com<br />
\bdetetiveparticularsaopaulo\.hpgvip\.ig\.com\.br <br />
\bdetetivesnobrasil\.com\.br<br />
\bdevaneiosdesintericos\.blogspot\.com<br />
\bdeveloperslinux\.com <br />
\bdiariodosartistas\.com<br />
\bdiariosantee\.com\.br<br />
\bdicas-de-presente\.com<br />
\bdicionariodesimbolos\.com\.br<br />
\bdicionario-portugues\.com<br />
\bdictionary\.valodas\.com<br />
\bdieta-certa\.com<br />
\bdietafacil\.awardspace\.com<br />
\bdigicurso\.com <br />
\bdigidelta-software\.com<br />
\bdigipronto\.com\.br<br />
\bdigitrace\-portugal\.com<br />
\bdignidadevascaina\.com<br />
\bdigorest\.com<br />
\bdigshop\.com\.br<br />
\bdiplomaticsociety\.org<br />
\bdireitodoestado\.com\.br<br />
\bdiretodehollywood\.com<br />
\bdiscadorpreditivo\.com\.br<br />
\bdistintivos\.com\.br<br />
\bdisturbiodopanico\.com\.br<br />
\bditudo\.etc\.br<br />
\bditudo\.wiki\.br<br />
\bdivulgaemails\.com<br />
\bdjban\.com\.br<br />
\bdmfer\.com\.br<br />
\bdoencasealimentos\.com<br />
\bdonzeladedomremy\.webs\.com<br />
\bdormiu\.com\.br<br />
\bdorperportoazul\.com\.br <br />
\bdownload\.mus\.br<br />
\bdownloadcurriculum\.com<br />
\bdragaobranco\.com\.br<br />
\bdreamingdolls\.net<br />
\bdr-organico\.com\.br<br />
\bdstudium\.com<br />
\bduasasas\.com<br />
\bdubitando\.no\.sapo\.pt<br />
\bdublanet\.com\.br<br />
\bducker\.com\.br<br />
\bdurmamelhor\.com<br />
\bdvdbarato\.net<br />
\bdvdja\.com\.br<br />
\bdw-world\.de\/dw\/0,2142,2594,00.html<br />
\beasylanguages\.com<br />
\becogenesys\.com\.br<br />
\becognitiva\.blogspot\.com<br />
\becologiaurbana\.com\.br<br />
\becomm\.com\.br<br />
\beconomiacriativa\.blogspot\.com\.br<br />
\beconomiadacultural\.blogspot\.com\.br<br />
\bedemdma\.cjb\.net<br />
\beditoraelim\.com\.br<br />
\bedmrocky\.blogspot\.com<br />
\beduardabreda\.ucoz\.com<br />
\beducacaodeinfancia\.com <br />
\befeitogarage\.com\.br <br />
\begregoralfa\.republika\.pl<br />
\behelp\.eti\.br<br />
\behsportugal\.com<br />
\bejp\.com\.sapo\.pt<br />
\belbestia\.blogspot\.com<br />
\beldorado\.tur\.br<br />
\belegance\.bona-xira\.net<br />
\beleicoesceara\.com\.br<br />
\belevabrasil\.com\.br<br />
\belevadoresmais\.com\.br<br />
\bembarcados\.com\.br<br />
\bembriologiahumana\.com\.br <br />
\bemprego\.destaca\.com\.br<br />
\bemprestimo-info\.com<br />
\bemsaovicente\.com\.br<br />
\bemsintese\.com\.br<br />
\bemtr\.com\.br<br />
\bencena\.pt<br />
\benoises\.wordpress\.com<br />
\bentrevistamarcosmion\.blogspot\.com<br />
\bentrevistamionmarcos\.blogspot\.com<br />
\benxadrismoecultura\.blogspot\.com<br />
\bepel\.eu <br />
\bequipa-design\.com <br />
\berickastler\.com<br />
\berickerico\.blogspot\.com<br />
\bernandijunior\.com\.br<br />
\bervadaninha\.sarava\.org<br />
\bescforum\.net<br />
\bescortvip\.com\.br<br />
\bescritoriodearte\.com <br />
\besnips\.com\/web<br />
\bespacofitnessacademia\.com<br />
\besporrozine\.blogspot\.com<br />
\besportes\.820am\.com\.br<br />
\besquinadotempo\.com\.br<br />
\bestagionet\.com\.br<br />
\bestudandoparaoexamedaordem\.blogspot\.com<br />
\bestudoreligioso\.wordpress\.com<br />
\besyurl\.com<br />
\beuacheifacil\.com\.br<br />
\beubiologia\.xpg\.com\.br<br />
\beutodeferias\.com\.br<br />
\bexamehosting\.com<br />
\bexbancario\.blog\.br<br />
\bexcelencia\.com\.br<br />
\bexplorevale\.com\.br<br />
\bexplosaoderecrutamento\.empreenderonline\.com<br />
\bezboard\.com<br />
\bf1incridible\.blogspot\.com<br />
\bfabiofettuccia\.zip\.net<br />
\bfaclube_beatrizmonteiro\.blogs\.sapo\.pt<br />
\bfailblog\.org<br />
\bfainors\.com<br />
\bfalajacone\.blogspot\.com<br />
\bfalandoemprojetos\.com<br />
\bfalker\.com.br<br />
\bfamiliarotaria\.com\.br<br />
\bfamosas\.wiki\.br<br />
\bfamosasdespidas\.com<br />
\bfamosos\.dimensionebrasile\.com<br />
\bfantasyproducoes\.com<br />
\bfaraos\.org<br />
\bfatorambiental\.com\.br<br />
\bfbfsistemas\.com<br />
\bfeiraodaweb\.com\.br<br />
\bfeiticos\.150m\.com<br />
\bfelipegoncalvesoficial\.blogspot\.com<br />
\bfellipelli\.com\.br<br />
\bferomonios\.com<br />
\bferramentasweb\.com\.br <br />
\bfestadonatal\.wetpaint\.com<br />
\bfhrpromocional\.com\.br<br />
\bficacomigo\.net<br />
\bfifamanager\.com\.pt<br />
\bfiles\.wordpress\.com<br />
\bfilipux\.blig\.ig\.com\.br<br />
\bfilmesportugueses\.com<br />
\bfilosofiaetecnologia\.com\.br<br />
\bfinancasparavida\.com\.br<br />
\bfisiozone\.com<br />
\bfitmorumbi\.com\.br/<br />
\bflaasa\.blogspot\.com<br />
\bflickr\.com\/photos\/vitor107<br />
\bflogao\.com\.br\/avaianosempre <br />
\bflorais\.com\.br<br />
\bfloresnaweb\.com<br />
\bfloriano-gescon\.blogspot\.com<br />
\bfloridabrasil\.com<br />
\bfloripa360\.com\.br<br />
\bfnquimica\.com<br />
\bfocadoemvoce\.com<br />
\bfocushost\.com\.br<br />
\bfogaoshop\.com\.br<br />
\bfonoaudiologia\.com\.br<br />
\bfonoaudiologia\.ourtoolbar\.com<br />
\bfootbook\.com\.br<br />
\bfootbrasil\.net<br />
\bformosafest\.com\.br<br />
\bforo\.telenovela-world\.com<br />
\bforo\.telenovela\-world\.com<br />
\bfortalezaradical\.blogspot\.com<br />
\bfortalezas\.org<br />
\bforum\.alavigne\.com\.br<br />
\bforum\.imasters\.uol\.com\.br<br />
\bforum\.mymetro\.ru<br />
\bforum\.nwbrasil\.com<br />
\bforumaqui\.net<br />
\bforumbrasil\.net<br />
\bforumchaves\.com\.br <br />
\bforumeiro\.org<br />
\bforumeiros\.com<br />
\bforumfotografia\.net <br />
\bforum-livre\.com<br />
\bforumnow\.com\.br<br />
\bforumpratodos\.com<br />
\bforums\.abs\-cbn\.com<br />
\bforums\.abs-cbn\.com<br />
\bforums\.hardwarezone\.com\.sg<br />
\bforums\.techarena\.in<br />
\bfotodosurf\.com\.br <br />
\bfotolog\.com\/faloplastia<br />
\bfotolog\.terra\.com\.br<br />
\bfreehoxt\.com<br />
\bfreelancers\.googet\.eu<br />
\bfreesamplesblog\.com<br />
\bfreewebs\.com\/advogadossalvadorbahia<br />
\bfreewebs\.com\/thecheetahgirlsbr<br />
\bfrequencia\.eu<br />
\bfresnorock\.com/<br />
\bfromplanetasperger\.blogspot\.com<br />
\bfuiaoinfernoevoltei\.blogspot\.com<br />
\bFullCarTuning\.com <br />
\bfunctionpointmodeler\.com<br />
\bfunctionpointmodeler\.de<br />
\bfundacaoatitude\.com\.br<br />
\bfundos\.com <br />
\bfundoverde\.com\.br <br />
\bfuracaomexicano\.com<br />
\bfuriaps2\.blogspot\.com<br />
\bfusca\.mobi<br />
\bfuscadorock\.blogspot\.com<br />
\bfutcc\.com\/images<br />
\bfutebol\.nocelular\.biz <br />
\bfutebolefixe\.blogspot\.com<br />
\bfutemoney\.blogspot\.com<br />
\bfutnet\.com\.br <br />
\bfuturomelhor\.wordpress\.com<br />
\bfxcast\.com/<br />
\bgabrielortiz\.com<br />
\bgagocoutinho\.wordpress\.com<br />
\bgalapagocruise\.com<br />
\bgaleradofundao\.org<br />
\bgalodigital\.com\.br<br />
\bgamd\.com\.br<br />
\bgamehall\.uol\.com\.br<br />
\bgames\.cartoonnetworkhq\.com\/downloadGame\.php<br />
\bgangdomoinho\.net<br />
\bgarotacomtecnologia\.blogspot\.com<br />
\bgaypride\.com\.br<br />
\bgenealogiabrasileira\.org<br />
\bgeocities.com\/gurnemanzbr\/astrid<br />
\bgeocities\.com\/cirurgiaplasticaestetica<br />
\bgeocities\.com\/pajero_full_200891<br />
\bgeocities\.com\/spiritistgospel <br />
\bgeocities\.com\/valternascimento<br />
\bgeoconcursos\.geotrack\.com\.br<br />
\bgeorreferenciamentoincra\.com\.br<br />
\bgeotecnologias\.wordpress\.com\/<br />
\bgermany-travel-guide\.info<br />
\bgestaocondominial\.spaces\.live\.com<br />
\bgiardinicas\.blogspot\.com<br />
\bginecologia-online\.com\.br<br />
\bgladiatus\.com\.pt\/game<br />
\bgladiatus\.com\/game<br />
\bgloboeletronicos\.com\.br<br />
\bglobominastvdigital\.com<br />
\bglosk\.com<br />
\bgnosesul\.com\.br<br />
\bgnosisonline\.org<br />
\bgoaguu\.googlepages\.com<br />
\bgoa-property\.net<br />
\bgolo-digital\.blogspot\.com<br />
\bgolo-online\.blogspot\.com<br />
\bgo-night\.com<br />
\bgooglewavedicas\.wordpress\.com<br />
\bgoolervier\.blogspot\.com<br />
\bgorgonzola\.se <br />
\bgorpa\.com\.br<br />
\bgosmametalica\.blogspot\.com<br />
\bgotroot\.com\.br<br />
\bgportal\.hu<br />
\bgpxonline\.com\.br<br />
\bgraciejiujitsufabioleopoldo\.com\/site\/<br />
\bgraffiti\.keusta\.net<br />
\bgraffiti\.org\.br<br />
\bgramadoecanela\.com\.br <br />
\bgrancorazon\.org<br />
\bgrandefraternidadebranca\.com\.br<br />
\bgratishost\.com\.br<br />
\bgriaule\.com<br />
\bgriaulebiometrics\.com<br />
\bgrupoyes\.com\.br<br />
\bgrupoyes\.com\.br\/Cursos\.aspx<br />
\bgsbrazil\.net<br />
\bguesthouseinitaly\.com<br />
\bgugol-downloads\.blogspot\.com<br />
\bguiabrasiladventure\.com<br />
\bguiabsb\.com\.br<br />
\bguiacastor\.com<br />
\bguiacurso\.com\.br<br />
\bguiadacopa\.net<br />
\bguiadaembalagem\.com\.br<br />
\bguiadaobra\.net <br />
\bguiadapesca\.com\.br<br />
\bguiadeatibaia\.com<br />
\bguiadeinvestimento\.com\.br<br />
\bguiadeitupeva\.com\.br<br />
\bguiadelrei\.com\.br<br />
\bguiademidia\.com\.br<br />
\bguiademongagua\.com\.br<br />
\bguiadocftv\.com\.br<br />
\bguiadoparaguai\.com\.br<br />
\bguiamongagua\.com\.br<br />
\bguiamorrao\.com\.br<br />
\bguilhermeabreu\.com\.br<br />
\bgunnersbrasil\.com<br />
\bgunsnrosesbrasil\.com<br />
\bgwebtools\.com <br />
\bgword\.com\.br<br />
\bh1loeqbb7bsndivgoj\.usercash\.com<br />
\bhabto\.com\.br<br />
\bhackerofdark\.blogspot\.com<br />
\bhacktolive\.org<br />
\bhaicaizen\.blogspot\.com<br />
\bhatada\.com\.br<br />
\bhavilla\.com\.br<br />
\bhelenablavatsky\.com\.br<br />
\bhellinger\.com\.br<br />
\bhesjapanese\.com <br />
\bhi5\.com<br />
\bhigh-supplies\.com<br />
\bhistoriadetudo\.com<br />
\bhistoriaimagem\.com\.br<br />
\bhistoriaserankings\.blogspot\.com<br />
\bhitany-fx\.blogs\.sapo\.pt<br />
\bhmscacambas\.com\.br<br />
\bhmv\.com\.hk\/product<br />
\bhogfriends\.net<br />
\bhospedar-se\.com <br />
\bhostercom\.com\.br<br />
\bhot100brasil\.com<br />
\bhotblowjobs\.com <br />
\bhotcheats\.org <br />
\bhotel13outubro\.com<br />
\bhotmailive\.blogspot\.com<br />
\bhotsurfers\.com\.br<br />
\bhotvnews\.wordpress\.com<br />
\bhtmlstaff\.org<br />
\bhttp-guia\.blogspot\.com<br />
\bhumanitarianlion\.com<br />
\bhumanomatica\.blogspot\.com<br />
\bhunterxhunter\.otaku\.com\.br<br />
\bianfavorite\.com<br />
\bibaladas\.com\.br<br />
\bibem\.org\/artigos\/acrobat<br />
\bibem\.org\/Hom_DPG<br />
\bibrasao\.com<br />
\bic\.vila\.bol\.com\.br<br />
\bic\.vilabol\.com\.br<br />
\bicm\.k6\.com\.br<br />
\bidealgarve\.com <br />
\bideas\.live\.com <br />
\bideia-atlantico\.pt<br />
\bideia3\.com\.br<br />
\bideiasedinheiro\.blogspot\.com<br />
\bidolomaniacos\.blogspot\.com<br />
\bidoloshome\.com<br />
\bigrejaparatodos\.com\.br<br />
\biguablogger\.blogspot\.com<br />
\bihateyoujulia\.com<br />
\bilha-dos-amores\.com <br />
\bilhaguriri\.com<br />
\bilhaguriri\.net<br />
\billuminatiarchives\.org<br />
\bim2\.com\.br<br />
\bimages\.amazon\.com<br />
\bimages\.orkut\.com<br />
\bimageshack\.us<br />
\bimageshack\.us<br />
\bimarketing\.com\.br<br />
\bimg\.photobucket\.com\/albums<br />
\bimhep\.com\.br<br />
\bimobiliariamercatto\.com.br<br />
\bimobilien\.com\.br<br />
\bimplantedentarios\.blogspot\.com<br />
\binacreditavel\.com\.br<br />
\bindicetj\.com<br />
\binesrodena\.blogspot\.com<br />
\binfo-caimbras\.org<br />
\binfofranchising\.pt<br />
\binfortronicabh\.blogspot\.com<br />
\binfovasco\.com<br />
\binfowaysi\.com<br />
\binibio\.xpg\.com\.br<br />
\binovabrasil\.blogspot\.com<br />
\binovadigital\.com<br />
\binsetotec\.com\.br <br />
\binsidernews\.com\.br<br />
\binstitutohellinger\.com\.br<br />
\binstitutouniao\.com\.br\/artigos/sindromedopanico.asp<br />
\bintecabsp\.wordpress\.com<br />
\binteligenciavirtual\.com<br />
\binterblogs\.com\.br\/homerofonseca<br />
\bIntercambioCultural\.com\.br<br />
\bintercambiocultural\.com\.br<br />
\bIntercambioCultural\.org<br />
\bintercambiocultural\.org <br />
\binternetpaulista\.com <br />
\binvasao\.com\.br<br />
\binvest\.fok\.com\.br<br />
\binvestbolsa\.com<br />
\bipetitions\.com<br />
\biphonept\.blogspot\.com<br />
\bisa-te-kiero-mais\.blogspot\.com<br />
\biscoach\.com<br />
\bisfreepop\.com\/series<br />
\bismep\.com\.br <br />
\bitanhaemonline\.com<br />
\bitanhaemvirtual\.com\.br<br />
\bitanhem\.blogspot\.com<br />
\bitapevacity\.com\.br<br />
\bitvibopedatv\.wordpress\.com<br />
\biwl\.com\.br<br />
\bjakeefred\.blogspot\.com<br />
\bjapaneselanguage\.da\.ru<br />
\bjaunews\.net<br />
\bjaymepanerai\.blogspot\.com<br />
\bjcmrpgart\.blogspot\.com<br />
\bjdnamidia\.com\.br<br />
\bjesusvira\.com\.br<br />
\bjogaki\.net<br />
\bjogodebuzios\.com\.br<br />
\bjogos-e-brincadeiras\.blogspot\.com<br />
\bjogosolimpicospequim\.com<br />
\bjogosvideos\.com<br />
\bjoiasweb\.com<br />
\bjonatasanches\.blogspot\.com<br />
\bjornadanasestrelas\.com<br />
\bjornalclubpenguinhoje\.blogspot\.com<br />
\bjornaldoe-commerce\.com <br />
\bjornalismo-desportivo\.blogspot\.com<br />
\bjornaloeco\.com\.br<br />
\bjosemanuelperez\.es\/wikipedia\/pt<br />
\bjoveminvest\.com\.br <br />
\bjubaia\.com\.br<br />
\bjulianoaudiencia\.zip\.net<br />
\bjunkie\.zonesp\.com<br />
\bjurisprudenciaemrevista\.org <br />
\bkachorro\.xpg\.com\.br<br />
\bkarapintadas\.wordpress\.com<br />
\bkatatau\.com<br />
\bkeequeenalive\.web\.pt<br />
\bkevinhaddock\.com<br />
\bkidicas\.com<br />
\bkikiat\.com<br />
\bkiminda\.wordpress\.com<br />
\bkissboots\.blogspot\.com<br />
\bkitline43\.com<br />
\bkitmaladiretaoverdadeiro001\.com<br />
\bkitpipa\.com<br />
\bkoinoo\.ning\.com<br />
\bkombu\.de<br />
\bkombucha\.hotel-br.\com<br />
\bkraazydragonball\.com<br />
\bkriyayoga-mahavatarbabaji\.com<br />
\bkuthribeirooficial\.blogspot\.com<br />
\bkxk\.me<br />
\bkyliept\.forumeiro\.com<br />
\bkyocerasolar\.com\.br<br />
\bl2gp\.com<br />
\bl2ouro\.com<br />
\blabgeo\.blogspot\.com<br />
\blabirinto\.wiki\.br<br />
\blacchiappasogni\.tk<br />
\blageado\.com\.br<br />
\blagosmilitar\.blogspot\.com<br />
\blajepor\.com\.br<br />
\blasmanzanasdulces\.wordpress\.com<br />
\blastfm\.com\/event<br />
\blastfm\.pt\/event<br />
\blatinasex\.741\.com<br />
\blattesnet\.com\.br<br />
\blayart\.com\.br<br />
\blecachalot\.xmb\.com\.br<br />
\bleechesturkey\.com<br />
\blegendanimes\.com<br />
\blelecasapeca\.blogger\.com\.br<br />
\blendas-fantasia\.blogspot\.com<br />
\blfsapatos\.com\.br<br />
\blibertarianismo\.com<br />
\blicitamais\.com\.br<br />
\blife-stream\.webs\.com<br />
\blinerecordsshop\.com\.br<br />
\blingua-ingles\.blogspot\.com<br />
\blinhabase\.com\.br<br />
\blinhasnaareia\.com<br />
\blinkinparker\.webs\.com<br />
\blinkjb<br />
\blinkjb\.vilabol\.uol\.com\.br<br />
\blinknacional\.com\.br<br />
\blinkvitrine\.com\.br<br />
\blistadebrinquedos\.com<br />
\blistadelivros-doney\.blogspot\.com<br />
\blistapratica\.com<br />
\blitoraldesantacatarina\.com<br />
\blitoralnorters\.com\.br<br />
\bliverig\.wordpress\.com<br />
\blivestream\.com\.br<br />
\blivrariasaraiva\.com\.br\/produto<br />
\blivrogastronomico\.do\.sapo\.pt <br />
\blivromidp\.jorgecardoso\.eu<br />
\blixaoblog\.blogspot\.com<br />
\blogobr\.wordpress\.com<br />
\blojaconrad\.com\.br\/produto\.asp<br />
\blojasdobairro\.com<br />
\blondon-underground\.blogspot\.com<br />
\blosmandalas\.blogspot\.com<br />
\blrg\.ufsc\.br\/\~westphal<br />
\blucenaseguros\.com\.br <br />
\bbluebonnet\.com\.br<br />
\bluizjabour\.com<br />
\bluizmeira\.com<br />
\blusoproduction\.fr<br />
\bluta-capoeira\.blogspot\.com<br />
\blutopelobrasil\.com\.br<br />
\bluzespirita\.com<br />
\bluzespirita\.org<br />
\blvxsinistrae\.blogspot\.com<br />
\blyricshosting\.com<br />
\bmacore\.com\.br<br />
\bmacrocimento\.com\.br<br />
\bmademan\.com<br />
\bmagextreme\.blogspot\.com<br />
\bmagianegra\.org\.br <br />
\bmagiasebarbaridades\.blogspot\.com<br />
\bmagicaboutyou\.blogspot\.com <br />
\bmagistertempli\.blogspot\.com<br />
\bmaionesefastfood\.com<br />
\bmaisabc\.com\.br<br />
\bmaisbrasilia\.com<br />
\bmaissaude\.eu<br />
\bmaladiretaemails\.com<br />
\bmalamutedealaska\.com<br />
\bmalapronta\.com\.br<br />
\bmandalas\.art\.br<br />
\bmandalas\.skyrock\.com<br />
\bmandihost\.com\.br<br />
\bmangasjbc\.uol\.com\.br<br />
\bmantiqueiraimoveis\.com\.br<br />
\bmanutdbr\.com<br />
\bmapaguia\.com.br<br />
\bmapia\.com\.br<br />
\bmaqgoo\.com <br />
\bmaquiagememoda\.com\.br<br />
\bmarciopereira\.com\.br<br />
\bmarcocassol\.com\.br<br />
\bmarcosmionentrevista\.blogspot\.com<br />
\bmarcosrivelles\.zip\.net<br />
\bmarcosturbo\.com\.br<br />
\bmarduc\.blogspot\.com<br />
\bmarketingdeguerrilha\.wordpress\.com<br />
\bmarketingmadeinbrasil\.zip\.net <br />
\bmarlonstein\.com<br />
\bmarseille360\.schnurstracks\.de<br />
\bmashupkeyword\.com<br />
\bmasiero\.com\.br<br />
\bmassadouniverso\.blogspot\.com<br />
\bmatrixcaesdeguarda\.com\.br<br />
\bmaxtemporada\.com\.br<br />
\bmaysamonjardimoficial\.blogspot\.com<br />
\bmc2h2o\.blogspot\.com<br />
\bmcrbullet-oficial\.com<br />
\bmecatronica\.webng\.com<br />
\bmediatraffic\.de<br />
\bmedicarepoints\.pt<br />
\bmedicinadotorax\.com\.br/<br />
\bmedicinaealimentacao\.com <br />
\bmedicinanet\.com\.br<br />
\bmedicinatradicionalchinesa\.com<br />
\bmeditacao\.biz<br />
\bmeditacaotranscendental\.blogspot\.com<br />
\bmeditacaotranscendental\.com <br />
\bmegaideas\.net<br />
\bmeginformatica\.com\.br<br />
\bmeiobit\.pop\.com\.br<br />
\bmemoriasdofront\.blogspot\.com<br />
\bmemurl.com<br />
\bmenuespecial\.com\.br<br />
\bmercadohorse\.com<br />
\bmerrychristmas\.no\.sapo\.pt<br />
\bmerrychristmashny\.no\.sapo\.pt<br />
\bmestreseo\.com\.br<br />
\bmetafisico\.net<br />
\bmetalgearpt\.awardspace\.com<br />
\bmetricimperial\.com <br />
\bmetro-subway-train-list\.com<br />
\bmeubox\.com\.br<br />
\bmeumomento\.com<br />
\bmeutaperoa\.com\.br <br />
\bmeuvitoria\.com<br />
\bmicaretas\.oipapai\.com\.br<br />
\bmictmr\.blogspot\.com<br />
\bmideos\.com<br />
\bmidiaclipping\.blogspot\.com<br />
\bmiguel-montenegro\.com<br />
\bminasclassificados\.com<br />
\bminhaaudiencia\.wordpress\.com<br />
\bminhacidadetem\.com\.br<br />
\bminhaconexao\.com\.br<br />
\bminhavida\.com\.br<br />
\bminimomultiplo\.com<br />
\bminitrem\.com<br />
\bminutodebarulho\.blogspot\.com<br />
\bmionmarcoscocadaboa\.blogspot\.com<br />
\bmissesemmanchete\.blogspot\.com<br />
\bmix\.phoneclub\.com\.br<br />
\bmjacksonart\.com <br />
\bmkarmageddon\.com<br />
\bmktg2\.net<br />
\bmktportugal\.com<br />
\bmnecho\.com <br />
\bmoananui\.wordpress\.com<br />
\bmochileiros\.com<br />
\bmodemdownloads\.net<br />
\bmoedas\.com<br />
\bmonografiaexpressa\.com<br />
\bmonografiapratica\.com<br />
\bmonografiaurgente\.com <br />
\bmorangos5serie\.blogs\.sapo\.pt<br />
\bmorangos-com-acucar\.com<br />
\bmorraderir\.com\.br<br />
\bmortesubita\.org<br />
\bmoscoso\.biz <br />
\bmouralacerda\.com\.br<br />
\bmovimentosestudantis\.blogspot\.com<br />
\bmovimentovotonulo\.blogspot\.com<br />
\bmsbesporte\.blogspot\.com<br />
\bmtv\.com\.br\/vivaovinil<br />
\bmtv\.uol\.com\.br\/vivaovinil<br />
\bmuestrasgratis\.es<br />
\bmulticreditos\.com<br />
\bmultigolb\.wordpress\.com<br />
\bmultiply.com\/blog<br />
\bmultiply.com\/journal<br />
\bmultiply.com\/links<br />
\bmultiply.com\/photos<br />
\bmultiply.com\/reviews<br />
\bmultiply.com\/tag<br />
\bmultiply.com\/video<br />
\bmultserv\.com\.br<br />
\bmundobariloche\.com\.br<br />
\bmundocruzeiros\.com\.br<br />
\bmundodatvaberta\.blogspot\.com<br />
\bmundodeclubpenguin\.blogspot\.com<br />
\bmundodomarketing\.com\.br<br />
\bmundodosincompreendidos\.blogspot\.com<br />
\bmundoeducacaofisica\.com<br />
\bmundopratico\.blogspot\.com<br />
\bmundoseo\.com\.br<br />
\bmupasales\.dominiotemporario\.com<br />
\bmuselius\.com<br />
\bmuseudosexo\.com\.br<br />
\bmuseuvirt\.com\.br<br />
\bmusicaseclipes\.com<br />
\bmuv.\com\.br <br />
\bmuzaminastear\.com\.br<br />
\bmybesthotel\.eu<br />
\bmyspace\.com\/bandanovadinastia<br />
\bmyspace\.com\/gaiteirosdealcochete<br />
\bmyspace\.com\/idolos<br />
\bmyvuvuzela\.blogspot\.com<br />
\bnacaocatolica\.com\.br<br />
\bnanetcomcdc\.blogspot\.com<br />
\bnanuqueinforma\.com/<br />
\bnaozero\.com\.br<br />
\bnarutodb\.com<br />
\bnarutomx\.free\.fr<br />
\bnarutoplayers\.com<br />
\bnatalf\.no\.sapo\.pt<br />
\bncpdtoo\.info <br />
\bncriacaodesites\.com<br />
\bnedvarticles\.narod\.ru<br />
\bnegocioextra\.com<br />
\bnetauthor\.org<br />
\bnetcampos\.com <br />
\bnethbc\.com<br />
\bnetronic\.com\.br<br />
\bnewagetokyo\.com<br />
\bnewdigitalsouth\.org<br />
\bnewronio\.espm\.br<br />
\bnfedobrasil\.com\.br<br />
\bning\.com<br />
\bnintendomania-gs\.blogspot\.com<br />
\bnintendowiiblog\.org <br />
\bnirvana\.com\.sapo\.pt<br />
\bnitarq\.blogspot\.com<br />
\bniteroitv\.com\.br<br />
\bnitrofl.webs\.com\.br<br />
\bnoh\.com\.br<br />
\bnoiabr\.ueuo\.com<br />
\bnoisnatira\.blogspot\.com <br />
\bnoivacarioca\.com\.br<br />
\bnoivasdeportugal\.com<br />
\bnomadismocelular\.wordpress\.com<br />
\bnomundodosfamosos\.zip\.net<br />
\bnonnux\.com<br />
\bnordestefree\.blogspot\.com<br />
\bnoskirebr\.com<br />
\bnoticiasdatvbrasileira\.blogspot\.com<br />
\bnoticiasmusicais\.radioativohits\.com<br />
\bnotlong\.com<br />
\bnoturnafm\.com\.br<br />
\bnovafriburgoturismo\.com\.br<br />
\bnovatec\.com\.br<br />
\bnovevolts\.blogspot\.com<br />
\bnovodaiblog\.blogspot\.com<br />
\bnsonline\.com\.br<br />
\bnsrbr\.com<br />
\bnucleodeoportunidades\.net<br />
\boanodogolfinho\.com<br />
\bobabox\.com <br />
\bobaepitacio\.com\.br<br />
\bobesidadeinfo\.com <br />
\bobjetivoguarulhos\.com\.br<br />
\boblogtv\.blogspot\.com<br />
\bobrasileirinho\.com\.br<br />
\bobrigadas2010\.megaideas\.net<br />
\bocachacier\.com\.br<br />
\bocanal\.wordpress\.com<br />
\bocantinhodosdeprimidos\.blogspot\.com<br />
\bodontologiaconcursos\.com\.br<br />
\bofileumgay\.blogspot\.com<br />
\boilondres\.com\.br<br />
\boipapai\.com\.br<br />
\boitentona\.com\.br<br />
\bojovem\.net<br />
\bokardecista\.blogspot\.com<br />
\bolharaspie\.blogspot\.com<br />
\bolhareconomico\.cjb\.net<br />
\bolharobscuro\.com<br />
\bomdl\.com\.br<br />
\bomelhordecapao\.com\.br<br />
\bomelhordobairro\.com\.br<br />
\bomelhordocerrado\.com\.br<br />
\boncopediatria\.org<br />
\bondatuga\.com<br />
\bondeanda\.multiply\.com<br />
\bondeestagenebra\.blogspot\.com<br />
\bonibusemdebate\.fotopages\.com<br />
\bonlypop\.blogspot\.com<br />
\boparanasondasdoradio\.ufpa\.br\/livro.htm<br />
\bopartidolivre\.blogspot\.com<br />
\bopersan\.com\.br<br />
\bopiniaoenoticia\.com\.br<br />
\bopiniaoipiau\.com\.br<br />
\boportunidadesanhembi\.com\.br<br />
\bordemdotemploiluminista\.blogspot\.com<br />
\bordemlivre\.org<br />
\borganizacionais\.com\.br<br />
\borganizandoeventos\.com\.br<br />
\borixas\.sites\.sapo\.pt<br />
\borladeatalaia\.com\.br<br />
\borlandocalado\.flogbrasil\.terra\.com\.br<br />
\bosbaladeiros\.com\.br<br />
\boseriestvz.broguiz.com <br />
\bosmelancias\.com\.br<br />
\bosmutantescdcc\.blogspot\.com<br />
\bosmutantesnanet\.blogspot\.com<br />
\botbr\.com\.br<br />
\botemponaopara\.wordpress\.com<br />
\botserv\.com\.br<br />
\bousar\.net<br />
\boysfirsttime\.com<br />
\bpagmenos\.net<br />
\bpaixaoautomovel\.blogspot\.com<br />
\bpakaas\.com\.br<br />
\bpalatando\.com<br />
\bpalavras-arquitectura\.com<br />
\bpamonhart\.com\.br<br />
\bpandajogosgratis\.com<br />
\bpandamovies\.com <br />
\bpantanalecoturismo\.tur\.br<br />
\bpapaleguaspt\.blogspot\.com<br />
\bpaqueralegal\.com<br />
\bparanapiacabaecotur\.com<br />
\bparasempremiguelfalabella\.blogspot\.com<br />
\bparquesepracasdecuritiba\.com\.br<br />
\bpartidolivre\.org\.br<br />
\bpassageirodomundo\.blogspot\.com<br />
\bpath\.to/b677<br />
\bpath\.to\/e6b3\/ <br />
\bpatriciafelinaa\.blogspot\.com<br />
\bpauloandreissa\.com<br />
\bpaulobeck\.blogspot\.com<br />
\bpcclinic\.pt<br />
\bpcs\.k6\.com\.br<br />
\bpcsist\.com\.br<br />
\bpeaceoneday\.org<br />
\bpedalativo\.com<br />
\bpediatria\.com.\br<br />
\bpedrodoria\.com\.br<br />
\bpedro-rossi-clube-da-esquina\.blogspot\.com<br />
\bpegamais\.com\.br<br />
\bpennichollo\.blogspot\.com<br />
\bpensamentopositivo\.com\.br<br />
\bpepe\.org\.br<br />
\bpescaemsintra\.com<br />
\bpesqueirafutebolclube2008\.blogspot\.com <br />
\bpet\.di\.ufpb\.br\/ferramentadct<br />
\bpetsecia\.com<br />
\bphotobucket\.com <br />
\bphotobucket\.com\/albums<br />
\bphysicalgym\.com\.br\/site\/<br />
\bpiadasonline\.com\.br<br />
\bpiauinauta\.blogspot\.com<br />
\bpiauionline\.com\.br<br />
\bpicodogaviao\.com\.br<br />
\bpicodogaviao\.esp\.br<br />
\bpieceextremo\.blogspot\.com<br />
\bpierdeipanema\.com\.br<br />
\bpimentanegra\.blogspot\.com<br />
\bpimentelonline\.com<br />
\bpinblogger\.weblogger\.com\.br <br />
\bpindavale\.com<br />
\bpindavale\.com\.br<br />
\bpindavale\.net<br />
\bpindavale\.org <br />
\bpingon\.com\.br<br />
\bpiritubaclick\.com\.br<br />
\bpiroalquimista\.vilabol\.uol\.com\.br<br />
\bpisodegranito\.com<br />
\bplanetabodyboard\.com<br />
\bplanetatv\.wordpress\.com<br />
\bplanetavet\.com<br />
\bplanodesaude\.biz<br />
\bplanotatico\.com<br />
\bplano-verao\.com<br />
\bplantiodireto\.com\.br<br />
\bplasmalcd\.110mb\.com <br />
\bplasticos.hdfree\.com\.br<br />
\bplugcidade\.com\.br<br />
\bpndt\.com\.br<br />
\bpobreotario\.blogspot\.com<br />
\bpodermasculino\.com\.br<br />
\bpodiatryworldwide\.com <br />
\bpokemondarkay\.blogspot\.com<br />
\bpokenewsonline\.blogspot\.com<br />
\bpolegar\.k6\.com\.br<br />
\bpontagrossa\.com\.br<br />
\bpontagrossacvb\.com\.br<br />
\bpontoperdido\.blogspot\.com<br />
\bpopart-esfh\.com<br />
\bpornotube\.com<br />
\bporntune\.net<br />
\bportabilidade\.com\.br<br />
\bportal1000\.com\.br<br />
\bportalacontece\.com\.br<br />
\bportaladm\.adm\.br<br />
\bportalafricanista\.blogspot\.com<br />
\bportalararipina\.blogspot\.com<br />
\bportalcapelinha\.com\.br<br />
\bportaldaspousadas\.net<br />
\bportaldecontabilidade\.com\.br<br />
\bportaldehospedagem\.com\.br<br />
\bportaldopajeu\.com<br />
\bportalegrecidadepostal\.blogspot\.com<br />
\bportalglobinho\.rg3\.net<br />
\bportalico\.com\.br<br />
\bportalilheus\.xpg\.com\.br<br />
\bportaljarinu\.com\.br<br />
\bportalligtv\.com\.br<br />
\bportaloceania\.com<br />
\bportalparaisense\.com\.br<br />
\bportalpiraju\.com<br />
\bportalpornoportugues\.pt\.vu<br />
\bportalsmallville\.net<br />
\bportalssvip\.com<br />
\bportaltributario\.com\.br<br />
\bportugacard\.com<br />
\bportugalempresarial\.com <br />
\bpotimvale\.blogspot\.com<br />
\bpousadajubaia\.com\.br<br />
\bpousadariopreto\.com\.br<br />
\bpousadascomcharme\.com\.br<br />
\bprainhadeburitama\.com\.br<br />
\bpranos\.com\.br<br />
\bpreditivo\.com\.br<br />
\bprestacao\.com<br />
\bpriestknack\.com<br />
\bprintax\.com\.br<br />
\bpriscilalino\.com\.br<br />
\bprodulz\.com\.br<br />
\bproduto\.mercadolivre\.com\.br<br />
\bprofcardy\.com\/calculadoras/<br />
\bprofessorprojeto\.blogspot\.com<br />
\bprofkbrito\.zip\.net<br />
\bprogramabrasil\.org<br />
\bprojectodinheiro\.pt<br />
\bprojectos\-arquitectos\.blogspot\.com<br />
\bprojectos-arquitectos\.blogspot\.com<br />
\bprojetogenoma\.com\.br<br />
\bpro-laudo\.com\.br<br />
\bpromocoes\.biz<br />
\bprosementes\.com\.br<br />
\bprovadetran\.com\.br<br />
\bpsymania\.com<br />
\bpt\.wikipedia\.org\.br<br />
\bpt\.shvoong\.com\/how-to\/writing<br />
\bptairsoft\.org<br />
\bptpassatempos\.com<br />
\bptwebsite\.com<br />
\bpubsender\.com<br />
\bpunkshop\.com\.br <br />
\bpuppyclick\.com<br />
\bputadaloucura\.com<br />
\bputarianatv\.com<br />
\bputsblog\.com<br />
\bqaudiencia\.blogspot\.com<br />
\bqeenmedia\.com\.ar<br />
\bqi\.com\.br<br />
\bqibla\.com\.br<br />
\bquadrante\-natural\.pt<br />
\bqualasuabossa\.com\.br<br />
\bqualjogo\.com <br />
\bqualpeca\.com<br />
\bqudrante\-natural\.pt <br />
\bqueroficarrico\.net<br />
\bquerosaude10\.blogspot\.com<br />
\bquickgoldfacts\.blogspot\.com<br />
\bquintabiologica\.info<br />
\bradiestesia\.br\.tripod\.com<br />
\bradiobaseurgente\.blogspot\.com<br />
\bradioharekrishna\.blog\.br<br />
\bradiomec\.com\.br<br />
\bradiowebavivamentojovem\.com<br />
\braeiro\.com<br />
\brankbrasil\.com\.br<br />
\brapidshare.com\/files\/<br />
\braultabajara\.blogspot\.com<br />
\brayervas\.com\.br<br />
\brbgestao\.com\.br<br />
\brcpsoftware\.com\.br<br />
\brd1audiencia\.com<br />
\brd1audienciadatv\.wordpress\.com<br />
\brd1audienciadatv\.wordpress\.com<br />
\brecblog\.com\.br<br />
\breceitaculinaria.\com\.br<br />
\brecibosverdes\.com<br />
\breciclaconnosco\.blogspot\.com <br />
\breciclareviver\.rg3\.net<br />
\breconcavonoticias\.com<br />
\brede-brasil-tv\.blogspot\.com<br />
\bredefile\.com<br />
\bredeisatkm\.blogspot\.com<br />
\bredmadox\.com\.br <br />
\bredtube\.com<br />
\breflexoesdeumlouco\.blogspot\.com<br />
\breflexoesdigitais\.com\.br<br />
\bregeneration\.com\.br<br />
\breidobrasfoot\.blogspot\.com<br />
\breiki\.portais\.org<br />
\breikimawashi\.com<br />
\breikiuniverso\.org<br />
\breinodeoxala\.com\/videoteca<br />
\brelojesweb\.imitable\.com<br />
\bremade\.com\.br <br />
\brendaweb\.weebly\.com<br />
\brenerlopes\.zip\.net<br />
\brenter\.com\.br<br />
\brenzogracie\.com\/<br />
\breportervelazquez\.blogspot\.com<br />
\breservas\.net<br />
\bresidentevilwork\.blogspot\.com<br />
\brestauranteocaipira\.com\.br<br />
\bresumodanoticia\.blogspot\.com<br />
\bresumodasnovelas\.net<br />
\bresumododia\.wordpress\.com<br />
\bresumos\.net<br />
\breto-europa\.ning\.com<br />
\bretratoiberico\.com<br />
\bretratto\.com<br />
\brevistadatv\.blogspot\.com<br />
\brevistasgratis\.ws<br />
\brevoclim\.zip\.net<br />
\breybiannchi\.4shared\.com<br />
\brhorigami\.com<br />
\briodejaneiro-copacabana\.com\.br<br />
\briodejaneirophotoguide\.com<br />
\brioferias\.com<br />
\brio-rj\.com\.br<br />
\brmrconsultoria\.v10\.com\.br<br />
\brobertexto\.com<br />
\brobitexplore\.com<br />
\brockbrasiliadesde64\.blogspot\.com<br />
\brockybalboa\.com\.br<br />
\brockybalboa\.com\.br<br />
\brodolfo\.typepad\.com<br />
\brodrigofneves\.blogspot\.com<br />
\brommopaula\.blogspot\.com<br />
\bromuloesbt\.blogspot\.com<br />
\brose-mcgowan-brasil\.blogspot\.com<br />
\brotadoromanico\.com<br />
\broteirodelavras\.com <br />
\broteirostelevisao\.blogspot\.com<br />
\broxclan\.net<br />
\brpgdesafios\.com\.br<br />
\brplanetagospel\.blogspot\.com<br />
\brppnweb\.com<br />
\bruadasflores\.com<br />
\brugby\.esp\.br<br />
\bsalaodetuning\.com\.br<br />
\bsalto12\.blogspot\.com<br />
\bsanbara\.com\.br<br />
\bsandramouraramos\.blogspot\.com<br />
\bsandrasantos\.com<br />
\bsandrinha\.com\.br<br />
\bsanguesuga\.com <br />
\bsantainquisicaocatolica\.blogspot\.com<br />
\bsantoantoniodopinhal\.com\.br<br />
\bsantosreporter\.blogspot\.com<br />
\bsaopaulobairros\.com\.br<br />
\bsaopaulocenter\.com\.br <br />
\bsatere\.com<br />
\bsaturei\.com<br />
\bsaudedofuturo\.wordpress\.com<br />
\bschwarzenegger\.it<br />
\bscrapbookbrasil\.com<br />
\bscrapjackie\.locaweb\.com\.br<br />
\bscribd\.com\/download<br />
\bscribd\.com\/group<br />
\bscribd\.com\/people<br />
\bscribd\.com\/profile<br />
\bscribd\.com\/word<br />
\bscriptline\.net/<br />
\bsegurosguia\.com<br />
\bseinstrumentos\.com\.br<br />
\bsejavegetariano\.com\.br<br />
\bsekstv\.info<br />
\bsemreligiao\.com\.br<br />
\bsenha1234\.blogspot\.com<br />
\bsenhoradeoliveira\.blig\.com\.br<br />
\bseomaster\.com\.br<br />
\bsergioprata\.com\.br<br />
\bseries-etc\.blogspot\.com<br />
\bsexxxchurch\.com<br />
\bsg7net.\com\.br<br />
\bsgospel\.com<br />
\bshareapic\.net<br />
\bshemalesexstar\.com<br />
\bshowdelance\.com\.br<br />
\bsicchiquititas\.blogs\.sapo\.pt<br />
\bsigmasociety\.com<br />
\bsimonepedacos\.multiply\.com<br />
\bsimplyjolie2008\.blogspot\.com<br />
\bsimpozio\.ufsc\.br<br />
\bsimsbrasil\.com\.br<br />
\bsite\.oiyes\.com\.br<br />
\bsite\.voila\.fr\/chezmirage/<br />
\bsitegratisgratis\.com\.br <br />
\bsitemeu\.net<br />
\bsites\.google\.com/site/gagocoutinhocom<br />
\bsites\.google\.com/site/top100brazil/Home/<br />
\bsites\.google\.com/site/vermelhovelho<br />
\bsitesdesites\.webnode\.com\.br<br />
\bsitiomarado\.forumeiro\.com<br />
\bskindoctornyc\.com<br />
\bskydrive\.live\.com\/self\.aspx<br />
\bskyscrapercity\.com<br />
\bslam\.regeneration\.com\.br<br />
\bslamdunk\.suprasolucoes\.com<br />
\bslideshare\.net<br />
\bsms\.ie\.ma <br />
\bsmswebo\.com <br />
\bsoarquitetura\.com\.br<br />
\bsobrelivros\.com\.br<br />
\bsobresites.com\/taro<br />
\bsobresites\.com\/biblioteconomia<br />
\bsocarnavaldepoa\.webs\.com<br />
\bsociedadedosblogueiros\.blogspot\.com<br />
\bsocomedia\.oipapai\.com\.br<br />
\bsoevami\.blogspot\.com<br />
\bsofatv\.net<br />
\bsoftfacil\.net<br />
\bsofttoys\.com\.br<br />
\bsolabm\.com\.br<br />
\bsoletrando\.com\.br<br />
\bsolucoesageis\.com\.br <br />
\bsomenoise\.com\.br<br />
\bsomudancasmg\.com\.br<br />
\bsoprodoator\.com<br />
\bsosdividas\.com\.br<br />
\bsoteropolitanosculturaafro\.wordpress\.com<br />
\bsouthernhides\.com\.ar<br />
\bsouturista\.com\.br<br />
\bspacejovem\.com<br />
\bspeedbrazil\.blogspot\.com <br />
\bspeedhost\.com\.br <br />
\bspellrpg\.com\.br<br />
\bspirituc\.com<br />
\bsportdigital\.net <br />
\bsportingapoio\.com<br />
\bspringer\.com\.br<br />
\bspvilas\.com\.br <br />
\bstadiumzone\.net<br />
\bstalloneforever\.blogspot\.com<br />
\bstamadvies\.nl<br />
\bstarmedica\.blogspot\.com<br />
\bstartrekbrasil\.com\.br<br />
\bstatisticum\.org<br />
\bstatuscompany\.com\.br<br />
\bsteinerimoveis\.com\.br<br />
\bstelling\.cc<br />
\bstifler\.com\.br<br />
\bstreetdogstudio\.com<br />
\bstudiopreview\.com\.br<br />
\bstyleua\.com<br />
\bsuamente\.com\.br<br />
\bsuamenteseuguia\.blog\.com<br />
\bsubcor\.multiply\.com<br />
\bsubxtreme\.net<br />
\bsudoku\.mundopt\.com <br />
\bsudokunine\.com<br />
\bsuperblog93\.blogspot\.com<br />
\bsuper-congresso\.com\.br<br />
\bsupergrana\.com<br />
\bsupermemoria\.com\.br<br />
\bsupernatural\-fans\.tk<br />
\bsuper-nutricao\.com\.br<br />
\bsuprasolucoes\.com<br />
\bsuprasolucoes\.com\/redireciona\.asp<br />
\bsurfa\.com\.br\/blog\/2010\/08\/rj-arpoador<br />
\btag\.com\.pt<br />
\btaginvest\.com\.br<br />
\btaichibrasileiro\.blogspot\.com<br />
\btaichipailin\.com\.br<br />
\btalentmanager\.pt<br />
\btalk\.livedaily\.com<br />
\btaoismo\.org <br />
\btargetw\.com<br />
\btarzia-tattoo\.com<br />
\btatianavianna\.com\.br/<br />
\btechseg\.com <br />
\btechtuga\.net <br />
\btecmais\.com <br />
\btecnopt\.com<br />
\btek\.sapo\.pt<br />
\btekoha\.org<br />
\btelecestas\.com\.br<br />
\bteleco\.com\.br<br />
\btelenovelasbr\.blogspot\.com<br />
\btelevisionado\.wordpress\.com<br />
\btelevisionnews\.wordpress\.com<br />
\btemplodeapolo\.net<br />
\bteobaldobs\.blogspot\.com<br />
\bterminologia\.com\.br <br />
\bterraforum\.com\.br<br />
\bTerrasdaMantiqueira\.com<br />
\btertdow\.blogspot\.com<br />
\btestdriveonline\.com\.br<br />
\bteusite\.net <br />
\btevenoticias\.wordpress\.com<br />
\btheazoresislands\.blogspot\.com<br />
\bthebestthingscomeinthree\.pt\.vu/<br />
\bthe-englishstudio\.com\.br<br />
\bthemaozoleum\.com <br />
\bthinkball\.com\.br<br />
\bthinkfn\.com<br />
\bthinkfnwiki\.com<br />
\bthinnetworks\.com\.br<br />
\bthumblogger\.com <br />
\bthundersuplementos\.com\.br<br />
\btibbisuluk\.com <br />
\btintazul\.com\.pt<br />
\btinypic\.com<br />
\btiopatinhas\.1br\.net<br />
\btiplan\.com\.br <br />
\btodocanal\.wordpress\.com<br />
\btokiohotel\.com\.br<br />
\btokiohotelbrasil\.com<br />
\btokufriends\.com<br />
\btonycorreia\.com\.br<br />
\btoolssites\.com\.br<br />
\btop100equestrian\.com<br />
\btopsexywomen\.com<br />
\btorrentsparabaixar\.blogspot\.com<br />
\btotalmentecharmed\.spaceblog\.com\.br<br />
\btownbridgecom\.com<br />
\btrabalhoescolares\.blogspot\.com<br />
\btraditionalvalues\.org<br />
\btraditionalvalues\.org\/urban\/nine\.php<br />
\btraineemeup\.blogspot\.com<br />
\btransformatec\.com\.br<br />
\btravian\.(?:pt|com\.br)/\?uc=<br />
\btribodatrilha\.com<br />
\btrilhadoslobos\.com\.br<br />
\btrombeteiro\.com<br />
\btudo-sobre-a-tv\.blogs\.sapo\.pt<br />
\btudosobrecdc\.blogspot\.com<br />
\btudosobrecharmed\.blogspot\.com<br />
\btudosobreufologia2010\.blogspot\/.com<br />
\btudotemos\.com\.br <br />
\btunigup.rg3\.net<br />
\bturismobahia\.com\.br<br />
\bturismoholambra\.com\.br<br />
\bturismonovale\.com <br />
\bturismonovale\.com\.br<br />
\btvaqui\.com\.br<br />
\btvbrasilaudiencia\.zip\.net<br />
\btvcontacto\.wordpress\.com<br />
\btvdigitalnopc\.com<br />
\btvfoco\.com\.br<br />
\btvlivre\.org<br />
\btvmundo\.wordpress\.com<br />
\btvtuga\.tv<br />
\btwitter\.com\/analistati<br />
\btwitter\.com\/vini_rio<br />
\btwitter\.com\/weloveisatkmas<br />
\btwitterbrasil\.org<br />
\bucrania\-mozambique\.blogspot\.com<br />
\bufotvonline\.com\.br<br />
\buhdtv\.com\.br <br />
\bultimatesonic\.wordpress\.com<br />
\bumbanda\.blogs\.sapo\.pt<br />
\buniagua\.org.\br<br />
\buniblog\.com\.br<br />
\bunitedphotopress\.com<br />
\buniversalistas\.blogspot\.com<br />
\buniversalposterz\.com<br />
\buniversoanyeviny\.com\.br<br />
\buniversoben10\.blogspot\.com<br />
\buo\.com\.br<br />
\buppw\.org <br />
\burbanawebsite\.com\.br<br />
\burban-rivals\.com/\?sponsor=<br />
\busercash\.com/\?r=<br />
\buvaonline\.uva\.br<br />
\bvagalume\.uol\.com\.br<br />
\bvagasti\.v10\.com<br />
\bvalegastronomia\.com <br />
\bvalegastronomia\.com\.br<br />
\bvalegastronomia\.net <br />
\bvalegastronomia\.org<br />
\bvalinor\.com\.br\/forum\/<br />
\bvalinor\.com\.br\/viewtopic\.php\?<br />
\bvejalourdes\.com\.br<br />
\bveleirodingue\.freeboat.\com\.br<br />
\bvendasnaweb\.com\.br<br />
\bventurosanet\.com<br />
\bveredaestreita\.org<br />
\bveredaestreita\.org\/2008/<br />
\bveredasbrasil\.com\.br<br />
\bviagemlegal\.com<br />
\bviagensbariloche\.com\.br<br />
\bviagens-belgica\.info <br />
\bviagensdubai\.com\.br<br />
\bviagens-grecia\.info<br />
\bviagens-noruega\.info<br />
\bviagens-republica-checa\.info<br />
\bviaiguassu\.com<br />
\bviajarapuntadeleste\.com\.ar<br />
\bviajoporargentina\.com<br />
\bviciodeviajar\.blogspot\.com<br />
\bvidavaitorta\.blogspot\.com<br />
\bvideo\.google\.com\/videoplay\?<br />
\bvideocliper\.com<br />
\bvideolog\.tv<br />
\bvideolog\.uol\.com\.br <br />
\bvideos\.etc\.br<br />
\bvideosmusica\.tv<br />
\bvidyayoga\.org<br />
\bvilacriativa\.com\.br<br />
\bvilanovenseblog\.blogspot\.com<br />
\bvimeo\.com<br />
\bvini.rio\.vila\.bol\.com\.br<br />
\bvini.rio\.vilabol\.com\.br<br />
\bvirouviral\.com<br />
\bvisitasonline\.com<br />
\bvisitearacaju\.com\.br<br />
\bvisitepontagrossa\.com\.br<br />
\bvisitesaopaulo\.com <br />
\bvisualmedia\.com\.br<br />
\bvitoriagrande\.com <br />
\bvitorsousaalbufeira\.blogspot\.com <br />
\bvitrinepublicitaria\.net<br />
\bvjez\.com<br />
\bvoceselembra\.blogspot\.com<br />
\bvoipbra\.com\.br<br />
\bvolta\.mirc\.vilabol\.uol\.com\.br<br />
\bvoltamirc\.co\.nr<br />
\bvoltamirc\.rg3\.net<br />
\bvoltamirc\.web44\.net <br />
\bvoos-info\.com <br />
\bwallpapers\.regeneration\.com\.br<br />
\bwaoIndia\.com<br />
\bwarriors-of-wrestling\.blogspot\.com<br />
\bwata-eh-legal\.blogspot\.com<br />
\bwaysforus\.org<br />
\bwebcaldas\.com\.br<br />
\bwebcarcenter\.com\.br<br />
\bwebcolinas\.com<br />
\bwebimoveisnointerior\.com\.br<br />
\bwebland\.ppg\.br<br />
\bwebmap\.in<br />
\bwebmove\.com\.br<br />
\bwebng\.com\/itatiaia<br />
\bwebsoccerclub\.com <br />
\bwebtemplarios\.forumup\.com <br />
\bweshow\.com<br />
\bwicca-ipatinga\.blogspot\.com<br />
\bwikipedia\.artudi\.org<br />
\bwikipediaqueixas\.blogspot\.com<br />
\bwikisus\.net<br />
\bwindowsvistadicasemgeral\.com<br />
\bwordpress-genial\.com<br />
\bworld7\.monstersgame\.com\.pt<br />
\bworldcruises1\.blogspot.\com<br />
\bworldpressphoto\.nl <br />
\bwurdulaks\.blogspot\.com<br />
\bwwwrichardgoterra\.blogspot\.com<br />
\bx-dsg\.com<br />
\bx-flog\.com\.br<br />
\bxgamesnet\.blogspot\.com<br />
\bxgoogle\.com\.br/blog\/2008\/04\/26\/download-de-psych<br />
\bxn--musculao-xza3b\.com<br />
\bXoppi\.com <br />
\by2kdesign\.com<br />
\byenidizayn\.com<br />
\byogaclick\.com\.br<br />
\byogavaidika\.com<br />
\byoungandhealthy\.ca<br />
\byoupiee\.com\.br<br />
\byouporn\.com<br />
\byoutube\.com\/results\?<br />
\byoutube\.com\/v\/<br />
\byoutube\.com\/view_play_list\?<br />
\byoutube\.com\/watch\?<br />
\byoutube\.com\/watch\?v<br />
\bz10.invisionfree\.com<br />
\bz6\.invisionfree\.com<br />
\bzamarian\.com\.br<br />
\bzanottofederal1555\.com\.br/<br />
\bzapbox\.com\.br<br />
\bzapenglish\.com<br />
\bziggi\.com\.br\/downloads<br />
\bzoonadocelular\.com <br />
\bzoonose\.com\.br<br />
\bzymboo\.com<br />
\.myjerseys\.org<br />
\.weddingdressebay\.com<br />
#</pre> <!-- leave this line exactly as it is --></div>Gmaxwellhttps://wiki.xiph.org/index.php?title=TDLT&diff=14102TDLT2013-04-23T00:06:37Z<p>Gmaxwell: /* Type-III = */</p>
<hr />
<div>This page holds the results of Time Domain Lapped Transform (TDLT) optimization problems looking for integer transform coefficients that provide optimal coding gain. Wherever possible the assumptions are stated. Later we should include testing against actual image data to verify the results (see test data [http://people.xiph.org/~tterribe/tmp/subset1-y4m.tar.gz here]).<br />
<br />
The coding gain objective used as the objective is taken from slide 13 of Tim's presentation [http://people.xiph.org/~tterribe/pubs/lca2012/auckland/intro_to_video1.pdf An Introduction to Video Coding]<br />
<br />
<need figure with block matrix diagrams><br />
<br />
The free parameters are initially just the coefficients p_0,...,p_m,q_0,...,q_m where m=(n/2)-1. We limit these to being dyadic rationals, e.g., x/2^d with d=6, between [-1,1].<br />
<br />
Given p's and q's and assuming a linear ramp constrains the s's.<br />
<br />
== 4x8 ==<br />
<br />
Optimal real-valued coefficients for V:<br />
<br />
p0 = -0.18117338915051454<br />
<br />
q0 = 0.6331818230771687<br />
<br />
CG = 8.60603<br />
<br />
{|<br />
!<br />
!p0<br />
!q0<br />
!s0<br />
!s1<br />
!CG<br />
!SBA<br />
!Filterbank<br />
|-<br />
|R=f<br>6-bit<br />
| -11/64<br>-0.171875<br />
| 36/64<br>0.5625<br />
| 91/64<br>1.421875<br />
| 85/64<br>1.328125<br />
| &nbsp;<br>8.63473<br />
| &nbsp;<br>22.0331<br />
| [[Image:4x8.png|64px]]<br />
|-<br />
|R=f<br>5-bit<br />
| -5/32<br>-0.15625<br />
| 18/32<br>0.5625<br />
| 46/32<br>1.4375<br />
| 42/32<br>1.3125<br />
| &nbsp;<br>8.63409<br />
| &nbsp;<br>22.5715<br />
| [[Image:4x8_5bit.png|64px]]<br />
|-<br />
|R=t,D=f<br />
| -12/64<br>-0.1875<br />
| 41/64<br>0.640625<br />
| 92/64<br>1.4375<br />
| 1093/768<br>1.423177<br />
| &nbsp;<br>8.60486<br />
| &nbsp;<br>20.0573<br />
| [[Image:4x8r.png|64px]]<br />
|-<br />
|R=t,D=t<br>8-bit<br />
| -32/256<br>-0.125<br />
| 162/256<br>0.6328125<br />
| 376/256<br>1.46875<br />
| 357/256<br>1.39453125<br />
| &nbsp;<br>8.60104<br />
| &nbsp;<br>21.4037<br />
| [[Image:4x8rd_8bit.png|64px]]<br />
|-<br />
|R=t,D=t<br>7-bit<br />
| -32/128<br>-0.25<br />
| 82/128<br>0.640625<br />
| 184/128<br>1.4375<br />
| 186/128<br>1.453125<br />
| &nbsp;<br>8.59886<br />
| &nbsp;<br>18.9411<br />
| [[Image:4x8rd_7bit.png|64px]]<br />
|-<br />
|R=t,D=t<br>6-bit<br />
| -16/64<br>-0.25<br />
| 41/64<br>0.640625<br />
| 92/64<br>1.4375<br />
| 93/64<br>1.453125<br />
| &nbsp;<br>8.59886<br />
| &nbsp;<br>18.9411<br />
| [[Image:4x8rd.png|64px]]<br />
|-<br />
|R=t,D=t<br>5-bit<br />
| -8/32<br>-0.25<br />
| 19/32<br>0.59375<br />
| 52/32<br>1.625<br />
| 47/32<br>1.46875<br />
| &nbsp;<br>8.56068<br />
| &nbsp;<br>20.3279<br />
| [[Image:4x8rd_5bit.png|64px]]<br />
|-<br />
|R=t,D=t<br>max SBA<br />
| -8/64<br>-0.125<br />
| 30/64<br>0.46875<br />
| 136/64<br>2.125<br />
| 91/64<br>1.421875<br />
| &nbsp;<br>8.23230<br />
| &nbsp;<br>25.1934<br />
| [[Image:4x8rd_sba.png|64px]]<br />
|}<br />
<br />
== 8x16 ==<br />
<br />
Optimal real-valued coefficients for V:<br />
<br />
p0 = -0.39460731547057293<br />
<br />
p1 = -0.33002212811740816<br />
<br />
p2 = -0.12391270981321137<br />
<br />
q0 = 0.822154737511288<br />
<br />
q1 = 0.632488694485779<br />
<br />
q2 = 0.40214668677553894<br />
<br />
CG = 9.56867<br />
<br />
{|<br />
!<br />
!p0<br />
!p1<br />
!p2<br />
!q0<br />
!q1<br />
!q2<br />
!s0<br />
!s1<br />
!s2<br />
!s3<br />
!CG<br />
!Filterbank<br />
|-<br />
|R=f<br>6-bit<br />
| -23/64<br>-0.359375<br />
| -18/64<br>-0.28125<br />
| -6/64<br>-0.09375<br />
| 48/64<br>0.75<br />
| 34/64<br>0.53125<br />
| 20/64<br>0.3125<br />
| 90/64<br>1.40625<br />
| 73/64<br>1.140625<br />
| 72/64<br>1.125<br />
| 75/64<br>1.171875<br />
| &nbsp;<br>9.60021<br />
| [[Image:8x16.png|64px]]<br />
|-<br />
|R=f<br>5-bit<br />
| -12/32<br>-0.375<br />
| -9/32<br>-0.28125<br />
| -4/32<br>-0.125<br />
| 24/32<br>0.75<br />
| 17/32<br>0.53125<br />
| 10/32<br><br />
| 45/32<br>1.40625<br />
| 37/32<br>1.15625<br />
| 36/32<br><br />
| 38/32<br>1.1875<br />
| &nbsp;<br>9.59946<br />
| [[Image:8x16_5bit.png|64px]]<br />
|-<br />
|R=t,D=f<br />
| -26/64<br>-0.40625<br />
| -22/64<br>-0.34375<br />
| -8/64<br>-0.125<br />
| 53/64<br>0.828125<br />
| 41/64<br>0.640625<br />
| 26/64<br>0.40625<br />
| 11/8<br>1.375<br />
| 879/768<br>1.14453125<br />
| 1469/1280<br>1.14765625<br />
| 275/224<br>1.2276785714285714<br />
| &nbsp;<br>9.56627<br />
| [[Image:8x16r.png|64px]]<br />
|-<br />
|R=t,D=t<br>8-bit<br />
| -96/256<br>-0.375<br />
| -83/256<br>-0.32421875<br />
| -36/256<br>-0.140625<br />
| 210/256<br>0.8203125<br />
| 160/256<br>0.625<br />
| 104/256<br>0.40625<br />
| 368/256<br>1.4375<br />
| 302/256<br>1.1796875<br />
| 293/256<br>1.14453125<br />
| 317/256<br>1.23828125<br />
| &nbsp;<br>9.56761<br />
| [[Image:8x16rd_8bit.png|64px]]<br />
|-<br />
|R=t,D=t<br>7-bit<br />
| -48/128<br>-0.375<br />
| -45/128<br>-0.3515625<br />
| -16/128<br>-0.125<br />
| 105/128<br>0.8203125<br />
| 80/128<br>0.625<br />
| 53/128<br>0.4140625<br />
| 184/128<br>1.4375<br />
| 151/128<br>1.1796875<br />
| 147/128<br>1.1484375<br />
| 157/128<br>1.2265625<br />
| &nbsp;<br>9.56672<br />
| [[Image:8x16rd_7bit.png|64px]]<br />
|-<br />
|R=t,D=t<br>6-bit<br />
| -24/64<br>-0.375<br />
| -20/64<br>-0.3125<br />
| -4/64<br>-0.0625<br />
| 53/64<br>0.828125<br />
| 40/64<br>0.625<br />
| 24/64<br>0.375<br />
| 88/64<br>1.375<br />
| 75/64<br>1.171875<br />
| 76/64<br>1.1875<br />
| 76/64<br>1.1875<br />
| &nbsp;<br>9.56161<br />
| [[Image:8x16rd.png|64px]]<br />
|-<br />
|R=t,D=t<br>5-bit<br />
| -12/32<br>-0.375<br />
| -10/32<br>-0.3125<br />
| -2/32<br>-0.0625<br />
| 26/32<br>0.8125<br />
| 20/32<br>0.625<br />
| 12/32<br>0.375<br />
| 48/32<br>1.5<br />
| 38/32<br>1.1875<br />
| 38/32<br>1.1875<br />
| 38/32<br>1.1875<br />
| &nbsp;<br>9.5596<br />
| [[Image:8x16rd_5bit.png|64px]]<br />
|}<br />
<br />
== 16x32 ==<br />
<br />
Best-known real-valued coefficients for V (R=t):<br />
<br />
p0 = -0.42111473798940136<br />
<br />
p1 = -0.4121736499899753<br />
<br />
p2 = -0.3350240707669929<br />
<br />
p3 = -0.3224547931861314<br />
<br />
p4 = -0.25883387978005545<br />
<br />
p5 = -0.20951913473498104<br />
<br />
p6 = -0.0598657149803332<br />
<br />
q0 = 0.9107782439906195<br />
<br />
q1 = 0.8109855829278226<br />
<br />
q2 = 0.715846584586721<br />
<br />
q3 = 0.6135951570714172<br />
<br />
q4 = 0.49846644853347627<br />
<br />
q5 = 0.3945215834922529<br />
<br />
q6 = 0.21822275136248082<br />
<br />
CG = 9.81157<br />
<br />
{|<br />
!<br />
!p0<br />
!p1<br />
!p2<br />
!p3<br />
!p4<br />
!p5<br />
!p6<br />
!q0<br />
!q1<br />
!q2<br />
!q3<br />
!q4<br />
!q5<br />
!q6<br />
!s0<br />
!s1<br />
!s2<br />
!s3<br />
!s4<br />
!s5<br />
!s6<br />
!s7<br />
!CG<br />
!Filterbank<br />
|-<br />
|R=f<br>6-bit<br />
| -24/64<br>-0.375<br />
| -23/64<br>-0.359375<br />
| -17/64<br>-0.265625<br />
| -12/64<br>-0.1875<br />
| -14/64<br>-0.21875<br />
| -13/64<br>-0.203125<br />
| -7/64<br>-0.109375<br />
| 50/64<br>0.78125<br />
| 40/64<br>0.625<br />
| 31/64<br>0.484375<br />
| 22/64<br>0.34375<br />
| 18/64<br>0.28125<br />
| 16/64<br>0.25<br />
| 11/64<br>0.171875<br />
| 90/64<br>1.40625<br />
| 74/64<br>1.15625<br />
| 73/64<br>1.140625<br />
| 71/64<br>1.109375<br />
| 67/64<br>1.046875<br />
| 67/64<br>1.046875<br />
| 67/64<br>1.046875<br />
| 72/64<br>1.125<br />
| &nbsp;<br>9.89338<br />
| [[Image:16x32.png|64px]]<br />
|-<br />
|R=t,D=f<br />
| -26/64<br>-0.40625<br />
| -27/64<br>-0.421875<br />
| -22/64<br>-0.34375<br />
| -18/64<br>-0.28125<br />
| -16/64<br>-0.25<br />
| -14/64<br>-0.21875<br />
| -5/64<br>-0.078125<br />
| 58/64<br>0.90625<br />
| 52/64<br>0.8125<br />
| 45/64<br>0.703125<br />
| 36/64<br>0.5625<br />
| 31/64<br>0.484375<br />
| 23/64<br>0.359375<br />
| 13/64<br>0.203125<br />
| 3/2<br>1.5<br />
| 77/64<br>1.203125<br />
| 77/64<br>1.203125<br />
| 1105/896<br>1.23326<br />
| 218/192<br>1.135417<br />
| 197/176<br>1.119318<br />
| 1919/1664<br>1.153245<br />
| 4351/3840<br>1.133073<br />
| &nbsp;<br>9.79398<br />
| [[Image:16x32r.png|64px]]<br />
|-<br />
|R=t,D=t<br>6-bit<br />
| -32/64<br>-0.5<br />
| -28/64<br>-0.4375<br />
| -24/64<br>-0.375<br />
| -32/64<br>-0.5<br />
| -24/64<br>-0.375<br />
| -13/64<br>-0.203125<br />
| -2/64<br>-0.03125<br />
| 59/64<br>0.921875<br />
| 53/64<br>0.828125<br />
| 46/64<br>0.71875<br />
| 41/64<br>0.640625<br />
| 35/64<br>0.546875<br />
| 24/64<br>0.375<br />
| 12/64<br>0.1875<br />
| 80/64<br>1.25<br />
| 72/64<br>1.125<br />
| 73/64<br>1.140625<br />
| 68/64<br>1.0625<br />
| 72/64<br>1.125<br />
| 74/64<br>1.15625<br />
| 74/64<br>1.15625<br />
| 70/64<br>1.09375<br />
| &nbsp;<br>9.78294<br />
| [[Image:16x32rd.png|64px]]<br />
|}<br />
<br />
== Type-IV Coding Gain ==<br />
<br />
{|<br />
!<br />
!4x8<br />
!4x8 Ramp<br />
!8x16<br />
!8x16 Ramp<br />
!16x32<br />
!16x32 Ramp<br />
|-<br />
|Real Valued<br />
|8.6349<br />
|8.60603<br />
|9.6005<br />
|9.56867<br />
|9.9057<br />
|9.81157<br />
|-<br />
|Dyadic (8-bit)<br />
|<br />
|8.60104<br />
|<br />
|9.56761<br />
|<br />
|<br />
|-<br />
|Loss<br />
|<br />
|0.00499<br />
|<br />
|0.00105<br />
|<br />
|<br />
|-<br />
|Dyadic (7-bit)<br />
|<br />
|8.59886<br />
|<br />
|9.56672<br />
|<br />
|<br />
|-<br />
|Loss<br />
|<br />
|0.00717<br />
|<br />
|0.00195<br />
|<br />
|<br />
|-<br />
|Dyadic (6-bit)<br />
|8.63473<br />
|8.59886<br />
|9.60021<br />
|9.56161<br />
|9.89338<br />
|9.78294<br />
|-<br />
|Loss<br />
|0.00017<br />
|0.00717<br />
|0.00029<br />
|0.00706<br />
|0.01232<br />
|0.02863<br />
|-<br />
|Dyadic (5-bit)<br />
|8.63409<br />
|8.56068<br />
|9.59946<br />
|9.5596<br />
|<br />
|<br />
|-<br />
|Loss<br />
|0.00081<br />
|0.04535<br />
|0.00104<br />
|0.00907<br />
|<br />
|<br />
|}<br />
<br />
== 8x16 Type-III ==<br />
<br />
{|<br />
!<br />
!p0<br />
!p1<br />
!p2<br />
!q0<br />
!q1<br />
!q2<br />
!s0<br />
!s1<br />
!s2<br />
!s3<br />
!CG<br />
!Filterbank<br />
|-<br />
|R=f<br>6-bit<br />
| -25/64<br>-0.390625<br />
| -20/64<br>-0.3125<br />
| -7/64<br>-0.109375<br />
| 49/64<br>0.765625<br />
| 35/64<br>0.546875<br />
| 21/64<br>0.328125<br />
| 90/64<br>1.40625<br />
| 72/64<br>1.125<br />
| 73/64<br>1.140625<br />
| 76/64<br>1.1875<br />
| &nbsp;<br>9.6112<br />
| [[Image:8x16_type3.png|64px]]<br />
|-<br />
|R=f<br>5-bit<br />
| -13/32<br>-0.40625<br />
| -11/32<br>-0.34375<br />
| -4/32<br>-0.125<br />
| 25/32<br>0.78125<br />
| 18/32<br>0.5625<br />
| 11/32<br>0.34375<br />
| 45/32<br>1.40625<br />
| 36/32<br>1.125<br />
| 36/32<br>1.125<br />
| 38/32<br>1.1875<br />
| &nbsp;<br>9.61048<br />
| [[Image:8x16_type3_5bit.png|64px]]<br />
|}<br />
<br />
== 16x32 Type-III ==<br />
<br />
{|<br />
!<br />
!p0<br />
!p1<br />
!p2<br />
!p3<br />
!p4<br />
!p5<br />
!p6<br />
!q0<br />
!q1<br />
!q2<br />
!q3<br />
!q4<br />
!q5<br />
!q6<br />
!s0<br />
!s1<br />
!s2<br />
!s3<br />
!s4<br />
!s5<br />
!s6<br />
!s7<br />
!CG<br />
!Filterbank<br />
|-<br />
|R=f<br>6-bit<br />
| -30/64<br>-0.46875<br />
| -35/64<br>-0.546875<br />
| -31/64<br>-0.484375<br />
| -29/64<br>-0.453125<br />
| -25/64<br>-0.390625<br />
| -19/64<br>-0.296875<br />
| -10/64<br>-0.15625<br />
| 54/64<br>0.84375<br />
| 45/64<br>0.703125<br />
| 40/64<br>0.625<br />
| 36/64<br>0.5625<br />
| 32/64<br>0.5<br />
| 25/64<br>0.390625<br />
| 17/64<br>0.265625<br />
| 90/64<br>1.40625<br />
| 70/64<br>1.09375<br />
| 69/64<br>1.078125<br />
| 67/64<br>1.046875<br />
| 67/64<br>1.046875<br />
| 67/64<br>1.046875<br />
| 68/64<br>1.0625<br />
| 74/64<br>1.15625<br />
| &nbsp;<br>9.94127<br />
| [[Image:16x32_type3_6bit.png|64px]]<br />
|-<br />
|R=f<br>5-bit<br />
| -15/32<br>-0.46875<br />
| -17/32<br>-0.53125<br />
| -14/32<br>-0.4375<br />
| -12/32<br>-0.375<br />
| -9/32<br>-0.28125<br />
| -5/32<br>-0.15625<br />
| 0/32<br>0.0<br />
| 27/32<br>0.84375<br />
| 23/32<br>0.71875<br />
| 20/32<br>0.625<br />
| 17/32<br>0.53125<br />
| 14/32<br>0.4375<br />
| 9/32<br>0.28125<br />
| 3/32<br>0.09375<br />
| 45/32<br>1.40625<br />
| 35/32<br>1.09375<br />
| 35/32<br>1.09375<br />
| 34/32<br>1.0625<br />
| 34/32<br>1.0625<br />
| 35/32<br>1.09375<br />
| 36/32<br>1.125<br />
| 33/32<br>1.03125<br />
| &nbsp;<br>9.93998<br />
| [[Image:16x32_type3_5bit.png|64px]]<br />
|}<br />
<br />
== Type-III Coding Gain ==<br />
<br />
{|<br />
!<br />
!4x8<br />
!8x16<br />
!16x32<br />
|-<br />
|Real Valued<br />
|8.6349<br />
|9.6115<br />
|9.9496<br />
|-<br />
|Dyadic (6-bit)<br />
|8.63473<br />
|9.6112<br />
|9.94127<br />
|-<br />
|Loss<br />
|0.00017<br />
|0.00030<br />
|0.00833<br />
|-<br />
|Dyadic (5-bit)<br />
|8.63409<br />
|9.61048<br />
|9.93998<br />
|-<br />
|Loss<br />
|0.00081<br />
|0.00102<br />
|0.00962<br />
|}<br />
<br />
== Simplex search results ==<br />
<br />
=== Type-IV ===<br />
* 8x16 2D AR95<br />
** 19.199865874793673 { 89, 73, 72, 75,-23,-18, -6, 48, 34, 20}<br />
* 8x16 Subset 1<br />
** 13.9812271938690706 { 84, 68, 67, 68,-24,-19, -8, 38, 24, 13}<br />
* 8x16 Subset 3<br />
** 16.7631044694739657 { 85, 68, 67, 69,-24,-18, -9, 38, 24, 13}<br />
<br />
=== Type-III ===<br />
* 8x16 2D AR95<br />
** 19.2223200050370124 { 90, 72, 73, 76,-25,-20, -7, 49, 35, 21}<br />
* 8x16 Subset 1<br />
** 14.0121200303196343 { 86, 66, 67, 69,-28,-25,-11, 44, 28, 16}<br />
* 8x16 Subset 3<br />
** 16.8035257369844686 { 87, 66, 67, 70,-29,-24,-11, 44, 28, 15}</div>Gmaxwellhttps://wiki.xiph.org/index.php?title=TDLT&diff=14101TDLT2013-04-23T00:06:24Z<p>Gmaxwell: add some search results</p>
<hr />
<div>This page holds the results of Time Domain Lapped Transform (TDLT) optimization problems looking for integer transform coefficients that provide optimal coding gain. Wherever possible the assumptions are stated. Later we should include testing against actual image data to verify the results (see test data [http://people.xiph.org/~tterribe/tmp/subset1-y4m.tar.gz here]).<br />
<br />
The coding gain objective used as the objective is taken from slide 13 of Tim's presentation [http://people.xiph.org/~tterribe/pubs/lca2012/auckland/intro_to_video1.pdf An Introduction to Video Coding]<br />
<br />
<need figure with block matrix diagrams><br />
<br />
The free parameters are initially just the coefficients p_0,...,p_m,q_0,...,q_m where m=(n/2)-1. We limit these to being dyadic rationals, e.g., x/2^d with d=6, between [-1,1].<br />
<br />
Given p's and q's and assuming a linear ramp constrains the s's.<br />
<br />
== 4x8 ==<br />
<br />
Optimal real-valued coefficients for V:<br />
<br />
p0 = -0.18117338915051454<br />
<br />
q0 = 0.6331818230771687<br />
<br />
CG = 8.60603<br />
<br />
{|<br />
!<br />
!p0<br />
!q0<br />
!s0<br />
!s1<br />
!CG<br />
!SBA<br />
!Filterbank<br />
|-<br />
|R=f<br>6-bit<br />
| -11/64<br>-0.171875<br />
| 36/64<br>0.5625<br />
| 91/64<br>1.421875<br />
| 85/64<br>1.328125<br />
| &nbsp;<br>8.63473<br />
| &nbsp;<br>22.0331<br />
| [[Image:4x8.png|64px]]<br />
|-<br />
|R=f<br>5-bit<br />
| -5/32<br>-0.15625<br />
| 18/32<br>0.5625<br />
| 46/32<br>1.4375<br />
| 42/32<br>1.3125<br />
| &nbsp;<br>8.63409<br />
| &nbsp;<br>22.5715<br />
| [[Image:4x8_5bit.png|64px]]<br />
|-<br />
|R=t,D=f<br />
| -12/64<br>-0.1875<br />
| 41/64<br>0.640625<br />
| 92/64<br>1.4375<br />
| 1093/768<br>1.423177<br />
| &nbsp;<br>8.60486<br />
| &nbsp;<br>20.0573<br />
| [[Image:4x8r.png|64px]]<br />
|-<br />
|R=t,D=t<br>8-bit<br />
| -32/256<br>-0.125<br />
| 162/256<br>0.6328125<br />
| 376/256<br>1.46875<br />
| 357/256<br>1.39453125<br />
| &nbsp;<br>8.60104<br />
| &nbsp;<br>21.4037<br />
| [[Image:4x8rd_8bit.png|64px]]<br />
|-<br />
|R=t,D=t<br>7-bit<br />
| -32/128<br>-0.25<br />
| 82/128<br>0.640625<br />
| 184/128<br>1.4375<br />
| 186/128<br>1.453125<br />
| &nbsp;<br>8.59886<br />
| &nbsp;<br>18.9411<br />
| [[Image:4x8rd_7bit.png|64px]]<br />
|-<br />
|R=t,D=t<br>6-bit<br />
| -16/64<br>-0.25<br />
| 41/64<br>0.640625<br />
| 92/64<br>1.4375<br />
| 93/64<br>1.453125<br />
| &nbsp;<br>8.59886<br />
| &nbsp;<br>18.9411<br />
| [[Image:4x8rd.png|64px]]<br />
|-<br />
|R=t,D=t<br>5-bit<br />
| -8/32<br>-0.25<br />
| 19/32<br>0.59375<br />
| 52/32<br>1.625<br />
| 47/32<br>1.46875<br />
| &nbsp;<br>8.56068<br />
| &nbsp;<br>20.3279<br />
| [[Image:4x8rd_5bit.png|64px]]<br />
|-<br />
|R=t,D=t<br>max SBA<br />
| -8/64<br>-0.125<br />
| 30/64<br>0.46875<br />
| 136/64<br>2.125<br />
| 91/64<br>1.421875<br />
| &nbsp;<br>8.23230<br />
| &nbsp;<br>25.1934<br />
| [[Image:4x8rd_sba.png|64px]]<br />
|}<br />
<br />
== 8x16 ==<br />
<br />
Optimal real-valued coefficients for V:<br />
<br />
p0 = -0.39460731547057293<br />
<br />
p1 = -0.33002212811740816<br />
<br />
p2 = -0.12391270981321137<br />
<br />
q0 = 0.822154737511288<br />
<br />
q1 = 0.632488694485779<br />
<br />
q2 = 0.40214668677553894<br />
<br />
CG = 9.56867<br />
<br />
{|<br />
!<br />
!p0<br />
!p1<br />
!p2<br />
!q0<br />
!q1<br />
!q2<br />
!s0<br />
!s1<br />
!s2<br />
!s3<br />
!CG<br />
!Filterbank<br />
|-<br />
|R=f<br>6-bit<br />
| -23/64<br>-0.359375<br />
| -18/64<br>-0.28125<br />
| -6/64<br>-0.09375<br />
| 48/64<br>0.75<br />
| 34/64<br>0.53125<br />
| 20/64<br>0.3125<br />
| 90/64<br>1.40625<br />
| 73/64<br>1.140625<br />
| 72/64<br>1.125<br />
| 75/64<br>1.171875<br />
| &nbsp;<br>9.60021<br />
| [[Image:8x16.png|64px]]<br />
|-<br />
|R=f<br>5-bit<br />
| -12/32<br>-0.375<br />
| -9/32<br>-0.28125<br />
| -4/32<br>-0.125<br />
| 24/32<br>0.75<br />
| 17/32<br>0.53125<br />
| 10/32<br><br />
| 45/32<br>1.40625<br />
| 37/32<br>1.15625<br />
| 36/32<br><br />
| 38/32<br>1.1875<br />
| &nbsp;<br>9.59946<br />
| [[Image:8x16_5bit.png|64px]]<br />
|-<br />
|R=t,D=f<br />
| -26/64<br>-0.40625<br />
| -22/64<br>-0.34375<br />
| -8/64<br>-0.125<br />
| 53/64<br>0.828125<br />
| 41/64<br>0.640625<br />
| 26/64<br>0.40625<br />
| 11/8<br>1.375<br />
| 879/768<br>1.14453125<br />
| 1469/1280<br>1.14765625<br />
| 275/224<br>1.2276785714285714<br />
| &nbsp;<br>9.56627<br />
| [[Image:8x16r.png|64px]]<br />
|-<br />
|R=t,D=t<br>8-bit<br />
| -96/256<br>-0.375<br />
| -83/256<br>-0.32421875<br />
| -36/256<br>-0.140625<br />
| 210/256<br>0.8203125<br />
| 160/256<br>0.625<br />
| 104/256<br>0.40625<br />
| 368/256<br>1.4375<br />
| 302/256<br>1.1796875<br />
| 293/256<br>1.14453125<br />
| 317/256<br>1.23828125<br />
| &nbsp;<br>9.56761<br />
| [[Image:8x16rd_8bit.png|64px]]<br />
|-<br />
|R=t,D=t<br>7-bit<br />
| -48/128<br>-0.375<br />
| -45/128<br>-0.3515625<br />
| -16/128<br>-0.125<br />
| 105/128<br>0.8203125<br />
| 80/128<br>0.625<br />
| 53/128<br>0.4140625<br />
| 184/128<br>1.4375<br />
| 151/128<br>1.1796875<br />
| 147/128<br>1.1484375<br />
| 157/128<br>1.2265625<br />
| &nbsp;<br>9.56672<br />
| [[Image:8x16rd_7bit.png|64px]]<br />
|-<br />
|R=t,D=t<br>6-bit<br />
| -24/64<br>-0.375<br />
| -20/64<br>-0.3125<br />
| -4/64<br>-0.0625<br />
| 53/64<br>0.828125<br />
| 40/64<br>0.625<br />
| 24/64<br>0.375<br />
| 88/64<br>1.375<br />
| 75/64<br>1.171875<br />
| 76/64<br>1.1875<br />
| 76/64<br>1.1875<br />
| &nbsp;<br>9.56161<br />
| [[Image:8x16rd.png|64px]]<br />
|-<br />
|R=t,D=t<br>5-bit<br />
| -12/32<br>-0.375<br />
| -10/32<br>-0.3125<br />
| -2/32<br>-0.0625<br />
| 26/32<br>0.8125<br />
| 20/32<br>0.625<br />
| 12/32<br>0.375<br />
| 48/32<br>1.5<br />
| 38/32<br>1.1875<br />
| 38/32<br>1.1875<br />
| 38/32<br>1.1875<br />
| &nbsp;<br>9.5596<br />
| [[Image:8x16rd_5bit.png|64px]]<br />
|}<br />
<br />
== 16x32 ==<br />
<br />
Best-known real-valued coefficients for V (R=t):<br />
<br />
p0 = -0.42111473798940136<br />
<br />
p1 = -0.4121736499899753<br />
<br />
p2 = -0.3350240707669929<br />
<br />
p3 = -0.3224547931861314<br />
<br />
p4 = -0.25883387978005545<br />
<br />
p5 = -0.20951913473498104<br />
<br />
p6 = -0.0598657149803332<br />
<br />
q0 = 0.9107782439906195<br />
<br />
q1 = 0.8109855829278226<br />
<br />
q2 = 0.715846584586721<br />
<br />
q3 = 0.6135951570714172<br />
<br />
q4 = 0.49846644853347627<br />
<br />
q5 = 0.3945215834922529<br />
<br />
q6 = 0.21822275136248082<br />
<br />
CG = 9.81157<br />
<br />
{|<br />
!<br />
!p0<br />
!p1<br />
!p2<br />
!p3<br />
!p4<br />
!p5<br />
!p6<br />
!q0<br />
!q1<br />
!q2<br />
!q3<br />
!q4<br />
!q5<br />
!q6<br />
!s0<br />
!s1<br />
!s2<br />
!s3<br />
!s4<br />
!s5<br />
!s6<br />
!s7<br />
!CG<br />
!Filterbank<br />
|-<br />
|R=f<br>6-bit<br />
| -24/64<br>-0.375<br />
| -23/64<br>-0.359375<br />
| -17/64<br>-0.265625<br />
| -12/64<br>-0.1875<br />
| -14/64<br>-0.21875<br />
| -13/64<br>-0.203125<br />
| -7/64<br>-0.109375<br />
| 50/64<br>0.78125<br />
| 40/64<br>0.625<br />
| 31/64<br>0.484375<br />
| 22/64<br>0.34375<br />
| 18/64<br>0.28125<br />
| 16/64<br>0.25<br />
| 11/64<br>0.171875<br />
| 90/64<br>1.40625<br />
| 74/64<br>1.15625<br />
| 73/64<br>1.140625<br />
| 71/64<br>1.109375<br />
| 67/64<br>1.046875<br />
| 67/64<br>1.046875<br />
| 67/64<br>1.046875<br />
| 72/64<br>1.125<br />
| &nbsp;<br>9.89338<br />
| [[Image:16x32.png|64px]]<br />
|-<br />
|R=t,D=f<br />
| -26/64<br>-0.40625<br />
| -27/64<br>-0.421875<br />
| -22/64<br>-0.34375<br />
| -18/64<br>-0.28125<br />
| -16/64<br>-0.25<br />
| -14/64<br>-0.21875<br />
| -5/64<br>-0.078125<br />
| 58/64<br>0.90625<br />
| 52/64<br>0.8125<br />
| 45/64<br>0.703125<br />
| 36/64<br>0.5625<br />
| 31/64<br>0.484375<br />
| 23/64<br>0.359375<br />
| 13/64<br>0.203125<br />
| 3/2<br>1.5<br />
| 77/64<br>1.203125<br />
| 77/64<br>1.203125<br />
| 1105/896<br>1.23326<br />
| 218/192<br>1.135417<br />
| 197/176<br>1.119318<br />
| 1919/1664<br>1.153245<br />
| 4351/3840<br>1.133073<br />
| &nbsp;<br>9.79398<br />
| [[Image:16x32r.png|64px]]<br />
|-<br />
|R=t,D=t<br>6-bit<br />
| -32/64<br>-0.5<br />
| -28/64<br>-0.4375<br />
| -24/64<br>-0.375<br />
| -32/64<br>-0.5<br />
| -24/64<br>-0.375<br />
| -13/64<br>-0.203125<br />
| -2/64<br>-0.03125<br />
| 59/64<br>0.921875<br />
| 53/64<br>0.828125<br />
| 46/64<br>0.71875<br />
| 41/64<br>0.640625<br />
| 35/64<br>0.546875<br />
| 24/64<br>0.375<br />
| 12/64<br>0.1875<br />
| 80/64<br>1.25<br />
| 72/64<br>1.125<br />
| 73/64<br>1.140625<br />
| 68/64<br>1.0625<br />
| 72/64<br>1.125<br />
| 74/64<br>1.15625<br />
| 74/64<br>1.15625<br />
| 70/64<br>1.09375<br />
| &nbsp;<br>9.78294<br />
| [[Image:16x32rd.png|64px]]<br />
|}<br />
<br />
== Type-IV Coding Gain ==<br />
<br />
{|<br />
!<br />
!4x8<br />
!4x8 Ramp<br />
!8x16<br />
!8x16 Ramp<br />
!16x32<br />
!16x32 Ramp<br />
|-<br />
|Real Valued<br />
|8.6349<br />
|8.60603<br />
|9.6005<br />
|9.56867<br />
|9.9057<br />
|9.81157<br />
|-<br />
|Dyadic (8-bit)<br />
|<br />
|8.60104<br />
|<br />
|9.56761<br />
|<br />
|<br />
|-<br />
|Loss<br />
|<br />
|0.00499<br />
|<br />
|0.00105<br />
|<br />
|<br />
|-<br />
|Dyadic (7-bit)<br />
|<br />
|8.59886<br />
|<br />
|9.56672<br />
|<br />
|<br />
|-<br />
|Loss<br />
|<br />
|0.00717<br />
|<br />
|0.00195<br />
|<br />
|<br />
|-<br />
|Dyadic (6-bit)<br />
|8.63473<br />
|8.59886<br />
|9.60021<br />
|9.56161<br />
|9.89338<br />
|9.78294<br />
|-<br />
|Loss<br />
|0.00017<br />
|0.00717<br />
|0.00029<br />
|0.00706<br />
|0.01232<br />
|0.02863<br />
|-<br />
|Dyadic (5-bit)<br />
|8.63409<br />
|8.56068<br />
|9.59946<br />
|9.5596<br />
|<br />
|<br />
|-<br />
|Loss<br />
|0.00081<br />
|0.04535<br />
|0.00104<br />
|0.00907<br />
|<br />
|<br />
|}<br />
<br />
== 8x16 Type-III ==<br />
<br />
{|<br />
!<br />
!p0<br />
!p1<br />
!p2<br />
!q0<br />
!q1<br />
!q2<br />
!s0<br />
!s1<br />
!s2<br />
!s3<br />
!CG<br />
!Filterbank<br />
|-<br />
|R=f<br>6-bit<br />
| -25/64<br>-0.390625<br />
| -20/64<br>-0.3125<br />
| -7/64<br>-0.109375<br />
| 49/64<br>0.765625<br />
| 35/64<br>0.546875<br />
| 21/64<br>0.328125<br />
| 90/64<br>1.40625<br />
| 72/64<br>1.125<br />
| 73/64<br>1.140625<br />
| 76/64<br>1.1875<br />
| &nbsp;<br>9.6112<br />
| [[Image:8x16_type3.png|64px]]<br />
|-<br />
|R=f<br>5-bit<br />
| -13/32<br>-0.40625<br />
| -11/32<br>-0.34375<br />
| -4/32<br>-0.125<br />
| 25/32<br>0.78125<br />
| 18/32<br>0.5625<br />
| 11/32<br>0.34375<br />
| 45/32<br>1.40625<br />
| 36/32<br>1.125<br />
| 36/32<br>1.125<br />
| 38/32<br>1.1875<br />
| &nbsp;<br>9.61048<br />
| [[Image:8x16_type3_5bit.png|64px]]<br />
|}<br />
<br />
== 16x32 Type-III ==<br />
<br />
{|<br />
!<br />
!p0<br />
!p1<br />
!p2<br />
!p3<br />
!p4<br />
!p5<br />
!p6<br />
!q0<br />
!q1<br />
!q2<br />
!q3<br />
!q4<br />
!q5<br />
!q6<br />
!s0<br />
!s1<br />
!s2<br />
!s3<br />
!s4<br />
!s5<br />
!s6<br />
!s7<br />
!CG<br />
!Filterbank<br />
|-<br />
|R=f<br>6-bit<br />
| -30/64<br>-0.46875<br />
| -35/64<br>-0.546875<br />
| -31/64<br>-0.484375<br />
| -29/64<br>-0.453125<br />
| -25/64<br>-0.390625<br />
| -19/64<br>-0.296875<br />
| -10/64<br>-0.15625<br />
| 54/64<br>0.84375<br />
| 45/64<br>0.703125<br />
| 40/64<br>0.625<br />
| 36/64<br>0.5625<br />
| 32/64<br>0.5<br />
| 25/64<br>0.390625<br />
| 17/64<br>0.265625<br />
| 90/64<br>1.40625<br />
| 70/64<br>1.09375<br />
| 69/64<br>1.078125<br />
| 67/64<br>1.046875<br />
| 67/64<br>1.046875<br />
| 67/64<br>1.046875<br />
| 68/64<br>1.0625<br />
| 74/64<br>1.15625<br />
| &nbsp;<br>9.94127<br />
| [[Image:16x32_type3_6bit.png|64px]]<br />
|-<br />
|R=f<br>5-bit<br />
| -15/32<br>-0.46875<br />
| -17/32<br>-0.53125<br />
| -14/32<br>-0.4375<br />
| -12/32<br>-0.375<br />
| -9/32<br>-0.28125<br />
| -5/32<br>-0.15625<br />
| 0/32<br>0.0<br />
| 27/32<br>0.84375<br />
| 23/32<br>0.71875<br />
| 20/32<br>0.625<br />
| 17/32<br>0.53125<br />
| 14/32<br>0.4375<br />
| 9/32<br>0.28125<br />
| 3/32<br>0.09375<br />
| 45/32<br>1.40625<br />
| 35/32<br>1.09375<br />
| 35/32<br>1.09375<br />
| 34/32<br>1.0625<br />
| 34/32<br>1.0625<br />
| 35/32<br>1.09375<br />
| 36/32<br>1.125<br />
| 33/32<br>1.03125<br />
| &nbsp;<br>9.93998<br />
| [[Image:16x32_type3_5bit.png|64px]]<br />
|}<br />
<br />
== Type-III Coding Gain ==<br />
<br />
{|<br />
!<br />
!4x8<br />
!8x16<br />
!16x32<br />
|-<br />
|Real Valued<br />
|8.6349<br />
|9.6115<br />
|9.9496<br />
|-<br />
|Dyadic (6-bit)<br />
|8.63473<br />
|9.6112<br />
|9.94127<br />
|-<br />
|Loss<br />
|0.00017<br />
|0.00030<br />
|0.00833<br />
|-<br />
|Dyadic (5-bit)<br />
|8.63409<br />
|9.61048<br />
|9.93998<br />
|-<br />
|Loss<br />
|0.00081<br />
|0.00102<br />
|0.00962<br />
|}<br />
<br />
== Simplex search results ==<br />
<br />
=== Type-IV ===<br />
* 8x16 2D AR95<br />
** 19.199865874793673 { 89, 73, 72, 75,-23,-18, -6, 48, 34, 20}<br />
* 8x16 Subset 1<br />
** 13.9812271938690706 { 84, 68, 67, 68,-24,-19, -8, 38, 24, 13}<br />
* 8x16 Subset 3<br />
** 16.7631044694739657 { 85, 68, 67, 69,-24,-18, -9, 38, 24, 13}<br />
<br />
== Type-III ===<br />
* 8x16 2D AR95<br />
** 19.2223200050370124 { 90, 72, 73, 76,-25,-20, -7, 49, 35, 21}<br />
* 8x16 Subset 1<br />
** 14.0121200303196343 { 86, 66, 67, 69,-28,-25,-11, 44, 28, 16}<br />
* 8x16 Subset 3<br />
** 16.8035257369844686 { 87, 66, 67, 70,-29,-24,-11, 44, 28, 15}</div>Gmaxwellhttps://wiki.xiph.org/index.php?title=Daala_on_Wheels&diff=14071Daala on Wheels2013-03-16T03:23:17Z<p>Gmaxwell: Reverted edits by Ipodsoft (talk) to last revision by Rillian</p>
<hr />
<div>Daala is the current working name of a next generation video codec— to be renamed once someone insists on something better. So far the best proposed alternative is PatentCake.<br />
<br />
For now the purposes of this page is to collect notes about things which have been discussed in informal public IRC discussion about the next generation initiative. Participants in these discussions have included Timothy Terriberry, Jason Garrett-Glaser, Loren Merritt, Ben Schwartz, Greg Maxwell, and others. <br />
<br />
See also: [https://xiph.org/daala/ https://xiph.org/daala/]<br />
<br />
== Weekly meetings ==<br />
<br />
We've been having weekly progress meetings on mumble.<br />
<br />
* 2012 June 4 [https://people.xiph.org/~giles/2012/daala_20120604.txt minutes] (actually a work week)<br />
* 2012 June 22 [https://people.xiph.org/~giles/2012/daala_20120622.txt minutes]<br />
* 2012 June 29 [https://people.xiph.org/~giles/2012/daala_20120629.txt minutes] [https://people.xiph.org/~giles/2012/daala_20120629.opus recording]<br />
* 2012 July 6 [https://people.xiph.org/~giles/2012/daala_20120706.txt minutes]<br />
* 2012 July 13 [https://people.xiph.org/~giles/2012/daala_20120713.txt minutes]<br />
* 2012 July 20 [https://people.xiph.org/~giles/2012/daala_20120720.txt minutes]<br />
* 2012 July 27 [https://people.xiph.org/~giles/2012/daala_20120727.txt minutes]<br />
* 2012 August 3 [https://people.xiph.org/~giles/2012/daala_20120803.txt minutes] [https://people.xiph.org/~giles/2012/daala_20120803.opus recording]<br />
* 2012 August 10 [https://people.xiph.org/~giles/2012/daala_20120810.txt minutes]<br />
* 2012 August 17 - no meeting<br />
* 2012 August 24 - [https://people.xiph.org/~giles/2012/daala_20120824.txt minutes] [https://people.xiph.org/~giles/2012/daala_20120824.opus recording]<br />
* 2012 August 31 - no meeting<br />
* 2012 September 7 - no meeting<br />
* 2012 September 14 - no meeting<br />
* 2012 September 21 - [https://people.xiph.org/~giles/2012/daala_20120921.txt minutes]<br />
* 2012 September 28 - [https://people.xiph.org/~giles/2012/daala_20120928.txt minutes] [https://people.xiph.org/~giles/2012/daala_20120928.opus recording]<br />
* 2012 October 5 - [https://people.xiph.org/~giles/2012/daala_20121005.opus recording]<br />
* 20120 October 26 - <br />
* 2012 Novemeber 2 - no meeting<br />
* 2012 December 7 - [https://people.xiph.org/~giles/2012/daala_20121207.txt minutes]<br />
<br />
= Techniques =<br />
<br />
The discussed overall structure so far has been a variable size lapped-DCT block based codec with lapping done via pre/post filtering with a specially structured (lifting) linear phase transform along the edges along with overlapped block motion compensation and the expected trimmings. The lapping can be optimized for energy compaction and other useful properties, including invert-ability, and yields excellent results with efficient finite precision math.<br />
<br />
Other components which have been discussed include:<br />
<br />
==Techniques applicable to all frame types==<br />
* Multisymbol arithmetic coding <br />
** Timothy has some trial code showing speed-up proportional to the number of bits coded at once. (ec_test.c)<br />
* Mode prediction using the previously decoded data, e.g. coding the mode using a probability function derived from trained predictors on the surrounding blocks. <br />
** This will be terrible for robustness but may significantly reduce signalling overhead, allowing many more modes, and provide continuous adaptation between signalling free and fully signalled modes.<br />
* Explore legendre polynomial basis transforms instead of DCT<br />
** May have better perceptual properties and/or result in 'less compromised' efficient implementations. <br />
* Coefficient domain prediction to allow efficient energy preserving quantization.<br />
* Variable partition size/shape and the use of good predictors appears to remove most of the benefit of directional transforms.<br />
** Perhaps 45deg is still useful?<br />
** How does this change with partition sizes? Directional transforms are clearly not that useful with 4x4. <br />
* Transform-post filtering to allow merging smaller transform blocks (like TF merging in CELT) may allow more flexible partitioning then outright using mixed block sizes.<br />
* Perturbed quantization mode-signalling has been discussed but mostly laughed at. ;) <br />
* Special block modes well suited to solid color/cartoon like content— avoiding ringing.<br />
** Are pixel prediction modes too slow?<br />
* In general— what markov random field techniques can be applied with acceptable performance. Any?<br />
* Designed for parallel encode and decode within each frame<br />
** Important because<br />
*** the proposed techniques need a lot more CPU than H.264 and VP8 for both encode and decode<br />
*** Moore's law for single-threaded throughput is dead. Future hardware is all multicore/GPU.<br />
** Implies<br />
*** Getting the order of application right for the lapping filters.<br />
*** Mandatory slicing? Maybe some kind of multilevel entropy coding to reduce redundancy between slices while minimizing the single-threaded portion of decode.<br />
<br />
* Using PVQ and energy conservation: see http://jmvalin.ca/video/video_pvq_v3.pdf<br />
<br />
==Techniques applicable to inter frames==<br />
* Using x264 as a test-bed Jason and Loren demonstrated 15% rate/distortion improvements from using 10-bit intermediaries and references, estimated as being 1/3rd from quality calculation in the 10-bit space, 1/3rd from the higher precision references, and 1/3rd from higher intermediate precision in calculations (e.g. MC filter processing).<br />
** Increased reference precision competes for memory with increased number of references. The improvements demonstrated appear to be a greater win than increasing the reference count once there are four references or so.<br />
* Super-resolution techniques for motion-compensation references have been discussed— in particular it appears that the half-pel location is where intelligent filtering matters the most so staged computation could be effectively used to allow more expensive filtering at that level.<br />
** Edge-directed interpolation techniques might be effectively applied to increase motion compensation accuracy, but most of the techniques known to be very effective are too slow.<br />
** Speculation has been offered that a significant part of MC inaccuracy may be due to blending in a physically incorrect (gamma-corrected) space, though no real conclusions were made. Academic papers on motion compensation accuracy seem to have ignored this issue.<br />
* Timothy has an example code base for a variable partition size blocking-free motion compensation scheme which merges OBMC (overlapped block motion compensation) and CGI (control-grid interpolation) with an interesting prediction/sub-division scheme and whole-frame trellis optimization of motion vectors. (daala-exp)<br />
<br />
==Basic features==<br />
* YUV 4:4:4, 4:2:2 , 4:2:0 subsamplings, 8-bit, 10bit.<br />
* Alpha channel — need testing material!<br />
* 8-bit RGB compatible mode? (e.g. YCoCg, internally or at least flagging for it)<br />
* Efficient 3D? — need testing material!<br />
* Lossless?<br />
** The value of this is disputable. If nothing else it's arguable that stuffing lossless into a lossy format may be the only way to get lossless into many people's hands. Also, see below<br />
* Good support for decode side droppable frames?<br />
** Hopefully the referencing structure will be flexible enough to enable this even if it's not an intentional feature.<br />
<br />
==Frills==<br />
* Optionally storing a checksum of the expected decoded frame for decoder/encoder mismatch detection.<br />
* Expose the number of referential descendants of a given frame (or even the whole reference DAG) for most efficient allocation of FEC.<br />
<br />
==Wingdings==<br />
Crazy crap that might be interesting or at least fun to make fun of... <br />
* >10bit?<br />
** Use cases don't seem well enough defined yet. Significant complexity. Any prospective hardware developer may hire assassins.<br />
** Possible compromise: the video reference structure contains a backbone that can be decoded at only N bits of depth (e.g. 10), and higher precisions are only supported outside of this reference chain.<br />
**# Precision by truncation: decode is performed twice on each frame, identically, at low and high precision. The only difference between them is the bit-depth of the transform, or possibly of the transform and MC filters. Only low-precision outputs can be referenced by subsequent frames. Useful if high-precision content is still worth watching at low precision.<br />
**# Precision by gamma: decode is performed once at low precision as normal. Then the output frame is converted to linear-light at high precision, after which another layer of residuals is added. The second layer can be permitted to reference previous high-precision frames... tricky to use both sets of references though. Useful if high precision is used for storing linear data, but people still want to watch it on "low-end" hardware.<br />
* Some high end digital cameras are operating jpeg-derivatives in a special mode that keeps the image in the native linear RGB bayer format in order to avoid lossy/slow demosaicing on the camera. In particular this allows white balancing in post without excessive loss. Probably out of scope for Daala itself.<br />
** Bayer, 4:2:0, 4:2:2, and Interlacing are all special cases of a more general pattern in which the output frames are decimated/subsampled in a regular fashion. All such subsamplings could be supported by a unified framework in which the video is always stored with all planes fully sampled, with a header indicating the recommended subsampling for display. In such cases, the encoder can regard the transform as highly overcomplete, and simply ignore unneeded coefficients (presumably by leaving high frequency residuals coded as zero). This structure would in effect turn the codec into a motion-compensated interpolating/deinterlacing filter. Whether this approach is sensible presumably depends in part on how the transform is structured. It would be especially easy if the transform's highest-frequencies were coded by a wavelet-like layer.<br />
* Lossless intra-ability: The ability to losslessly rewrite any frame as an intra frame (perhaps with significant bitrate overhead) in order to make frame accurate cuts possible.<br />
** Or best handled by making sure that containers have working pre-roll, but presumably common GOP sizes will be greater than the number of references so even if losslessly reencoding the references is expensive it may be cheaper than pre-roll. Do both?<br />
** Can be had for 'free' if lossless is supported, plus the right header flags to restuff the references from lossless copies in a packed hidden frame.<br />
** Use of explicitly (rather than staged) super-resolution and/or deeper references may make this functionality unattractive due to increased overhead.<br />
* Internal overlays which could be swapped without re-encoding? (e.g. advertising, station ID). Could also be automatically generated by a Sufficiently Advanced™ encoder to improve efficiencies for static sprites over moving backgrounds.<br />
** Complicates making the complexity bounded. No Sufficiently Advanced™ encoder likely to ever exist. But perhaps the station id/advertising uses fully justify this.<br />
** Could be done externally to the video codec, but if so it's no likely to be useful for anyone ever.<br />
* A secondary reference implementation in OpenCL, maintained throughout development, to make sure that the codec is GPU-friendly and can be done efficiently using OpenCL primitives.<br />
* SWAR-friendly arithmetic. For example, choosing transform coefficients so that no intermediate product overflows 16 bits (tricky for signed values) can sometimes enable (e.g.) 4 parallel operations in one uint64_t. This can allow a pure C reference implementation to run faster, which is valuable for initial adoption and ports to new platforms.<br />
* Parametric decode-side blur.<br />
** Symmetrical blur in regions that are smooth on scales longer than the block size. Could be signaled or derived from observed DC values.<br />
** Motion blur so that moving objects are blurred along the motion vector. May require coding a shutter speed parameter (0..1 as a fraction of the inter-frame interval).<br />
* Fancy block property prediction. (Not clear how these prediction interact with intra pred)<br />
** Predict block properties (quantizer, energy, etc.) from MV. (0,0) probably means small delta. Larger MV's may correspond to larger deltas ... although at low shutter speeds large MVs may correlate with reduced overall HF energy.<br />
** Predict delta spectral shape from source block spectral shape. HF/LF ratio of the delta may be correlated with the same ratio in its source blocks. Works well with decode-side fDCT.<br />
<br />
==Negative results==<br />
<br />
* Using Kurtosis for detecting text in a frame<br />
** The idea was to detect a Bernouilli distribution but it's not robust and too noisy</div>Gmaxwellhttps://wiki.xiph.org/index.php?title=PortablePlayers&diff=14070PortablePlayers2013-03-16T03:23:12Z<p>Gmaxwell: Reverted edits by Ipodsoft (talk) to last revision by Gsauthof</p>
<hr />
<div>Here you'll find all mobile players known to natively support [[Vorbis]].<br />
<br />
When updating this information, please consider these guidelines: Use the term Vorbis not <strike>OGG</strike> ([[Ogg]] is the container format, Vorbis is the codec name). Add information about other Xiph-codecs such as Speex, FLAC, and Theora. Do not add information about non-Xiph-codecs such as MP3, WMA, or WAV.<br />
<br />
This page contains a [[PortablePlayers#Portable Vorbis Native Support Table|handy overview table]] of recent portable players that play [[Ogg]] Vorbis files. Very detailed descriptions of these and many more players (old and new) are available on these sub-pages:<br />
<br />
* [[PortablePlayers/Flash|Flash Memory Storage]]<br />
* [[PortablePlayers/Harddisk|Harddisk Storage]]<br />
* [[PortablePlayers/Others#CD.2FDVD_Audio_Players|CD/DVD Audio Players]]<br />
* [[PortablePlayers/Others#Mobile_Phones|Mobile Phones]]<br />
* [[PortablePlayers/Others#Others|Others]]<br />
<br />
== Portable Vorbis Native Support Table ==<br />
{| style="font-size: 85%; text-align: center;" class="wikitable sortable" <br />
! Brand<br />
! Model<br />
! Additional Xiph codecs<br />
! FM<br />
! Voice Rec<br />
! Interface<br />
! USB Mass storage<br />
! MTP<br />
! Built-in Capacity (GB)<br />
! Additional Capacity via<br />
! Storage Type<br />
! Estim. battery life<br />
! other<br />
! Estimated price<br />
! In Production?<br />
|-<br />
<br />
! SanDisk<br />
! [[PortablePlayers/Flash#SanDisk_Sansa_Clip_and_Sansa_Fuze|Sansa Clip+]]<br />
| FLAC<br />
| yes<br />
| yes<br />
| USB 2.0<br />
| yes<br />
| yes<br />
| 8<br />
| MicroSD<br />
| Flash<br />
| 11 h<br />
| 25g weight<br />
| 45 €<br />
| Yes, as of 2012.08<br />
|-<br />
! SanDisk<br />
! [[PortablePlayers/Flash#SanDisk_Sansa_Clip_and_Sansa_Fuze|Sansa Fuze]]<br />
| FLAC<br />
| yes<br />
| yes<br />
| USB 2.0<br />
| yes<br />
| yes<br />
| 8<br />
| MicroSD<br />
| Flash<br />
| 20 h<br />
| 60g weight, video<br />
| 70 €<br />
| Yes, as of 2012.08<br />
|-<br />
! Cowon<br />
! [[PortablePlayers/Flash#Cowon.2FiAudio_D2.2C_F2.2C_T2.2C_U3.2C_U2.2C_G3.2C_5.2C_G2.2C_U5.2C_7|iAudio 9]]<br />
| FLAC<br />
| yes<br />
| yes<br />
| USB ?<br />
| yes<br />
| yes<br />
| 16<br />
| no<br />
| Flash<br />
| 30 h<br />
| 42g weight, video<br />
| 120 €<br />
| Yes, as of 2012.08<br />
|-<br />
! Cowon<br />
! D3<br />
| FLAC<br />
| yes<br />
| yes<br />
| USB<br />
| yes<br />
| yes<br />
| 8<br />
| microSD<br />
| Flash<br />
| 20 h<br />
| 120g weight, BT, Wi-Fi, 3.7"<br />
| 149 €<br />
| Yes, as of 2012.08<br />
|-<br />
! Trekstor<br />
! [[PortablePlayers/Flash#TrekStor.27s_blaxx.2C_iBeat_cody.2C_iBeat_organix_2.0.2C_iBeat_sonix.2C|iBeat Organix 2.0]]<br />
|<br />
|<br />
| yes<br />
| USB 2.0<br />
| yes<br />
| no<br />
| 8<br />
|<br />
| Flash<br />
| 50 h<br />
|<br />
| 50 €<br />
| ?<br />
|-<br />
! Trekstor<br />
! i.Beat veo<br />
| FLAC<br />
| yes<br />
| yes<br />
| USB 2.0<br />
| yes<br />
| no<br />
| 8<br />
| microSD<br />
| Flash<br />
| 8 h<br />
| 3", .mkv<br />
| 60 €<br />
| yes, as of 2011.07<br />
|-<br />
! HTC<br />
! Hero<br />
|<br />
| no<br />
| yes<br />
| USB 2.0<br />
| yes<br />
|<br />
| 8<br />
| MicroSD<br />
| Flash<br />
|<br />
| 135g, Android phone<br />
| 309 £<br />
| Yes, as of 2010.04<br />
|-<br />
! Intenso<br />
! Music Twister<br />
|<br />
| no<br />
| yes<br />
| USB ?<br />
| yes<br />
| no<br />
| 4<br />
| no<br />
| Flash<br />
| 9 h<br />
| 21g<br />
| 30 €<br />
| Yes, as of 2010.06<br />
|-<br />
! Archos<br />
! Clipper<br />
|<br />
| no<br />
| no<br />
| USB ?<br />
| yes<br />
| no<br />
| 2<br />
| no<br />
| Flash<br />
| 12 h<br />
| 15g<br />
| 25 €<br />
| Yes, as of 2010.06<br />
|-<br />
! Archos<br />
! [[PortablePlayers/Flash#Archos Vision 30c|Vision 30c]]<br />
| FLAC<br />
| yes<br />
| yes<br />
| USB<br />
| yes<br />
|<br />
| 8<br />
| no<br />
| Flash<br />
| 8 h<br />
|<br />
| 53 €<br />
| Yes, as of 2011.07<br />
|-<br />
! Grundig<br />
! MPaxx 940<br />
|<br />
| no<br />
| no<br />
| USB ?<br />
| yes<br />
| no<br />
| 4<br />
| no<br />
| Flash<br />
| 12 h<br />
| 17g<br />
| 35 €<br />
| Yes, as of 2010.06<br />
|-<br />
! iRiver<br />
! E150<br />
| FLAC<br />
| yes<br />
| yes<br />
| USB ?<br />
| yes<br />
| yes<br />
| 8<br />
| MicroSD<br />
| Flash<br />
| 21 h<br />
| 64g, video, line-in<br />
| 100 €<br />
| Yes, as of 2010.06<br />
|-<br />
! Philips<br />
! [[PortablePlayers/Flash#Philips GoGear Muse|GoGear Muse]]<br />
| FLAC<br />
| yes<br />
| yes<br />
| USB ?<br />
| yes<br />
| yes<br />
| 16<br />
| microSD<br />
| Flash<br />
| 24 h<br />
| 105g, video<br />
| 170 €<br />
| Yes, as of 2011.07<br />
|-<br />
! Samsung<br />
! YP-R1<br />
| FLAC<br />
| yes<br />
| yes<br />
| USB ?<br />
| yes<br />
| yes<br />
| 8<br />
| no<br />
| Flash<br />
| 25 h<br />
| 51g, video<br />
| 139 €<br />
| Yes, as of 2010.06<br />
|-<br />
! Samsung<br />
! YP-M1<br />
| FLAC<br />
| yes<br />
| yes<br />
| USB ?<br />
| yes<br />
| yes<br />
| 32<br />
| MicroSD<br />
| Flash<br />
| 31 h<br />
| 95g<br />
| 350 €<br />
| Yes, as of 2010.06<br />
|-<br />
! EnVivo<br />
! 4GB MP4<br />
| FLAC<br />
| yes<br />
| yes<br />
| USB 2.0<br />
| yes<br />
| ?<br />
| 4<br />
| MicroSD max 8GB<br />
| Flash<br />
| 11 h<br />
| 74 g<br />
| 30 €<br />
| bought in 2010.08<br />
|}<br />
<br />
@wiki-admins: It looks like this mediawiki instance does not support nice table cell templates (like in [http://en.wikipedia.org/wiki/List_of_BitTorrent_clients#Operating_system_support this example]). The support for this table related features would really improve this table layout.</div>Gmaxwellhttps://wiki.xiph.org/index.php?title=Talk:Videos/Digital_Show_and_Tell&diff=14053Talk:Videos/Digital Show and Tell2013-02-28T18:55:36Z<p>Gmaxwell: hyperlink CSS</p>
<hr />
<div>Greetings, Feel free to comment here— just log in to edit— or join us on [http://webchat.freenode.net/?channels=xiph IRC chat]. <br />
<br />
The wiki version of the video isn't yet as complete as the last video, due to schedules and timelines. In particular I think it could use some more going-deeper coverage. I'm surprised that I couldn't better HTML5 audio api examples of the "type your own JS, get audio and a scope" kind, if anyone knows of a better one than the one we have now that would be great.<br />
<br />
--[[User:Gmaxwell|Gmaxwell]] 02:54, 26 February 2013 (PST)<br />
<br />
Just dropping a line to say thank you! I'm continually impressed by the guides and overall outreach coming out of the xiph team. The latest video was a great introduction that managed to walk that fine line between theory and application without falling over or flailing about madly (in my opinion, anyway). Not to mention, I'm going through the gtk-bounce and waveform code now and really like it! It's not so trivial a piece of software as to be meaningless when learning to code useful applications, but it's not so gigantic as to be unapproachable either. Hell, I think it would serve as a great example for the GNOME folks to use in their documentation. Most guides on GTK just have you draw shapes on the screen and leave it at that. All in all, I'm really impressed and hope to have a similar setup replicated in a few weeks at my university, just for the sake of it.<br />
<br />
--[[User:Aggroskater|Aggroskater]] 23:16, 26 February 2013 (PST)<br />
<br />
: Some parts are better written than others... I used enough cut & paste to warn against taking it too seriously :-) --[[User:Xiphmont|Xiphmont]] 10:50, 28 February 2013 (PST)<br />
<br />
@Monty: Thanks for these information. And as a non-native English speaker I want to thank you for your clear pronunciation.<br />
What did you mean with "no one ever ruined a great recording by not dithering the final master."? Do you mean, that nobody ever would forget it, or that it was not ruinous?<br />
That "CSS is awesome"-cup made me really nervous. I hope it means something like "Cascading Style Sheets", and not, what would fit better in this context, "Content Scramble System"[shudder]!<br />
--[[User:Akf|Akf]] 15:20, 27 February 2013 (PST)<br />
<br />
: I meant that "not adding dither is not ruinous". I recall in at least one listening test on the subject, a minority of participants had a statistically significant preference for undithered versions, at least on those samples where it was in fact audible and the testers were encouraged to increase gain and listen to fade-outs. *However* I can't find the results of that test now that I've gone back to look for it, so my memory may be faulty. I've asked the HA folks to help me find it again if it really existed :-) <br />
:CSS refers to [[WikiPedia:Cascading Style Sheets|Cascading Style Sheets]]. Thus the typsetting that overflows the box. --[[User:Xiphmont|Xiphmont]] 10:50, 28 February 2013 (PST)<br />
<br />
Thanks for these resources! One question: In the vid, you mention the Gibbs phenomenon. Is that in any way related to the Fourier uncertainty principle? These days, in various audio-related forums, people throw this Zyga (2013) paper entitled "Human hearing beats the Fourier uncertainty principle" around in response to your 24/192 article. Does Zyga qualify any of the results presented in the video and/or your 24/192 article?<br />
<br />
: it is related to the fourier uncertainty principle in that all of these effects are in some way related by the same math. As for the "Human hearing beats the Fourier uncertainty principle" paper floating around, a) the headline is effectively wrong, b) the effect described as 'newly discovered' has been understood for roughly 100 years, this merely adds some new hard measurements to the data set, c) the Gabor limit does not even apply to the detection task they're describing. So either the authors or their editor are partly confused. [http://www.hydrogenaudio.org/forums/index.php?showtopic=99371| There's been a decent discussion of it at Hydrogen Audio], with none other than James Johnston and Ethan Winer weighing in. --[[User:Xiphmont|Xiphmont]] 10:50, 28 February 2013 (PST)</div>Gmaxwellhttps://wiki.xiph.org/index.php?title=Videos/Digital_Show_and_Tell&diff=14046Videos/Digital Show and Tell2013-02-26T11:35:09Z<p>Gmaxwell: /* Stairsteps */ Reorder images, I think this order may more easily understood.</p>
<hr />
<div><small>''Wiki edition''</small><br />
[[Image:dsat_001.jpg|400px|right]]<br />
<br />
Continuing in the "firehose" tradition of [[Videos/A_Digital_Media_Primer_For_Geeks|Episode 01]], Xiph.Org's second video on digital media explores multiple facets of digital audio signals and how they ''really'' behave in the real world.<br />
<br />
Demonstrations of sampling, quantization, bit-depth, and dither explore digital audio behavior on real audio equipment using both modern digital analysis and vintage analog bench equipment, just in case we can't trust those newfangled digital gizmos. You can download the source code for each demo and try it all for yourself!<br />
<br/><br/><br/><br />
<center><font size="+2">[http://www.xiph.org/video/vid2.shtml Download or Watch online]</font></center><br />
<br style="clear:both;"/><br />
Supported players: [http://www.videolan.org/vlc/ VLC 1.1+], [https://www.mozilla.com/en-US/firefox/ Firefox ], [http://www.chromium.org/Home Chrome ], [http://www.opera.com/ Opera]. Or see [http://www.webmproject.org/users/ other WebM] or [[TheoraSoftwarePlayers|other Theora]] players.<br />
<br />
If you're having trouble with playback in a modern browser or player, please visit our [[Playback_Troubleshooting|playback troubleshooting and discussion]] page.<br />
<br/><br />
<hr/><br />
<br/><br/><br/><br />
[[Image:Xiph_ep02_test.png|400px|right]]<br />
<br />
&ldquo;Hi, I'm Monty Montgomery from [http://www.redhat.com/ Red Hat] and [http://xiph.org/ Xiph.Org].<br />
<br />
&ldquo;A few months ago, I wrote<br />
[http://people.xiph.org/~xiphmont/demo/neil-young.html an article on digital audio and why 24bit/192kHz music downloads don't make sense].<br />
In the article, I<br />
mentioned--almost in passing--that a digital waveform is<br />
[http://people.xiph.org/~xiphmont/demo/neil-young.html#toc_sfam not a stairstep],<br />
and you certainly don't get a stairstep when you<br />
[[WikiPedia:Digital-to-analog_converter|convert from digital back to analog]].<br />
<br />
&ldquo;Of everything in the entire article, '''that''' was the number one thing<br />
people wrote about. In fact, more than half the mail I got was questions and<br />
comments about basic digital signal behavior. Since there's interest, let's<br />
take a little time to play with some ''simple'' digital signals. &rdquo;<br />
<br />
==Veritas ex machina==<br />
[[Image:Dsat_002.jpg|200px|right]]<br />
[[Image:Dsat_003.jpg|200px|right]]<br />
[[Image:Dsat_004.jpg|200px|right]]<br />
[[Image:Dsat_005.jpg|200px|right]]<br />
<br />
If we pretend for a moment that we have no idea how digital signals really<br />
behave, then it doesn't make sense for us to use digital test<br />
equipment. Fortunately for this exercise, there's still plenty<br />
of working analog lab equipment out there.<br />
<br />
We need a [[WikiPedia:Function_generator|signal generator]] to provide us with analog input<br />
signals--in this case, an<br />
[http://www.home.agilent.com/en/pd-3325A%3Aepsg%3Apro-pn-3325A/synthesizer-function-generator?pm=PL&nid=-536900197.536896863&cc=SE&lc=swe HP3325]<br />
from 1978.<br />
<br />
We'll observe our analog waveforms on [[WikiPedia:Oscilloscope_types#Cathode-ray_oscilloscope_.28CRO.29|analog oscilloscopes]],<br />
like this Tektronix 2246 from the mid-90s, one of the last and best analog scopes made.<br />
<br />
Finally, we'll inspect the [[WikiPedia:Spectral_density#Electrical_engineering|frequency spectrum]] of our signals using an<br />
[[WikiPedia:Spectrum_analyzer#Swept-tuned|analog spectrum analyzer]], this<br />
[http://www.home.agilent.com/en/pd-3585A%3Aepsg%3Apro-pn-3585A/spectrum-analyzer-high-perf-20hz-40mhz?pm=PL&nid=-536900197.536897319&cc=SE&lc=swe HP3585]<br />
from the same product line as<br />
the signal generator. Like the other equipment here it has<br />
[http://www.hp9845.net/9845/hardware/processors/ a rudimentary and hilariously large microcontroller],<br />
but the signal path<br />
from input to what you see on the screen is completely analog.<br />
<br />
All of this equipment is vintage, but the specs are still quite good.<br />
We start with the signal generator set to output a 1 [[WikiPedia:Hertz#SI_multiples|kHz]]<br />
sine wave at one [[WikiPedia:Volt|Volt]] [[WikiPedia:Amplitude#Root_mean_square_amplitude|RMS]].<br />
We see the sine wave on the oscilloscope, can verify that it is indeed<br />
1 kHz at 1 Volt RMS, which is 2.8 Volts<br />
[[WikiPedia:Amplitude#Peak-to-peak_amplitude|peak-to-peak]],<br />
and that matches the<br />
measurement on the spectrum analyzer as well.<br />
<br />
The analyzer also shows some low-level [[WikiPedia:White_noise|white noise]]<br />
and just a bit of [[WikiPedia:Harmonic_distortion#Harmonic_distortion|harmonic distortion]],<br />
with the highest peak about 70[[WikiPedia:Decibel|dB]] or so below<br />
[[WikiPedia:Fundamental_frequency|the fundamental]].<br />
This doesn't matter to the demos, but it's good to take notice of it now to avoid confusion later.<br />
<br />
For digital conversion, we use a boring, consumer-grade, eMagic USB1<br />
audio device. It's more than ten years old at this point, and it's<br />
getting obsolete.<br />
<br />
A recent converter can easily have an order of magnitude better specs.<br />
[[WikiPedia:Reconstruction_filter#Sampled_data_reconstruction_filters|Flatness]],<br />
[[WikiPedia:Analog-to-digital_converter#Non-linearity|linearity]],<br />
[[WikiPedia:Jitter#Sampling_jitter|jitter]],<br />
[[WikiPedia:Noise_floor|noise behavior]],<br />
[[WikiPedia:Digital-to-analog_converter#DAC_performance|everything]]...<br />
You may not<br />
have noticed. Just because we can measure an improvement doesn't<br />
mean we can hear it, and even these old consumer boxes were already at<br />
the edge of ideal transparency.<br />
<br />
The eMagic connects to my ThinkPad, which displays a digital<br />
waveform and spectrum for comparison, then the ThinkPad<br />
sends the digital signal right back out to the eMagic for<br />
re-conversion to analog and observation on the output scopes.<br />
<br />
<br style="clear:both;"/><br />
<br />
==Stairsteps==<br />
[[Image:Dsat 007.png|360px|right]]<br />
[[Image:Dsat 006.jpg|360px|right]]<br />
First demo: We begin by converting an analog signal to digital and<br />
then right back to analog again with no other steps.<br />
<br />
The signal generator is set to produce a 1kHz sine wave just like<br />
before and we can see the analog sine wave on the input-side oscilloscope. The eMagic digitizes our signal to<br />
[[Videos/A_Digital_Media_Primer_For_Geeks#Raw_.28digital_audio.29_meat|16 bit PCM at 44.1kHz]],<br />
same as on a CD. The spectrum of the digitized signal on the Thinkpad matches what we saw earlier and what we see now on the analog spectrum analyzer, aside from its <br />
[[WikiPedia:High_impedance|high-impedance input]] being just a smidge noisier. For now, the waveform display shows our digitized sine wave as a<br />
stairstep pattern, one step for each sample.<br />
<br />
When we look at the output signal that's been converted<br />
from digital back to analog, we see that it's exactly like the original sine wave. No stairsteps.<br />
<br />
1 kHz is still a fairly low frequency, so perhaps the stairsteps are just<br />
hard to see or they're being smoothed away. Next, set the signal generator to 15kHz, which is much closer to [[WikiPedia:Nyquist_frequency|Nyquist]].<br />
Now the sine wave is represented by less than three samples per cycle, and the digital waveform appears rather poor! Yet the analog output is still a perfect sine wave, exactly like the original.<br />
As we keep increasing frequency, all the way to 20kHz, the output waveform is still perfect. No jagged edges, no dropoff, no stairsteps.<br />
<br />
So where'd the stairsteps go? It's a trick question; they were never there. Drawing a digital waveform as a stairstep was wrong to begin with.<br />
<br />
A stairstep is a continuous-time function. It's jagged, and it's piecewise, but it has a defined value at every point in time.<br />
A sampled signal is entirely different. It's discrete-time; it's only got a value right at each instantaneous sample point and it's<br />
undefined, there is no value at all, everywhere between. A discrete-time signal is properly drawn as a lollipop graph.<br />
The continuous, analog counterpart of a digital signal passes smoothly through each sample point, and that's just as true for high<br />
frequencies as it is for low.<br />
<br />
[[Image:Dsat 008.png|360px|right]]<br />
The interesting and non-obvious bit is that [[WikiPedia:Nyquist%E2%80%93Shannon_sampling_theorem|there's only one<br />
bandlimited signal that passes exactly through each sample point]]; it's a unique solution. If you sample a bandlimited signal and then convert it back, the original input is also the only possible output.<br />
A signal that differs even minutely from the original includes frequency content at or beyond Nyquist, breaks the bandlimiting requirement and isn't a valid solution.<br />
<br />
So how did everyone get confused and start thinking of digital signals as stairsteps? I can think of two good reasons.<br />
<br />
First: it's easy to convert a sampled signal to a true stairstep. Just<br />
extend each sample value forward until the next sample period. This is<br />
called a [[WikiPedia:Zero-order hold|zero-order hold]], and it's an important part of how some<br />
digital-to-analog converters work, especially the simplest ones.<br />
As a result, anyone who looks up [[WikiPedia:Digital-to-analog_converter#Practical_operation|digital-to-analog converter or<br />
digital-to-analog conversion]] is probably going to see a diagram of a<br />
stairstep waveform somewhere, but that's not a finished conversion,<br />
and it's not the signal that comes out.<br />
<br />
Second, and this is probably the more likely reason, engineers who<br />
supposedly know better (yes, even I) draw stairsteps even though they're<br />
technically wrong. It's a sort of one-dimensional version of<br />
[[WikiPedia:MacPaint#Development|fat bits in an image editor]].<br />
Pixels aren't squares either, they're samples of a 2-dimensional<br />
function space and so they're also, conceptually, infinitely small<br />
points. Practically, it's a real pain in the ass to see or manipulate<br />
infinitely small anything, so big squares it is.<br />
<br />
Digital stairstep drawings are exactly the same thing. It's just a convenient drawing. The stairsteps aren't really there.<br />
<div style="clear:both"></div><br />
<br />
==Bit-depth==<br />
[[Image:Dsat_009.jpg|360px|right]]<br />
[[Image:Dsat_010.jpg|260px|right]]<br />
<br />
When we convert a digital signal back to analog, the result is<br />
''also'' smooth regardless of the [[WikiPedia:Audio_bit_depth|bit depth]]. It doesn't matter if it's 24 bits or 16 bits or 8 bits.<br />
So does that mean that the digital bit depth makes no difference at<br />
all? Of course not.<br />
<br />
Channel 2 is the same sine wave input, but we quantize it with<br />
[[WikiPedia:Dither|dither]] down to 8 bits.<br />
On the scope, we still see a nice<br />
smooth sine wave on channel 2. Look very close, and you'll also see a<br />
bit more noise. That's a clue.<br />
<br />
If we look at the spectrum of the signal, our sine wave is<br />
still there unaffected, but the noise level of the 8-bit signal on<br />
the second channel is much higher. And that's the difference, the only difference, the number of bits makes.<br />
<br />
When we digitize a signal, first we sample it. The<br />
sampling step is perfect; it loses nothing. But then we [[WikiPedia:Quantization_(sound_processing)|quantize]] it,<br />
and [[WikiPedia:Quantization_error|quantization adds noise]].<br />
The number of bits determines how much noise and so the level of the<br />
noise floor.<br />
<br />
What does this dithered quantization noise sound like?<br />
Those of you who have used analog recording equipment might think to yourselves, "My goodness! That sounds like tape hiss!"<br />
Well, it doesn't just sound like tape hiss, it acts like it too, and<br />
if we use a [[WikiPedia:Dither#Different_types|gaussian dither]] then it's<br />
[[WikiPedia:Central_limit_theorem|mathematically equivalent]] in every way. It ''is'' tape hiss.<br />
<br />
Intuitively, that means that we can measure tape hiss and thus the noise floor<br />
of [[WikiPedia:Magnetic_tape_sound_recording|magnetic audio tape]]<br />
in [[WikiPedia:Shannon–Hartley_theorem#Examples|bits instead of decibels]], in order to put things in a<br />
digital perspective. [[WikiPedia:Compact cassettes|Compact cassettes]], for those of you who are old enough to remember them, could reach as<br />
deep as 9 bits in perfect conditions. 5 to 6 bits was<br />
more typical, especially if it was a recording made on a<br />
[[WikiPedia:Cassette_deck|tape deck]]. That's right; your old mix tapes were only about 6 bits<br />
deep if you were lucky!<br />
<br />
The very best professional [[WikiPedia:Reel-to-reel_audio_tape_recording|open reel tape]] used in studios could barely<br />
hit 13 bits ''with'' [[WikiPedia:Reel-to-reel_audio_tape_recording#Noise_reduction|advanced noise reduction]]. <br />
That's why seeing '[[WikiPedia:SPARS_code|D D D]]' on a [[WikiPedia:Compact_disk|Compact Disc]] used to be such a big,<br />
high-end deal.<br />
<br />
<div style="clear:both"></div><br />
<br />
==Dither==<br />
[[Image:Dsat_011.png|360px|right]]<br />
<br />
We've been quantizing with [[Wikipedia:dither|dither]]. What is dither<br />
exactly and, more importantly, what does it do?<br />
<br />
The simplest way to quantize a signal is to choose the digital<br />
amplitude value [[WikiPedia:Rounding|closest to the original analog amplitude]].<br />
Unfortunately, the exact noise that results from this simple<br />
quantization scheme depends somewhat on the input signal.<br />
It may be inconsistent, cause distortion, or be<br />
undesirable in some other way.<br />
<br style="clear:both;"/><br />
<br />
<center><div style="background-color:#DDDDFF;border-color:#CCCCDD;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
'''Going deeper…'''<br />
*Cameron Nicklaus Christou's thesis [http://uwspace.uwaterloo.ca/bitstream/10012/3867/1/thesis.pdf Optimal Dither and Noise Shaping in Image Processing] provides an ''excellent'' explanation of dither and noise shaping.<br />
</div>&nbsp;</center><br />
<br />
Dither is specially-constructed noise that substitutes for the noise<br />
produced by simple quantization. Dither doesn't [[WikiPedia:Sound_masking|drown out or mask]]<br />
quantization noise, it replaces it with noise characteristics<br />
of our choosing that aren't influenced by the input.<br />
<br />
The signal generator has too much noise for this test so we produce a mathematically perfect sine wave with the ThinkPad and quantize it to 8 bits with dithering.<br />
We see the sine wave on waveform display and output scope, and <br />
a clean frequency peak with a uniform noise floor on both spectral displays<br />
just like before. Again, this is with dither.<br />
<br />
Now I turn dithering off.<br />
<br />
The quantization noise that dither had spread out into a nice, flat noise<br />
floor, piles up into harmonic distortion peaks. The noise floor is<br />
lower, but the level of distortion becomes nonzero, and the distortion<br />
peaks sit higher than the dithering noise did.<br />
<br />
At 8 bits this effect is exaggerated. At 16 bits,<br />
even without dither, harmonic distortion is going to be so low as to<br />
be completely inaudible. Still, we can use dither to eliminate it completely if we so choose.<br />
<br />
Turning the dither off again for a moment, you'll notice that the<br />
absolute level of distortion from undithered quantization stays<br />
approximately constant regardless of the input amplitude.<br />
But when the signal level drops below a half a bit, everything<br />
quantizes to zero.<br />
<br />
In a sense, everything quantizing to zero is just 100% distortion!<br />
Dither eliminates this distortion too. When we reenable dither, we clearly see our signal at 1/4 bit with a nice flat noise floor.<br />
<br />
The noise floor doesn't have to be flat. Dither is noise of our<br />
choosing, so it makes sense to choose a noise as [http://www.acoustics.salford.ac.uk/res/cox/sound_quality/?content=subjective inoffensive] and<br />
[[WikiPedia:Absolute_threshold_of_hearing|difficult to notice]]<br />
as possible.<br />
<br />
Human hearing is [[WikiPedia:Equal-loudness_contour|most sensitive in the midrange from 2kHz to 4kHz]]; that's where background noise is going to be the most obvious.<br />
We can [[WikiPedia:Noise_shaping|shape dithering noise]] away from sensitive frequencies to where<br />
hearing is less sensitive, usually the highest frequencies.<br />
<br />
Lastly, dithered quantization noise ''is'' higher [[WikiPedia:Sound_power|power]] overall<br />
than undithered quantization noise, even though it often sounds quieter, and<br />
you can see that on a [[WikiPedia:VU_meter|VU meter]] during passages of near-silence. However,<br />
dither isn't only an on or off choice. We can reduce the dither's<br />
power to balance less noise against a bit of distortion to minimize<br />
the overall effect.<br />
<br />
For the next test, we also [[WikiPedia:Amplitude_modulation|modulate the input signal]] like this to show how a varying input affects the quantization noise. At<br />
full dithering power, the noise is uniform, constant, and featureless<br />
just like we expect.<br />
<br />
As we reduce the dither's power, the input increasingly<br />
affects the amplitude and the character of the quantization noise.<br />
Shaped dither behaves similarly, but noise shaping lends one more nice<br />
advantage; it can use a somewhat lower<br />
dither power before the input has as much effect on the output.<br />
<br />
Despite all this text spent on dither, the differences exist 100 decibels or more below [[WikiPedia:Full_scale|full scale]]. If the CD had been<br />
[http://www.research.philips.com/technologies/projects/cd/index.html 14 bits as originally designed],<br />
perhaps dither ''might'' be<br />
more important. At 16 bits it's mostly a wash. It's reasonable to treat<br />
dither as an insurance policy that gives several extra<br />
decibels of dynamic range just in case. That said no<br />
one ever ruined a great recording by not dithering the final master.<br />
<br />
==Bandlimitation and timing==<br />
[[image:Dsat_016.jpg|360px|right]]<br />
<br />
We've been using [[WikiPedia:Sine_wave|sine waves]]. They're the obvious choice when what we<br />
want to see is a system's behavior at a given isolated frequency. Now let's look at something a bit more complex. What should we expect to happen when I change the input to a [[WikiPedia:Square_wave|square wave]]? <br />
<br />
The input scope confirms a 1kHz square wave. The output scope shows... exactly what it should.<br />
<br />
What is a square wave really? <br />
<br />
We can say it's a waveform that's some positive value for half a cycle and then transitions instantaneously to a negative value for the other half.<br />
<br />
:<math><br />
\ squarewave(t) = \begin{cases} 1, & |t| < T_1 \\ 0, & T_1 < |t| \leq {1 \over 2}T \end{cases}<br />
</math><br />
<br />
But that doesn't really tell us anything useful about how that input becomes this output.<br />
<br />
We remember that any waveform is also [[WikiPedia:Fourier_series|the sum of discrete frequencies]],<br />
and a square wave is particularly simple sum: a fundamental and an infinite series of [[WikiPedia:Even_and_odd_functions#Harmonics|odd harmonics]].<br />
<br />
[[image:Dsat_013.jpg|360px|right]]<br />
:<math>\begin{align}<br />
\ squarewave(t) = \frac{4}{\pi}\sin(\omega t) + \frac{4}{3\pi}\sin(3\omega t) + \frac{4}{5\pi}\sin(5\omega t) + \\<br />
\frac{4}{7\pi}\sin(7\omega t) + \frac{4}{9\pi}\sin(9\omega t) + \frac{4}{11\pi}\sin(11\omega t) + \\ <br />
\frac{4}{13\pi}\sin(13\omega t) + \frac{4}{15\pi}\sin(15\omega t) + \frac{4}{17\pi}\sin(17\omega t) + \\<br />
\frac{4}{19\pi}\sin(19\omega t) + \frac{4}{21\pi}\sin(21\omega t) + \frac{4}{23\pi}\sin(23\omega t) + \\<br />
\frac{4}{25\pi}\sin(25\omega t) + \frac{4}{27\pi}\sin(27\omega t) + \frac{4}{29\pi}\sin(29\omega t) + \\<br />
\frac{4}{31\pi}\sin(31\omega t) + \frac{4}{33\pi}\sin(33\omega t) + \cdots <br />
\end{align}</math><br />
<br />
At first glance, that doesn't seem very useful either; you'd have to sum an infinite number of harmonics to get the answer! However, we don't have an infinite number of harmonics.<br />
<br />
We're using a quite sharp [[WikiPedia:Low-pass_filter|anti-aliasing filter]] that cuts off right<br />
above 20kHz, so our signal is [[WikiPedia:Bandlimiting|bandlimited]]. Only the first ten terms make it through, and that's exactly what we see on the output scope.<br />
<br />
<br style="clear:both;"/><br />
<center><div style="background-color:#DDDDFF;border-color:#CCCCDD;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
'''Going deeper…'''<br />
*In modern web browsers you can program audio synthesizers directly in javascript. Use the two square wave formulas to get a square wave out of [http://js.do/blog/sound-waves-with-javascript/ this page]. (Note: The scope is not very accurate/useful.) <br />
</div></center><br />
<div>&nbsp;</div><br />
<br />
[[Image:dsat_015.jpg|360px|right]]<br />
The rippling you see around sharp edges in a bandlimited signal is called the [[WikiPedia:/Gibbs_phenomenon|Gibbs effect]]. It happens whenever you slice off part of the frequency domain in the middle of nonzero energy.<br />
<br />
The usual rule of thumb you'll hear is "the sharper the cutoff, the<br />
stronger the rippling", which is approximately true, but we have to be<br />
careful how we think about it. For example, what would you expect our quite sharp anti-aliasing filter<br />
to do if I run our signal through it a second time?<br />
<br />
Aside from adding a few fractional cycles of delay, the answer is:<br />
Nothing at all. The signal is already bandlimited. Bandlimiting it<br />
again doesn't do anything. A second pass can't remove frequencies<br />
that we already removed.<br />
<br />
That's important. People tend to think of the ripples as<br />
a kind of [[WikiPedia:Sonic_artifact|artifact]] that's added by anti-aliasing and [[WikiPedia:Reconstruction_filter|anti-imaging]]<br />
filters, implying that the ripples get worse each time the signal<br />
passes through. We see that in this case that didn't happen, so<br />
it wasn't really the filter that added the ripples the first time<br />
through. It's a subtle distinction, but Gibbs effect<br />
ripples aren't added by filters, they're just part of what a<br />
bandlimited signal ''is''.<br />
<br />
Even if we synthetically construct what looks like a perfect digital<br />
square wave it's still limited to the channel bandwidth. Remember that<br />
the stairstep representation is misleading. What we really have here are instantaneous sample points<br />
and only one bandlimited signal fits those points. All we did when we<br />
drew our apparently perfect square wave was line up the sample points<br />
just right so it appeared that there were no ripples if we played<br />
[[WikiPedia:Interpolation|connect-the-dots]]. The original bandlimited signal, complete with ripples, was<br />
still there.<br />
<br />
[[image:Dsat_014.gif|360px|right]]<br />
That leads us to one more important point. You've probably heard<br />
that the timing precision of a digital signal is limited by its sample<br />
rate; put another way, that digital signals can't represent anything that falls between the<br />
samples.. implying that [[WikiPedia:Dirac_delta_function|impulses]] or<br />
[[WikiPedia:Synthesizer#ADSR_envelope|fast attacks]] have to align exactly<br />
with a sample, or the timing gets mangled or they just disappear.<br />
At this point, we can easily see why that's wrong.<br />
<br />
Again, our input signals are bandlimited. And digital signals are<br />
samples, not stairsteps, not 'connect-the-dots'. We most certainly<br />
can, for example, put the rising edge of our bandlimited square wave<br />
anywhere we want between samples.<br />
<br />
It's represented perfectly and it's reconstructed perfectly.<br />
<br />
==Epilogue==<br />
<br />
[[Image:Moffey.jpg|360px|right]]<br />
<br />
Like in [[Videos/A_Digital_Media_Primer_For_Geeks|_A Digital Media Primer for Geeks_]], we've covered a broad range of<br />
topics, and yet barely scratched the surface of each one. If anything, my<br />
sins of omission are greater this time around.<br />
<br />
Thus I encourage you to dig deeper and experiment. I chose my<br />
demos carefully to be simple and give clear results. You can<br />
reproduce every one of them on your own if you like, but let's face<br />
it: Sometimes we learn the most about a spiffy toy by breaking it open<br />
and studying all the pieces that fall out. Play with the demo parameters, hack up the code, set up<br />
alternate experiments. The source code for everything, including the<br />
little pushbutton demo application, is at the [[Videos/Digital_Show_and_Tell#Use_The_Source_Luke|bottom of this page]].<br />
<br />
In the course of experimentation, you're likely to run into something<br />
that you didn't expect and can't explain. Don't worry! My earlier<br />
snark aside, Wikipedia is fantastic for exactly this kind of casual<br />
research. If you're really serious about understanding signals,<br />
several universities have advanced materials online, such as the<br />
[http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-003-signals-and-systems-spring-2010/index.htm 6.003]<br />
and<br />
[http://ocw.mit.edu/resources/res-6-007-signals-and-systems-spring-2011/ RES.6-007]<br />
Signals and Systems modules at MIT OpenCourseWare. And of<br />
course, there's always the [http://webchat.freenode.net/?channels=xiph community here at Xiph.Org].<br />
<br />
==Credits==<br />
[[Image:Dmpfg_019.png|360px|right]]<br />
Written by: Christopher (Monty) Montgomery and the Xiph.Org Community<br />
<br />
Special thanks to:<br />
*Heidi Baumgartner, for the second Tektronix oscilloscope<br />
*Gregory Maxwell and Dr. Timothy Terriberry, for additional technical review<br />
<br />
Intro, title and credits music:<br><br />
"[http://music.lousyrobot.com/track/andy-warhol-is-gone Andy Warhol Is Gone]", by Lousy Robot<br><br />
Used by permission of Lousy Robot.<br><br />
Original source track All Rights Reserved.<br><br />
[http://www.lousyrobot.com www.lousyrobot.com]<br />
<br />
This Video Was Produced Entirely With Free and Open Source Software:<br><br />
<br />
*[http://www.gnu.org/ GNU]<br><br />
*[http://www.linux.org/ Linux]<br><br />
*[http://fedoraproject.org/ Fedora]<br><br />
*[http://cinelerra.org/ Cinelerra]<br><br />
*[http://www.gimp.org/ The Gimp]<br><br />
*[http://audacity.sourceforge.net/ Audacity]<br><br />
*[http://svn.xiph.org/trunk/postfish/README Postfish]<br><br />
*[http://gstreamer.freedesktop.org/ Gstreamer]<br><br />
<br />
All trademarks are the property of their respective owners. <br />
<br />
*''Complete video'' [http://creativecommons.org/licenses/by-sa/3.0/legalcode CC-BY-SA]<br><br />
*''Text transcript and Wiki edition'' [http://creativecommons.org/licenses/by-sa/3.0/legalcode CC-BY-SA]<br><br />
<br />
A Co-Production of Xiph.Org and Red Hat, Inc.<br><br />
(C) 2012-2013, Some Rights Reserved<br><br />
<hr/><br />
<br />
== Use The Source Luke ==<br />
<br />
As stated in the Epilogue, everything that appears in the video demos is driven by open source software, which means the source is both available for inspection and freely usable by the community. The Thinkpad that appears in the video was running Fedora 17 and Gnome Shell (Gnome 3). The demonstration software does not require Fedora specifically, but it does require Gnu/Linux to run in its current form. In all, the video involved just under 50,000 lines of new and custom-purpose code (including contributions to non-Xiph projects such as Cinelerra and [http://sourceforge.net/projects/gromit-mpx/ Gromit]).<br />
<br />
=== The Spectrum and Waveform Viewer ===<br />
<br />
The realtime software spectrum analyzer application that appears in the video was a preexisting application that was dusted off and updated for use in the video. The waveform viewer (effectively a simple software oscilloscope) was written from scratch making use of some of the internals from the spectrum analyzer application. Both are available from Xiph.Org svn:<br />
<br />
<center><div style="background-color:#DDDDDD;border-color:#CCCCCC;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
*Source for the Spectrum and Waveform applications is found at:<br />
https://svn.xiph.org/trunk/spectrum/<br />
*The source can be checked out of svn using the following command line:<br />
svn co https://svn.xiph.org/trunk/spectrum<br />
*Trac is a convenient way to browse the source without checking out a copy:<br />
https://trac.xiph.org/browser/trunk/spectrum<br />
</div></center><br />
<br />
Spectrum and Waveform both expect an input stream on the command line, either as raw data or as a WAV file.<br />
<br />
=== GTK-Bounce ===<br />
<br />
The touch-controlled application used in the video is named 'gtk-bounce' and was custom-written for the sole purpose of the in-video demonstrations. It is so named because, for the most part, all it does is read the input from an audio device, and then immediately write the same data back out for playback. It also forwards a copy of this data to up to two external monitoring applications, and in several demos, applies simple filters or generates simple waveforms. It includes several demos not included in the video.<br />
<br />
<center><div style="background-color:#DDDDDD;border-color:#CCCCCC;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
*Source for gtk-bounce is found at:<br />
https://svn.xiph.org/trunk/Xiph-episode-II/bounce/<br />
*The source can be checked out of svn using the following command line:<br />
svn co https://svn.xiph.org/trunk/Xiph-episode-II/bounce/<br />
*Trac is a convenient way to browse the source without checking out a copy:<br />
https://trac.xiph.org/browser/trunk/Xiph-episode-II/bounce/<br />
</div></center><br />
<br />
==== Starting Gtk-bounce ====<br />
The application is somewhat hardwired for specific demo parameters, but most of the hardwired settings can be found at the top of each source file. As found in SVN, the application expects an ALSA hardware audio device at hw:1, and if none if found, it will wait for one to appear. Once a sound device is successfully initialized, it expects to find and open two pipes named pipe0 and pipe1 for output in the current directory. In the video, the waveform and spectrum applications are started to take input from pipe0 and pipe1 respectively. The output sent to the two pipes is identical, and in most demos matches the output data sent to the hardware device for conversion to analog. The only exception is the tenth demo panel (which does not appear in the video) where gtk-bounce can be set to monitor the hardware inputs instead while the outputs are used to produce test waveforms.<br />
<br />
Assuming gtk-bounce, spectrum and waveform have been checked out and built, the configuration seen in the video can be started using the following commands:<br />
<center><div style="background-color:#DDDDDD;border-color:#CCCCCC;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
* make the pipe fifos for the applications to communicate (only needs to be done once)<br />
mkfifo pipe0 pipe1<br />
* start all three applications<br />
waveform pipe0 & spectrum pipe1 & gtk-bounce &<br />
</div></center><br />
<br />
==== Using Gtk-bounce ====<br />
<br />
Gtk-bounce consists of eleven pushbutton panels (numbered zero through ten) that can be selected by scrolling up and dwon with the arrow buttons on the right side. Each panel is intended for a specific demo or part of a demo.<br />
<br />
<center><div style="background-color:#DDDDDD;border-color:#CCCCCC;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
<br />
[[Image:Dsat-panel0.png|700px|center]]<br />
* '''Panel 0''': This panel presents buttons that allow the sound card to be configured in several sampling rates and bit depths. Samples read from the audio inputs are sent to the output pipes and audio outputs for playback without modification.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel1.png|700px|center]]<br />
* '''Panel 1''': Both channels are forwarded to the outputs, however the user may select the bit depth of each channel independently. When the sound card is running in 16 bit mode and 16-bit depth is selected, the data is untouched. Requantization to a lower bit depth is performed with a flat triangle dither.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel2.png|700px|center]]<br />
* '''Panel 2''': Both channels are re-quantized to the selected bit depth. Requantization to a lower bit depth is performed with a flat triangle dither.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel3.png|700px|center]]<br />
* '''Panel 3''': 'generate sine wave' discards the audio inputs and instead internally generates a sine wave at 32 bit precision, which is then quantized to the selected bit depth, optionally with dither. The resulting signal is then forwarded to the output. <br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel4.png|700px|center]]<br />
* '''Panel 4''': gtk-bounce generates a 16-bit sine wave of the selected amplitude, optionally with dither, and forwards the resulting signal to the outputs. The audio input from the audio device is discarded. Note that the slider sets the peak amplitude, not the peak-to-peak amplitude.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel5.png|700px|center]]<br />
* '''Panel 5''': generates a 16-bit sine wave, optionally quantized using dither. The user may additionally select a flat or a shaped dither. The 'notch and gain' button applies a notch filter to the resulting signal, and boosts the gain of the remaining noise so that it's easily audible. The audio input from the audio device is discarded.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel6.png|700px|center]]<br />
* '''Panel 6''': allows the user to play with the power of the dithering noise applied before quantizing the sine wave. Shaped or flat dither are available. The sine wave may also be modulated with a varying amplitude to highlight correlations between the input and the resulting quantization noise. The 'notch and gain' button applies a notch filter to the resulting signal, and boosts the gain of the remaining noise so that it's easily audible. The audio input from the audio device is discarded.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel7.png|700px|center]]<br />
* '''Panel 7''': applies a sharper antialiasing (lowpass) filter than is likely to be built into the sound-card hardware (as there's generally no reason to use a filter quite this sharp in practice). The very sharp filter allows us to bandpass the demonstration square wave without any harmonics landing in the transition band. The input is read from the audio device, passed through this sharper filter, and then forwarded to the outputs.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel8.png|700px|center]]<br />
* '''Panel 8''': when selected, generate a synthetic 'square wave' (this is not quite equivalent to a bandlimited analog square wave; the harmonic amplitudes are a bit different) that when aligned with the sampling phase just right gives the appearance of having infinite rise and fall time. The slider allows us to shift the waveform sample alignment back and forth by +/- one sample to reveal that the underlying signal is still band-limited.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel9.png|700px|center]]<br />
* '''Panel 9''': as in panel 8, generate a 'perfect' synthetic 'square wave'. However, the slider now allows us to shift the sample alignment of the second channel with respect to the first, instead of shifting both channels. This allows us the trigger/lock the scope timing to the channel 1 waveform so we can see the fractional sample movement and alignment of the waveform on channel 2. The audio input from the audio device is discarded.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel10.png|700px|center]]<br />
* '''Panel 10''': not used in the video; The audio device is configured to 24-bit input/output. The user may produce one of a range of test signals that are output to both the external applications and the audio device on the first channel. The input on the second channel is passed-through to the applications and audio device outputs unchanged. The first channel input is unused unless 'two input mode' is selected. When two input mode is selected, both input channels are read and the data sent to the external applications. Generated test signals are sent only to the audio hardware (on the first channel). This combination of test signals and input modes allows self-references frequency response, phase, noise, distortion and crosstalk testing of a given audio device.<br />
<br />
<div style="clear: both">&nbsp;</div><br />
<br />
</div></center><br />
<br />
=== Cairo Animations ===<br />
<br />
The animations featured throughout the Episode 2 video were rapid-development spaghetti hack-jobs coded by hand in raw Cairo. Each module generated a series of PNG stills that were then stitched into an animation with Cinelerra or mplayer. In the interest of pointing and laughing at what really bad code looks like...<br />
<br />
<center><div style="background-color:#DDDDDD;border-color:#CCCCCC;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
*Source for the Cairo animations is found at:<br />
https://svn.xiph.org/trunk/Xiph-episode-II/cairo/<br />
*The source can be checked out of svn using the following command line:<br />
svn co https://svn.xiph.org/trunk/Xiph-episode-II/cairo/<br />
*Trac is a convenient way to browse the source without checking out a copy:<br />
https://trac.xiph.org/browser/trunk/Xiph-episode-II/cairo/<br />
</div></center></div>Gmaxwellhttps://wiki.xiph.org/index.php?title=Videos/Digital_Show_and_Tell&diff=14045Videos/Digital Show and Tell2013-02-26T11:29:52Z<p>Gmaxwell: /* Use The Source Luke */ Gromit-mpx link</p>
<hr />
<div><small>''Wiki edition''</small><br />
[[Image:dsat_001.jpg|400px|right]]<br />
<br />
Continuing in the "firehose" tradition of [[Videos/A_Digital_Media_Primer_For_Geeks|Episode 01]], Xiph.Org's second video on digital media explores multiple facets of digital audio signals and how they ''really'' behave in the real world.<br />
<br />
Demonstrations of sampling, quantization, bit-depth, and dither explore digital audio behavior on real audio equipment using both modern digital analysis and vintage analog bench equipment, just in case we can't trust those newfangled digital gizmos. You can download the source code for each demo and try it all for yourself!<br />
<br/><br/><br/><br />
<center><font size="+2">[http://www.xiph.org/video/vid2.shtml Download or Watch online]</font></center><br />
<br style="clear:both;"/><br />
Supported players: [http://www.videolan.org/vlc/ VLC 1.1+], [https://www.mozilla.com/en-US/firefox/ Firefox ], [http://www.chromium.org/Home Chrome ], [http://www.opera.com/ Opera]. Or see [http://www.webmproject.org/users/ other WebM] or [[TheoraSoftwarePlayers|other Theora]] players.<br />
<br />
If you're having trouble with playback in a modern browser or player, please visit our [[Playback_Troubleshooting|playback troubleshooting and discussion]] page.<br />
<br/><br />
<hr/><br />
<br/><br/><br/><br />
[[Image:Xiph_ep02_test.png|400px|right]]<br />
<br />
&ldquo;Hi, I'm Monty Montgomery from [http://www.redhat.com/ Red Hat] and [http://xiph.org/ Xiph.Org].<br />
<br />
&ldquo;A few months ago, I wrote<br />
[http://people.xiph.org/~xiphmont/demo/neil-young.html an article on digital audio and why 24bit/192kHz music downloads don't make sense].<br />
In the article, I<br />
mentioned--almost in passing--that a digital waveform is<br />
[http://people.xiph.org/~xiphmont/demo/neil-young.html#toc_sfam not a stairstep],<br />
and you certainly don't get a stairstep when you<br />
[[WikiPedia:Digital-to-analog_converter|convert from digital back to analog]].<br />
<br />
&ldquo;Of everything in the entire article, '''that''' was the number one thing<br />
people wrote about. In fact, more than half the mail I got was questions and<br />
comments about basic digital signal behavior. Since there's interest, let's<br />
take a little time to play with some ''simple'' digital signals. &rdquo;<br />
<br />
==Veritas ex machina==<br />
[[Image:Dsat_002.jpg|200px|right]]<br />
[[Image:Dsat_003.jpg|200px|right]]<br />
[[Image:Dsat_004.jpg|200px|right]]<br />
[[Image:Dsat_005.jpg|200px|right]]<br />
<br />
If we pretend for a moment that we have no idea how digital signals really<br />
behave, then it doesn't make sense for us to use digital test<br />
equipment. Fortunately for this exercise, there's still plenty<br />
of working analog lab equipment out there.<br />
<br />
We need a [[WikiPedia:Function_generator|signal generator]] to provide us with analog input<br />
signals--in this case, an<br />
[http://www.home.agilent.com/en/pd-3325A%3Aepsg%3Apro-pn-3325A/synthesizer-function-generator?pm=PL&nid=-536900197.536896863&cc=SE&lc=swe HP3325]<br />
from 1978.<br />
<br />
We'll observe our analog waveforms on [[WikiPedia:Oscilloscope_types#Cathode-ray_oscilloscope_.28CRO.29|analog oscilloscopes]],<br />
like this Tektronix 2246 from the mid-90s, one of the last and best analog scopes made.<br />
<br />
Finally, we'll inspect the [[WikiPedia:Spectral_density#Electrical_engineering|frequency spectrum]] of our signals using an<br />
[[WikiPedia:Spectrum_analyzer#Swept-tuned|analog spectrum analyzer]], this<br />
[http://www.home.agilent.com/en/pd-3585A%3Aepsg%3Apro-pn-3585A/spectrum-analyzer-high-perf-20hz-40mhz?pm=PL&nid=-536900197.536897319&cc=SE&lc=swe HP3585]<br />
from the same product line as<br />
the signal generator. Like the other equipment here it has<br />
[http://www.hp9845.net/9845/hardware/processors/ a rudimentary and hilariously large microcontroller],<br />
but the signal path<br />
from input to what you see on the screen is completely analog.<br />
<br />
All of this equipment is vintage, but the specs are still quite good.<br />
We start with the signal generator set to output a 1 [[WikiPedia:Hertz#SI_multiples|kHz]]<br />
sine wave at one [[WikiPedia:Volt|Volt]] [[WikiPedia:Amplitude#Root_mean_square_amplitude|RMS]].<br />
We see the sine wave on the oscilloscope, can verify that it is indeed<br />
1 kHz at 1 Volt RMS, which is 2.8 Volts<br />
[[WikiPedia:Amplitude#Peak-to-peak_amplitude|peak-to-peak]],<br />
and that matches the<br />
measurement on the spectrum analyzer as well.<br />
<br />
The analyzer also shows some low-level [[WikiPedia:White_noise|white noise]]<br />
and just a bit of [[WikiPedia:Harmonic_distortion#Harmonic_distortion|harmonic distortion]],<br />
with the highest peak about 70[[WikiPedia:Decibel|dB]] or so below<br />
[[WikiPedia:Fundamental_frequency|the fundamental]].<br />
This doesn't matter to the demos, but it's good to take notice of it now to avoid confusion later.<br />
<br />
For digital conversion, we use a boring, consumer-grade, eMagic USB1<br />
audio device. It's more than ten years old at this point, and it's<br />
getting obsolete.<br />
<br />
A recent converter can easily have an order of magnitude better specs.<br />
[[WikiPedia:Reconstruction_filter#Sampled_data_reconstruction_filters|Flatness]],<br />
[[WikiPedia:Analog-to-digital_converter#Non-linearity|linearity]],<br />
[[WikiPedia:Jitter#Sampling_jitter|jitter]],<br />
[[WikiPedia:Noise_floor|noise behavior]],<br />
[[WikiPedia:Digital-to-analog_converter#DAC_performance|everything]]...<br />
You may not<br />
have noticed. Just because we can measure an improvement doesn't<br />
mean we can hear it, and even these old consumer boxes were already at<br />
the edge of ideal transparency.<br />
<br />
The eMagic connects to my ThinkPad, which displays a digital<br />
waveform and spectrum for comparison, then the ThinkPad<br />
sends the digital signal right back out to the eMagic for<br />
re-conversion to analog and observation on the output scopes.<br />
<br />
<br style="clear:both;"/><br />
<br />
==Stairsteps==<br />
[[Image:Dsat 006.jpg|360px|right]]<br />
[[Image:Dsat 007.png|360px|right]]<br />
First demo: We begin by converting an analog signal to digital and<br />
then right back to analog again with no other steps.<br />
<br />
The signal generator is set to produce a 1kHz sine wave just like<br />
before and we can see the analog sine wave on the input-side oscilloscope. The eMagic digitizes our signal to<br />
[[Videos/A_Digital_Media_Primer_For_Geeks#Raw_.28digital_audio.29_meat|16 bit PCM at 44.1kHz]],<br />
same as on a CD. The spectrum of the digitized signal on the Thinkpad matches what we saw earlier and what we see now on the analog spectrum analyzer, aside from its <br />
[[WikiPedia:High_impedance|high-impedance input]] being just a smidge noisier. For now, the waveform display shows our digitized sine wave as a<br />
stairstep pattern, one step for each sample.<br />
<br />
When we look at the output signal that's been converted<br />
from digital back to analog, we see that it's exactly like the original sine wave. No stairsteps.<br />
<br />
1 kHz is still a fairly low frequency, so perhaps the stairsteps are just<br />
hard to see or they're being smoothed away. Next, set the signal generator to 15kHz, which is much closer to [[WikiPedia:Nyquist_frequency|Nyquist]].<br />
Now the sine wave is represented by less than three samples per cycle, and the digital waveform appears rather poor! Yet the analog output is still a perfect sine wave, exactly like the original.<br />
As we keep increasing frequency, all the way to 20kHz, the output waveform is still perfect. No jagged edges, no dropoff, no stairsteps.<br />
<br />
So where'd the stairsteps go? It's a trick question; they were never there. Drawing a digital waveform as a stairstep was wrong to begin with.<br />
<br />
A stairstep is a continuous-time function. It's jagged, and it's piecewise, but it has a defined value at every point in time.<br />
A sampled signal is entirely different. It's discrete-time; it's only got a value right at each instantaneous sample point and it's<br />
undefined, there is no value at all, everywhere between. A discrete-time signal is properly drawn as a lollipop graph.<br />
The continuous, analog counterpart of a digital signal passes smoothly through each sample point, and that's just as true for high<br />
frequencies as it is for low.<br />
<br />
[[Image:Dsat 008.png|360px|right]]<br />
The interesting and non-obvious bit is that [[WikiPedia:Nyquist%E2%80%93Shannon_sampling_theorem|there's only one<br />
bandlimited signal that passes exactly through each sample point]]; it's a unique solution. If you sample a bandlimited signal and then convert it back, the original input is also the only possible output.<br />
A signal that differs even minutely from the original includes frequency content at or beyond Nyquist, breaks the bandlimiting requirement and isn't a valid solution.<br />
<br />
So how did everyone get confused and start thinking of digital signals as stairsteps? I can think of two good reasons.<br />
<br />
First: it's easy to convert a sampled signal to a true stairstep. Just<br />
extend each sample value forward until the next sample period. This is<br />
called a [[WikiPedia:Zero-order hold|zero-order hold]], and it's an important part of how some<br />
digital-to-analog converters work, especially the simplest ones.<br />
As a result, anyone who looks up [[WikiPedia:Digital-to-analog_converter#Practical_operation|digital-to-analog converter or<br />
digital-to-analog conversion]] is probably going to see a diagram of a<br />
stairstep waveform somewhere, but that's not a finished conversion,<br />
and it's not the signal that comes out.<br />
<br />
Second, and this is probably the more likely reason, engineers who<br />
supposedly know better (yes, even I) draw stairsteps even though they're<br />
technically wrong. It's a sort of one-dimensional version of<br />
[[WikiPedia:MacPaint#Development|fat bits in an image editor]].<br />
Pixels aren't squares either, they're samples of a 2-dimensional<br />
function space and so they're also, conceptually, infinitely small<br />
points. Practically, it's a real pain in the ass to see or manipulate<br />
infinitely small anything, so big squares it is.<br />
<br />
Digital stairstep drawings are exactly the same thing. It's just a convenient drawing. The stairsteps aren't really there.<br />
<div style="clear:both"></div><br />
<br />
==Bit-depth==<br />
[[Image:Dsat_009.jpg|360px|right]]<br />
[[Image:Dsat_010.jpg|260px|right]]<br />
<br />
When we convert a digital signal back to analog, the result is<br />
''also'' smooth regardless of the [[WikiPedia:Audio_bit_depth|bit depth]]. It doesn't matter if it's 24 bits or 16 bits or 8 bits.<br />
So does that mean that the digital bit depth makes no difference at<br />
all? Of course not.<br />
<br />
Channel 2 is the same sine wave input, but we quantize it with<br />
[[WikiPedia:Dither|dither]] down to 8 bits.<br />
On the scope, we still see a nice<br />
smooth sine wave on channel 2. Look very close, and you'll also see a<br />
bit more noise. That's a clue.<br />
<br />
If we look at the spectrum of the signal, our sine wave is<br />
still there unaffected, but the noise level of the 8-bit signal on<br />
the second channel is much higher. And that's the difference, the only difference, the number of bits makes.<br />
<br />
When we digitize a signal, first we sample it. The<br />
sampling step is perfect; it loses nothing. But then we [[WikiPedia:Quantization_(sound_processing)|quantize]] it,<br />
and [[WikiPedia:Quantization_error|quantization adds noise]].<br />
The number of bits determines how much noise and so the level of the<br />
noise floor.<br />
<br />
What does this dithered quantization noise sound like?<br />
Those of you who have used analog recording equipment might think to yourselves, "My goodness! That sounds like tape hiss!"<br />
Well, it doesn't just sound like tape hiss, it acts like it too, and<br />
if we use a [[WikiPedia:Dither#Different_types|gaussian dither]] then it's<br />
[[WikiPedia:Central_limit_theorem|mathematically equivalent]] in every way. It ''is'' tape hiss.<br />
<br />
Intuitively, that means that we can measure tape hiss and thus the noise floor<br />
of [[WikiPedia:Magnetic_tape_sound_recording|magnetic audio tape]]<br />
in [[WikiPedia:Shannon–Hartley_theorem#Examples|bits instead of decibels]], in order to put things in a<br />
digital perspective. [[WikiPedia:Compact cassettes|Compact cassettes]], for those of you who are old enough to remember them, could reach as<br />
deep as 9 bits in perfect conditions. 5 to 6 bits was<br />
more typical, especially if it was a recording made on a<br />
[[WikiPedia:Cassette_deck|tape deck]]. That's right; your old mix tapes were only about 6 bits<br />
deep if you were lucky!<br />
<br />
The very best professional [[WikiPedia:Reel-to-reel_audio_tape_recording|open reel tape]] used in studios could barely<br />
hit 13 bits ''with'' [[WikiPedia:Reel-to-reel_audio_tape_recording#Noise_reduction|advanced noise reduction]]. <br />
That's why seeing '[[WikiPedia:SPARS_code|D D D]]' on a [[WikiPedia:Compact_disk|Compact Disc]] used to be such a big,<br />
high-end deal.<br />
<br />
<div style="clear:both"></div><br />
<br />
==Dither==<br />
[[Image:Dsat_011.png|360px|right]]<br />
<br />
We've been quantizing with [[Wikipedia:dither|dither]]. What is dither<br />
exactly and, more importantly, what does it do?<br />
<br />
The simplest way to quantize a signal is to choose the digital<br />
amplitude value [[WikiPedia:Rounding|closest to the original analog amplitude]].<br />
Unfortunately, the exact noise that results from this simple<br />
quantization scheme depends somewhat on the input signal.<br />
It may be inconsistent, cause distortion, or be<br />
undesirable in some other way.<br />
<br style="clear:both;"/><br />
<br />
<center><div style="background-color:#DDDDFF;border-color:#CCCCDD;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
'''Going deeper…'''<br />
*Cameron Nicklaus Christou's thesis [http://uwspace.uwaterloo.ca/bitstream/10012/3867/1/thesis.pdf Optimal Dither and Noise Shaping in Image Processing] provides an ''excellent'' explanation of dither and noise shaping.<br />
</div>&nbsp;</center><br />
<br />
Dither is specially-constructed noise that substitutes for the noise<br />
produced by simple quantization. Dither doesn't [[WikiPedia:Sound_masking|drown out or mask]]<br />
quantization noise, it replaces it with noise characteristics<br />
of our choosing that aren't influenced by the input.<br />
<br />
The signal generator has too much noise for this test so we produce a mathematically perfect sine wave with the ThinkPad and quantize it to 8 bits with dithering.<br />
We see the sine wave on waveform display and output scope, and <br />
a clean frequency peak with a uniform noise floor on both spectral displays<br />
just like before. Again, this is with dither.<br />
<br />
Now I turn dithering off.<br />
<br />
The quantization noise that dither had spread out into a nice, flat noise<br />
floor, piles up into harmonic distortion peaks. The noise floor is<br />
lower, but the level of distortion becomes nonzero, and the distortion<br />
peaks sit higher than the dithering noise did.<br />
<br />
At 8 bits this effect is exaggerated. At 16 bits,<br />
even without dither, harmonic distortion is going to be so low as to<br />
be completely inaudible. Still, we can use dither to eliminate it completely if we so choose.<br />
<br />
Turning the dither off again for a moment, you'll notice that the<br />
absolute level of distortion from undithered quantization stays<br />
approximately constant regardless of the input amplitude.<br />
But when the signal level drops below a half a bit, everything<br />
quantizes to zero.<br />
<br />
In a sense, everything quantizing to zero is just 100% distortion!<br />
Dither eliminates this distortion too. When we reenable dither, we clearly see our signal at 1/4 bit with a nice flat noise floor.<br />
<br />
The noise floor doesn't have to be flat. Dither is noise of our<br />
choosing, so it makes sense to choose a noise as [http://www.acoustics.salford.ac.uk/res/cox/sound_quality/?content=subjective inoffensive] and<br />
[[WikiPedia:Absolute_threshold_of_hearing|difficult to notice]]<br />
as possible.<br />
<br />
Human hearing is [[WikiPedia:Equal-loudness_contour|most sensitive in the midrange from 2kHz to 4kHz]]; that's where background noise is going to be the most obvious.<br />
We can [[WikiPedia:Noise_shaping|shape dithering noise]] away from sensitive frequencies to where<br />
hearing is less sensitive, usually the highest frequencies.<br />
<br />
Lastly, dithered quantization noise ''is'' higher [[WikiPedia:Sound_power|power]] overall<br />
than undithered quantization noise, even though it often sounds quieter, and<br />
you can see that on a [[WikiPedia:VU_meter|VU meter]] during passages of near-silence. However,<br />
dither isn't only an on or off choice. We can reduce the dither's<br />
power to balance less noise against a bit of distortion to minimize<br />
the overall effect.<br />
<br />
For the next test, we also [[WikiPedia:Amplitude_modulation|modulate the input signal]] like this to show how a varying input affects the quantization noise. At<br />
full dithering power, the noise is uniform, constant, and featureless<br />
just like we expect.<br />
<br />
As we reduce the dither's power, the input increasingly<br />
affects the amplitude and the character of the quantization noise.<br />
Shaped dither behaves similarly, but noise shaping lends one more nice<br />
advantage; it can use a somewhat lower<br />
dither power before the input has as much effect on the output.<br />
<br />
Despite all this text spent on dither, the differences exist 100 decibels or more below [[WikiPedia:Full_scale|full scale]]. If the CD had been<br />
[http://www.research.philips.com/technologies/projects/cd/index.html 14 bits as originally designed],<br />
perhaps dither ''might'' be<br />
more important. At 16 bits it's mostly a wash. It's reasonable to treat<br />
dither as an insurance policy that gives several extra<br />
decibels of dynamic range just in case. That said no<br />
one ever ruined a great recording by not dithering the final master.<br />
<br />
==Bandlimitation and timing==<br />
[[image:Dsat_016.jpg|360px|right]]<br />
<br />
We've been using [[WikiPedia:Sine_wave|sine waves]]. They're the obvious choice when what we<br />
want to see is a system's behavior at a given isolated frequency. Now let's look at something a bit more complex. What should we expect to happen when I change the input to a [[WikiPedia:Square_wave|square wave]]? <br />
<br />
The input scope confirms a 1kHz square wave. The output scope shows... exactly what it should.<br />
<br />
What is a square wave really? <br />
<br />
We can say it's a waveform that's some positive value for half a cycle and then transitions instantaneously to a negative value for the other half.<br />
<br />
:<math><br />
\ squarewave(t) = \begin{cases} 1, & |t| < T_1 \\ 0, & T_1 < |t| \leq {1 \over 2}T \end{cases}<br />
</math><br />
<br />
But that doesn't really tell us anything useful about how that input becomes this output.<br />
<br />
We remember that any waveform is also [[WikiPedia:Fourier_series|the sum of discrete frequencies]],<br />
and a square wave is particularly simple sum: a fundamental and an infinite series of [[WikiPedia:Even_and_odd_functions#Harmonics|odd harmonics]].<br />
<br />
[[image:Dsat_013.jpg|360px|right]]<br />
:<math>\begin{align}<br />
\ squarewave(t) = \frac{4}{\pi}\sin(\omega t) + \frac{4}{3\pi}\sin(3\omega t) + \frac{4}{5\pi}\sin(5\omega t) + \\<br />
\frac{4}{7\pi}\sin(7\omega t) + \frac{4}{9\pi}\sin(9\omega t) + \frac{4}{11\pi}\sin(11\omega t) + \\ <br />
\frac{4}{13\pi}\sin(13\omega t) + \frac{4}{15\pi}\sin(15\omega t) + \frac{4}{17\pi}\sin(17\omega t) + \\<br />
\frac{4}{19\pi}\sin(19\omega t) + \frac{4}{21\pi}\sin(21\omega t) + \frac{4}{23\pi}\sin(23\omega t) + \\<br />
\frac{4}{25\pi}\sin(25\omega t) + \frac{4}{27\pi}\sin(27\omega t) + \frac{4}{29\pi}\sin(29\omega t) + \\<br />
\frac{4}{31\pi}\sin(31\omega t) + \frac{4}{33\pi}\sin(33\omega t) + \cdots <br />
\end{align}</math><br />
<br />
At first glance, that doesn't seem very useful either; you'd have to sum an infinite number of harmonics to get the answer! However, we don't have an infinite number of harmonics.<br />
<br />
We're using a quite sharp [[WikiPedia:Low-pass_filter|anti-aliasing filter]] that cuts off right<br />
above 20kHz, so our signal is [[WikiPedia:Bandlimiting|bandlimited]]. Only the first ten terms make it through, and that's exactly what we see on the output scope.<br />
<br />
<br style="clear:both;"/><br />
<center><div style="background-color:#DDDDFF;border-color:#CCCCDD;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
'''Going deeper…'''<br />
*In modern web browsers you can program audio synthesizers directly in javascript. Use the two square wave formulas to get a square wave out of [http://js.do/blog/sound-waves-with-javascript/ this page]. (Note: The scope is not very accurate/useful.) <br />
</div></center><br />
<div>&nbsp;</div><br />
<br />
[[Image:dsat_015.jpg|360px|right]]<br />
The rippling you see around sharp edges in a bandlimited signal is called the [[WikiPedia:/Gibbs_phenomenon|Gibbs effect]]. It happens whenever you slice off part of the frequency domain in the middle of nonzero energy.<br />
<br />
The usual rule of thumb you'll hear is "the sharper the cutoff, the<br />
stronger the rippling", which is approximately true, but we have to be<br />
careful how we think about it. For example, what would you expect our quite sharp anti-aliasing filter<br />
to do if I run our signal through it a second time?<br />
<br />
Aside from adding a few fractional cycles of delay, the answer is:<br />
Nothing at all. The signal is already bandlimited. Bandlimiting it<br />
again doesn't do anything. A second pass can't remove frequencies<br />
that we already removed.<br />
<br />
That's important. People tend to think of the ripples as<br />
a kind of [[WikiPedia:Sonic_artifact|artifact]] that's added by anti-aliasing and [[WikiPedia:Reconstruction_filter|anti-imaging]]<br />
filters, implying that the ripples get worse each time the signal<br />
passes through. We see that in this case that didn't happen, so<br />
it wasn't really the filter that added the ripples the first time<br />
through. It's a subtle distinction, but Gibbs effect<br />
ripples aren't added by filters, they're just part of what a<br />
bandlimited signal ''is''.<br />
<br />
Even if we synthetically construct what looks like a perfect digital<br />
square wave it's still limited to the channel bandwidth. Remember that<br />
the stairstep representation is misleading. What we really have here are instantaneous sample points<br />
and only one bandlimited signal fits those points. All we did when we<br />
drew our apparently perfect square wave was line up the sample points<br />
just right so it appeared that there were no ripples if we played<br />
[[WikiPedia:Interpolation|connect-the-dots]]. The original bandlimited signal, complete with ripples, was<br />
still there.<br />
<br />
[[image:Dsat_014.gif|360px|right]]<br />
That leads us to one more important point. You've probably heard<br />
that the timing precision of a digital signal is limited by its sample<br />
rate; put another way, that digital signals can't represent anything that falls between the<br />
samples.. implying that [[WikiPedia:Dirac_delta_function|impulses]] or<br />
[[WikiPedia:Synthesizer#ADSR_envelope|fast attacks]] have to align exactly<br />
with a sample, or the timing gets mangled or they just disappear.<br />
At this point, we can easily see why that's wrong.<br />
<br />
Again, our input signals are bandlimited. And digital signals are<br />
samples, not stairsteps, not 'connect-the-dots'. We most certainly<br />
can, for example, put the rising edge of our bandlimited square wave<br />
anywhere we want between samples.<br />
<br />
It's represented perfectly and it's reconstructed perfectly.<br />
<br />
==Epilogue==<br />
<br />
[[Image:Moffey.jpg|360px|right]]<br />
<br />
Like in [[Videos/A_Digital_Media_Primer_For_Geeks|_A Digital Media Primer for Geeks_]], we've covered a broad range of<br />
topics, and yet barely scratched the surface of each one. If anything, my<br />
sins of omission are greater this time around.<br />
<br />
Thus I encourage you to dig deeper and experiment. I chose my<br />
demos carefully to be simple and give clear results. You can<br />
reproduce every one of them on your own if you like, but let's face<br />
it: Sometimes we learn the most about a spiffy toy by breaking it open<br />
and studying all the pieces that fall out. Play with the demo parameters, hack up the code, set up<br />
alternate experiments. The source code for everything, including the<br />
little pushbutton demo application, is at the [[Videos/Digital_Show_and_Tell#Use_The_Source_Luke|bottom of this page]].<br />
<br />
In the course of experimentation, you're likely to run into something<br />
that you didn't expect and can't explain. Don't worry! My earlier<br />
snark aside, Wikipedia is fantastic for exactly this kind of casual<br />
research. If you're really serious about understanding signals,<br />
several universities have advanced materials online, such as the<br />
[http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-003-signals-and-systems-spring-2010/index.htm 6.003]<br />
and<br />
[http://ocw.mit.edu/resources/res-6-007-signals-and-systems-spring-2011/ RES.6-007]<br />
Signals and Systems modules at MIT OpenCourseWare. And of<br />
course, there's always the [http://webchat.freenode.net/?channels=xiph community here at Xiph.Org].<br />
<br />
==Credits==<br />
[[Image:Dmpfg_019.png|360px|right]]<br />
Written by: Christopher (Monty) Montgomery and the Xiph.Org Community<br />
<br />
Special thanks to:<br />
*Heidi Baumgartner, for the second Tektronix oscilloscope<br />
*Gregory Maxwell and Dr. Timothy Terriberry, for additional technical review<br />
<br />
Intro, title and credits music:<br><br />
"[http://music.lousyrobot.com/track/andy-warhol-is-gone Andy Warhol Is Gone]", by Lousy Robot<br><br />
Used by permission of Lousy Robot.<br><br />
Original source track All Rights Reserved.<br><br />
[http://www.lousyrobot.com www.lousyrobot.com]<br />
<br />
This Video Was Produced Entirely With Free and Open Source Software:<br><br />
<br />
*[http://www.gnu.org/ GNU]<br><br />
*[http://www.linux.org/ Linux]<br><br />
*[http://fedoraproject.org/ Fedora]<br><br />
*[http://cinelerra.org/ Cinelerra]<br><br />
*[http://www.gimp.org/ The Gimp]<br><br />
*[http://audacity.sourceforge.net/ Audacity]<br><br />
*[http://svn.xiph.org/trunk/postfish/README Postfish]<br><br />
*[http://gstreamer.freedesktop.org/ Gstreamer]<br><br />
<br />
All trademarks are the property of their respective owners. <br />
<br />
*''Complete video'' [http://creativecommons.org/licenses/by-sa/3.0/legalcode CC-BY-SA]<br><br />
*''Text transcript and Wiki edition'' [http://creativecommons.org/licenses/by-sa/3.0/legalcode CC-BY-SA]<br><br />
<br />
A Co-Production of Xiph.Org and Red Hat, Inc.<br><br />
(C) 2012-2013, Some Rights Reserved<br><br />
<hr/><br />
<br />
== Use The Source Luke ==<br />
<br />
As stated in the Epilogue, everything that appears in the video demos is driven by open source software, which means the source is both available for inspection and freely usable by the community. The Thinkpad that appears in the video was running Fedora 17 and Gnome Shell (Gnome 3). The demonstration software does not require Fedora specifically, but it does require Gnu/Linux to run in its current form. In all, the video involved just under 50,000 lines of new and custom-purpose code (including contributions to non-Xiph projects such as Cinelerra and [http://sourceforge.net/projects/gromit-mpx/ Gromit]).<br />
<br />
=== The Spectrum and Waveform Viewer ===<br />
<br />
The realtime software spectrum analyzer application that appears in the video was a preexisting application that was dusted off and updated for use in the video. The waveform viewer (effectively a simple software oscilloscope) was written from scratch making use of some of the internals from the spectrum analyzer application. Both are available from Xiph.Org svn:<br />
<br />
<center><div style="background-color:#DDDDDD;border-color:#CCCCCC;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
*Source for the Spectrum and Waveform applications is found at:<br />
https://svn.xiph.org/trunk/spectrum/<br />
*The source can be checked out of svn using the following command line:<br />
svn co https://svn.xiph.org/trunk/spectrum<br />
*Trac is a convenient way to browse the source without checking out a copy:<br />
https://trac.xiph.org/browser/trunk/spectrum<br />
</div></center><br />
<br />
Spectrum and Waveform both expect an input stream on the command line, either as raw data or as a WAV file.<br />
<br />
=== GTK-Bounce ===<br />
<br />
The touch-controlled application used in the video is named 'gtk-bounce' and was custom-written for the sole purpose of the in-video demonstrations. It is so named because, for the most part, all it does is read the input from an audio device, and then immediately write the same data back out for playback. It also forwards a copy of this data to up to two external monitoring applications, and in several demos, applies simple filters or generates simple waveforms. It includes several demos not included in the video.<br />
<br />
<center><div style="background-color:#DDDDDD;border-color:#CCCCCC;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
*Source for gtk-bounce is found at:<br />
https://svn.xiph.org/trunk/Xiph-episode-II/bounce/<br />
*The source can be checked out of svn using the following command line:<br />
svn co https://svn.xiph.org/trunk/Xiph-episode-II/bounce/<br />
*Trac is a convenient way to browse the source without checking out a copy:<br />
https://trac.xiph.org/browser/trunk/Xiph-episode-II/bounce/<br />
</div></center><br />
<br />
==== Starting Gtk-bounce ====<br />
The application is somewhat hardwired for specific demo parameters, but most of the hardwired settings can be found at the top of each source file. As found in SVN, the application expects an ALSA hardware audio device at hw:1, and if none if found, it will wait for one to appear. Once a sound device is successfully initialized, it expects to find and open two pipes named pipe0 and pipe1 for output in the current directory. In the video, the waveform and spectrum applications are started to take input from pipe0 and pipe1 respectively. The output sent to the two pipes is identical, and in most demos matches the output data sent to the hardware device for conversion to analog. The only exception is the tenth demo panel (which does not appear in the video) where gtk-bounce can be set to monitor the hardware inputs instead while the outputs are used to produce test waveforms.<br />
<br />
Assuming gtk-bounce, spectrum and waveform have been checked out and built, the configuration seen in the video can be started using the following commands:<br />
<center><div style="background-color:#DDDDDD;border-color:#CCCCCC;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
* make the pipe fifos for the applications to communicate (only needs to be done once)<br />
mkfifo pipe0 pipe1<br />
* start all three applications<br />
waveform pipe0 & spectrum pipe1 & gtk-bounce &<br />
</div></center><br />
<br />
==== Using Gtk-bounce ====<br />
<br />
Gtk-bounce consists of eleven pushbutton panels (numbered zero through ten) that can be selected by scrolling up and dwon with the arrow buttons on the right side. Each panel is intended for a specific demo or part of a demo.<br />
<br />
<center><div style="background-color:#DDDDDD;border-color:#CCCCCC;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
<br />
[[Image:Dsat-panel0.png|700px|center]]<br />
* '''Panel 0''': This panel presents buttons that allow the sound card to be configured in several sampling rates and bit depths. Samples read from the audio inputs are sent to the output pipes and audio outputs for playback without modification.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel1.png|700px|center]]<br />
* '''Panel 1''': Both channels are forwarded to the outputs, however the user may select the bit depth of each channel independently. When the sound card is running in 16 bit mode and 16-bit depth is selected, the data is untouched. Requantization to a lower bit depth is performed with a flat triangle dither.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel2.png|700px|center]]<br />
* '''Panel 2''': Both channels are re-quantized to the selected bit depth. Requantization to a lower bit depth is performed with a flat triangle dither.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel3.png|700px|center]]<br />
* '''Panel 3''': 'generate sine wave' discards the audio inputs and instead internally generates a sine wave at 32 bit precision, which is then quantized to the selected bit depth, optionally with dither. The resulting signal is then forwarded to the output. <br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel4.png|700px|center]]<br />
* '''Panel 4''': gtk-bounce generates a 16-bit sine wave of the selected amplitude, optionally with dither, and forwards the resulting signal to the outputs. The audio input from the audio device is discarded. Note that the slider sets the peak amplitude, not the peak-to-peak amplitude.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel5.png|700px|center]]<br />
* '''Panel 5''': generates a 16-bit sine wave, optionally quantized using dither. The user may additionally select a flat or a shaped dither. The 'notch and gain' button applies a notch filter to the resulting signal, and boosts the gain of the remaining noise so that it's easily audible. The audio input from the audio device is discarded.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel6.png|700px|center]]<br />
* '''Panel 6''': allows the user to play with the power of the dithering noise applied before quantizing the sine wave. Shaped or flat dither are available. The sine wave may also be modulated with a varying amplitude to highlight correlations between the input and the resulting quantization noise. The 'notch and gain' button applies a notch filter to the resulting signal, and boosts the gain of the remaining noise so that it's easily audible. The audio input from the audio device is discarded.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel7.png|700px|center]]<br />
* '''Panel 7''': applies a sharper antialiasing (lowpass) filter than is likely to be built into the sound-card hardware (as there's generally no reason to use a filter quite this sharp in practice). The very sharp filter allows us to bandpass the demonstration square wave without any harmonics landing in the transition band. The input is read from the audio device, passed through this sharper filter, and then forwarded to the outputs.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel8.png|700px|center]]<br />
* '''Panel 8''': when selected, generate a synthetic 'square wave' (this is not quite equivalent to a bandlimited analog square wave; the harmonic amplitudes are a bit different) that when aligned with the sampling phase just right gives the appearance of having infinite rise and fall time. The slider allows us to shift the waveform sample alignment back and forth by +/- one sample to reveal that the underlying signal is still band-limited.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel9.png|700px|center]]<br />
* '''Panel 9''': as in panel 8, generate a 'perfect' synthetic 'square wave'. However, the slider now allows us to shift the sample alignment of the second channel with respect to the first, instead of shifting both channels. This allows us the trigger/lock the scope timing to the channel 1 waveform so we can see the fractional sample movement and alignment of the waveform on channel 2. The audio input from the audio device is discarded.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel10.png|700px|center]]<br />
* '''Panel 10''': not used in the video; The audio device is configured to 24-bit input/output. The user may produce one of a range of test signals that are output to both the external applications and the audio device on the first channel. The input on the second channel is passed-through to the applications and audio device outputs unchanged. The first channel input is unused unless 'two input mode' is selected. When two input mode is selected, both input channels are read and the data sent to the external applications. Generated test signals are sent only to the audio hardware (on the first channel). This combination of test signals and input modes allows self-references frequency response, phase, noise, distortion and crosstalk testing of a given audio device.<br />
<br />
<div style="clear: both">&nbsp;</div><br />
<br />
</div></center><br />
<br />
=== Cairo Animations ===<br />
<br />
The animations featured throughout the Episode 2 video were rapid-development spaghetti hack-jobs coded by hand in raw Cairo. Each module generated a series of PNG stills that were then stitched into an animation with Cinelerra or mplayer. In the interest of pointing and laughing at what really bad code looks like...<br />
<br />
<center><div style="background-color:#DDDDDD;border-color:#CCCCCC;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
*Source for the Cairo animations is found at:<br />
https://svn.xiph.org/trunk/Xiph-episode-II/cairo/<br />
*The source can be checked out of svn using the following command line:<br />
svn co https://svn.xiph.org/trunk/Xiph-episode-II/cairo/<br />
*Trac is a convenient way to browse the source without checking out a copy:<br />
https://trac.xiph.org/browser/trunk/Xiph-episode-II/cairo/<br />
</div></center></div>Gmaxwellhttps://wiki.xiph.org/index.php?title=Talk:Videos/Digital_Show_and_Tell&diff=14044Talk:Videos/Digital Show and Tell2013-02-26T11:27:55Z<p>Gmaxwell: more comments</p>
<hr />
<div>Greetings, Feel free to comment here— just log in to edit— or join us on [http://webchat.freenode.net/?channels=xiph IRC chat]. <br />
<br />
The wiki version of the video isn't yet as complete as the last video, due to schedules and timelines. In particular I think it could use some more going-deeper coverage. I'm surprised that I couldn't better HTML5 audio api examples of the "type your own JS, get audio and a scope" kind, if anyone knows of a better one than the one we have now that would be great.<br />
<br />
--[[User:Gmaxwell|Gmaxwell]] 02:54, 26 February 2013 (PST)</div>Gmaxwellhttps://wiki.xiph.org/index.php?title=Videos/Digital_Show_and_Tell&diff=14043Videos/Digital Show and Tell2013-02-26T11:20:35Z<p>Gmaxwell: /* Credits */ hr under the credits.</p>
<hr />
<div><small>''Wiki edition''</small><br />
[[Image:dsat_001.jpg|400px|right]]<br />
<br />
Continuing in the "firehose" tradition of [[Videos/A_Digital_Media_Primer_For_Geeks|Episode 01]], Xiph.Org's second video on digital media explores multiple facets of digital audio signals and how they ''really'' behave in the real world.<br />
<br />
Demonstrations of sampling, quantization, bit-depth, and dither explore digital audio behavior on real audio equipment using both modern digital analysis and vintage analog bench equipment, just in case we can't trust those newfangled digital gizmos. You can download the source code for each demo and try it all for yourself!<br />
<br/><br/><br/><br />
<center><font size="+2">[http://www.xiph.org/video/vid2.shtml Download or Watch online]</font></center><br />
<br style="clear:both;"/><br />
Supported players: [http://www.videolan.org/vlc/ VLC 1.1+], [https://www.mozilla.com/en-US/firefox/ Firefox ], [http://www.chromium.org/Home Chrome ], [http://www.opera.com/ Opera]. Or see [http://www.webmproject.org/users/ other WebM] or [[TheoraSoftwarePlayers|other Theora]] players.<br />
<br />
If you're having trouble with playback in a modern browser or player, please visit our [[Playback_Troubleshooting|playback troubleshooting and discussion]] page.<br />
<br/><br />
<hr/><br />
<br/><br/><br/><br />
[[Image:Xiph_ep02_test.png|400px|right]]<br />
<br />
&ldquo;Hi, I'm Monty Montgomery from [http://www.redhat.com/ Red Hat] and [http://xiph.org/ Xiph.Org].<br />
<br />
&ldquo;A few months ago, I wrote<br />
[http://people.xiph.org/~xiphmont/demo/neil-young.html an article on digital audio and why 24bit/192kHz music downloads don't make sense].<br />
In the article, I<br />
mentioned--almost in passing--that a digital waveform is<br />
[http://people.xiph.org/~xiphmont/demo/neil-young.html#toc_sfam not a stairstep],<br />
and you certainly don't get a stairstep when you<br />
[[WikiPedia:Digital-to-analog_converter|convert from digital back to analog]].<br />
<br />
&ldquo;Of everything in the entire article, '''that''' was the number one thing<br />
people wrote about. In fact, more than half the mail I got was questions and<br />
comments about basic digital signal behavior. Since there's interest, let's<br />
take a little time to play with some ''simple'' digital signals. &rdquo;<br />
<br />
==Veritas ex machina==<br />
[[Image:Dsat_002.jpg|200px|right]]<br />
[[Image:Dsat_003.jpg|200px|right]]<br />
[[Image:Dsat_004.jpg|200px|right]]<br />
[[Image:Dsat_005.jpg|200px|right]]<br />
<br />
If we pretend for a moment that we have no idea how digital signals really<br />
behave, then it doesn't make sense for us to use digital test<br />
equipment. Fortunately for this exercise, there's still plenty<br />
of working analog lab equipment out there.<br />
<br />
We need a [[WikiPedia:Function_generator|signal generator]] to provide us with analog input<br />
signals--in this case, an<br />
[http://www.home.agilent.com/en/pd-3325A%3Aepsg%3Apro-pn-3325A/synthesizer-function-generator?pm=PL&nid=-536900197.536896863&cc=SE&lc=swe HP3325]<br />
from 1978.<br />
<br />
We'll observe our analog waveforms on [[WikiPedia:Oscilloscope_types#Cathode-ray_oscilloscope_.28CRO.29|analog oscilloscopes]],<br />
like this Tektronix 2246 from the mid-90s, one of the last and best analog scopes made.<br />
<br />
Finally, we'll inspect the [[WikiPedia:Spectral_density#Electrical_engineering|frequency spectrum]] of our signals using an<br />
[[WikiPedia:Spectrum_analyzer#Swept-tuned|analog spectrum analyzer]], this<br />
[http://www.home.agilent.com/en/pd-3585A%3Aepsg%3Apro-pn-3585A/spectrum-analyzer-high-perf-20hz-40mhz?pm=PL&nid=-536900197.536897319&cc=SE&lc=swe HP3585]<br />
from the same product line as<br />
the signal generator. Like the other equipment here it has<br />
[http://www.hp9845.net/9845/hardware/processors/ a rudimentary and hilariously large microcontroller],<br />
but the signal path<br />
from input to what you see on the screen is completely analog.<br />
<br />
All of this equipment is vintage, but the specs are still quite good.<br />
We start with the signal generator set to output a 1 [[WikiPedia:Hertz#SI_multiples|kHz]]<br />
sine wave at one [[WikiPedia:Volt|Volt]] [[WikiPedia:Amplitude#Root_mean_square_amplitude|RMS]].<br />
We see the sine wave on the oscilloscope, can verify that it is indeed<br />
1 kHz at 1 Volt RMS, which is 2.8 Volts<br />
[[WikiPedia:Amplitude#Peak-to-peak_amplitude|peak-to-peak]],<br />
and that matches the<br />
measurement on the spectrum analyzer as well.<br />
<br />
The analyzer also shows some low-level [[WikiPedia:White_noise|white noise]]<br />
and just a bit of [[WikiPedia:Harmonic_distortion#Harmonic_distortion|harmonic distortion]],<br />
with the highest peak about 70[[WikiPedia:Decibel|dB]] or so below<br />
[[WikiPedia:Fundamental_frequency|the fundamental]].<br />
This doesn't matter to the demos, but it's good to take notice of it now to avoid confusion later.<br />
<br />
For digital conversion, we use a boring, consumer-grade, eMagic USB1<br />
audio device. It's more than ten years old at this point, and it's<br />
getting obsolete.<br />
<br />
A recent converter can easily have an order of magnitude better specs.<br />
[[WikiPedia:Reconstruction_filter#Sampled_data_reconstruction_filters|Flatness]],<br />
[[WikiPedia:Analog-to-digital_converter#Non-linearity|linearity]],<br />
[[WikiPedia:Jitter#Sampling_jitter|jitter]],<br />
[[WikiPedia:Noise_floor|noise behavior]],<br />
[[WikiPedia:Digital-to-analog_converter#DAC_performance|everything]]...<br />
You may not<br />
have noticed. Just because we can measure an improvement doesn't<br />
mean we can hear it, and even these old consumer boxes were already at<br />
the edge of ideal transparency.<br />
<br />
The eMagic connects to my ThinkPad, which displays a digital<br />
waveform and spectrum for comparison, then the ThinkPad<br />
sends the digital signal right back out to the eMagic for<br />
re-conversion to analog and observation on the output scopes.<br />
<br />
<br style="clear:both;"/><br />
<br />
==Stairsteps==<br />
[[Image:Dsat 006.jpg|360px|right]]<br />
[[Image:Dsat 007.png|360px|right]]<br />
First demo: We begin by converting an analog signal to digital and<br />
then right back to analog again with no other steps.<br />
<br />
The signal generator is set to produce a 1kHz sine wave just like<br />
before and we can see the analog sine wave on the input-side oscilloscope. The eMagic digitizes our signal to<br />
[[Videos/A_Digital_Media_Primer_For_Geeks#Raw_.28digital_audio.29_meat|16 bit PCM at 44.1kHz]],<br />
same as on a CD. The spectrum of the digitized signal on the Thinkpad matches what we saw earlier and what we see now on the analog spectrum analyzer, aside from its <br />
[[WikiPedia:High_impedance|high-impedance input]] being just a smidge noisier. For now, the waveform display shows our digitized sine wave as a<br />
stairstep pattern, one step for each sample.<br />
<br />
When we look at the output signal that's been converted<br />
from digital back to analog, we see that it's exactly like the original sine wave. No stairsteps.<br />
<br />
1 kHz is still a fairly low frequency, so perhaps the stairsteps are just<br />
hard to see or they're being smoothed away. Next, set the signal generator to 15kHz, which is much closer to [[WikiPedia:Nyquist_frequency|Nyquist]].<br />
Now the sine wave is represented by less than three samples per cycle, and the digital waveform appears rather poor! Yet the analog output is still a perfect sine wave, exactly like the original.<br />
As we keep increasing frequency, all the way to 20kHz, the output waveform is still perfect. No jagged edges, no dropoff, no stairsteps.<br />
<br />
So where'd the stairsteps go? It's a trick question; they were never there. Drawing a digital waveform as a stairstep was wrong to begin with.<br />
<br />
A stairstep is a continuous-time function. It's jagged, and it's piecewise, but it has a defined value at every point in time.<br />
A sampled signal is entirely different. It's discrete-time; it's only got a value right at each instantaneous sample point and it's<br />
undefined, there is no value at all, everywhere between. A discrete-time signal is properly drawn as a lollipop graph.<br />
The continuous, analog counterpart of a digital signal passes smoothly through each sample point, and that's just as true for high<br />
frequencies as it is for low.<br />
<br />
[[Image:Dsat 008.png|360px|right]]<br />
The interesting and non-obvious bit is that [[WikiPedia:Nyquist%E2%80%93Shannon_sampling_theorem|there's only one<br />
bandlimited signal that passes exactly through each sample point]]; it's a unique solution. If you sample a bandlimited signal and then convert it back, the original input is also the only possible output.<br />
A signal that differs even minutely from the original includes frequency content at or beyond Nyquist, breaks the bandlimiting requirement and isn't a valid solution.<br />
<br />
So how did everyone get confused and start thinking of digital signals as stairsteps? I can think of two good reasons.<br />
<br />
First: it's easy to convert a sampled signal to a true stairstep. Just<br />
extend each sample value forward until the next sample period. This is<br />
called a [[WikiPedia:Zero-order hold|zero-order hold]], and it's an important part of how some<br />
digital-to-analog converters work, especially the simplest ones.<br />
As a result, anyone who looks up [[WikiPedia:Digital-to-analog_converter#Practical_operation|digital-to-analog converter or<br />
digital-to-analog conversion]] is probably going to see a diagram of a<br />
stairstep waveform somewhere, but that's not a finished conversion,<br />
and it's not the signal that comes out.<br />
<br />
Second, and this is probably the more likely reason, engineers who<br />
supposedly know better (yes, even I) draw stairsteps even though they're<br />
technically wrong. It's a sort of one-dimensional version of<br />
[[WikiPedia:MacPaint#Development|fat bits in an image editor]].<br />
Pixels aren't squares either, they're samples of a 2-dimensional<br />
function space and so they're also, conceptually, infinitely small<br />
points. Practically, it's a real pain in the ass to see or manipulate<br />
infinitely small anything, so big squares it is.<br />
<br />
Digital stairstep drawings are exactly the same thing. It's just a convenient drawing. The stairsteps aren't really there.<br />
<div style="clear:both"></div><br />
<br />
==Bit-depth==<br />
[[Image:Dsat_009.jpg|360px|right]]<br />
[[Image:Dsat_010.jpg|260px|right]]<br />
<br />
When we convert a digital signal back to analog, the result is<br />
''also'' smooth regardless of the [[WikiPedia:Audio_bit_depth|bit depth]]. It doesn't matter if it's 24 bits or 16 bits or 8 bits.<br />
So does that mean that the digital bit depth makes no difference at<br />
all? Of course not.<br />
<br />
Channel 2 is the same sine wave input, but we quantize it with<br />
[[WikiPedia:Dither|dither]] down to 8 bits.<br />
On the scope, we still see a nice<br />
smooth sine wave on channel 2. Look very close, and you'll also see a<br />
bit more noise. That's a clue.<br />
<br />
If we look at the spectrum of the signal, our sine wave is<br />
still there unaffected, but the noise level of the 8-bit signal on<br />
the second channel is much higher. And that's the difference, the only difference, the number of bits makes.<br />
<br />
When we digitize a signal, first we sample it. The<br />
sampling step is perfect; it loses nothing. But then we [[WikiPedia:Quantization_(sound_processing)|quantize]] it,<br />
and [[WikiPedia:Quantization_error|quantization adds noise]].<br />
The number of bits determines how much noise and so the level of the<br />
noise floor.<br />
<br />
What does this dithered quantization noise sound like?<br />
Those of you who have used analog recording equipment might think to yourselves, "My goodness! That sounds like tape hiss!"<br />
Well, it doesn't just sound like tape hiss, it acts like it too, and<br />
if we use a [[WikiPedia:Dither#Different_types|gaussian dither]] then it's<br />
[[WikiPedia:Central_limit_theorem|mathematically equivalent]] in every way. It ''is'' tape hiss.<br />
<br />
Intuitively, that means that we can measure tape hiss and thus the noise floor<br />
of [[WikiPedia:Magnetic_tape_sound_recording|magnetic audio tape]]<br />
in [[WikiPedia:Shannon–Hartley_theorem#Examples|bits instead of decibels]], in order to put things in a<br />
digital perspective. [[WikiPedia:Compact cassettes|Compact cassettes]], for those of you who are old enough to remember them, could reach as<br />
deep as 9 bits in perfect conditions. 5 to 6 bits was<br />
more typical, especially if it was a recording made on a<br />
[[WikiPedia:Cassette_deck|tape deck]]. That's right; your old mix tapes were only about 6 bits<br />
deep if you were lucky!<br />
<br />
The very best professional [[WikiPedia:Reel-to-reel_audio_tape_recording|open reel tape]] used in studios could barely<br />
hit 13 bits ''with'' [[WikiPedia:Reel-to-reel_audio_tape_recording#Noise_reduction|advanced noise reduction]]. <br />
That's why seeing '[[WikiPedia:SPARS_code|D D D]]' on a [[WikiPedia:Compact_disk|Compact Disc]] used to be such a big,<br />
high-end deal.<br />
<br />
<div style="clear:both"></div><br />
<br />
==Dither==<br />
[[Image:Dsat_011.png|360px|right]]<br />
<br />
We've been quantizing with [[Wikipedia:dither|dither]]. What is dither<br />
exactly and, more importantly, what does it do?<br />
<br />
The simplest way to quantize a signal is to choose the digital<br />
amplitude value [[WikiPedia:Rounding|closest to the original analog amplitude]].<br />
Unfortunately, the exact noise that results from this simple<br />
quantization scheme depends somewhat on the input signal.<br />
It may be inconsistent, cause distortion, or be<br />
undesirable in some other way.<br />
<br style="clear:both;"/><br />
<br />
<center><div style="background-color:#DDDDFF;border-color:#CCCCDD;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
'''Going deeper…'''<br />
*Cameron Nicklaus Christou's thesis [http://uwspace.uwaterloo.ca/bitstream/10012/3867/1/thesis.pdf Optimal Dither and Noise Shaping in Image Processing] provides an ''excellent'' explanation of dither and noise shaping.<br />
</div>&nbsp;</center><br />
<br />
Dither is specially-constructed noise that substitutes for the noise<br />
produced by simple quantization. Dither doesn't [[WikiPedia:Sound_masking|drown out or mask]]<br />
quantization noise, it replaces it with noise characteristics<br />
of our choosing that aren't influenced by the input.<br />
<br />
The signal generator has too much noise for this test so we produce a mathematically perfect sine wave with the ThinkPad and quantize it to 8 bits with dithering.<br />
We see the sine wave on waveform display and output scope, and <br />
a clean frequency peak with a uniform noise floor on both spectral displays<br />
just like before. Again, this is with dither.<br />
<br />
Now I turn dithering off.<br />
<br />
The quantization noise that dither had spread out into a nice, flat noise<br />
floor, piles up into harmonic distortion peaks. The noise floor is<br />
lower, but the level of distortion becomes nonzero, and the distortion<br />
peaks sit higher than the dithering noise did.<br />
<br />
At 8 bits this effect is exaggerated. At 16 bits,<br />
even without dither, harmonic distortion is going to be so low as to<br />
be completely inaudible. Still, we can use dither to eliminate it completely if we so choose.<br />
<br />
Turning the dither off again for a moment, you'll notice that the<br />
absolute level of distortion from undithered quantization stays<br />
approximately constant regardless of the input amplitude.<br />
But when the signal level drops below a half a bit, everything<br />
quantizes to zero.<br />
<br />
In a sense, everything quantizing to zero is just 100% distortion!<br />
Dither eliminates this distortion too. When we reenable dither, we clearly see our signal at 1/4 bit with a nice flat noise floor.<br />
<br />
The noise floor doesn't have to be flat. Dither is noise of our<br />
choosing, so it makes sense to choose a noise as [http://www.acoustics.salford.ac.uk/res/cox/sound_quality/?content=subjective inoffensive] and<br />
[[WikiPedia:Absolute_threshold_of_hearing|difficult to notice]]<br />
as possible.<br />
<br />
Human hearing is [[WikiPedia:Equal-loudness_contour|most sensitive in the midrange from 2kHz to 4kHz]]; that's where background noise is going to be the most obvious.<br />
We can [[WikiPedia:Noise_shaping|shape dithering noise]] away from sensitive frequencies to where<br />
hearing is less sensitive, usually the highest frequencies.<br />
<br />
Lastly, dithered quantization noise ''is'' higher [[WikiPedia:Sound_power|power]] overall<br />
than undithered quantization noise, even though it often sounds quieter, and<br />
you can see that on a [[WikiPedia:VU_meter|VU meter]] during passages of near-silence. However,<br />
dither isn't only an on or off choice. We can reduce the dither's<br />
power to balance less noise against a bit of distortion to minimize<br />
the overall effect.<br />
<br />
For the next test, we also [[WikiPedia:Amplitude_modulation|modulate the input signal]] like this to show how a varying input affects the quantization noise. At<br />
full dithering power, the noise is uniform, constant, and featureless<br />
just like we expect.<br />
<br />
As we reduce the dither's power, the input increasingly<br />
affects the amplitude and the character of the quantization noise.<br />
Shaped dither behaves similarly, but noise shaping lends one more nice<br />
advantage; it can use a somewhat lower<br />
dither power before the input has as much effect on the output.<br />
<br />
Despite all this text spent on dither, the differences exist 100 decibels or more below [[WikiPedia:Full_scale|full scale]]. If the CD had been<br />
[http://www.research.philips.com/technologies/projects/cd/index.html 14 bits as originally designed],<br />
perhaps dither ''might'' be<br />
more important. At 16 bits it's mostly a wash. It's reasonable to treat<br />
dither as an insurance policy that gives several extra<br />
decibels of dynamic range just in case. That said no<br />
one ever ruined a great recording by not dithering the final master.<br />
<br />
==Bandlimitation and timing==<br />
[[image:Dsat_016.jpg|360px|right]]<br />
<br />
We've been using [[WikiPedia:Sine_wave|sine waves]]. They're the obvious choice when what we<br />
want to see is a system's behavior at a given isolated frequency. Now let's look at something a bit more complex. What should we expect to happen when I change the input to a [[WikiPedia:Square_wave|square wave]]? <br />
<br />
The input scope confirms a 1kHz square wave. The output scope shows... exactly what it should.<br />
<br />
What is a square wave really? <br />
<br />
We can say it's a waveform that's some positive value for half a cycle and then transitions instantaneously to a negative value for the other half.<br />
<br />
:<math><br />
\ squarewave(t) = \begin{cases} 1, & |t| < T_1 \\ 0, & T_1 < |t| \leq {1 \over 2}T \end{cases}<br />
</math><br />
<br />
But that doesn't really tell us anything useful about how that input becomes this output.<br />
<br />
We remember that any waveform is also [[WikiPedia:Fourier_series|the sum of discrete frequencies]],<br />
and a square wave is particularly simple sum: a fundamental and an infinite series of [[WikiPedia:Even_and_odd_functions#Harmonics|odd harmonics]].<br />
<br />
[[image:Dsat_013.jpg|360px|right]]<br />
:<math>\begin{align}<br />
\ squarewave(t) = \frac{4}{\pi}\sin(\omega t) + \frac{4}{3\pi}\sin(3\omega t) + \frac{4}{5\pi}\sin(5\omega t) + \\<br />
\frac{4}{7\pi}\sin(7\omega t) + \frac{4}{9\pi}\sin(9\omega t) + \frac{4}{11\pi}\sin(11\omega t) + \\ <br />
\frac{4}{13\pi}\sin(13\omega t) + \frac{4}{15\pi}\sin(15\omega t) + \frac{4}{17\pi}\sin(17\omega t) + \\<br />
\frac{4}{19\pi}\sin(19\omega t) + \frac{4}{21\pi}\sin(21\omega t) + \frac{4}{23\pi}\sin(23\omega t) + \\<br />
\frac{4}{25\pi}\sin(25\omega t) + \frac{4}{27\pi}\sin(27\omega t) + \frac{4}{29\pi}\sin(29\omega t) + \\<br />
\frac{4}{31\pi}\sin(31\omega t) + \frac{4}{33\pi}\sin(33\omega t) + \cdots <br />
\end{align}</math><br />
<br />
At first glance, that doesn't seem very useful either; you'd have to sum an infinite number of harmonics to get the answer! However, we don't have an infinite number of harmonics.<br />
<br />
We're using a quite sharp [[WikiPedia:Low-pass_filter|anti-aliasing filter]] that cuts off right<br />
above 20kHz, so our signal is [[WikiPedia:Bandlimiting|bandlimited]]. Only the first ten terms make it through, and that's exactly what we see on the output scope.<br />
<br />
<br style="clear:both;"/><br />
<center><div style="background-color:#DDDDFF;border-color:#CCCCDD;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
'''Going deeper…'''<br />
*In modern web browsers you can program audio synthesizers directly in javascript. Use the two square wave formulas to get a square wave out of [http://js.do/blog/sound-waves-with-javascript/ this page]. (Note: The scope is not very accurate/useful.) <br />
</div></center><br />
<div>&nbsp;</div><br />
<br />
[[Image:dsat_015.jpg|360px|right]]<br />
The rippling you see around sharp edges in a bandlimited signal is called the [[WikiPedia:/Gibbs_phenomenon|Gibbs effect]]. It happens whenever you slice off part of the frequency domain in the middle of nonzero energy.<br />
<br />
The usual rule of thumb you'll hear is "the sharper the cutoff, the<br />
stronger the rippling", which is approximately true, but we have to be<br />
careful how we think about it. For example, what would you expect our quite sharp anti-aliasing filter<br />
to do if I run our signal through it a second time?<br />
<br />
Aside from adding a few fractional cycles of delay, the answer is:<br />
Nothing at all. The signal is already bandlimited. Bandlimiting it<br />
again doesn't do anything. A second pass can't remove frequencies<br />
that we already removed.<br />
<br />
That's important. People tend to think of the ripples as<br />
a kind of [[WikiPedia:Sonic_artifact|artifact]] that's added by anti-aliasing and [[WikiPedia:Reconstruction_filter|anti-imaging]]<br />
filters, implying that the ripples get worse each time the signal<br />
passes through. We see that in this case that didn't happen, so<br />
it wasn't really the filter that added the ripples the first time<br />
through. It's a subtle distinction, but Gibbs effect<br />
ripples aren't added by filters, they're just part of what a<br />
bandlimited signal ''is''.<br />
<br />
Even if we synthetically construct what looks like a perfect digital<br />
square wave it's still limited to the channel bandwidth. Remember that<br />
the stairstep representation is misleading. What we really have here are instantaneous sample points<br />
and only one bandlimited signal fits those points. All we did when we<br />
drew our apparently perfect square wave was line up the sample points<br />
just right so it appeared that there were no ripples if we played<br />
[[WikiPedia:Interpolation|connect-the-dots]]. The original bandlimited signal, complete with ripples, was<br />
still there.<br />
<br />
[[image:Dsat_014.gif|360px|right]]<br />
That leads us to one more important point. You've probably heard<br />
that the timing precision of a digital signal is limited by its sample<br />
rate; put another way, that digital signals can't represent anything that falls between the<br />
samples.. implying that [[WikiPedia:Dirac_delta_function|impulses]] or<br />
[[WikiPedia:Synthesizer#ADSR_envelope|fast attacks]] have to align exactly<br />
with a sample, or the timing gets mangled or they just disappear.<br />
At this point, we can easily see why that's wrong.<br />
<br />
Again, our input signals are bandlimited. And digital signals are<br />
samples, not stairsteps, not 'connect-the-dots'. We most certainly<br />
can, for example, put the rising edge of our bandlimited square wave<br />
anywhere we want between samples.<br />
<br />
It's represented perfectly and it's reconstructed perfectly.<br />
<br />
==Epilogue==<br />
<br />
[[Image:Moffey.jpg|360px|right]]<br />
<br />
Like in [[Videos/A_Digital_Media_Primer_For_Geeks|_A Digital Media Primer for Geeks_]], we've covered a broad range of<br />
topics, and yet barely scratched the surface of each one. If anything, my<br />
sins of omission are greater this time around.<br />
<br />
Thus I encourage you to dig deeper and experiment. I chose my<br />
demos carefully to be simple and give clear results. You can<br />
reproduce every one of them on your own if you like, but let's face<br />
it: Sometimes we learn the most about a spiffy toy by breaking it open<br />
and studying all the pieces that fall out. Play with the demo parameters, hack up the code, set up<br />
alternate experiments. The source code for everything, including the<br />
little pushbutton demo application, is at the [[Videos/Digital_Show_and_Tell#Use_The_Source_Luke|bottom of this page]].<br />
<br />
In the course of experimentation, you're likely to run into something<br />
that you didn't expect and can't explain. Don't worry! My earlier<br />
snark aside, Wikipedia is fantastic for exactly this kind of casual<br />
research. If you're really serious about understanding signals,<br />
several universities have advanced materials online, such as the<br />
[http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-003-signals-and-systems-spring-2010/index.htm 6.003]<br />
and<br />
[http://ocw.mit.edu/resources/res-6-007-signals-and-systems-spring-2011/ RES.6-007]<br />
Signals and Systems modules at MIT OpenCourseWare. And of<br />
course, there's always the [http://webchat.freenode.net/?channels=xiph community here at Xiph.Org].<br />
<br />
==Credits==<br />
[[Image:Dmpfg_019.png|360px|right]]<br />
Written by: Christopher (Monty) Montgomery and the Xiph.Org Community<br />
<br />
Special thanks to:<br />
*Heidi Baumgartner, for the second Tektronix oscilloscope<br />
*Gregory Maxwell and Dr. Timothy Terriberry, for additional technical review<br />
<br />
Intro, title and credits music:<br><br />
"[http://music.lousyrobot.com/track/andy-warhol-is-gone Andy Warhol Is Gone]", by Lousy Robot<br><br />
Used by permission of Lousy Robot.<br><br />
Original source track All Rights Reserved.<br><br />
[http://www.lousyrobot.com www.lousyrobot.com]<br />
<br />
This Video Was Produced Entirely With Free and Open Source Software:<br><br />
<br />
*[http://www.gnu.org/ GNU]<br><br />
*[http://www.linux.org/ Linux]<br><br />
*[http://fedoraproject.org/ Fedora]<br><br />
*[http://cinelerra.org/ Cinelerra]<br><br />
*[http://www.gimp.org/ The Gimp]<br><br />
*[http://audacity.sourceforge.net/ Audacity]<br><br />
*[http://svn.xiph.org/trunk/postfish/README Postfish]<br><br />
*[http://gstreamer.freedesktop.org/ Gstreamer]<br><br />
<br />
All trademarks are the property of their respective owners. <br />
<br />
*''Complete video'' [http://creativecommons.org/licenses/by-sa/3.0/legalcode CC-BY-SA]<br><br />
*''Text transcript and Wiki edition'' [http://creativecommons.org/licenses/by-sa/3.0/legalcode CC-BY-SA]<br><br />
<br />
A Co-Production of Xiph.Org and Red Hat, Inc.<br><br />
(C) 2012-2013, Some Rights Reserved<br><br />
<hr/><br />
<br />
== Use The Source Luke ==<br />
<br />
As stated in the Epilogue, everything that appears in the video demos is driven by open source software, which means the source is both available for inspection and freely usable by the community. The Thinkpad that appears in the video was running Fedora 17 and Gnome Shell (Gnome 3). The demonstration software does not require Fedora specifically, but it does require Gnu/Linux to run in its current form. In all, the video involved just under 50,000 lines of new and custom-purpose code (including contributions to non-Xiph projects such as Cinelerra and Gromit).<br />
<br />
=== The Spectrum and Waveform Viewer ===<br />
<br />
The realtime software spectrum analyzer application that appears in the video was a preexisting application that was dusted off and updated for use in the video. The waveform viewer (effectively a simple software oscilloscope) was written from scratch making use of some of the internals from the spectrum analyzer application. Both are available from Xiph.Org svn:<br />
<br />
<center><div style="background-color:#DDDDDD;border-color:#CCCCCC;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
*Source for the Spectrum and Waveform applications is found at:<br />
https://svn.xiph.org/trunk/spectrum/<br />
*The source can be checked out of svn using the following command line:<br />
svn co https://svn.xiph.org/trunk/spectrum<br />
*Trac is a convenient way to browse the source without checking out a copy:<br />
https://trac.xiph.org/browser/trunk/spectrum<br />
</div></center><br />
<br />
Spectrum and Waveform both expect an input stream on the command line, either as raw data or as a WAV file.<br />
<br />
=== GTK-Bounce ===<br />
<br />
The touch-controlled application used in the video is named 'gtk-bounce' and was custom-written for the sole purpose of the in-video demonstrations. It is so named because, for the most part, all it does is read the input from an audio device, and then immediately write the same data back out for playback. It also forwards a copy of this data to up to two external monitoring applications, and in several demos, applies simple filters or generates simple waveforms. It includes several demos not included in the video.<br />
<br />
<center><div style="background-color:#DDDDDD;border-color:#CCCCCC;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
*Source for gtk-bounce is found at:<br />
https://svn.xiph.org/trunk/Xiph-episode-II/bounce/<br />
*The source can be checked out of svn using the following command line:<br />
svn co https://svn.xiph.org/trunk/Xiph-episode-II/bounce/<br />
*Trac is a convenient way to browse the source without checking out a copy:<br />
https://trac.xiph.org/browser/trunk/Xiph-episode-II/bounce/<br />
</div></center><br />
<br />
==== Starting Gtk-bounce ====<br />
The application is somewhat hardwired for specific demo parameters, but most of the hardwired settings can be found at the top of each source file. As found in SVN, the application expects an ALSA hardware audio device at hw:1, and if none if found, it will wait for one to appear. Once a sound device is successfully initialized, it expects to find and open two pipes named pipe0 and pipe1 for output in the current directory. In the video, the waveform and spectrum applications are started to take input from pipe0 and pipe1 respectively. The output sent to the two pipes is identical, and in most demos matches the output data sent to the hardware device for conversion to analog. The only exception is the tenth demo panel (which does not appear in the video) where gtk-bounce can be set to monitor the hardware inputs instead while the outputs are used to produce test waveforms.<br />
<br />
Assuming gtk-bounce, spectrum and waveform have been checked out and built, the configuration seen in the video can be started using the following commands:<br />
<center><div style="background-color:#DDDDDD;border-color:#CCCCCC;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
* make the pipe fifos for the applications to communicate (only needs to be done once)<br />
mkfifo pipe0 pipe1<br />
* start all three applications<br />
waveform pipe0 & spectrum pipe1 & gtk-bounce &<br />
</div></center><br />
<br />
==== Using Gtk-bounce ====<br />
<br />
Gtk-bounce consists of eleven pushbutton panels (numbered zero through ten) that can be selected by scrolling up and dwon with the arrow buttons on the right side. Each panel is intended for a specific demo or part of a demo.<br />
<br />
<center><div style="background-color:#DDDDDD;border-color:#CCCCCC;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
<br />
[[Image:Dsat-panel0.png|700px|center]]<br />
* '''Panel 0''': This panel presents buttons that allow the sound card to be configured in several sampling rates and bit depths. Samples read from the audio inputs are sent to the output pipes and audio outputs for playback without modification.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel1.png|700px|center]]<br />
* '''Panel 1''': Both channels are forwarded to the outputs, however the user may select the bit depth of each channel independently. When the sound card is running in 16 bit mode and 16-bit depth is selected, the data is untouched. Requantization to a lower bit depth is performed with a flat triangle dither.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel2.png|700px|center]]<br />
* '''Panel 2''': Both channels are re-quantized to the selected bit depth. Requantization to a lower bit depth is performed with a flat triangle dither.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel3.png|700px|center]]<br />
* '''Panel 3''': 'generate sine wave' discards the audio inputs and instead internally generates a sine wave at 32 bit precision, which is then quantized to the selected bit depth, optionally with dither. The resulting signal is then forwarded to the output. <br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel4.png|700px|center]]<br />
* '''Panel 4''': gtk-bounce generates a 16-bit sine wave of the selected amplitude, optionally with dither, and forwards the resulting signal to the outputs. The audio input from the audio device is discarded. Note that the slider sets the peak amplitude, not the peak-to-peak amplitude.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel5.png|700px|center]]<br />
* '''Panel 5''': generates a 16-bit sine wave, optionally quantized using dither. The user may additionally select a flat or a shaped dither. The 'notch and gain' button applies a notch filter to the resulting signal, and boosts the gain of the remaining noise so that it's easily audible. The audio input from the audio device is discarded.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel6.png|700px|center]]<br />
* '''Panel 6''': allows the user to play with the power of the dithering noise applied before quantizing the sine wave. Shaped or flat dither are available. The sine wave may also be modulated with a varying amplitude to highlight correlations between the input and the resulting quantization noise. The 'notch and gain' button applies a notch filter to the resulting signal, and boosts the gain of the remaining noise so that it's easily audible. The audio input from the audio device is discarded.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel7.png|700px|center]]<br />
* '''Panel 7''': applies a sharper antialiasing (lowpass) filter than is likely to be built into the sound-card hardware (as there's generally no reason to use a filter quite this sharp in practice). The very sharp filter allows us to bandpass the demonstration square wave without any harmonics landing in the transition band. The input is read from the audio device, passed through this sharper filter, and then forwarded to the outputs.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel8.png|700px|center]]<br />
* '''Panel 8''': when selected, generate a synthetic 'square wave' (this is not quite equivalent to a bandlimited analog square wave; the harmonic amplitudes are a bit different) that when aligned with the sampling phase just right gives the appearance of having infinite rise and fall time. The slider allows us to shift the waveform sample alignment back and forth by +/- one sample to reveal that the underlying signal is still band-limited.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel9.png|700px|center]]<br />
* '''Panel 9''': as in panel 8, generate a 'perfect' synthetic 'square wave'. However, the slider now allows us to shift the sample alignment of the second channel with respect to the first, instead of shifting both channels. This allows us the trigger/lock the scope timing to the channel 1 waveform so we can see the fractional sample movement and alignment of the waveform on channel 2. The audio input from the audio device is discarded.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel10.png|700px|center]]<br />
* '''Panel 10''': not used in the video; The audio device is configured to 24-bit input/output. The user may produce one of a range of test signals that are output to both the external applications and the audio device on the first channel. The input on the second channel is passed-through to the applications and audio device outputs unchanged. The first channel input is unused unless 'two input mode' is selected. When two input mode is selected, both input channels are read and the data sent to the external applications. Generated test signals are sent only to the audio hardware (on the first channel). This combination of test signals and input modes allows self-references frequency response, phase, noise, distortion and crosstalk testing of a given audio device.<br />
<br />
<div style="clear: both">&nbsp;</div><br />
<br />
</div></center><br />
<br />
=== Cairo Animations ===<br />
<br />
The animations featured throughout the Episode 2 video were rapid-development spaghetti hack-jobs coded by hand in raw Cairo. Each module generated a series of PNG stills that were then stitched into an animation with Cinelerra or mplayer. In the interest of pointing and laughing at what really bad code looks like...<br />
<br />
<center><div style="background-color:#DDDDDD;border-color:#CCCCCC;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
*Source for the Cairo animations is found at:<br />
https://svn.xiph.org/trunk/Xiph-episode-II/cairo/<br />
*The source can be checked out of svn using the following command line:<br />
svn co https://svn.xiph.org/trunk/Xiph-episode-II/cairo/<br />
*Trac is a convenient way to browse the source without checking out a copy:<br />
https://trac.xiph.org/browser/trunk/Xiph-episode-II/cairo/<br />
</div></center></div>Gmaxwellhttps://wiki.xiph.org/index.php?title=Videos/Digital_Show_and_Tell&diff=14042Videos/Digital Show and Tell2013-02-26T11:18:32Z<p>Gmaxwell: /* GTK-Bounce */ fix the fix to another trac link</p>
<hr />
<div><small>''Wiki edition''</small><br />
[[Image:dsat_001.jpg|400px|right]]<br />
<br />
Continuing in the "firehose" tradition of [[Videos/A_Digital_Media_Primer_For_Geeks|Episode 01]], Xiph.Org's second video on digital media explores multiple facets of digital audio signals and how they ''really'' behave in the real world.<br />
<br />
Demonstrations of sampling, quantization, bit-depth, and dither explore digital audio behavior on real audio equipment using both modern digital analysis and vintage analog bench equipment, just in case we can't trust those newfangled digital gizmos. You can download the source code for each demo and try it all for yourself!<br />
<br/><br/><br/><br />
<center><font size="+2">[http://www.xiph.org/video/vid2.shtml Download or Watch online]</font></center><br />
<br style="clear:both;"/><br />
Supported players: [http://www.videolan.org/vlc/ VLC 1.1+], [https://www.mozilla.com/en-US/firefox/ Firefox ], [http://www.chromium.org/Home Chrome ], [http://www.opera.com/ Opera]. Or see [http://www.webmproject.org/users/ other WebM] or [[TheoraSoftwarePlayers|other Theora]] players.<br />
<br />
If you're having trouble with playback in a modern browser or player, please visit our [[Playback_Troubleshooting|playback troubleshooting and discussion]] page.<br />
<br/><br />
<hr/><br />
<br/><br/><br/><br />
[[Image:Xiph_ep02_test.png|400px|right]]<br />
<br />
&ldquo;Hi, I'm Monty Montgomery from [http://www.redhat.com/ Red Hat] and [http://xiph.org/ Xiph.Org].<br />
<br />
&ldquo;A few months ago, I wrote<br />
[http://people.xiph.org/~xiphmont/demo/neil-young.html an article on digital audio and why 24bit/192kHz music downloads don't make sense].<br />
In the article, I<br />
mentioned--almost in passing--that a digital waveform is<br />
[http://people.xiph.org/~xiphmont/demo/neil-young.html#toc_sfam not a stairstep],<br />
and you certainly don't get a stairstep when you<br />
[[WikiPedia:Digital-to-analog_converter|convert from digital back to analog]].<br />
<br />
&ldquo;Of everything in the entire article, '''that''' was the number one thing<br />
people wrote about. In fact, more than half the mail I got was questions and<br />
comments about basic digital signal behavior. Since there's interest, let's<br />
take a little time to play with some ''simple'' digital signals. &rdquo;<br />
<br />
==Veritas ex machina==<br />
[[Image:Dsat_002.jpg|200px|right]]<br />
[[Image:Dsat_003.jpg|200px|right]]<br />
[[Image:Dsat_004.jpg|200px|right]]<br />
[[Image:Dsat_005.jpg|200px|right]]<br />
<br />
If we pretend for a moment that we have no idea how digital signals really<br />
behave, then it doesn't make sense for us to use digital test<br />
equipment. Fortunately for this exercise, there's still plenty<br />
of working analog lab equipment out there.<br />
<br />
We need a [[WikiPedia:Function_generator|signal generator]] to provide us with analog input<br />
signals--in this case, an<br />
[http://www.home.agilent.com/en/pd-3325A%3Aepsg%3Apro-pn-3325A/synthesizer-function-generator?pm=PL&nid=-536900197.536896863&cc=SE&lc=swe HP3325]<br />
from 1978.<br />
<br />
We'll observe our analog waveforms on [[WikiPedia:Oscilloscope_types#Cathode-ray_oscilloscope_.28CRO.29|analog oscilloscopes]],<br />
like this Tektronix 2246 from the mid-90s, one of the last and best analog scopes made.<br />
<br />
Finally, we'll inspect the [[WikiPedia:Spectral_density#Electrical_engineering|frequency spectrum]] of our signals using an<br />
[[WikiPedia:Spectrum_analyzer#Swept-tuned|analog spectrum analyzer]], this<br />
[http://www.home.agilent.com/en/pd-3585A%3Aepsg%3Apro-pn-3585A/spectrum-analyzer-high-perf-20hz-40mhz?pm=PL&nid=-536900197.536897319&cc=SE&lc=swe HP3585]<br />
from the same product line as<br />
the signal generator. Like the other equipment here it has<br />
[http://www.hp9845.net/9845/hardware/processors/ a rudimentary and hilariously large microcontroller],<br />
but the signal path<br />
from input to what you see on the screen is completely analog.<br />
<br />
All of this equipment is vintage, but the specs are still quite good.<br />
We start with the signal generator set to output a 1 [[WikiPedia:Hertz#SI_multiples|kHz]]<br />
sine wave at one [[WikiPedia:Volt|Volt]] [[WikiPedia:Amplitude#Root_mean_square_amplitude|RMS]].<br />
We see the sine wave on the oscilloscope, can verify that it is indeed<br />
1 kHz at 1 Volt RMS, which is 2.8 Volts<br />
[[WikiPedia:Amplitude#Peak-to-peak_amplitude|peak-to-peak]],<br />
and that matches the<br />
measurement on the spectrum analyzer as well.<br />
<br />
The analyzer also shows some low-level [[WikiPedia:White_noise|white noise]]<br />
and just a bit of [[WikiPedia:Harmonic_distortion#Harmonic_distortion|harmonic distortion]],<br />
with the highest peak about 70[[WikiPedia:Decibel|dB]] or so below<br />
[[WikiPedia:Fundamental_frequency|the fundamental]].<br />
This doesn't matter to the demos, but it's good to take notice of it now to avoid confusion later.<br />
<br />
For digital conversion, we use a boring, consumer-grade, eMagic USB1<br />
audio device. It's more than ten years old at this point, and it's<br />
getting obsolete.<br />
<br />
A recent converter can easily have an order of magnitude better specs.<br />
[[WikiPedia:Reconstruction_filter#Sampled_data_reconstruction_filters|Flatness]],<br />
[[WikiPedia:Analog-to-digital_converter#Non-linearity|linearity]],<br />
[[WikiPedia:Jitter#Sampling_jitter|jitter]],<br />
[[WikiPedia:Noise_floor|noise behavior]],<br />
[[WikiPedia:Digital-to-analog_converter#DAC_performance|everything]]...<br />
You may not<br />
have noticed. Just because we can measure an improvement doesn't<br />
mean we can hear it, and even these old consumer boxes were already at<br />
the edge of ideal transparency.<br />
<br />
The eMagic connects to my ThinkPad, which displays a digital<br />
waveform and spectrum for comparison, then the ThinkPad<br />
sends the digital signal right back out to the eMagic for<br />
re-conversion to analog and observation on the output scopes.<br />
<br />
<br style="clear:both;"/><br />
<br />
==Stairsteps==<br />
[[Image:Dsat 006.jpg|360px|right]]<br />
[[Image:Dsat 007.png|360px|right]]<br />
First demo: We begin by converting an analog signal to digital and<br />
then right back to analog again with no other steps.<br />
<br />
The signal generator is set to produce a 1kHz sine wave just like<br />
before and we can see the analog sine wave on the input-side oscilloscope. The eMagic digitizes our signal to<br />
[[Videos/A_Digital_Media_Primer_For_Geeks#Raw_.28digital_audio.29_meat|16 bit PCM at 44.1kHz]],<br />
same as on a CD. The spectrum of the digitized signal on the Thinkpad matches what we saw earlier and what we see now on the analog spectrum analyzer, aside from its <br />
[[WikiPedia:High_impedance|high-impedance input]] being just a smidge noisier. For now, the waveform display shows our digitized sine wave as a<br />
stairstep pattern, one step for each sample.<br />
<br />
When we look at the output signal that's been converted<br />
from digital back to analog, we see that it's exactly like the original sine wave. No stairsteps.<br />
<br />
1 kHz is still a fairly low frequency, so perhaps the stairsteps are just<br />
hard to see or they're being smoothed away. Next, set the signal generator to 15kHz, which is much closer to [[WikiPedia:Nyquist_frequency|Nyquist]].<br />
Now the sine wave is represented by less than three samples per cycle, and the digital waveform appears rather poor! Yet the analog output is still a perfect sine wave, exactly like the original.<br />
As we keep increasing frequency, all the way to 20kHz, the output waveform is still perfect. No jagged edges, no dropoff, no stairsteps.<br />
<br />
So where'd the stairsteps go? It's a trick question; they were never there. Drawing a digital waveform as a stairstep was wrong to begin with.<br />
<br />
A stairstep is a continuous-time function. It's jagged, and it's piecewise, but it has a defined value at every point in time.<br />
A sampled signal is entirely different. It's discrete-time; it's only got a value right at each instantaneous sample point and it's<br />
undefined, there is no value at all, everywhere between. A discrete-time signal is properly drawn as a lollipop graph.<br />
The continuous, analog counterpart of a digital signal passes smoothly through each sample point, and that's just as true for high<br />
frequencies as it is for low.<br />
<br />
[[Image:Dsat 008.png|360px|right]]<br />
The interesting and non-obvious bit is that [[WikiPedia:Nyquist%E2%80%93Shannon_sampling_theorem|there's only one<br />
bandlimited signal that passes exactly through each sample point]]; it's a unique solution. If you sample a bandlimited signal and then convert it back, the original input is also the only possible output.<br />
A signal that differs even minutely from the original includes frequency content at or beyond Nyquist, breaks the bandlimiting requirement and isn't a valid solution.<br />
<br />
So how did everyone get confused and start thinking of digital signals as stairsteps? I can think of two good reasons.<br />
<br />
First: it's easy to convert a sampled signal to a true stairstep. Just<br />
extend each sample value forward until the next sample period. This is<br />
called a [[WikiPedia:Zero-order hold|zero-order hold]], and it's an important part of how some<br />
digital-to-analog converters work, especially the simplest ones.<br />
As a result, anyone who looks up [[WikiPedia:Digital-to-analog_converter#Practical_operation|digital-to-analog converter or<br />
digital-to-analog conversion]] is probably going to see a diagram of a<br />
stairstep waveform somewhere, but that's not a finished conversion,<br />
and it's not the signal that comes out.<br />
<br />
Second, and this is probably the more likely reason, engineers who<br />
supposedly know better (yes, even I) draw stairsteps even though they're<br />
technically wrong. It's a sort of one-dimensional version of<br />
[[WikiPedia:MacPaint#Development|fat bits in an image editor]].<br />
Pixels aren't squares either, they're samples of a 2-dimensional<br />
function space and so they're also, conceptually, infinitely small<br />
points. Practically, it's a real pain in the ass to see or manipulate<br />
infinitely small anything, so big squares it is.<br />
<br />
Digital stairstep drawings are exactly the same thing. It's just a convenient drawing. The stairsteps aren't really there.<br />
<div style="clear:both"></div><br />
<br />
==Bit-depth==<br />
[[Image:Dsat_009.jpg|360px|right]]<br />
[[Image:Dsat_010.jpg|260px|right]]<br />
<br />
When we convert a digital signal back to analog, the result is<br />
''also'' smooth regardless of the [[WikiPedia:Audio_bit_depth|bit depth]]. It doesn't matter if it's 24 bits or 16 bits or 8 bits.<br />
So does that mean that the digital bit depth makes no difference at<br />
all? Of course not.<br />
<br />
Channel 2 is the same sine wave input, but we quantize it with<br />
[[WikiPedia:Dither|dither]] down to 8 bits.<br />
On the scope, we still see a nice<br />
smooth sine wave on channel 2. Look very close, and you'll also see a<br />
bit more noise. That's a clue.<br />
<br />
If we look at the spectrum of the signal, our sine wave is<br />
still there unaffected, but the noise level of the 8-bit signal on<br />
the second channel is much higher. And that's the difference, the only difference, the number of bits makes.<br />
<br />
When we digitize a signal, first we sample it. The<br />
sampling step is perfect; it loses nothing. But then we [[WikiPedia:Quantization_(sound_processing)|quantize]] it,<br />
and [[WikiPedia:Quantization_error|quantization adds noise]].<br />
The number of bits determines how much noise and so the level of the<br />
noise floor.<br />
<br />
What does this dithered quantization noise sound like?<br />
Those of you who have used analog recording equipment might think to yourselves, "My goodness! That sounds like tape hiss!"<br />
Well, it doesn't just sound like tape hiss, it acts like it too, and<br />
if we use a [[WikiPedia:Dither#Different_types|gaussian dither]] then it's<br />
[[WikiPedia:Central_limit_theorem|mathematically equivalent]] in every way. It ''is'' tape hiss.<br />
<br />
Intuitively, that means that we can measure tape hiss and thus the noise floor<br />
of [[WikiPedia:Magnetic_tape_sound_recording|magnetic audio tape]]<br />
in [[WikiPedia:Shannon–Hartley_theorem#Examples|bits instead of decibels]], in order to put things in a<br />
digital perspective. [[WikiPedia:Compact cassettes|Compact cassettes]], for those of you who are old enough to remember them, could reach as<br />
deep as 9 bits in perfect conditions. 5 to 6 bits was<br />
more typical, especially if it was a recording made on a<br />
[[WikiPedia:Cassette_deck|tape deck]]. That's right; your old mix tapes were only about 6 bits<br />
deep if you were lucky!<br />
<br />
The very best professional [[WikiPedia:Reel-to-reel_audio_tape_recording|open reel tape]] used in studios could barely<br />
hit 13 bits ''with'' [[WikiPedia:Reel-to-reel_audio_tape_recording#Noise_reduction|advanced noise reduction]]. <br />
That's why seeing '[[WikiPedia:SPARS_code|D D D]]' on a [[WikiPedia:Compact_disk|Compact Disc]] used to be such a big,<br />
high-end deal.<br />
<br />
<div style="clear:both"></div><br />
<br />
==Dither==<br />
[[Image:Dsat_011.png|360px|right]]<br />
<br />
We've been quantizing with [[Wikipedia:dither|dither]]. What is dither<br />
exactly and, more importantly, what does it do?<br />
<br />
The simplest way to quantize a signal is to choose the digital<br />
amplitude value [[WikiPedia:Rounding|closest to the original analog amplitude]].<br />
Unfortunately, the exact noise that results from this simple<br />
quantization scheme depends somewhat on the input signal.<br />
It may be inconsistent, cause distortion, or be<br />
undesirable in some other way.<br />
<br style="clear:both;"/><br />
<br />
<center><div style="background-color:#DDDDFF;border-color:#CCCCDD;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
'''Going deeper…'''<br />
*Cameron Nicklaus Christou's thesis [http://uwspace.uwaterloo.ca/bitstream/10012/3867/1/thesis.pdf Optimal Dither and Noise Shaping in Image Processing] provides an ''excellent'' explanation of dither and noise shaping.<br />
</div>&nbsp;</center><br />
<br />
Dither is specially-constructed noise that substitutes for the noise<br />
produced by simple quantization. Dither doesn't [[WikiPedia:Sound_masking|drown out or mask]]<br />
quantization noise, it replaces it with noise characteristics<br />
of our choosing that aren't influenced by the input.<br />
<br />
The signal generator has too much noise for this test so we produce a mathematically perfect sine wave with the ThinkPad and quantize it to 8 bits with dithering.<br />
We see the sine wave on waveform display and output scope, and <br />
a clean frequency peak with a uniform noise floor on both spectral displays<br />
just like before. Again, this is with dither.<br />
<br />
Now I turn dithering off.<br />
<br />
The quantization noise that dither had spread out into a nice, flat noise<br />
floor, piles up into harmonic distortion peaks. The noise floor is<br />
lower, but the level of distortion becomes nonzero, and the distortion<br />
peaks sit higher than the dithering noise did.<br />
<br />
At 8 bits this effect is exaggerated. At 16 bits,<br />
even without dither, harmonic distortion is going to be so low as to<br />
be completely inaudible. Still, we can use dither to eliminate it completely if we so choose.<br />
<br />
Turning the dither off again for a moment, you'll notice that the<br />
absolute level of distortion from undithered quantization stays<br />
approximately constant regardless of the input amplitude.<br />
But when the signal level drops below a half a bit, everything<br />
quantizes to zero.<br />
<br />
In a sense, everything quantizing to zero is just 100% distortion!<br />
Dither eliminates this distortion too. When we reenable dither, we clearly see our signal at 1/4 bit with a nice flat noise floor.<br />
<br />
The noise floor doesn't have to be flat. Dither is noise of our<br />
choosing, so it makes sense to choose a noise as [http://www.acoustics.salford.ac.uk/res/cox/sound_quality/?content=subjective inoffensive] and<br />
[[WikiPedia:Absolute_threshold_of_hearing|difficult to notice]]<br />
as possible.<br />
<br />
Human hearing is [[WikiPedia:Equal-loudness_contour|most sensitive in the midrange from 2kHz to 4kHz]]; that's where background noise is going to be the most obvious.<br />
We can [[WikiPedia:Noise_shaping|shape dithering noise]] away from sensitive frequencies to where<br />
hearing is less sensitive, usually the highest frequencies.<br />
<br />
Lastly, dithered quantization noise ''is'' higher [[WikiPedia:Sound_power|power]] overall<br />
than undithered quantization noise, even though it often sounds quieter, and<br />
you can see that on a [[WikiPedia:VU_meter|VU meter]] during passages of near-silence. However,<br />
dither isn't only an on or off choice. We can reduce the dither's<br />
power to balance less noise against a bit of distortion to minimize<br />
the overall effect.<br />
<br />
For the next test, we also [[WikiPedia:Amplitude_modulation|modulate the input signal]] like this to show how a varying input affects the quantization noise. At<br />
full dithering power, the noise is uniform, constant, and featureless<br />
just like we expect.<br />
<br />
As we reduce the dither's power, the input increasingly<br />
affects the amplitude and the character of the quantization noise.<br />
Shaped dither behaves similarly, but noise shaping lends one more nice<br />
advantage; it can use a somewhat lower<br />
dither power before the input has as much effect on the output.<br />
<br />
Despite all this text spent on dither, the differences exist 100 decibels or more below [[WikiPedia:Full_scale|full scale]]. If the CD had been<br />
[http://www.research.philips.com/technologies/projects/cd/index.html 14 bits as originally designed],<br />
perhaps dither ''might'' be<br />
more important. At 16 bits it's mostly a wash. It's reasonable to treat<br />
dither as an insurance policy that gives several extra<br />
decibels of dynamic range just in case. That said no<br />
one ever ruined a great recording by not dithering the final master.<br />
<br />
==Bandlimitation and timing==<br />
[[image:Dsat_016.jpg|360px|right]]<br />
<br />
We've been using [[WikiPedia:Sine_wave|sine waves]]. They're the obvious choice when what we<br />
want to see is a system's behavior at a given isolated frequency. Now let's look at something a bit more complex. What should we expect to happen when I change the input to a [[WikiPedia:Square_wave|square wave]]? <br />
<br />
The input scope confirms a 1kHz square wave. The output scope shows... exactly what it should.<br />
<br />
What is a square wave really? <br />
<br />
We can say it's a waveform that's some positive value for half a cycle and then transitions instantaneously to a negative value for the other half.<br />
<br />
:<math><br />
\ squarewave(t) = \begin{cases} 1, & |t| < T_1 \\ 0, & T_1 < |t| \leq {1 \over 2}T \end{cases}<br />
</math><br />
<br />
But that doesn't really tell us anything useful about how that input becomes this output.<br />
<br />
We remember that any waveform is also [[WikiPedia:Fourier_series|the sum of discrete frequencies]],<br />
and a square wave is particularly simple sum: a fundamental and an infinite series of [[WikiPedia:Even_and_odd_functions#Harmonics|odd harmonics]].<br />
<br />
[[image:Dsat_013.jpg|360px|right]]<br />
:<math>\begin{align}<br />
\ squarewave(t) = \frac{4}{\pi}\sin(\omega t) + \frac{4}{3\pi}\sin(3\omega t) + \frac{4}{5\pi}\sin(5\omega t) + \\<br />
\frac{4}{7\pi}\sin(7\omega t) + \frac{4}{9\pi}\sin(9\omega t) + \frac{4}{11\pi}\sin(11\omega t) + \\ <br />
\frac{4}{13\pi}\sin(13\omega t) + \frac{4}{15\pi}\sin(15\omega t) + \frac{4}{17\pi}\sin(17\omega t) + \\<br />
\frac{4}{19\pi}\sin(19\omega t) + \frac{4}{21\pi}\sin(21\omega t) + \frac{4}{23\pi}\sin(23\omega t) + \\<br />
\frac{4}{25\pi}\sin(25\omega t) + \frac{4}{27\pi}\sin(27\omega t) + \frac{4}{29\pi}\sin(29\omega t) + \\<br />
\frac{4}{31\pi}\sin(31\omega t) + \frac{4}{33\pi}\sin(33\omega t) + \cdots <br />
\end{align}</math><br />
<br />
At first glance, that doesn't seem very useful either; you'd have to sum an infinite number of harmonics to get the answer! However, we don't have an infinite number of harmonics.<br />
<br />
We're using a quite sharp [[WikiPedia:Low-pass_filter|anti-aliasing filter]] that cuts off right<br />
above 20kHz, so our signal is [[WikiPedia:Bandlimiting|bandlimited]]. Only the first ten terms make it through, and that's exactly what we see on the output scope.<br />
<br />
<br style="clear:both;"/><br />
<center><div style="background-color:#DDDDFF;border-color:#CCCCDD;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
'''Going deeper…'''<br />
*In modern web browsers you can program audio synthesizers directly in javascript. Use the two square wave formulas to get a square wave out of [http://js.do/blog/sound-waves-with-javascript/ this page]. (Note: The scope is not very accurate/useful.) <br />
</div></center><br />
<div>&nbsp;</div><br />
<br />
[[Image:dsat_015.jpg|360px|right]]<br />
The rippling you see around sharp edges in a bandlimited signal is called the [[WikiPedia:/Gibbs_phenomenon|Gibbs effect]]. It happens whenever you slice off part of the frequency domain in the middle of nonzero energy.<br />
<br />
The usual rule of thumb you'll hear is "the sharper the cutoff, the<br />
stronger the rippling", which is approximately true, but we have to be<br />
careful how we think about it. For example, what would you expect our quite sharp anti-aliasing filter<br />
to do if I run our signal through it a second time?<br />
<br />
Aside from adding a few fractional cycles of delay, the answer is:<br />
Nothing at all. The signal is already bandlimited. Bandlimiting it<br />
again doesn't do anything. A second pass can't remove frequencies<br />
that we already removed.<br />
<br />
That's important. People tend to think of the ripples as<br />
a kind of [[WikiPedia:Sonic_artifact|artifact]] that's added by anti-aliasing and [[WikiPedia:Reconstruction_filter|anti-imaging]]<br />
filters, implying that the ripples get worse each time the signal<br />
passes through. We see that in this case that didn't happen, so<br />
it wasn't really the filter that added the ripples the first time<br />
through. It's a subtle distinction, but Gibbs effect<br />
ripples aren't added by filters, they're just part of what a<br />
bandlimited signal ''is''.<br />
<br />
Even if we synthetically construct what looks like a perfect digital<br />
square wave it's still limited to the channel bandwidth. Remember that<br />
the stairstep representation is misleading. What we really have here are instantaneous sample points<br />
and only one bandlimited signal fits those points. All we did when we<br />
drew our apparently perfect square wave was line up the sample points<br />
just right so it appeared that there were no ripples if we played<br />
[[WikiPedia:Interpolation|connect-the-dots]]. The original bandlimited signal, complete with ripples, was<br />
still there.<br />
<br />
[[image:Dsat_014.gif|360px|right]]<br />
That leads us to one more important point. You've probably heard<br />
that the timing precision of a digital signal is limited by its sample<br />
rate; put another way, that digital signals can't represent anything that falls between the<br />
samples.. implying that [[WikiPedia:Dirac_delta_function|impulses]] or<br />
[[WikiPedia:Synthesizer#ADSR_envelope|fast attacks]] have to align exactly<br />
with a sample, or the timing gets mangled or they just disappear.<br />
At this point, we can easily see why that's wrong.<br />
<br />
Again, our input signals are bandlimited. And digital signals are<br />
samples, not stairsteps, not 'connect-the-dots'. We most certainly<br />
can, for example, put the rising edge of our bandlimited square wave<br />
anywhere we want between samples.<br />
<br />
It's represented perfectly and it's reconstructed perfectly.<br />
<br />
==Epilogue==<br />
<br />
[[Image:Moffey.jpg|360px|right]]<br />
<br />
Like in [[Videos/A_Digital_Media_Primer_For_Geeks|_A Digital Media Primer for Geeks_]], we've covered a broad range of<br />
topics, and yet barely scratched the surface of each one. If anything, my<br />
sins of omission are greater this time around.<br />
<br />
Thus I encourage you to dig deeper and experiment. I chose my<br />
demos carefully to be simple and give clear results. You can<br />
reproduce every one of them on your own if you like, but let's face<br />
it: Sometimes we learn the most about a spiffy toy by breaking it open<br />
and studying all the pieces that fall out. Play with the demo parameters, hack up the code, set up<br />
alternate experiments. The source code for everything, including the<br />
little pushbutton demo application, is at the [[Videos/Digital_Show_and_Tell#Use_The_Source_Luke|bottom of this page]].<br />
<br />
In the course of experimentation, you're likely to run into something<br />
that you didn't expect and can't explain. Don't worry! My earlier<br />
snark aside, Wikipedia is fantastic for exactly this kind of casual<br />
research. If you're really serious about understanding signals,<br />
several universities have advanced materials online, such as the<br />
[http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-003-signals-and-systems-spring-2010/index.htm 6.003]<br />
and<br />
[http://ocw.mit.edu/resources/res-6-007-signals-and-systems-spring-2011/ RES.6-007]<br />
Signals and Systems modules at MIT OpenCourseWare. And of<br />
course, there's always the [http://webchat.freenode.net/?channels=xiph community here at Xiph.Org].<br />
<br />
==Credits==<br />
[[Image:Dmpfg_019.png|360px|right]]<br />
Written by: Christopher (Monty) Montgomery and the Xiph.Org Community<br />
<br />
Special thanks to:<br />
*Heidi Baumgartner, for the second Tektronix oscilloscope<br />
*Gregory Maxwell and Dr. Timothy Terriberry, for additional technical review<br />
<br />
Intro, title and credits music:<br><br />
"[http://music.lousyrobot.com/track/andy-warhol-is-gone Andy Warhol Is Gone]", by Lousy Robot<br><br />
Used by permission of Lousy Robot.<br><br />
Original source track All Rights Reserved.<br><br />
[http://www.lousyrobot.com www.lousyrobot.com]<br />
<br />
This Video Was Produced Entirely With Free and Open Source Software:<br><br />
<br />
*[http://www.gnu.org/ GNU]<br><br />
*[http://www.linux.org/ Linux]<br><br />
*[http://fedoraproject.org/ Fedora]<br><br />
*[http://cinelerra.org/ Cinelerra]<br><br />
*[http://www.gimp.org/ The Gimp]<br><br />
*[http://audacity.sourceforge.net/ Audacity]<br><br />
*[http://svn.xiph.org/trunk/postfish/README Postfish]<br><br />
*[http://gstreamer.freedesktop.org/ Gstreamer]<br><br />
<br />
All trademarks are the property of their respective owners. <br />
<br />
*''Complete video'' [http://creativecommons.org/licenses/by-sa/3.0/legalcode CC-BY-SA]<br><br />
*''Text transcript and Wiki edition'' [http://creativecommons.org/licenses/by-sa/3.0/legalcode CC-BY-SA]<br><br />
<br />
A Co-Production of Xiph.Org and Red Hat, Inc.<br><br />
(C) 2012-2013, Some Rights Reserved<br><br />
<br />
== Use The Source Luke ==<br />
<br />
As stated in the Epilogue, everything that appears in the video demos is driven by open source software, which means the source is both available for inspection and freely usable by the community. The Thinkpad that appears in the video was running Fedora 17 and Gnome Shell (Gnome 3). The demonstration software does not require Fedora specifically, but it does require Gnu/Linux to run in its current form. In all, the video involved just under 50,000 lines of new and custom-purpose code (including contributions to non-Xiph projects such as Cinelerra and Gromit).<br />
<br />
=== The Spectrum and Waveform Viewer ===<br />
<br />
The realtime software spectrum analyzer application that appears in the video was a preexisting application that was dusted off and updated for use in the video. The waveform viewer (effectively a simple software oscilloscope) was written from scratch making use of some of the internals from the spectrum analyzer application. Both are available from Xiph.Org svn:<br />
<br />
<center><div style="background-color:#DDDDDD;border-color:#CCCCCC;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
*Source for the Spectrum and Waveform applications is found at:<br />
https://svn.xiph.org/trunk/spectrum/<br />
*The source can be checked out of svn using the following command line:<br />
svn co https://svn.xiph.org/trunk/spectrum<br />
*Trac is a convenient way to browse the source without checking out a copy:<br />
https://trac.xiph.org/browser/trunk/spectrum<br />
</div></center><br />
<br />
Spectrum and Waveform both expect an input stream on the command line, either as raw data or as a WAV file.<br />
<br />
=== GTK-Bounce ===<br />
<br />
The touch-controlled application used in the video is named 'gtk-bounce' and was custom-written for the sole purpose of the in-video demonstrations. It is so named because, for the most part, all it does is read the input from an audio device, and then immediately write the same data back out for playback. It also forwards a copy of this data to up to two external monitoring applications, and in several demos, applies simple filters or generates simple waveforms. It includes several demos not included in the video.<br />
<br />
<center><div style="background-color:#DDDDDD;border-color:#CCCCCC;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
*Source for gtk-bounce is found at:<br />
https://svn.xiph.org/trunk/Xiph-episode-II/bounce/<br />
*The source can be checked out of svn using the following command line:<br />
svn co https://svn.xiph.org/trunk/Xiph-episode-II/bounce/<br />
*Trac is a convenient way to browse the source without checking out a copy:<br />
https://trac.xiph.org/browser/trunk/Xiph-episode-II/bounce/<br />
</div></center><br />
<br />
==== Starting Gtk-bounce ====<br />
The application is somewhat hardwired for specific demo parameters, but most of the hardwired settings can be found at the top of each source file. As found in SVN, the application expects an ALSA hardware audio device at hw:1, and if none if found, it will wait for one to appear. Once a sound device is successfully initialized, it expects to find and open two pipes named pipe0 and pipe1 for output in the current directory. In the video, the waveform and spectrum applications are started to take input from pipe0 and pipe1 respectively. The output sent to the two pipes is identical, and in most demos matches the output data sent to the hardware device for conversion to analog. The only exception is the tenth demo panel (which does not appear in the video) where gtk-bounce can be set to monitor the hardware inputs instead while the outputs are used to produce test waveforms.<br />
<br />
Assuming gtk-bounce, spectrum and waveform have been checked out and built, the configuration seen in the video can be started using the following commands:<br />
<center><div style="background-color:#DDDDDD;border-color:#CCCCCC;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
* make the pipe fifos for the applications to communicate (only needs to be done once)<br />
mkfifo pipe0 pipe1<br />
* start all three applications<br />
waveform pipe0 & spectrum pipe1 & gtk-bounce &<br />
</div></center><br />
<br />
==== Using Gtk-bounce ====<br />
<br />
Gtk-bounce consists of eleven pushbutton panels (numbered zero through ten) that can be selected by scrolling up and dwon with the arrow buttons on the right side. Each panel is intended for a specific demo or part of a demo.<br />
<br />
<center><div style="background-color:#DDDDDD;border-color:#CCCCCC;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
<br />
[[Image:Dsat-panel0.png|700px|center]]<br />
* '''Panel 0''': This panel presents buttons that allow the sound card to be configured in several sampling rates and bit depths. Samples read from the audio inputs are sent to the output pipes and audio outputs for playback without modification.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel1.png|700px|center]]<br />
* '''Panel 1''': Both channels are forwarded to the outputs, however the user may select the bit depth of each channel independently. When the sound card is running in 16 bit mode and 16-bit depth is selected, the data is untouched. Requantization to a lower bit depth is performed with a flat triangle dither.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel2.png|700px|center]]<br />
* '''Panel 2''': Both channels are re-quantized to the selected bit depth. Requantization to a lower bit depth is performed with a flat triangle dither.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel3.png|700px|center]]<br />
* '''Panel 3''': 'generate sine wave' discards the audio inputs and instead internally generates a sine wave at 32 bit precision, which is then quantized to the selected bit depth, optionally with dither. The resulting signal is then forwarded to the output. <br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel4.png|700px|center]]<br />
* '''Panel 4''': gtk-bounce generates a 16-bit sine wave of the selected amplitude, optionally with dither, and forwards the resulting signal to the outputs. The audio input from the audio device is discarded. Note that the slider sets the peak amplitude, not the peak-to-peak amplitude.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel5.png|700px|center]]<br />
* '''Panel 5''': generates a 16-bit sine wave, optionally quantized using dither. The user may additionally select a flat or a shaped dither. The 'notch and gain' button applies a notch filter to the resulting signal, and boosts the gain of the remaining noise so that it's easily audible. The audio input from the audio device is discarded.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel6.png|700px|center]]<br />
* '''Panel 6''': allows the user to play with the power of the dithering noise applied before quantizing the sine wave. Shaped or flat dither are available. The sine wave may also be modulated with a varying amplitude to highlight correlations between the input and the resulting quantization noise. The 'notch and gain' button applies a notch filter to the resulting signal, and boosts the gain of the remaining noise so that it's easily audible. The audio input from the audio device is discarded.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel7.png|700px|center]]<br />
* '''Panel 7''': applies a sharper antialiasing (lowpass) filter than is likely to be built into the sound-card hardware (as there's generally no reason to use a filter quite this sharp in practice). The very sharp filter allows us to bandpass the demonstration square wave without any harmonics landing in the transition band. The input is read from the audio device, passed through this sharper filter, and then forwarded to the outputs.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel8.png|700px|center]]<br />
* '''Panel 8''': when selected, generate a synthetic 'square wave' (this is not quite equivalent to a bandlimited analog square wave; the harmonic amplitudes are a bit different) that when aligned with the sampling phase just right gives the appearance of having infinite rise and fall time. The slider allows us to shift the waveform sample alignment back and forth by +/- one sample to reveal that the underlying signal is still band-limited.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel9.png|700px|center]]<br />
* '''Panel 9''': as in panel 8, generate a 'perfect' synthetic 'square wave'. However, the slider now allows us to shift the sample alignment of the second channel with respect to the first, instead of shifting both channels. This allows us the trigger/lock the scope timing to the channel 1 waveform so we can see the fractional sample movement and alignment of the waveform on channel 2. The audio input from the audio device is discarded.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel10.png|700px|center]]<br />
* '''Panel 10''': not used in the video; The audio device is configured to 24-bit input/output. The user may produce one of a range of test signals that are output to both the external applications and the audio device on the first channel. The input on the second channel is passed-through to the applications and audio device outputs unchanged. The first channel input is unused unless 'two input mode' is selected. When two input mode is selected, both input channels are read and the data sent to the external applications. Generated test signals are sent only to the audio hardware (on the first channel). This combination of test signals and input modes allows self-references frequency response, phase, noise, distortion and crosstalk testing of a given audio device.<br />
<br />
<div style="clear: both">&nbsp;</div><br />
<br />
</div></center><br />
<br />
=== Cairo Animations ===<br />
<br />
The animations featured throughout the Episode 2 video were rapid-development spaghetti hack-jobs coded by hand in raw Cairo. Each module generated a series of PNG stills that were then stitched into an animation with Cinelerra or mplayer. In the interest of pointing and laughing at what really bad code looks like...<br />
<br />
<center><div style="background-color:#DDDDDD;border-color:#CCCCCC;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
*Source for the Cairo animations is found at:<br />
https://svn.xiph.org/trunk/Xiph-episode-II/cairo/<br />
*The source can be checked out of svn using the following command line:<br />
svn co https://svn.xiph.org/trunk/Xiph-episode-II/cairo/<br />
*Trac is a convenient way to browse the source without checking out a copy:<br />
https://trac.xiph.org/browser/trunk/Xiph-episode-II/cairo/<br />
</div></center></div>Gmaxwellhttps://wiki.xiph.org/index.php?title=Videos/Digital_Show_and_Tell&diff=14041Videos/Digital Show and Tell2013-02-26T11:18:10Z<p>Gmaxwell: /* GTK-Bounce */ fix another trac link</p>
<hr />
<div><small>''Wiki edition''</small><br />
[[Image:dsat_001.jpg|400px|right]]<br />
<br />
Continuing in the "firehose" tradition of [[Videos/A_Digital_Media_Primer_For_Geeks|Episode 01]], Xiph.Org's second video on digital media explores multiple facets of digital audio signals and how they ''really'' behave in the real world.<br />
<br />
Demonstrations of sampling, quantization, bit-depth, and dither explore digital audio behavior on real audio equipment using both modern digital analysis and vintage analog bench equipment, just in case we can't trust those newfangled digital gizmos. You can download the source code for each demo and try it all for yourself!<br />
<br/><br/><br/><br />
<center><font size="+2">[http://www.xiph.org/video/vid2.shtml Download or Watch online]</font></center><br />
<br style="clear:both;"/><br />
Supported players: [http://www.videolan.org/vlc/ VLC 1.1+], [https://www.mozilla.com/en-US/firefox/ Firefox ], [http://www.chromium.org/Home Chrome ], [http://www.opera.com/ Opera]. Or see [http://www.webmproject.org/users/ other WebM] or [[TheoraSoftwarePlayers|other Theora]] players.<br />
<br />
If you're having trouble with playback in a modern browser or player, please visit our [[Playback_Troubleshooting|playback troubleshooting and discussion]] page.<br />
<br/><br />
<hr/><br />
<br/><br/><br/><br />
[[Image:Xiph_ep02_test.png|400px|right]]<br />
<br />
&ldquo;Hi, I'm Monty Montgomery from [http://www.redhat.com/ Red Hat] and [http://xiph.org/ Xiph.Org].<br />
<br />
&ldquo;A few months ago, I wrote<br />
[http://people.xiph.org/~xiphmont/demo/neil-young.html an article on digital audio and why 24bit/192kHz music downloads don't make sense].<br />
In the article, I<br />
mentioned--almost in passing--that a digital waveform is<br />
[http://people.xiph.org/~xiphmont/demo/neil-young.html#toc_sfam not a stairstep],<br />
and you certainly don't get a stairstep when you<br />
[[WikiPedia:Digital-to-analog_converter|convert from digital back to analog]].<br />
<br />
&ldquo;Of everything in the entire article, '''that''' was the number one thing<br />
people wrote about. In fact, more than half the mail I got was questions and<br />
comments about basic digital signal behavior. Since there's interest, let's<br />
take a little time to play with some ''simple'' digital signals. &rdquo;<br />
<br />
==Veritas ex machina==<br />
[[Image:Dsat_002.jpg|200px|right]]<br />
[[Image:Dsat_003.jpg|200px|right]]<br />
[[Image:Dsat_004.jpg|200px|right]]<br />
[[Image:Dsat_005.jpg|200px|right]]<br />
<br />
If we pretend for a moment that we have no idea how digital signals really<br />
behave, then it doesn't make sense for us to use digital test<br />
equipment. Fortunately for this exercise, there's still plenty<br />
of working analog lab equipment out there.<br />
<br />
We need a [[WikiPedia:Function_generator|signal generator]] to provide us with analog input<br />
signals--in this case, an<br />
[http://www.home.agilent.com/en/pd-3325A%3Aepsg%3Apro-pn-3325A/synthesizer-function-generator?pm=PL&nid=-536900197.536896863&cc=SE&lc=swe HP3325]<br />
from 1978.<br />
<br />
We'll observe our analog waveforms on [[WikiPedia:Oscilloscope_types#Cathode-ray_oscilloscope_.28CRO.29|analog oscilloscopes]],<br />
like this Tektronix 2246 from the mid-90s, one of the last and best analog scopes made.<br />
<br />
Finally, we'll inspect the [[WikiPedia:Spectral_density#Electrical_engineering|frequency spectrum]] of our signals using an<br />
[[WikiPedia:Spectrum_analyzer#Swept-tuned|analog spectrum analyzer]], this<br />
[http://www.home.agilent.com/en/pd-3585A%3Aepsg%3Apro-pn-3585A/spectrum-analyzer-high-perf-20hz-40mhz?pm=PL&nid=-536900197.536897319&cc=SE&lc=swe HP3585]<br />
from the same product line as<br />
the signal generator. Like the other equipment here it has<br />
[http://www.hp9845.net/9845/hardware/processors/ a rudimentary and hilariously large microcontroller],<br />
but the signal path<br />
from input to what you see on the screen is completely analog.<br />
<br />
All of this equipment is vintage, but the specs are still quite good.<br />
We start with the signal generator set to output a 1 [[WikiPedia:Hertz#SI_multiples|kHz]]<br />
sine wave at one [[WikiPedia:Volt|Volt]] [[WikiPedia:Amplitude#Root_mean_square_amplitude|RMS]].<br />
We see the sine wave on the oscilloscope, can verify that it is indeed<br />
1 kHz at 1 Volt RMS, which is 2.8 Volts<br />
[[WikiPedia:Amplitude#Peak-to-peak_amplitude|peak-to-peak]],<br />
and that matches the<br />
measurement on the spectrum analyzer as well.<br />
<br />
The analyzer also shows some low-level [[WikiPedia:White_noise|white noise]]<br />
and just a bit of [[WikiPedia:Harmonic_distortion#Harmonic_distortion|harmonic distortion]],<br />
with the highest peak about 70[[WikiPedia:Decibel|dB]] or so below<br />
[[WikiPedia:Fundamental_frequency|the fundamental]].<br />
This doesn't matter to the demos, but it's good to take notice of it now to avoid confusion later.<br />
<br />
For digital conversion, we use a boring, consumer-grade, eMagic USB1<br />
audio device. It's more than ten years old at this point, and it's<br />
getting obsolete.<br />
<br />
A recent converter can easily have an order of magnitude better specs.<br />
[[WikiPedia:Reconstruction_filter#Sampled_data_reconstruction_filters|Flatness]],<br />
[[WikiPedia:Analog-to-digital_converter#Non-linearity|linearity]],<br />
[[WikiPedia:Jitter#Sampling_jitter|jitter]],<br />
[[WikiPedia:Noise_floor|noise behavior]],<br />
[[WikiPedia:Digital-to-analog_converter#DAC_performance|everything]]...<br />
You may not<br />
have noticed. Just because we can measure an improvement doesn't<br />
mean we can hear it, and even these old consumer boxes were already at<br />
the edge of ideal transparency.<br />
<br />
The eMagic connects to my ThinkPad, which displays a digital<br />
waveform and spectrum for comparison, then the ThinkPad<br />
sends the digital signal right back out to the eMagic for<br />
re-conversion to analog and observation on the output scopes.<br />
<br />
<br style="clear:both;"/><br />
<br />
==Stairsteps==<br />
[[Image:Dsat 006.jpg|360px|right]]<br />
[[Image:Dsat 007.png|360px|right]]<br />
First demo: We begin by converting an analog signal to digital and<br />
then right back to analog again with no other steps.<br />
<br />
The signal generator is set to produce a 1kHz sine wave just like<br />
before and we can see the analog sine wave on the input-side oscilloscope. The eMagic digitizes our signal to<br />
[[Videos/A_Digital_Media_Primer_For_Geeks#Raw_.28digital_audio.29_meat|16 bit PCM at 44.1kHz]],<br />
same as on a CD. The spectrum of the digitized signal on the Thinkpad matches what we saw earlier and what we see now on the analog spectrum analyzer, aside from its <br />
[[WikiPedia:High_impedance|high-impedance input]] being just a smidge noisier. For now, the waveform display shows our digitized sine wave as a<br />
stairstep pattern, one step for each sample.<br />
<br />
When we look at the output signal that's been converted<br />
from digital back to analog, we see that it's exactly like the original sine wave. No stairsteps.<br />
<br />
1 kHz is still a fairly low frequency, so perhaps the stairsteps are just<br />
hard to see or they're being smoothed away. Next, set the signal generator to 15kHz, which is much closer to [[WikiPedia:Nyquist_frequency|Nyquist]].<br />
Now the sine wave is represented by less than three samples per cycle, and the digital waveform appears rather poor! Yet the analog output is still a perfect sine wave, exactly like the original.<br />
As we keep increasing frequency, all the way to 20kHz, the output waveform is still perfect. No jagged edges, no dropoff, no stairsteps.<br />
<br />
So where'd the stairsteps go? It's a trick question; they were never there. Drawing a digital waveform as a stairstep was wrong to begin with.<br />
<br />
A stairstep is a continuous-time function. It's jagged, and it's piecewise, but it has a defined value at every point in time.<br />
A sampled signal is entirely different. It's discrete-time; it's only got a value right at each instantaneous sample point and it's<br />
undefined, there is no value at all, everywhere between. A discrete-time signal is properly drawn as a lollipop graph.<br />
The continuous, analog counterpart of a digital signal passes smoothly through each sample point, and that's just as true for high<br />
frequencies as it is for low.<br />
<br />
[[Image:Dsat 008.png|360px|right]]<br />
The interesting and non-obvious bit is that [[WikiPedia:Nyquist%E2%80%93Shannon_sampling_theorem|there's only one<br />
bandlimited signal that passes exactly through each sample point]]; it's a unique solution. If you sample a bandlimited signal and then convert it back, the original input is also the only possible output.<br />
A signal that differs even minutely from the original includes frequency content at or beyond Nyquist, breaks the bandlimiting requirement and isn't a valid solution.<br />
<br />
So how did everyone get confused and start thinking of digital signals as stairsteps? I can think of two good reasons.<br />
<br />
First: it's easy to convert a sampled signal to a true stairstep. Just<br />
extend each sample value forward until the next sample period. This is<br />
called a [[WikiPedia:Zero-order hold|zero-order hold]], and it's an important part of how some<br />
digital-to-analog converters work, especially the simplest ones.<br />
As a result, anyone who looks up [[WikiPedia:Digital-to-analog_converter#Practical_operation|digital-to-analog converter or<br />
digital-to-analog conversion]] is probably going to see a diagram of a<br />
stairstep waveform somewhere, but that's not a finished conversion,<br />
and it's not the signal that comes out.<br />
<br />
Second, and this is probably the more likely reason, engineers who<br />
supposedly know better (yes, even I) draw stairsteps even though they're<br />
technically wrong. It's a sort of one-dimensional version of<br />
[[WikiPedia:MacPaint#Development|fat bits in an image editor]].<br />
Pixels aren't squares either, they're samples of a 2-dimensional<br />
function space and so they're also, conceptually, infinitely small<br />
points. Practically, it's a real pain in the ass to see or manipulate<br />
infinitely small anything, so big squares it is.<br />
<br />
Digital stairstep drawings are exactly the same thing. It's just a convenient drawing. The stairsteps aren't really there.<br />
<div style="clear:both"></div><br />
<br />
==Bit-depth==<br />
[[Image:Dsat_009.jpg|360px|right]]<br />
[[Image:Dsat_010.jpg|260px|right]]<br />
<br />
When we convert a digital signal back to analog, the result is<br />
''also'' smooth regardless of the [[WikiPedia:Audio_bit_depth|bit depth]]. It doesn't matter if it's 24 bits or 16 bits or 8 bits.<br />
So does that mean that the digital bit depth makes no difference at<br />
all? Of course not.<br />
<br />
Channel 2 is the same sine wave input, but we quantize it with<br />
[[WikiPedia:Dither|dither]] down to 8 bits.<br />
On the scope, we still see a nice<br />
smooth sine wave on channel 2. Look very close, and you'll also see a<br />
bit more noise. That's a clue.<br />
<br />
If we look at the spectrum of the signal, our sine wave is<br />
still there unaffected, but the noise level of the 8-bit signal on<br />
the second channel is much higher. And that's the difference, the only difference, the number of bits makes.<br />
<br />
When we digitize a signal, first we sample it. The<br />
sampling step is perfect; it loses nothing. But then we [[WikiPedia:Quantization_(sound_processing)|quantize]] it,<br />
and [[WikiPedia:Quantization_error|quantization adds noise]].<br />
The number of bits determines how much noise and so the level of the<br />
noise floor.<br />
<br />
What does this dithered quantization noise sound like?<br />
Those of you who have used analog recording equipment might think to yourselves, "My goodness! That sounds like tape hiss!"<br />
Well, it doesn't just sound like tape hiss, it acts like it too, and<br />
if we use a [[WikiPedia:Dither#Different_types|gaussian dither]] then it's<br />
[[WikiPedia:Central_limit_theorem|mathematically equivalent]] in every way. It ''is'' tape hiss.<br />
<br />
Intuitively, that means that we can measure tape hiss and thus the noise floor<br />
of [[WikiPedia:Magnetic_tape_sound_recording|magnetic audio tape]]<br />
in [[WikiPedia:Shannon–Hartley_theorem#Examples|bits instead of decibels]], in order to put things in a<br />
digital perspective. [[WikiPedia:Compact cassettes|Compact cassettes]], for those of you who are old enough to remember them, could reach as<br />
deep as 9 bits in perfect conditions. 5 to 6 bits was<br />
more typical, especially if it was a recording made on a<br />
[[WikiPedia:Cassette_deck|tape deck]]. That's right; your old mix tapes were only about 6 bits<br />
deep if you were lucky!<br />
<br />
The very best professional [[WikiPedia:Reel-to-reel_audio_tape_recording|open reel tape]] used in studios could barely<br />
hit 13 bits ''with'' [[WikiPedia:Reel-to-reel_audio_tape_recording#Noise_reduction|advanced noise reduction]]. <br />
That's why seeing '[[WikiPedia:SPARS_code|D D D]]' on a [[WikiPedia:Compact_disk|Compact Disc]] used to be such a big,<br />
high-end deal.<br />
<br />
<div style="clear:both"></div><br />
<br />
==Dither==<br />
[[Image:Dsat_011.png|360px|right]]<br />
<br />
We've been quantizing with [[Wikipedia:dither|dither]]. What is dither<br />
exactly and, more importantly, what does it do?<br />
<br />
The simplest way to quantize a signal is to choose the digital<br />
amplitude value [[WikiPedia:Rounding|closest to the original analog amplitude]].<br />
Unfortunately, the exact noise that results from this simple<br />
quantization scheme depends somewhat on the input signal.<br />
It may be inconsistent, cause distortion, or be<br />
undesirable in some other way.<br />
<br style="clear:both;"/><br />
<br />
<center><div style="background-color:#DDDDFF;border-color:#CCCCDD;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
'''Going deeper…'''<br />
*Cameron Nicklaus Christou's thesis [http://uwspace.uwaterloo.ca/bitstream/10012/3867/1/thesis.pdf Optimal Dither and Noise Shaping in Image Processing] provides an ''excellent'' explanation of dither and noise shaping.<br />
</div>&nbsp;</center><br />
<br />
Dither is specially-constructed noise that substitutes for the noise<br />
produced by simple quantization. Dither doesn't [[WikiPedia:Sound_masking|drown out or mask]]<br />
quantization noise, it replaces it with noise characteristics<br />
of our choosing that aren't influenced by the input.<br />
<br />
The signal generator has too much noise for this test so we produce a mathematically perfect sine wave with the ThinkPad and quantize it to 8 bits with dithering.<br />
We see the sine wave on waveform display and output scope, and <br />
a clean frequency peak with a uniform noise floor on both spectral displays<br />
just like before. Again, this is with dither.<br />
<br />
Now I turn dithering off.<br />
<br />
The quantization noise that dither had spread out into a nice, flat noise<br />
floor, piles up into harmonic distortion peaks. The noise floor is<br />
lower, but the level of distortion becomes nonzero, and the distortion<br />
peaks sit higher than the dithering noise did.<br />
<br />
At 8 bits this effect is exaggerated. At 16 bits,<br />
even without dither, harmonic distortion is going to be so low as to<br />
be completely inaudible. Still, we can use dither to eliminate it completely if we so choose.<br />
<br />
Turning the dither off again for a moment, you'll notice that the<br />
absolute level of distortion from undithered quantization stays<br />
approximately constant regardless of the input amplitude.<br />
But when the signal level drops below a half a bit, everything<br />
quantizes to zero.<br />
<br />
In a sense, everything quantizing to zero is just 100% distortion!<br />
Dither eliminates this distortion too. When we reenable dither, we clearly see our signal at 1/4 bit with a nice flat noise floor.<br />
<br />
The noise floor doesn't have to be flat. Dither is noise of our<br />
choosing, so it makes sense to choose a noise as [http://www.acoustics.salford.ac.uk/res/cox/sound_quality/?content=subjective inoffensive] and<br />
[[WikiPedia:Absolute_threshold_of_hearing|difficult to notice]]<br />
as possible.<br />
<br />
Human hearing is [[WikiPedia:Equal-loudness_contour|most sensitive in the midrange from 2kHz to 4kHz]]; that's where background noise is going to be the most obvious.<br />
We can [[WikiPedia:Noise_shaping|shape dithering noise]] away from sensitive frequencies to where<br />
hearing is less sensitive, usually the highest frequencies.<br />
<br />
Lastly, dithered quantization noise ''is'' higher [[WikiPedia:Sound_power|power]] overall<br />
than undithered quantization noise, even though it often sounds quieter, and<br />
you can see that on a [[WikiPedia:VU_meter|VU meter]] during passages of near-silence. However,<br />
dither isn't only an on or off choice. We can reduce the dither's<br />
power to balance less noise against a bit of distortion to minimize<br />
the overall effect.<br />
<br />
For the next test, we also [[WikiPedia:Amplitude_modulation|modulate the input signal]] like this to show how a varying input affects the quantization noise. At<br />
full dithering power, the noise is uniform, constant, and featureless<br />
just like we expect.<br />
<br />
As we reduce the dither's power, the input increasingly<br />
affects the amplitude and the character of the quantization noise.<br />
Shaped dither behaves similarly, but noise shaping lends one more nice<br />
advantage; it can use a somewhat lower<br />
dither power before the input has as much effect on the output.<br />
<br />
Despite all this text spent on dither, the differences exist 100 decibels or more below [[WikiPedia:Full_scale|full scale]]. If the CD had been<br />
[http://www.research.philips.com/technologies/projects/cd/index.html 14 bits as originally designed],<br />
perhaps dither ''might'' be<br />
more important. At 16 bits it's mostly a wash. It's reasonable to treat<br />
dither as an insurance policy that gives several extra<br />
decibels of dynamic range just in case. That said no<br />
one ever ruined a great recording by not dithering the final master.<br />
<br />
==Bandlimitation and timing==<br />
[[image:Dsat_016.jpg|360px|right]]<br />
<br />
We've been using [[WikiPedia:Sine_wave|sine waves]]. They're the obvious choice when what we<br />
want to see is a system's behavior at a given isolated frequency. Now let's look at something a bit more complex. What should we expect to happen when I change the input to a [[WikiPedia:Square_wave|square wave]]? <br />
<br />
The input scope confirms a 1kHz square wave. The output scope shows... exactly what it should.<br />
<br />
What is a square wave really? <br />
<br />
We can say it's a waveform that's some positive value for half a cycle and then transitions instantaneously to a negative value for the other half.<br />
<br />
:<math><br />
\ squarewave(t) = \begin{cases} 1, & |t| < T_1 \\ 0, & T_1 < |t| \leq {1 \over 2}T \end{cases}<br />
</math><br />
<br />
But that doesn't really tell us anything useful about how that input becomes this output.<br />
<br />
We remember that any waveform is also [[WikiPedia:Fourier_series|the sum of discrete frequencies]],<br />
and a square wave is particularly simple sum: a fundamental and an infinite series of [[WikiPedia:Even_and_odd_functions#Harmonics|odd harmonics]].<br />
<br />
[[image:Dsat_013.jpg|360px|right]]<br />
:<math>\begin{align}<br />
\ squarewave(t) = \frac{4}{\pi}\sin(\omega t) + \frac{4}{3\pi}\sin(3\omega t) + \frac{4}{5\pi}\sin(5\omega t) + \\<br />
\frac{4}{7\pi}\sin(7\omega t) + \frac{4}{9\pi}\sin(9\omega t) + \frac{4}{11\pi}\sin(11\omega t) + \\ <br />
\frac{4}{13\pi}\sin(13\omega t) + \frac{4}{15\pi}\sin(15\omega t) + \frac{4}{17\pi}\sin(17\omega t) + \\<br />
\frac{4}{19\pi}\sin(19\omega t) + \frac{4}{21\pi}\sin(21\omega t) + \frac{4}{23\pi}\sin(23\omega t) + \\<br />
\frac{4}{25\pi}\sin(25\omega t) + \frac{4}{27\pi}\sin(27\omega t) + \frac{4}{29\pi}\sin(29\omega t) + \\<br />
\frac{4}{31\pi}\sin(31\omega t) + \frac{4}{33\pi}\sin(33\omega t) + \cdots <br />
\end{align}</math><br />
<br />
At first glance, that doesn't seem very useful either; you'd have to sum an infinite number of harmonics to get the answer! However, we don't have an infinite number of harmonics.<br />
<br />
We're using a quite sharp [[WikiPedia:Low-pass_filter|anti-aliasing filter]] that cuts off right<br />
above 20kHz, so our signal is [[WikiPedia:Bandlimiting|bandlimited]]. Only the first ten terms make it through, and that's exactly what we see on the output scope.<br />
<br />
<br style="clear:both;"/><br />
<center><div style="background-color:#DDDDFF;border-color:#CCCCDD;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
'''Going deeper…'''<br />
*In modern web browsers you can program audio synthesizers directly in javascript. Use the two square wave formulas to get a square wave out of [http://js.do/blog/sound-waves-with-javascript/ this page]. (Note: The scope is not very accurate/useful.) <br />
</div></center><br />
<div>&nbsp;</div><br />
<br />
[[Image:dsat_015.jpg|360px|right]]<br />
The rippling you see around sharp edges in a bandlimited signal is called the [[WikiPedia:/Gibbs_phenomenon|Gibbs effect]]. It happens whenever you slice off part of the frequency domain in the middle of nonzero energy.<br />
<br />
The usual rule of thumb you'll hear is "the sharper the cutoff, the<br />
stronger the rippling", which is approximately true, but we have to be<br />
careful how we think about it. For example, what would you expect our quite sharp anti-aliasing filter<br />
to do if I run our signal through it a second time?<br />
<br />
Aside from adding a few fractional cycles of delay, the answer is:<br />
Nothing at all. The signal is already bandlimited. Bandlimiting it<br />
again doesn't do anything. A second pass can't remove frequencies<br />
that we already removed.<br />
<br />
That's important. People tend to think of the ripples as<br />
a kind of [[WikiPedia:Sonic_artifact|artifact]] that's added by anti-aliasing and [[WikiPedia:Reconstruction_filter|anti-imaging]]<br />
filters, implying that the ripples get worse each time the signal<br />
passes through. We see that in this case that didn't happen, so<br />
it wasn't really the filter that added the ripples the first time<br />
through. It's a subtle distinction, but Gibbs effect<br />
ripples aren't added by filters, they're just part of what a<br />
bandlimited signal ''is''.<br />
<br />
Even if we synthetically construct what looks like a perfect digital<br />
square wave it's still limited to the channel bandwidth. Remember that<br />
the stairstep representation is misleading. What we really have here are instantaneous sample points<br />
and only one bandlimited signal fits those points. All we did when we<br />
drew our apparently perfect square wave was line up the sample points<br />
just right so it appeared that there were no ripples if we played<br />
[[WikiPedia:Interpolation|connect-the-dots]]. The original bandlimited signal, complete with ripples, was<br />
still there.<br />
<br />
[[image:Dsat_014.gif|360px|right]]<br />
That leads us to one more important point. You've probably heard<br />
that the timing precision of a digital signal is limited by its sample<br />
rate; put another way, that digital signals can't represent anything that falls between the<br />
samples.. implying that [[WikiPedia:Dirac_delta_function|impulses]] or<br />
[[WikiPedia:Synthesizer#ADSR_envelope|fast attacks]] have to align exactly<br />
with a sample, or the timing gets mangled or they just disappear.<br />
At this point, we can easily see why that's wrong.<br />
<br />
Again, our input signals are bandlimited. And digital signals are<br />
samples, not stairsteps, not 'connect-the-dots'. We most certainly<br />
can, for example, put the rising edge of our bandlimited square wave<br />
anywhere we want between samples.<br />
<br />
It's represented perfectly and it's reconstructed perfectly.<br />
<br />
==Epilogue==<br />
<br />
[[Image:Moffey.jpg|360px|right]]<br />
<br />
Like in [[Videos/A_Digital_Media_Primer_For_Geeks|_A Digital Media Primer for Geeks_]], we've covered a broad range of<br />
topics, and yet barely scratched the surface of each one. If anything, my<br />
sins of omission are greater this time around.<br />
<br />
Thus I encourage you to dig deeper and experiment. I chose my<br />
demos carefully to be simple and give clear results. You can<br />
reproduce every one of them on your own if you like, but let's face<br />
it: Sometimes we learn the most about a spiffy toy by breaking it open<br />
and studying all the pieces that fall out. Play with the demo parameters, hack up the code, set up<br />
alternate experiments. The source code for everything, including the<br />
little pushbutton demo application, is at the [[Videos/Digital_Show_and_Tell#Use_The_Source_Luke|bottom of this page]].<br />
<br />
In the course of experimentation, you're likely to run into something<br />
that you didn't expect and can't explain. Don't worry! My earlier<br />
snark aside, Wikipedia is fantastic for exactly this kind of casual<br />
research. If you're really serious about understanding signals,<br />
several universities have advanced materials online, such as the<br />
[http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-003-signals-and-systems-spring-2010/index.htm 6.003]<br />
and<br />
[http://ocw.mit.edu/resources/res-6-007-signals-and-systems-spring-2011/ RES.6-007]<br />
Signals and Systems modules at MIT OpenCourseWare. And of<br />
course, there's always the [http://webchat.freenode.net/?channels=xiph community here at Xiph.Org].<br />
<br />
==Credits==<br />
[[Image:Dmpfg_019.png|360px|right]]<br />
Written by: Christopher (Monty) Montgomery and the Xiph.Org Community<br />
<br />
Special thanks to:<br />
*Heidi Baumgartner, for the second Tektronix oscilloscope<br />
*Gregory Maxwell and Dr. Timothy Terriberry, for additional technical review<br />
<br />
Intro, title and credits music:<br><br />
"[http://music.lousyrobot.com/track/andy-warhol-is-gone Andy Warhol Is Gone]", by Lousy Robot<br><br />
Used by permission of Lousy Robot.<br><br />
Original source track All Rights Reserved.<br><br />
[http://www.lousyrobot.com www.lousyrobot.com]<br />
<br />
This Video Was Produced Entirely With Free and Open Source Software:<br><br />
<br />
*[http://www.gnu.org/ GNU]<br><br />
*[http://www.linux.org/ Linux]<br><br />
*[http://fedoraproject.org/ Fedora]<br><br />
*[http://cinelerra.org/ Cinelerra]<br><br />
*[http://www.gimp.org/ The Gimp]<br><br />
*[http://audacity.sourceforge.net/ Audacity]<br><br />
*[http://svn.xiph.org/trunk/postfish/README Postfish]<br><br />
*[http://gstreamer.freedesktop.org/ Gstreamer]<br><br />
<br />
All trademarks are the property of their respective owners. <br />
<br />
*''Complete video'' [http://creativecommons.org/licenses/by-sa/3.0/legalcode CC-BY-SA]<br><br />
*''Text transcript and Wiki edition'' [http://creativecommons.org/licenses/by-sa/3.0/legalcode CC-BY-SA]<br><br />
<br />
A Co-Production of Xiph.Org and Red Hat, Inc.<br><br />
(C) 2012-2013, Some Rights Reserved<br><br />
<br />
== Use The Source Luke ==<br />
<br />
As stated in the Epilogue, everything that appears in the video demos is driven by open source software, which means the source is both available for inspection and freely usable by the community. The Thinkpad that appears in the video was running Fedora 17 and Gnome Shell (Gnome 3). The demonstration software does not require Fedora specifically, but it does require Gnu/Linux to run in its current form. In all, the video involved just under 50,000 lines of new and custom-purpose code (including contributions to non-Xiph projects such as Cinelerra and Gromit).<br />
<br />
=== The Spectrum and Waveform Viewer ===<br />
<br />
The realtime software spectrum analyzer application that appears in the video was a preexisting application that was dusted off and updated for use in the video. The waveform viewer (effectively a simple software oscilloscope) was written from scratch making use of some of the internals from the spectrum analyzer application. Both are available from Xiph.Org svn:<br />
<br />
<center><div style="background-color:#DDDDDD;border-color:#CCCCCC;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
*Source for the Spectrum and Waveform applications is found at:<br />
https://svn.xiph.org/trunk/spectrum/<br />
*The source can be checked out of svn using the following command line:<br />
svn co https://svn.xiph.org/trunk/spectrum<br />
*Trac is a convenient way to browse the source without checking out a copy:<br />
https://trac.xiph.org/browser/trunk/spectrum<br />
</div></center><br />
<br />
Spectrum and Waveform both expect an input stream on the command line, either as raw data or as a WAV file.<br />
<br />
=== GTK-Bounce ===<br />
<br />
The touch-controlled application used in the video is named 'gtk-bounce' and was custom-written for the sole purpose of the in-video demonstrations. It is so named because, for the most part, all it does is read the input from an audio device, and then immediately write the same data back out for playback. It also forwards a copy of this data to up to two external monitoring applications, and in several demos, applies simple filters or generates simple waveforms. It includes several demos not included in the video.<br />
<br />
<center><div style="background-color:#DDDDDD;border-color:#CCCCCC;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
*Source for gtk-bounce is found at:<br />
https://svn.xiph.org/trunk/Xiph-episode-II/bounce/<br />
*The source can be checked out of svn using the following command line:<br />
svn co https://svn.xiph.org/trunk/Xiph-episode-II/bounce/<br />
*Trac is a convenient way to browse the source without checking out a copy:<br />
https://trac.xiph.org/browser/trac/Xiph-episode-II/bounce/<br />
</div></center><br />
<br />
==== Starting Gtk-bounce ====<br />
The application is somewhat hardwired for specific demo parameters, but most of the hardwired settings can be found at the top of each source file. As found in SVN, the application expects an ALSA hardware audio device at hw:1, and if none if found, it will wait for one to appear. Once a sound device is successfully initialized, it expects to find and open two pipes named pipe0 and pipe1 for output in the current directory. In the video, the waveform and spectrum applications are started to take input from pipe0 and pipe1 respectively. The output sent to the two pipes is identical, and in most demos matches the output data sent to the hardware device for conversion to analog. The only exception is the tenth demo panel (which does not appear in the video) where gtk-bounce can be set to monitor the hardware inputs instead while the outputs are used to produce test waveforms.<br />
<br />
Assuming gtk-bounce, spectrum and waveform have been checked out and built, the configuration seen in the video can be started using the following commands:<br />
<center><div style="background-color:#DDDDDD;border-color:#CCCCCC;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
* make the pipe fifos for the applications to communicate (only needs to be done once)<br />
mkfifo pipe0 pipe1<br />
* start all three applications<br />
waveform pipe0 & spectrum pipe1 & gtk-bounce &<br />
</div></center><br />
<br />
==== Using Gtk-bounce ====<br />
<br />
Gtk-bounce consists of eleven pushbutton panels (numbered zero through ten) that can be selected by scrolling up and dwon with the arrow buttons on the right side. Each panel is intended for a specific demo or part of a demo.<br />
<br />
<center><div style="background-color:#DDDDDD;border-color:#CCCCCC;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
<br />
[[Image:Dsat-panel0.png|700px|center]]<br />
* '''Panel 0''': This panel presents buttons that allow the sound card to be configured in several sampling rates and bit depths. Samples read from the audio inputs are sent to the output pipes and audio outputs for playback without modification.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel1.png|700px|center]]<br />
* '''Panel 1''': Both channels are forwarded to the outputs, however the user may select the bit depth of each channel independently. When the sound card is running in 16 bit mode and 16-bit depth is selected, the data is untouched. Requantization to a lower bit depth is performed with a flat triangle dither.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel2.png|700px|center]]<br />
* '''Panel 2''': Both channels are re-quantized to the selected bit depth. Requantization to a lower bit depth is performed with a flat triangle dither.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel3.png|700px|center]]<br />
* '''Panel 3''': 'generate sine wave' discards the audio inputs and instead internally generates a sine wave at 32 bit precision, which is then quantized to the selected bit depth, optionally with dither. The resulting signal is then forwarded to the output. <br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel4.png|700px|center]]<br />
* '''Panel 4''': gtk-bounce generates a 16-bit sine wave of the selected amplitude, optionally with dither, and forwards the resulting signal to the outputs. The audio input from the audio device is discarded. Note that the slider sets the peak amplitude, not the peak-to-peak amplitude.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel5.png|700px|center]]<br />
* '''Panel 5''': generates a 16-bit sine wave, optionally quantized using dither. The user may additionally select a flat or a shaped dither. The 'notch and gain' button applies a notch filter to the resulting signal, and boosts the gain of the remaining noise so that it's easily audible. The audio input from the audio device is discarded.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel6.png|700px|center]]<br />
* '''Panel 6''': allows the user to play with the power of the dithering noise applied before quantizing the sine wave. Shaped or flat dither are available. The sine wave may also be modulated with a varying amplitude to highlight correlations between the input and the resulting quantization noise. The 'notch and gain' button applies a notch filter to the resulting signal, and boosts the gain of the remaining noise so that it's easily audible. The audio input from the audio device is discarded.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel7.png|700px|center]]<br />
* '''Panel 7''': applies a sharper antialiasing (lowpass) filter than is likely to be built into the sound-card hardware (as there's generally no reason to use a filter quite this sharp in practice). The very sharp filter allows us to bandpass the demonstration square wave without any harmonics landing in the transition band. The input is read from the audio device, passed through this sharper filter, and then forwarded to the outputs.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel8.png|700px|center]]<br />
* '''Panel 8''': when selected, generate a synthetic 'square wave' (this is not quite equivalent to a bandlimited analog square wave; the harmonic amplitudes are a bit different) that when aligned with the sampling phase just right gives the appearance of having infinite rise and fall time. The slider allows us to shift the waveform sample alignment back and forth by +/- one sample to reveal that the underlying signal is still band-limited.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel9.png|700px|center]]<br />
* '''Panel 9''': as in panel 8, generate a 'perfect' synthetic 'square wave'. However, the slider now allows us to shift the sample alignment of the second channel with respect to the first, instead of shifting both channels. This allows us the trigger/lock the scope timing to the channel 1 waveform so we can see the fractional sample movement and alignment of the waveform on channel 2. The audio input from the audio device is discarded.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel10.png|700px|center]]<br />
* '''Panel 10''': not used in the video; The audio device is configured to 24-bit input/output. The user may produce one of a range of test signals that are output to both the external applications and the audio device on the first channel. The input on the second channel is passed-through to the applications and audio device outputs unchanged. The first channel input is unused unless 'two input mode' is selected. When two input mode is selected, both input channels are read and the data sent to the external applications. Generated test signals are sent only to the audio hardware (on the first channel). This combination of test signals and input modes allows self-references frequency response, phase, noise, distortion and crosstalk testing of a given audio device.<br />
<br />
<div style="clear: both">&nbsp;</div><br />
<br />
</div></center><br />
<br />
=== Cairo Animations ===<br />
<br />
The animations featured throughout the Episode 2 video were rapid-development spaghetti hack-jobs coded by hand in raw Cairo. Each module generated a series of PNG stills that were then stitched into an animation with Cinelerra or mplayer. In the interest of pointing and laughing at what really bad code looks like...<br />
<br />
<center><div style="background-color:#DDDDDD;border-color:#CCCCCC;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
*Source for the Cairo animations is found at:<br />
https://svn.xiph.org/trunk/Xiph-episode-II/cairo/<br />
*The source can be checked out of svn using the following command line:<br />
svn co https://svn.xiph.org/trunk/Xiph-episode-II/cairo/<br />
*Trac is a convenient way to browse the source without checking out a copy:<br />
https://trac.xiph.org/browser/trunk/Xiph-episode-II/cairo/<br />
</div></center></div>Gmaxwellhttps://wiki.xiph.org/index.php?title=Videos/Digital_Show_and_Tell&diff=14040Videos/Digital Show and Tell2013-02-26T11:17:40Z<p>Gmaxwell: /* Cairo Animations */ fix trac link</p>
<hr />
<div><small>''Wiki edition''</small><br />
[[Image:dsat_001.jpg|400px|right]]<br />
<br />
Continuing in the "firehose" tradition of [[Videos/A_Digital_Media_Primer_For_Geeks|Episode 01]], Xiph.Org's second video on digital media explores multiple facets of digital audio signals and how they ''really'' behave in the real world.<br />
<br />
Demonstrations of sampling, quantization, bit-depth, and dither explore digital audio behavior on real audio equipment using both modern digital analysis and vintage analog bench equipment, just in case we can't trust those newfangled digital gizmos. You can download the source code for each demo and try it all for yourself!<br />
<br/><br/><br/><br />
<center><font size="+2">[http://www.xiph.org/video/vid2.shtml Download or Watch online]</font></center><br />
<br style="clear:both;"/><br />
Supported players: [http://www.videolan.org/vlc/ VLC 1.1+], [https://www.mozilla.com/en-US/firefox/ Firefox ], [http://www.chromium.org/Home Chrome ], [http://www.opera.com/ Opera]. Or see [http://www.webmproject.org/users/ other WebM] or [[TheoraSoftwarePlayers|other Theora]] players.<br />
<br />
If you're having trouble with playback in a modern browser or player, please visit our [[Playback_Troubleshooting|playback troubleshooting and discussion]] page.<br />
<br/><br />
<hr/><br />
<br/><br/><br/><br />
[[Image:Xiph_ep02_test.png|400px|right]]<br />
<br />
&ldquo;Hi, I'm Monty Montgomery from [http://www.redhat.com/ Red Hat] and [http://xiph.org/ Xiph.Org].<br />
<br />
&ldquo;A few months ago, I wrote<br />
[http://people.xiph.org/~xiphmont/demo/neil-young.html an article on digital audio and why 24bit/192kHz music downloads don't make sense].<br />
In the article, I<br />
mentioned--almost in passing--that a digital waveform is<br />
[http://people.xiph.org/~xiphmont/demo/neil-young.html#toc_sfam not a stairstep],<br />
and you certainly don't get a stairstep when you<br />
[[WikiPedia:Digital-to-analog_converter|convert from digital back to analog]].<br />
<br />
&ldquo;Of everything in the entire article, '''that''' was the number one thing<br />
people wrote about. In fact, more than half the mail I got was questions and<br />
comments about basic digital signal behavior. Since there's interest, let's<br />
take a little time to play with some ''simple'' digital signals. &rdquo;<br />
<br />
==Veritas ex machina==<br />
[[Image:Dsat_002.jpg|200px|right]]<br />
[[Image:Dsat_003.jpg|200px|right]]<br />
[[Image:Dsat_004.jpg|200px|right]]<br />
[[Image:Dsat_005.jpg|200px|right]]<br />
<br />
If we pretend for a moment that we have no idea how digital signals really<br />
behave, then it doesn't make sense for us to use digital test<br />
equipment. Fortunately for this exercise, there's still plenty<br />
of working analog lab equipment out there.<br />
<br />
We need a [[WikiPedia:Function_generator|signal generator]] to provide us with analog input<br />
signals--in this case, an<br />
[http://www.home.agilent.com/en/pd-3325A%3Aepsg%3Apro-pn-3325A/synthesizer-function-generator?pm=PL&nid=-536900197.536896863&cc=SE&lc=swe HP3325]<br />
from 1978.<br />
<br />
We'll observe our analog waveforms on [[WikiPedia:Oscilloscope_types#Cathode-ray_oscilloscope_.28CRO.29|analog oscilloscopes]],<br />
like this Tektronix 2246 from the mid-90s, one of the last and best analog scopes made.<br />
<br />
Finally, we'll inspect the [[WikiPedia:Spectral_density#Electrical_engineering|frequency spectrum]] of our signals using an<br />
[[WikiPedia:Spectrum_analyzer#Swept-tuned|analog spectrum analyzer]], this<br />
[http://www.home.agilent.com/en/pd-3585A%3Aepsg%3Apro-pn-3585A/spectrum-analyzer-high-perf-20hz-40mhz?pm=PL&nid=-536900197.536897319&cc=SE&lc=swe HP3585]<br />
from the same product line as<br />
the signal generator. Like the other equipment here it has<br />
[http://www.hp9845.net/9845/hardware/processors/ a rudimentary and hilariously large microcontroller],<br />
but the signal path<br />
from input to what you see on the screen is completely analog.<br />
<br />
All of this equipment is vintage, but the specs are still quite good.<br />
We start with the signal generator set to output a 1 [[WikiPedia:Hertz#SI_multiples|kHz]]<br />
sine wave at one [[WikiPedia:Volt|Volt]] [[WikiPedia:Amplitude#Root_mean_square_amplitude|RMS]].<br />
We see the sine wave on the oscilloscope, can verify that it is indeed<br />
1 kHz at 1 Volt RMS, which is 2.8 Volts<br />
[[WikiPedia:Amplitude#Peak-to-peak_amplitude|peak-to-peak]],<br />
and that matches the<br />
measurement on the spectrum analyzer as well.<br />
<br />
The analyzer also shows some low-level [[WikiPedia:White_noise|white noise]]<br />
and just a bit of [[WikiPedia:Harmonic_distortion#Harmonic_distortion|harmonic distortion]],<br />
with the highest peak about 70[[WikiPedia:Decibel|dB]] or so below<br />
[[WikiPedia:Fundamental_frequency|the fundamental]].<br />
This doesn't matter to the demos, but it's good to take notice of it now to avoid confusion later.<br />
<br />
For digital conversion, we use a boring, consumer-grade, eMagic USB1<br />
audio device. It's more than ten years old at this point, and it's<br />
getting obsolete.<br />
<br />
A recent converter can easily have an order of magnitude better specs.<br />
[[WikiPedia:Reconstruction_filter#Sampled_data_reconstruction_filters|Flatness]],<br />
[[WikiPedia:Analog-to-digital_converter#Non-linearity|linearity]],<br />
[[WikiPedia:Jitter#Sampling_jitter|jitter]],<br />
[[WikiPedia:Noise_floor|noise behavior]],<br />
[[WikiPedia:Digital-to-analog_converter#DAC_performance|everything]]...<br />
You may not<br />
have noticed. Just because we can measure an improvement doesn't<br />
mean we can hear it, and even these old consumer boxes were already at<br />
the edge of ideal transparency.<br />
<br />
The eMagic connects to my ThinkPad, which displays a digital<br />
waveform and spectrum for comparison, then the ThinkPad<br />
sends the digital signal right back out to the eMagic for<br />
re-conversion to analog and observation on the output scopes.<br />
<br />
<br style="clear:both;"/><br />
<br />
==Stairsteps==<br />
[[Image:Dsat 006.jpg|360px|right]]<br />
[[Image:Dsat 007.png|360px|right]]<br />
First demo: We begin by converting an analog signal to digital and<br />
then right back to analog again with no other steps.<br />
<br />
The signal generator is set to produce a 1kHz sine wave just like<br />
before and we can see the analog sine wave on the input-side oscilloscope. The eMagic digitizes our signal to<br />
[[Videos/A_Digital_Media_Primer_For_Geeks#Raw_.28digital_audio.29_meat|16 bit PCM at 44.1kHz]],<br />
same as on a CD. The spectrum of the digitized signal on the Thinkpad matches what we saw earlier and what we see now on the analog spectrum analyzer, aside from its <br />
[[WikiPedia:High_impedance|high-impedance input]] being just a smidge noisier. For now, the waveform display shows our digitized sine wave as a<br />
stairstep pattern, one step for each sample.<br />
<br />
When we look at the output signal that's been converted<br />
from digital back to analog, we see that it's exactly like the original sine wave. No stairsteps.<br />
<br />
1 kHz is still a fairly low frequency, so perhaps the stairsteps are just<br />
hard to see or they're being smoothed away. Next, set the signal generator to 15kHz, which is much closer to [[WikiPedia:Nyquist_frequency|Nyquist]].<br />
Now the sine wave is represented by less than three samples per cycle, and the digital waveform appears rather poor! Yet the analog output is still a perfect sine wave, exactly like the original.<br />
As we keep increasing frequency, all the way to 20kHz, the output waveform is still perfect. No jagged edges, no dropoff, no stairsteps.<br />
<br />
So where'd the stairsteps go? It's a trick question; they were never there. Drawing a digital waveform as a stairstep was wrong to begin with.<br />
<br />
A stairstep is a continuous-time function. It's jagged, and it's piecewise, but it has a defined value at every point in time.<br />
A sampled signal is entirely different. It's discrete-time; it's only got a value right at each instantaneous sample point and it's<br />
undefined, there is no value at all, everywhere between. A discrete-time signal is properly drawn as a lollipop graph.<br />
The continuous, analog counterpart of a digital signal passes smoothly through each sample point, and that's just as true for high<br />
frequencies as it is for low.<br />
<br />
[[Image:Dsat 008.png|360px|right]]<br />
The interesting and non-obvious bit is that [[WikiPedia:Nyquist%E2%80%93Shannon_sampling_theorem|there's only one<br />
bandlimited signal that passes exactly through each sample point]]; it's a unique solution. If you sample a bandlimited signal and then convert it back, the original input is also the only possible output.<br />
A signal that differs even minutely from the original includes frequency content at or beyond Nyquist, breaks the bandlimiting requirement and isn't a valid solution.<br />
<br />
So how did everyone get confused and start thinking of digital signals as stairsteps? I can think of two good reasons.<br />
<br />
First: it's easy to convert a sampled signal to a true stairstep. Just<br />
extend each sample value forward until the next sample period. This is<br />
called a [[WikiPedia:Zero-order hold|zero-order hold]], and it's an important part of how some<br />
digital-to-analog converters work, especially the simplest ones.<br />
As a result, anyone who looks up [[WikiPedia:Digital-to-analog_converter#Practical_operation|digital-to-analog converter or<br />
digital-to-analog conversion]] is probably going to see a diagram of a<br />
stairstep waveform somewhere, but that's not a finished conversion,<br />
and it's not the signal that comes out.<br />
<br />
Second, and this is probably the more likely reason, engineers who<br />
supposedly know better (yes, even I) draw stairsteps even though they're<br />
technically wrong. It's a sort of one-dimensional version of<br />
[[WikiPedia:MacPaint#Development|fat bits in an image editor]].<br />
Pixels aren't squares either, they're samples of a 2-dimensional<br />
function space and so they're also, conceptually, infinitely small<br />
points. Practically, it's a real pain in the ass to see or manipulate<br />
infinitely small anything, so big squares it is.<br />
<br />
Digital stairstep drawings are exactly the same thing. It's just a convenient drawing. The stairsteps aren't really there.<br />
<div style="clear:both"></div><br />
<br />
==Bit-depth==<br />
[[Image:Dsat_009.jpg|360px|right]]<br />
[[Image:Dsat_010.jpg|260px|right]]<br />
<br />
When we convert a digital signal back to analog, the result is<br />
''also'' smooth regardless of the [[WikiPedia:Audio_bit_depth|bit depth]]. It doesn't matter if it's 24 bits or 16 bits or 8 bits.<br />
So does that mean that the digital bit depth makes no difference at<br />
all? Of course not.<br />
<br />
Channel 2 is the same sine wave input, but we quantize it with<br />
[[WikiPedia:Dither|dither]] down to 8 bits.<br />
On the scope, we still see a nice<br />
smooth sine wave on channel 2. Look very close, and you'll also see a<br />
bit more noise. That's a clue.<br />
<br />
If we look at the spectrum of the signal, our sine wave is<br />
still there unaffected, but the noise level of the 8-bit signal on<br />
the second channel is much higher. And that's the difference, the only difference, the number of bits makes.<br />
<br />
When we digitize a signal, first we sample it. The<br />
sampling step is perfect; it loses nothing. But then we [[WikiPedia:Quantization_(sound_processing)|quantize]] it,<br />
and [[WikiPedia:Quantization_error|quantization adds noise]].<br />
The number of bits determines how much noise and so the level of the<br />
noise floor.<br />
<br />
What does this dithered quantization noise sound like?<br />
Those of you who have used analog recording equipment might think to yourselves, "My goodness! That sounds like tape hiss!"<br />
Well, it doesn't just sound like tape hiss, it acts like it too, and<br />
if we use a [[WikiPedia:Dither#Different_types|gaussian dither]] then it's<br />
[[WikiPedia:Central_limit_theorem|mathematically equivalent]] in every way. It ''is'' tape hiss.<br />
<br />
Intuitively, that means that we can measure tape hiss and thus the noise floor<br />
of [[WikiPedia:Magnetic_tape_sound_recording|magnetic audio tape]]<br />
in [[WikiPedia:Shannon–Hartley_theorem#Examples|bits instead of decibels]], in order to put things in a<br />
digital perspective. [[WikiPedia:Compact cassettes|Compact cassettes]], for those of you who are old enough to remember them, could reach as<br />
deep as 9 bits in perfect conditions. 5 to 6 bits was<br />
more typical, especially if it was a recording made on a<br />
[[WikiPedia:Cassette_deck|tape deck]]. That's right; your old mix tapes were only about 6 bits<br />
deep if you were lucky!<br />
<br />
The very best professional [[WikiPedia:Reel-to-reel_audio_tape_recording|open reel tape]] used in studios could barely<br />
hit 13 bits ''with'' [[WikiPedia:Reel-to-reel_audio_tape_recording#Noise_reduction|advanced noise reduction]]. <br />
That's why seeing '[[WikiPedia:SPARS_code|D D D]]' on a [[WikiPedia:Compact_disk|Compact Disc]] used to be such a big,<br />
high-end deal.<br />
<br />
<div style="clear:both"></div><br />
<br />
==Dither==<br />
[[Image:Dsat_011.png|360px|right]]<br />
<br />
We've been quantizing with [[Wikipedia:dither|dither]]. What is dither<br />
exactly and, more importantly, what does it do?<br />
<br />
The simplest way to quantize a signal is to choose the digital<br />
amplitude value [[WikiPedia:Rounding|closest to the original analog amplitude]].<br />
Unfortunately, the exact noise that results from this simple<br />
quantization scheme depends somewhat on the input signal.<br />
It may be inconsistent, cause distortion, or be<br />
undesirable in some other way.<br />
<br style="clear:both;"/><br />
<br />
<center><div style="background-color:#DDDDFF;border-color:#CCCCDD;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
'''Going deeper…'''<br />
*Cameron Nicklaus Christou's thesis [http://uwspace.uwaterloo.ca/bitstream/10012/3867/1/thesis.pdf Optimal Dither and Noise Shaping in Image Processing] provides an ''excellent'' explanation of dither and noise shaping.<br />
</div>&nbsp;</center><br />
<br />
Dither is specially-constructed noise that substitutes for the noise<br />
produced by simple quantization. Dither doesn't [[WikiPedia:Sound_masking|drown out or mask]]<br />
quantization noise, it replaces it with noise characteristics<br />
of our choosing that aren't influenced by the input.<br />
<br />
The signal generator has too much noise for this test so we produce a mathematically perfect sine wave with the ThinkPad and quantize it to 8 bits with dithering.<br />
We see the sine wave on waveform display and output scope, and <br />
a clean frequency peak with a uniform noise floor on both spectral displays<br />
just like before. Again, this is with dither.<br />
<br />
Now I turn dithering off.<br />
<br />
The quantization noise that dither had spread out into a nice, flat noise<br />
floor, piles up into harmonic distortion peaks. The noise floor is<br />
lower, but the level of distortion becomes nonzero, and the distortion<br />
peaks sit higher than the dithering noise did.<br />
<br />
At 8 bits this effect is exaggerated. At 16 bits,<br />
even without dither, harmonic distortion is going to be so low as to<br />
be completely inaudible. Still, we can use dither to eliminate it completely if we so choose.<br />
<br />
Turning the dither off again for a moment, you'll notice that the<br />
absolute level of distortion from undithered quantization stays<br />
approximately constant regardless of the input amplitude.<br />
But when the signal level drops below a half a bit, everything<br />
quantizes to zero.<br />
<br />
In a sense, everything quantizing to zero is just 100% distortion!<br />
Dither eliminates this distortion too. When we reenable dither, we clearly see our signal at 1/4 bit with a nice flat noise floor.<br />
<br />
The noise floor doesn't have to be flat. Dither is noise of our<br />
choosing, so it makes sense to choose a noise as [http://www.acoustics.salford.ac.uk/res/cox/sound_quality/?content=subjective inoffensive] and<br />
[[WikiPedia:Absolute_threshold_of_hearing|difficult to notice]]<br />
as possible.<br />
<br />
Human hearing is [[WikiPedia:Equal-loudness_contour|most sensitive in the midrange from 2kHz to 4kHz]]; that's where background noise is going to be the most obvious.<br />
We can [[WikiPedia:Noise_shaping|shape dithering noise]] away from sensitive frequencies to where<br />
hearing is less sensitive, usually the highest frequencies.<br />
<br />
Lastly, dithered quantization noise ''is'' higher [[WikiPedia:Sound_power|power]] overall<br />
than undithered quantization noise, even though it often sounds quieter, and<br />
you can see that on a [[WikiPedia:VU_meter|VU meter]] during passages of near-silence. However,<br />
dither isn't only an on or off choice. We can reduce the dither's<br />
power to balance less noise against a bit of distortion to minimize<br />
the overall effect.<br />
<br />
For the next test, we also [[WikiPedia:Amplitude_modulation|modulate the input signal]] like this to show how a varying input affects the quantization noise. At<br />
full dithering power, the noise is uniform, constant, and featureless<br />
just like we expect.<br />
<br />
As we reduce the dither's power, the input increasingly<br />
affects the amplitude and the character of the quantization noise.<br />
Shaped dither behaves similarly, but noise shaping lends one more nice<br />
advantage; it can use a somewhat lower<br />
dither power before the input has as much effect on the output.<br />
<br />
Despite all this text spent on dither, the differences exist 100 decibels or more below [[WikiPedia:Full_scale|full scale]]. If the CD had been<br />
[http://www.research.philips.com/technologies/projects/cd/index.html 14 bits as originally designed],<br />
perhaps dither ''might'' be<br />
more important. At 16 bits it's mostly a wash. It's reasonable to treat<br />
dither as an insurance policy that gives several extra<br />
decibels of dynamic range just in case. That said no<br />
one ever ruined a great recording by not dithering the final master.<br />
<br />
==Bandlimitation and timing==<br />
[[image:Dsat_016.jpg|360px|right]]<br />
<br />
We've been using [[WikiPedia:Sine_wave|sine waves]]. They're the obvious choice when what we<br />
want to see is a system's behavior at a given isolated frequency. Now let's look at something a bit more complex. What should we expect to happen when I change the input to a [[WikiPedia:Square_wave|square wave]]? <br />
<br />
The input scope confirms a 1kHz square wave. The output scope shows... exactly what it should.<br />
<br />
What is a square wave really? <br />
<br />
We can say it's a waveform that's some positive value for half a cycle and then transitions instantaneously to a negative value for the other half.<br />
<br />
:<math><br />
\ squarewave(t) = \begin{cases} 1, & |t| < T_1 \\ 0, & T_1 < |t| \leq {1 \over 2}T \end{cases}<br />
</math><br />
<br />
But that doesn't really tell us anything useful about how that input becomes this output.<br />
<br />
We remember that any waveform is also [[WikiPedia:Fourier_series|the sum of discrete frequencies]],<br />
and a square wave is particularly simple sum: a fundamental and an infinite series of [[WikiPedia:Even_and_odd_functions#Harmonics|odd harmonics]].<br />
<br />
[[image:Dsat_013.jpg|360px|right]]<br />
:<math>\begin{align}<br />
\ squarewave(t) = \frac{4}{\pi}\sin(\omega t) + \frac{4}{3\pi}\sin(3\omega t) + \frac{4}{5\pi}\sin(5\omega t) + \\<br />
\frac{4}{7\pi}\sin(7\omega t) + \frac{4}{9\pi}\sin(9\omega t) + \frac{4}{11\pi}\sin(11\omega t) + \\ <br />
\frac{4}{13\pi}\sin(13\omega t) + \frac{4}{15\pi}\sin(15\omega t) + \frac{4}{17\pi}\sin(17\omega t) + \\<br />
\frac{4}{19\pi}\sin(19\omega t) + \frac{4}{21\pi}\sin(21\omega t) + \frac{4}{23\pi}\sin(23\omega t) + \\<br />
\frac{4}{25\pi}\sin(25\omega t) + \frac{4}{27\pi}\sin(27\omega t) + \frac{4}{29\pi}\sin(29\omega t) + \\<br />
\frac{4}{31\pi}\sin(31\omega t) + \frac{4}{33\pi}\sin(33\omega t) + \cdots <br />
\end{align}</math><br />
<br />
At first glance, that doesn't seem very useful either; you'd have to sum an infinite number of harmonics to get the answer! However, we don't have an infinite number of harmonics.<br />
<br />
We're using a quite sharp [[WikiPedia:Low-pass_filter|anti-aliasing filter]] that cuts off right<br />
above 20kHz, so our signal is [[WikiPedia:Bandlimiting|bandlimited]]. Only the first ten terms make it through, and that's exactly what we see on the output scope.<br />
<br />
<br style="clear:both;"/><br />
<center><div style="background-color:#DDDDFF;border-color:#CCCCDD;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
'''Going deeper…'''<br />
*In modern web browsers you can program audio synthesizers directly in javascript. Use the two square wave formulas to get a square wave out of [http://js.do/blog/sound-waves-with-javascript/ this page]. (Note: The scope is not very accurate/useful.) <br />
</div></center><br />
<div>&nbsp;</div><br />
<br />
[[Image:dsat_015.jpg|360px|right]]<br />
The rippling you see around sharp edges in a bandlimited signal is called the [[WikiPedia:/Gibbs_phenomenon|Gibbs effect]]. It happens whenever you slice off part of the frequency domain in the middle of nonzero energy.<br />
<br />
The usual rule of thumb you'll hear is "the sharper the cutoff, the<br />
stronger the rippling", which is approximately true, but we have to be<br />
careful how we think about it. For example, what would you expect our quite sharp anti-aliasing filter<br />
to do if I run our signal through it a second time?<br />
<br />
Aside from adding a few fractional cycles of delay, the answer is:<br />
Nothing at all. The signal is already bandlimited. Bandlimiting it<br />
again doesn't do anything. A second pass can't remove frequencies<br />
that we already removed.<br />
<br />
That's important. People tend to think of the ripples as<br />
a kind of [[WikiPedia:Sonic_artifact|artifact]] that's added by anti-aliasing and [[WikiPedia:Reconstruction_filter|anti-imaging]]<br />
filters, implying that the ripples get worse each time the signal<br />
passes through. We see that in this case that didn't happen, so<br />
it wasn't really the filter that added the ripples the first time<br />
through. It's a subtle distinction, but Gibbs effect<br />
ripples aren't added by filters, they're just part of what a<br />
bandlimited signal ''is''.<br />
<br />
Even if we synthetically construct what looks like a perfect digital<br />
square wave it's still limited to the channel bandwidth. Remember that<br />
the stairstep representation is misleading. What we really have here are instantaneous sample points<br />
and only one bandlimited signal fits those points. All we did when we<br />
drew our apparently perfect square wave was line up the sample points<br />
just right so it appeared that there were no ripples if we played<br />
[[WikiPedia:Interpolation|connect-the-dots]]. The original bandlimited signal, complete with ripples, was<br />
still there.<br />
<br />
[[image:Dsat_014.gif|360px|right]]<br />
That leads us to one more important point. You've probably heard<br />
that the timing precision of a digital signal is limited by its sample<br />
rate; put another way, that digital signals can't represent anything that falls between the<br />
samples.. implying that [[WikiPedia:Dirac_delta_function|impulses]] or<br />
[[WikiPedia:Synthesizer#ADSR_envelope|fast attacks]] have to align exactly<br />
with a sample, or the timing gets mangled or they just disappear.<br />
At this point, we can easily see why that's wrong.<br />
<br />
Again, our input signals are bandlimited. And digital signals are<br />
samples, not stairsteps, not 'connect-the-dots'. We most certainly<br />
can, for example, put the rising edge of our bandlimited square wave<br />
anywhere we want between samples.<br />
<br />
It's represented perfectly and it's reconstructed perfectly.<br />
<br />
==Epilogue==<br />
<br />
[[Image:Moffey.jpg|360px|right]]<br />
<br />
Like in [[Videos/A_Digital_Media_Primer_For_Geeks|_A Digital Media Primer for Geeks_]], we've covered a broad range of<br />
topics, and yet barely scratched the surface of each one. If anything, my<br />
sins of omission are greater this time around.<br />
<br />
Thus I encourage you to dig deeper and experiment. I chose my<br />
demos carefully to be simple and give clear results. You can<br />
reproduce every one of them on your own if you like, but let's face<br />
it: Sometimes we learn the most about a spiffy toy by breaking it open<br />
and studying all the pieces that fall out. Play with the demo parameters, hack up the code, set up<br />
alternate experiments. The source code for everything, including the<br />
little pushbutton demo application, is at the [[Videos/Digital_Show_and_Tell#Use_The_Source_Luke|bottom of this page]].<br />
<br />
In the course of experimentation, you're likely to run into something<br />
that you didn't expect and can't explain. Don't worry! My earlier<br />
snark aside, Wikipedia is fantastic for exactly this kind of casual<br />
research. If you're really serious about understanding signals,<br />
several universities have advanced materials online, such as the<br />
[http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-003-signals-and-systems-spring-2010/index.htm 6.003]<br />
and<br />
[http://ocw.mit.edu/resources/res-6-007-signals-and-systems-spring-2011/ RES.6-007]<br />
Signals and Systems modules at MIT OpenCourseWare. And of<br />
course, there's always the [http://webchat.freenode.net/?channels=xiph community here at Xiph.Org].<br />
<br />
==Credits==<br />
[[Image:Dmpfg_019.png|360px|right]]<br />
Written by: Christopher (Monty) Montgomery and the Xiph.Org Community<br />
<br />
Special thanks to:<br />
*Heidi Baumgartner, for the second Tektronix oscilloscope<br />
*Gregory Maxwell and Dr. Timothy Terriberry, for additional technical review<br />
<br />
Intro, title and credits music:<br><br />
"[http://music.lousyrobot.com/track/andy-warhol-is-gone Andy Warhol Is Gone]", by Lousy Robot<br><br />
Used by permission of Lousy Robot.<br><br />
Original source track All Rights Reserved.<br><br />
[http://www.lousyrobot.com www.lousyrobot.com]<br />
<br />
This Video Was Produced Entirely With Free and Open Source Software:<br><br />
<br />
*[http://www.gnu.org/ GNU]<br><br />
*[http://www.linux.org/ Linux]<br><br />
*[http://fedoraproject.org/ Fedora]<br><br />
*[http://cinelerra.org/ Cinelerra]<br><br />
*[http://www.gimp.org/ The Gimp]<br><br />
*[http://audacity.sourceforge.net/ Audacity]<br><br />
*[http://svn.xiph.org/trunk/postfish/README Postfish]<br><br />
*[http://gstreamer.freedesktop.org/ Gstreamer]<br><br />
<br />
All trademarks are the property of their respective owners. <br />
<br />
*''Complete video'' [http://creativecommons.org/licenses/by-sa/3.0/legalcode CC-BY-SA]<br><br />
*''Text transcript and Wiki edition'' [http://creativecommons.org/licenses/by-sa/3.0/legalcode CC-BY-SA]<br><br />
<br />
A Co-Production of Xiph.Org and Red Hat, Inc.<br><br />
(C) 2012-2013, Some Rights Reserved<br><br />
<br />
== Use The Source Luke ==<br />
<br />
As stated in the Epilogue, everything that appears in the video demos is driven by open source software, which means the source is both available for inspection and freely usable by the community. The Thinkpad that appears in the video was running Fedora 17 and Gnome Shell (Gnome 3). The demonstration software does not require Fedora specifically, but it does require Gnu/Linux to run in its current form. In all, the video involved just under 50,000 lines of new and custom-purpose code (including contributions to non-Xiph projects such as Cinelerra and Gromit).<br />
<br />
=== The Spectrum and Waveform Viewer ===<br />
<br />
The realtime software spectrum analyzer application that appears in the video was a preexisting application that was dusted off and updated for use in the video. The waveform viewer (effectively a simple software oscilloscope) was written from scratch making use of some of the internals from the spectrum analyzer application. Both are available from Xiph.Org svn:<br />
<br />
<center><div style="background-color:#DDDDDD;border-color:#CCCCCC;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
*Source for the Spectrum and Waveform applications is found at:<br />
https://svn.xiph.org/trunk/spectrum/<br />
*The source can be checked out of svn using the following command line:<br />
svn co https://svn.xiph.org/trunk/spectrum<br />
*Trac is a convenient way to browse the source without checking out a copy:<br />
https://trac.xiph.org/browser/trunk/spectrum<br />
</div></center><br />
<br />
Spectrum and Waveform both expect an input stream on the command line, either as raw data or as a WAV file.<br />
<br />
=== GTK-Bounce ===<br />
<br />
The touch-controlled application used in the video is named 'gtk-bounce' and was custom-written for the sole purpose of the in-video demonstrations. It is so named because, for the most part, all it does is read the input from an audio device, and then immediately write the same data back out for playback. It also forwards a copy of this data to up to two external monitoring applications, and in several demos, applies simple filters or generates simple waveforms. It includes several demos not included in the video.<br />
<br />
<center><div style="background-color:#DDDDDD;border-color:#CCCCCC;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
*Source for gtk-bounce is found at:<br />
https://svn.xiph.org/trunk/Xiph-episode-II/bounce/<br />
*The source can be checked out of svn using the following command line:<br />
svn co https://svn.xiph.org/trunk/Xiph-episode-II/bounce/<br />
*Trac is a convenient way to browse the source without checking out a copy:<br />
https://trac.xiph.org/browser/Xiph-episode-II/bounce/<br />
</div></center><br />
<br />
==== Starting Gtk-bounce ====<br />
The application is somewhat hardwired for specific demo parameters, but most of the hardwired settings can be found at the top of each source file. As found in SVN, the application expects an ALSA hardware audio device at hw:1, and if none if found, it will wait for one to appear. Once a sound device is successfully initialized, it expects to find and open two pipes named pipe0 and pipe1 for output in the current directory. In the video, the waveform and spectrum applications are started to take input from pipe0 and pipe1 respectively. The output sent to the two pipes is identical, and in most demos matches the output data sent to the hardware device for conversion to analog. The only exception is the tenth demo panel (which does not appear in the video) where gtk-bounce can be set to monitor the hardware inputs instead while the outputs are used to produce test waveforms.<br />
<br />
Assuming gtk-bounce, spectrum and waveform have been checked out and built, the configuration seen in the video can be started using the following commands:<br />
<center><div style="background-color:#DDDDDD;border-color:#CCCCCC;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
* make the pipe fifos for the applications to communicate (only needs to be done once)<br />
mkfifo pipe0 pipe1<br />
* start all three applications<br />
waveform pipe0 & spectrum pipe1 & gtk-bounce &<br />
</div></center><br />
<br />
==== Using Gtk-bounce ====<br />
<br />
Gtk-bounce consists of eleven pushbutton panels (numbered zero through ten) that can be selected by scrolling up and dwon with the arrow buttons on the right side. Each panel is intended for a specific demo or part of a demo.<br />
<br />
<center><div style="background-color:#DDDDDD;border-color:#CCCCCC;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
<br />
[[Image:Dsat-panel0.png|700px|center]]<br />
* '''Panel 0''': This panel presents buttons that allow the sound card to be configured in several sampling rates and bit depths. Samples read from the audio inputs are sent to the output pipes and audio outputs for playback without modification.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel1.png|700px|center]]<br />
* '''Panel 1''': Both channels are forwarded to the outputs, however the user may select the bit depth of each channel independently. When the sound card is running in 16 bit mode and 16-bit depth is selected, the data is untouched. Requantization to a lower bit depth is performed with a flat triangle dither.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel2.png|700px|center]]<br />
* '''Panel 2''': Both channels are re-quantized to the selected bit depth. Requantization to a lower bit depth is performed with a flat triangle dither.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel3.png|700px|center]]<br />
* '''Panel 3''': 'generate sine wave' discards the audio inputs and instead internally generates a sine wave at 32 bit precision, which is then quantized to the selected bit depth, optionally with dither. The resulting signal is then forwarded to the output. <br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel4.png|700px|center]]<br />
* '''Panel 4''': gtk-bounce generates a 16-bit sine wave of the selected amplitude, optionally with dither, and forwards the resulting signal to the outputs. The audio input from the audio device is discarded. Note that the slider sets the peak amplitude, not the peak-to-peak amplitude.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel5.png|700px|center]]<br />
* '''Panel 5''': generates a 16-bit sine wave, optionally quantized using dither. The user may additionally select a flat or a shaped dither. The 'notch and gain' button applies a notch filter to the resulting signal, and boosts the gain of the remaining noise so that it's easily audible. The audio input from the audio device is discarded.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel6.png|700px|center]]<br />
* '''Panel 6''': allows the user to play with the power of the dithering noise applied before quantizing the sine wave. Shaped or flat dither are available. The sine wave may also be modulated with a varying amplitude to highlight correlations between the input and the resulting quantization noise. The 'notch and gain' button applies a notch filter to the resulting signal, and boosts the gain of the remaining noise so that it's easily audible. The audio input from the audio device is discarded.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel7.png|700px|center]]<br />
* '''Panel 7''': applies a sharper antialiasing (lowpass) filter than is likely to be built into the sound-card hardware (as there's generally no reason to use a filter quite this sharp in practice). The very sharp filter allows us to bandpass the demonstration square wave without any harmonics landing in the transition band. The input is read from the audio device, passed through this sharper filter, and then forwarded to the outputs.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel8.png|700px|center]]<br />
* '''Panel 8''': when selected, generate a synthetic 'square wave' (this is not quite equivalent to a bandlimited analog square wave; the harmonic amplitudes are a bit different) that when aligned with the sampling phase just right gives the appearance of having infinite rise and fall time. The slider allows us to shift the waveform sample alignment back and forth by +/- one sample to reveal that the underlying signal is still band-limited.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel9.png|700px|center]]<br />
* '''Panel 9''': as in panel 8, generate a 'perfect' synthetic 'square wave'. However, the slider now allows us to shift the sample alignment of the second channel with respect to the first, instead of shifting both channels. This allows us the trigger/lock the scope timing to the channel 1 waveform so we can see the fractional sample movement and alignment of the waveform on channel 2. The audio input from the audio device is discarded.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel10.png|700px|center]]<br />
* '''Panel 10''': not used in the video; The audio device is configured to 24-bit input/output. The user may produce one of a range of test signals that are output to both the external applications and the audio device on the first channel. The input on the second channel is passed-through to the applications and audio device outputs unchanged. The first channel input is unused unless 'two input mode' is selected. When two input mode is selected, both input channels are read and the data sent to the external applications. Generated test signals are sent only to the audio hardware (on the first channel). This combination of test signals and input modes allows self-references frequency response, phase, noise, distortion and crosstalk testing of a given audio device.<br />
<br />
<div style="clear: both">&nbsp;</div><br />
<br />
</div></center><br />
<br />
=== Cairo Animations ===<br />
<br />
The animations featured throughout the Episode 2 video were rapid-development spaghetti hack-jobs coded by hand in raw Cairo. Each module generated a series of PNG stills that were then stitched into an animation with Cinelerra or mplayer. In the interest of pointing and laughing at what really bad code looks like...<br />
<br />
<center><div style="background-color:#DDDDDD;border-color:#CCCCCC;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
*Source for the Cairo animations is found at:<br />
https://svn.xiph.org/trunk/Xiph-episode-II/cairo/<br />
*The source can be checked out of svn using the following command line:<br />
svn co https://svn.xiph.org/trunk/Xiph-episode-II/cairo/<br />
*Trac is a convenient way to browse the source without checking out a copy:<br />
https://trac.xiph.org/browser/trunk/Xiph-episode-II/cairo/<br />
</div></center></div>Gmaxwellhttps://wiki.xiph.org/index.php?title=Videos&diff=14039Videos2013-02-26T11:14:22Z<p>Gmaxwell: ep02 link; also: the momonga and the Japanese dwarf flying squirrel are one and the same!</p>
<hr />
<div>Xiph.Org's educational videos present the technical foundations of modern digital media as increasingly detailed installments.<br />
One community member described the [[/A Digital Media Primer For Geeks|first episode]] as “a Uni[versity] lecture I never got[,] but really wanted”.<br />
<br />
So, without any further ado, welcome to one hell of a new hobby.<br />
<br />
==Episodes==<br />
* [[/A Digital Media Primer For Geeks|Episode 01]] — History & basic concepts<br />
<br />
This episode explains modern digital media from historical origins, basic concepts, to modern implementation.<br />
It’s intended for engineers, [http://www.catb.org/~esr/faqs/hacker-howto.html (software) hackers], mathematicians — the people who are interested in discovering and making things and building the technology itself — and budding geeks wanting to begin exploring video coding, as well as the technically‐curious who want to know more about the media they wrangle for work or play.<br />
<br />
* [[/Digital_Show_and_Tell|Episode 02]] — Digital Show & Tell<br />
Xiph.Org's second video on digital media explores multiple facets of digital audio signals and how they ''really'' behave in the real world.<br />
<br />
Demonstrations of sampling, quantization, bit-depth, and dither explore digital audio behavior on real audio equipment using both modern digital analysis and vintage analog bench equipment, just in case we can't trust those newfangled digital gizmos. You can download the source code for each demo and try it all for yourself!<br />
<br />
<br />
==Playback Software==<br />
If you’re having trouble with playback in a modern browser or player, please visit our [[Playback Troubleshooting|playback troubleshooting and discussion]] page.<br />
<br />
===Players supporting [http://www.webmproject.org/ WebM] and Ogg/[[Theora]]===<br />
* [http://www.videolan.org/vlc/ VLC] v1·1+<br />
* [http://www.firefox.com/ Mozilla Firefox]<br />
* [http://www.chromium.org/ Google Chrome]<br />
* [http://www.opera.com/ Opera]<br />
* [http://www.webmproject.org/users/ Other WebM players…]<br />
* [[TheoraSoftwarePlayers|Other Theora players…]]</div>Gmaxwellhttps://wiki.xiph.org/index.php?title=Videos/A_Digital_Media_Primer_For_Geeks&diff=14038Videos/A Digital Media Primer For Geeks2013-02-26T11:09:21Z<p>Gmaxwell: ep02 link</p>
<hr />
<div><small>''Wiki edition''</small><br />
[[Image:Dmpfg_001.jpg|360px|right]]<br />
<br />
This first video from Xiph.Org presents the technical foundations of modern digital media via a half-hour firehose of information. One community member called it "a Uni lecture I never got but really wanted."<br />
<br />
The program offers a brief history of digital media, a quick summary of the sampling theorem, and myriad details of low level audio and video characterization and formatting. It's intended for budding geeks looking to get into video coding, as well as the technically curious who want to know more about the media they wrangle for work or play.<br />
<br/><br />
<br/><br />
See also: [[Videos/Digital_Show_and_Tell|Episode 02: Digital Show and Tell]]<br />
<br/><br/><br />
<center><font size="+2">[http://www.xiph.org/video/vid1.shtml Download or Watch online]</font></center><br />
<br style="clear:both;"/><br />
Players supporting WEBM: [http://www.videolan.org/vlc/ VLC 1.1+], [https://www.mozilla.com/en-US/firefox/ Firefox ], [http://www.chromium.org/Home Chrome ], [http://www.opera.com/ Opera], [http://www.webmproject.org/users/ more…]<br />
<br />
Players supporting Ogg/Theora: [http://www.videolan.org/vlc/ VLC], [http://www.firefox.com/ Firefox], [http://www.opera.com/ Opera], [[TheoraSoftwarePlayers|more…]]<br />
<br />
If you're having trouble with playback in a modern browser or player, please visit our [[Playback_Troubleshooting|playback troubleshooting and discussion]] page.<br />
<br/><br />
<hr/><br />
<br />
==Introduction==<br />
[[Image:Dmpfg_000.jpg|360px|right]]<br />
[[Image:Dmpfg_002.jpg|360px|right]]<br />
<small>[[Talk:A_Digital_Media_Primer_For_Geeks_(episode_1)#Introduction|Discuss this section]]</small><br />
<br />
Workstations and high-end personal computers have been able to<br />
manipulate digital audio pretty easily for about fifteen years now.<br />
It's only been about five years that a decent workstation's been able<br />
to handle raw video without a lot of expensive special purpose<br />
hardware.<br />
<br />
But today even most cheap home PCs have the processor power and<br />
storage necessary to really toss raw video around, at least without<br />
too much of a struggle. So now that everyone has all of this cheap media-capable hardware, <br />
more people, not surprisingly, want to do interesting<br />
things with digital media, especially streaming. YouTube was the first huge<br />
success, and now everybody wants in.<br />
<br />
Well good! Because this stuff is a lot of fun!<br />
<br />
<br />
It's no problem finding consumers for digital media. But here I'd<br />
like to address the engineers, the mathematicians, the hackers, the<br />
people who are interested in discovering and making things and<br />
building the technology itself. The people after my own heart.<br />
<br />
Digital media, compression especially, is perceived to be super-elite,<br />
somehow incredibly more difficult than anything else in computer<br />
science. The big industry players in the field don't mind this<br />
perception at all; it helps justify the staggering number of very<br />
basic patents they hold. They like the image that their media<br />
researchers "are the best of the best, so much smarter than anyone<br />
else that their brilliant ideas can't even be understood by mere<br />
mortals." This is bunk. <br />
<br />
Digital audio and video and streaming and compression offer endless<br />
deep and stimulating mental challenges, just like any other<br />
discipline. It seems elite because so few people have been<br />
involved. So few people have been involved perhaps because so few<br />
people could afford the expensive, special-purpose equipment it<br />
required. But today, just about anyone watching this video has a<br />
cheap, general-purpose computer powerful enough to play with the big<br />
boys. There are battles going on today around HTML5 and browsers and<br />
video and open vs. closed. So now is a pretty good time to get<br />
involved. The easiest place to start is probably understanding the<br />
technology we have right now.<br />
<br />
This is an introduction. Since it's an introduction, it glosses over a<br />
ton of details so that the big picture's a little easier to see.<br />
Quite a few people watching are going to be way past anything that I'm<br />
talking about, at least for now. On the other hand, I'm probably<br />
going to go too fast for folks who really are brand new to all of<br />
this, so if this is all new, relax. The important thing is to pick out<br />
any ideas that really grab your imagination. Especially pay attention<br />
to the terminology surrounding those ideas, because with those, and<br />
Google, and Wikipedia, you can dig as deep as interests you.<br />
<br />
So, without any further ado, welcome to one hell of a new hobby.<br />
<br />
<center><div style="background-color:#DDDDFF;border-color:#CCCCDD;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
'''Going deeper…'''<br />
*[http://www.xiph.org/about/ About Xiph.Org]: Why you should care about open media<br />
*[http://www.0xdeadbeef.com/weblog/2010/01/html5-video-and-h-264-what-history-tells-us-and-why-were-standing-with-the-web/ HTML5 Video and H.264: what history tells us and why we're standing with the web]: Chris Blizzard of Mozilla on free formats and the open web<br />
*[http://diveintohtml5.org/video.html Dive into HTML5]: tutorial on HTML5 web video<br />
*[http://webchat.freenode.net/?channels=xiph Chat with the creators of the video] via freenode IRC in #xiph.<br />
</div></center><br />
<br />
<br style="clear:both;"/><br />
<br />
==Analog vs Digital==<br />
[[Image:Dmpfg_004.jpg|360px|right]]<br />
[[Image:Dmpfg_006.jpg|360px|right]]<br />
[[Image:Dmpfg_007.jpg|360px|right]]<br />
<small>[[Talk:A_Digital_Media_Primer_For_Geeks_(episode_1)#Analog_vs_Digital|Discuss this section]]</small><br />
<br />
<br />
[[WikiPedia:Sound|Sound]] is the propagation of pressure waves through air, spreading out<br />
from a source like ripples spread from a stone tossed into a pond. A<br />
microphone, or the human ear for that matter, transforms these passing<br />
ripples of pressure into an electric signal. Right, this is<br />
middle school science class, everyone remembers this. Moving on.<br />
<br />
That audio signal is a one-dimensional function, a single value<br />
varying over time. If we slow the [[WikiPedia:Oscilloscope|'scope]] down a bit... that should be<br />
a little easier to see. A few other aspects of the signal are<br />
important. It's [[WikiPedia:Continuous_function|continuous]] in both value and time; that is, at any<br />
given time it can have any real value, and there's a smoothly varying<br />
value at every point in time. No matter how much we zoom in, there<br />
are no discontinuities, no singularities, no instantaneous steps or<br />
points where the signal ceases to exist. It's defined<br />
everywhere. Classic continuous math works very well on these signals.<br />
<br />
A digital signal on the other hand is [[WikiPedia:Discrete_math|discrete]] in both value and time.<br />
In the simplest and most common system, called [[WikiPedia:Pulse code modulation|Pulse Code Modulation]],<br />
one of a fixed number of possible values directly represents the<br />
instantaneous signal amplitude at points in time spaced a fixed<br />
distance apart. The end result is a stream of digits.<br />
<br />
Now this looks an awful lot like this. It seems intuitive that we<br />
should somehow be able to rigorously transform one into the other, and<br />
good news, the [[WikiPedia:Nyquist-Shannon sampling theorem|Sampling Theorem]] says we can and tells us<br />
how. Published in its most recognizable form by [[WikiPedia:Claude Shannon|Claude Shannon]] in 1949<br />
and built on the work of [[WikiPedia:Harry Nyquist|Nyquist]], and [[WikiPedia:Ralph Hartley|Hartley]], and tons of others, the<br />
sampling theorem states that not only can we go back and<br />
forth between analog and digital, but also lays<br />
down a set of conditions for which conversion is lossless and the two<br />
representations become equivalent and interchangeable. When the<br />
lossless conditions aren't met, the sampling theorem tells us how and<br />
how much information is lost or corrupted.<br />
<br />
Up until very recently, analog technology was the basis for<br />
practically everything done with audio, and that's not because most<br />
audio comes from an originally analog source. You may also think that<br />
since computers are fairly recent, analog signal technology must have<br />
come first. Nope. Digital is actually older. The [[WikiPedia:Telegraph|telegraph]] predates<br />
the telephone by half a century and was already fully mechanically<br />
automated by the 1860s, sending coded, multiplexed digital signals<br />
long distances. You know... [[WikiPedia:Tickertape|tickertape]]. Harry Nyquist of [[WikiPedia:Bell_labs|Bell Labs]] was<br />
researching telegraph pulse transmission when he published his<br />
description of what later became known as the [[WikiPedia:Nyquist_frequency|Nyquist frequency]], the<br />
core concept of the sampling theorem. Now, it's true the telegraph<br />
was transmitting symbolic information, text, not a digitized analog<br />
signal, but with the advent of the telephone and radio, analog and<br />
digital signal technology progressed rapidly and side-by-side.<br />
<br />
Audio had always been manipulated as an analog signal because... well,<br />
gee, it's so much easier. A [[WikiPedia:Low-pass_filter#Continuous-time_low-pass_filters|second-order low-pass filter]], for example,<br />
requires two passive components. An all-analog [[WikiPedia:Short-time_Fourier_transform|short-time Fourier<br />
transform]], a few hundred. Well, maybe a thousand if you want to build<br />
something really fancy (bang on the [http://www.testequipmentdepot.com/usedequipment/hewlettpackard/spectrumanalyzers/3585a.htm 3585]). Processing signals<br />
digitally requires millions to billions of transistors running at<br />
microwave frequencies, support hardware at very least to digitize and<br />
reconstruct the analog signals, a complete software ecosystem for<br />
programming and controlling that billion-transistor juggernaut,<br />
digital storage just in case you want to keep any of those bits for<br />
later...<br />
<br />
So we come to the conclusion that analog is the only practical way to<br />
do much with audio... well, unless you happen to have a billion<br />
transistors and all the other things just lying around. And [[WikiPedia:File:Transistor_Count_and_Moore's_Law_-_2008.svg|since we<br />
do]], digital signal processing becomes very attractive.<br />
<br />
For one thing, analog componentry just doesn't have the flexibility of<br />
a general purpose computer. Adding a new function to this<br />
beast [the 3585]... yeah, it's probably not going to happen. On a digital<br />
processor though, just write a new program. Software isn't trivial,<br />
but it is a lot easier.<br />
<br />
Perhaps more importantly though every analog component is an<br />
approximation. There's no such thing as a perfect transistor, or a<br />
perfect inductor, or a perfect capacitor. In analog, every component<br />
adds [[WikiPedia:Johnson–Nyquist_noise|noise]] and [[WikiPedia:Distortion#Electronic_signals|distortion]], usually not very much, but it adds up. Just<br />
transmitting an analog signal, especially over long distances,<br />
progressively, measurably, irretrievably corrupts it. Besides, all of<br />
those single-purpose analog components take up a lot of space. Two<br />
lines of code on the billion transistors back here can implement a<br />
filter that would require an [[WikiPedia:Inductor|inductor]] the size of a refrigerator.<br />
<br />
Digital systems don't have these drawbacks. Digital signals can be<br />
stored, copied, manipulated, and transmitted without adding any noise<br />
or distortion. We do use [[WikiPedia:Lossy_compression|lossy]] algorithms from time to time, but the<br />
only unavoidably non-ideal steps are digitization and reconstruction,<br />
where digital has to interface with all of that messy analog. Messy<br />
or not, modern [[WikiPedia:Digital-to-analog_converter|conversion stages]] are very, very good. By the<br />
standards of our ears, we can consider them practically lossless as<br />
well.<br />
<br />
With a little extra hardware, then, most of which is now small and<br />
inexpensive due to our modern industrial infrastructure, digital audio<br />
is the clear winner over analog. So let us then go about storing it,<br />
copying it, manipulating it, and transmitting it.<br />
<br />
<center><div style="background-color:#DDDDFF;border-color:#CCCCDD;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
'''Going deeper…'''<br />
*Wikipedia: [[WikiPedia:Nyquist–Shannon_sampling_theorem|Nyquist–Shannon sampling theorem]]<br />
*MIT OpenCourseWare [http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-003-signals-and-systems-spring-2010/lecture-notes/ Lecture notes from 6.003 signals and systems.]<br />
*Wikipedia: [[WikiPedia:Passive_analogue_filter_development|The history of analog filters]] such as the [[WikiPedia:RC circuit|RC low-pass]] shown connected to the [[wikipedia:Spectrum_analyzer|spectrum analyzer]] in the video.<br />
</div></center><br />
<br />
<br style="clear:both;"/><br />
<br />
==Raw (digital audio) meat==<br />
<small>[[Talk:A_Digital_Media_Primer_For_Geeks_(episode_1)#Raw_.28digital_audio.29_meat|Discuss this section]]</small><br />
<br />
Pulse Code Modulation is the most common representation for <br />
raw audio. Other practical representations do exist: for example, the<br />
[[WikiPedia:Delta-sigma_modulation|Sigma-Delta coding]] used by the [[WikiPedia:Super_Audio_CD|SACD]], which is a form of [[wikipedia:Pulse-density_modulation|Pulse Density<br />
Modulation]]. That said, Pulse Code Modulation is far<br />
and away dominant, mainly because it's so mathematically<br />
convenient. An audio engineer can spend an entire career without<br />
running into anything else.<br />
<br />
PCM encoding can be characterized in three parameters, making it easy<br />
to account for every possible PCM variant with mercifully little<br />
hassle.<br />
<br style="clear:both;"/><br />
===sample rate===<br />
<small>[[Talk:A_Digital_Media_Primer_For_Geeks_(episode_1)#Raw_.28digital_audio.29_meat|Discuss this section]]</small><br />
[[Image:Dmpfg_009.jpg|360px|right]]<br />
[[Image:Dmpfg_008.jpg|360px|right]]<br />
The first parameter is the [[wikipedia:Sampling_rate|sampling rate]]. The highest frequency an<br />
encoding can represent is called the Nyquist Frequency. The Nyquist<br />
frequency of PCM happens to be exactly half the sampling rate.<br />
Therefore, the sampling rate directly determines the highest possible<br />
frequency in the digitized signal.<br />
<br />
Analog telephone systems traditionally [[wikipedia:Bandlimiting|band-limited]] voice channels to<br />
just under 4kHz, so digital telephony and most classic voice<br />
applications use an 8kHz sampling rate: the minimum sampling rate<br />
necessary to capture the entire bandwidth of a 4kHz channel. This is<br />
what an 8kHz sampling rate sounds like&mdash;a bit muffled but perfectly<br />
intelligible for voice. This is the lowest sampling rate that's ever<br />
been used widely in practice.<br />
<br />
From there, as power, and memory, and storage increased, consumer<br />
computer hardware went to offering 11, and then 16, and then 22, and<br />
then 32kHz sampling. With each increase in the sampling rate and the<br />
Nyquist frequency, it's obvious that the high end becomes a little<br />
clearer and the sound more natural.<br />
<br />
The Compact Disc uses a 44.1kHz sampling rate, which is again slightly<br />
better than 32kHz, but the gains are becoming less distinct. 44.1kHz<br />
is a bit of an oddball choice, especially given that it hadn't been<br />
used for anything prior to the compact disc, but the huge success of<br />
the CD has made it a common rate.<br />
<br />
The most common hi-fidelity sampling rate aside from the CD is 48kHz.<br />
There's virtually no audible difference between the two. This video,<br />
or at least the original version of it, was shot and produced with<br />
48kHz audio, which happens to be the original standard for<br />
high-fidelity audio with video.<br />
<br />
Super-hi-fidelity sampling rates of 88, and 96, and 192kHz have also<br />
appeared. The reason for the sampling rates beyond 48kHz isn't to<br />
extend the audible high frequencies further. It's for a different<br />
reason.<br />
<br />
Stepping back for just a second, the French mathematician [[wikipedia:Joseph_Fourier|Jean<br />
Baptiste Joseph Fourier]] showed that we can also think of signals like<br />
audio as a set of component frequencies. This [[wikipedia:Frequency_domain|frequency-domain]]<br />
representation is equivalent to the time representation; the signal is<br />
exactly the same, we're just looking at it [[wikipedia:Basis_(linear_algebra)|a different way]]. Here we see the<br />
frequency-domain representation of a hypothetical analog signal we<br />
intend to digitally sample.<br />
<br />
The sampling theorem tells us two essential things about the sampling<br />
process. First, that a digital signal can't represent any<br />
frequencies above the Nyquist frequency. Second, and this is the new<br />
part, if we don't remove those frequencies with a low-pass [[wikipedia:Audio_filter|filter]]<br />
before sampling, the sampling process will fold them down into the<br />
representable frequency range as [[wikipedia:Aliasing|aliasing distortion]].<br />
<br />
Aliasing, in a nutshell, sounds freakin' awful, so it's essential to<br />
remove any beyond-Nyquist frequencies before sampling and after<br />
reconstruction.<br />
<br />
Human frequency perception is considered to extend to about 20kHz. In<br />
44.1 or 48kHz sampling, the low pass before the sampling stage has to<br />
be extremely sharp to avoid cutting any audible frequencies below<br />
[[wikipedia:Hearing_range|20kHz]] but still not allow frequencies above the Nyquist to leak<br />
forward into the sampling process. This is a difficult filter to<br />
build, and no practical filter succeeds completely. If the sampling<br />
rate is 96kHz or 192kHz on the other hand, the low pass has an extra<br />
[[wikipedia:Octave_(electronics)|octave]] or two for its [[wikipedia:Transition_band|transition band]]. This is a much easier filter to<br />
build. Sampling rates beyond 48kHz are actually one of those messy<br />
analog stage compromises.<br />
<br style="clear:both;"/><br />
<br />
===sample format===<br />
<small>[[Talk:A_Digital_Media_Primer_For_Geeks_(episode_1)#Raw_.28digital_audio.29_meat|Discuss this section]]</small><br />
[[Image:Dmpfg_anim.gif|right]]<br />
<br />
The second fundamental PCM parameter is the sample format; that is,<br />
the format of each digital number. A number is a number, but a number<br />
can be represented in bits a number of different ways.<br />
<br />
Early PCM was [[wikipedia:Quantization_(sound_processing)#Audio_quantization|eight-bit]] [[wikipedia:Linear_pulse_code_modulation|linear]], encoded as an [[wikipedia:Signedness|unsigned]] [[wikipedia:Integer_(computer_science)#Bytes_and_octets|byte]]. The<br />
[[wikipedia:Dynamic_range#Audio|dynamic range]] is limited to about [[wikipedia:Decibel|50dB]] and the [[wikipedia:Quantization_error|quantization noise]], as<br />
you can hear, is pretty severe. Eight-bit audio is vanishingly rare<br />
today.<br />
<br />
Digital telephony typically uses one of two related non-linear eight<br />
bit encodings called [[wikipedia:A-law_algorithm|A-law]] and [[wikipedia:Μ-law_algorithm|μ-law]]. These formats encode a roughly<br />
[[wikipedia:Audio_bit_depth#Dynamic_range|14 bit dynamic range]] into eight bits by spacing the higher amplitude<br />
values farther apart. A-law and mu-law obviously improve quantization<br />
noise compared to linear 8-bit, and voice harmonics especially hide<br />
the remaining quantization noise well. All three eight-bit encodings,<br />
linear, A-law, and mu-law, are typically paired with an 8kHz sampling<br />
rate, though I'm demonstrating them here at 48kHz.<br />
<br />
Most modern PCM uses 16- or 24-bit [[wikipedia:Two's_complement|two's-complement]] signed integers to<br />
encode the range from negative infinity to zero decibels in 16 or 24<br />
bits of precision. The maximum absolute value corresponds to zero decibels.<br />
As with all the sample formats so far, signals beyond zero decibels, and thus<br />
beyond the maximum representable range, are [[wikipedia:Clipping_(audio)|clipped]].<br />
<br />
In mixing and mastering, it's not unusual to use [[wikipedia:Floating_point|floating-point]]<br />
numbers for PCM instead of [[wikipedia:Integer_(computer_science)|integers]]. A 32 bit [[wikipedia:IEEE_754-2008|IEEE754]] float, that's<br />
the normal kind of floating point you see on current computers, has 24<br />
bits of resolution, but a seven bit floating-point exponent increases<br />
the representable range. Floating point usually represents zero<br />
decibels as +/-1.0, and because floats can obviously represent<br />
considerably beyond that, temporarily exceeding zero decibels during<br />
the mixing process doesn't cause clipping. Floating-point PCM takes<br />
up more space, so it tends to be used only as an intermediate<br />
production format.<br />
<br />
Lastly, most general purpose computers still read and<br />
write data in octet bytes, so it's important to remember that samples<br />
bigger than eight bits can be in [[wikipedia:Endianness|big- or little-endian order]], and both<br />
endiannesses are common. For example, Microsoft [[wikipedia:WAV|WAV]] files are little-endian,<br />
and Apple [[wikipedia:AIFC|AIFC]] files tend to be big-endian. Be aware of it.<br />
<br style="clear:both;"/><br />
<br />
===channels===<br />
<small>[[Talk:A_Digital_Media_Primer_For_Geeks_(episode_1)#Raw_.28digital_audio.29_meat|Discuss this section]]</small><br />
<br />
The third PCM parameter is the number of [[wikipedia:Multichannel_audio|channels]]. The convention in<br />
raw PCM is to encode multiple channels by interleaving the samples of<br />
each channel together into a single stream. Straightforward and extensible.<br />
<br style="clear:both;"/><br />
===done!===<br />
<br />
And that's it! That describes every PCM representation ever. Done.<br />
Digital audio is ''so easy''! There's more to do of course, but at this<br />
point we've got a nice useful chunk of audio data, so let's get some<br />
video too.<br />
<br />
<br />
<center><div style="background-color:#DDDDFF;border-color:#CCCCDD;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
'''Going deeper…'''<br />
* [[wikipedia:Roll-off|Wikipedia's article on filter roll-off]], to learn why it's hard to build analog filters with a very narrow [[wikipedia:Transition_band|transition band]] between the [[wikipedia:Passband|passband]] and the [[wikipedia:Stopband|stopband]]. Filters that achieve such hard edges often do so at the expense of increased [[wikipedia:Ripple_(filters)#Frequency-domain_ripple|ripple]] and [http://www.ocf.berkeley.edu/~ashon/audio/phase/phaseaud2.htm phase distortion].<br />
* [http://wiki.multimedia.cx/index.php?title=PCM Some more minutiae] about PCM in practice.<br />
* [[wikipedia:DPCM|DPCM]] and [[wikipedia:ADPCM|ADPCM]], simple audio codecs loosely inspired by PCM.<br />
</div></center><br />
<br />
<br style="clear:both;"/><br />
<br />
==Video vegetables (they're good for you!)==<br />
[[Image:Dmpfg_010.jpg|360px|right]]<br />
<small>[[Talk:A_Digital_Media_Primer_For_Geeks_(episode_1)#Video_vegetables_.28they.27re_good_for_you.21.29|Discuss this section]]</small><br />
<br />
One could think of video as being like audio but with two additional<br />
spatial dimensions, X and Y, in addition to the dimension of time.<br />
This is mathematically sound. The Sampling Theorem applies to all<br />
three video dimensions just as it does the single time dimension of<br />
audio.<br />
<br />
Audio and video are obviously quite different in practice. For one,<br />
compared to audio, video is huge. [[wikipedia:Red_Book_(audio_Compact_Disc_standard)#Technical_details|Raw CD audio]] is about 1.4 megabits<br />
per second. Raw [[wikipedia:1080i|1080i]] HD video is over 700 megabits per second. That's<br />
more than 500 times more data to capture, process, and store per<br />
second. By [[wikipedia:Moore's_law|Moore's law]]... that's... let's see... roughly eight<br />
doublings times two years, so yeah, computers requiring about an extra<br />
fifteen years to handle raw video after getting raw audio down pat was<br />
about right.<br />
<br />
Basic raw video is also just more complex than basic raw audio. The<br />
sheer volume of data currently necessitates a representation more<br />
efficient than the linear PCM used for audio. In addition, electronic<br />
video comes almost entirely from broadcast television alone, and the<br />
standards committees that govern broadcast video have always been very<br />
concerned with backward compatibility. Up until just last year in the<br />
US, a sixty-year-old black and white television could still show a<br />
normal [[wikipedia:NTSC|analog television broadcast]]. That's actually a really neat<br />
trick.<br />
<br />
The downside to backward compatibility is that once a detail makes it<br />
into a standard, you can't ever really throw it out again. Electronic<br />
video has never started over from scratch the way audio has multiple<br />
times. Sixty years worth of clever but obsolete hacks necessitated by<br />
the passing technology of a given era have built up into quite a pile,<br />
and because digital standards also come from broadcast television, all<br />
these eldritch hacks have been brought forward into the digital<br />
standards as well.<br />
<br />
In short, there are a whole lot more details involved in digital video<br />
than there were with audio. There's no hope of covering them<br />
all completely here, so we'll cover the broad fundamentals.<br />
<br style="clear:both;"/><br />
===resolution and aspect===<br />
[[Image:Dmpfg_011.jpg|360px|right]]<br />
<small>[[Talk:A_Digital_Media_Primer_For_Geeks_(episode_1)#Video_vegetables_.28they.27re_good_for_you.21.29|Discuss this section]]</small><br />
<br />
The most obvious raw video parameters are the width and height of the<br />
picture in pixels. As simple as that may sound, the pixel dimensions<br />
alone don't actually specify the absolute width and height of the<br />
picture, as most broadcast-derived video doesn't use square pixels.<br />
The number of [[wikipedia:Scan_line|scanlines]] in a broadcast image was fixed, but the<br />
effective number of horizontal pixels was a function of channel<br />
[[wikipedia:Bandwidth_(signal_processing)|bandwidth]]. Effective horizontal resolution could result in pixels that<br />
were either narrower or wider than the spacing between scanlines.<br />
<br />
Standards have generally specified that digitally sampled video should<br />
reflect the real resolution of the original analog source, so a large<br />
amount of digital video also uses non-square pixels. For example, a<br />
normal 4:3 aspect NTSC DVD is typically encoded with a display<br />
resolution of [[wikipedia:DVD-Video#Frame_size_and_frame_rate|704 by 480]], a ratio wider than 4:3. In this case, the<br />
pixels themselves are assigned an aspect ratio of [[wikipedia:Standard-definition_television#Resolution|10:11]], making them<br />
taller than they are wide and narrowing the image horizontally to the<br />
correct aspect. Such an image has to be resampled to show properly on<br />
a digital display with square pixels.<br />
<br style="clear:both;"/><br />
===frame rate and interlacing===<br />
[[Image:Dmpfg_012.jpg|360px|right]]<br />
<small>[[Talk:A_Digital_Media_Primer_For_Geeks_(episode_1)#Video_vegetables_.28they.27re_good_for_you.21.29|Discuss this section]]</small><br />
<br />
The second obvious video parameter is the [[wikipedia:Frame_rate|frame rate]], the number of<br />
full frames per second. Several standard frame rates are in active<br />
use. Digital video, in one form or another, can use all of them. Or,<br />
any other frame rate. Or even variable rates where the frame rate<br />
changes adaptively over the course of the video. The higher the frame<br />
rate, the smoother the motion and that brings us, unfortunately, to<br />
[[wikipedia:Interlace|interlacing]].<br />
<br />
In the very earliest days of broadcast video, engineers sought the<br />
fastest practical frame rate to smooth motion and to minimize [[wikipedia:Flicker_(screen)|flicker]]<br />
on phosphor-based [[wikipedia:Cathode_ray_tube|CRTs]]. They were also under pressure to use the<br />
least possible bandwidth for the highest resolution and fastest frame<br />
rate. Their solution was to interlace the video where the even lines<br />
are sent in one pass and the odd lines in the next. Each pass is<br />
called a field and two fields sort of produce one complete frame.<br />
"Sort of", because the even and odd fields aren't actually from the<br />
same source frame. In a 60 field per second picture, the source frame<br />
rate is actually 60 full frames per second, and half of each frame,<br />
every other line, is simply discarded. This is why we can't<br />
[[wikipedia:Deinterlacing|deinterlace]] a video simply by combining two fields into one frame;<br />
they're not actually from one frame to begin with.<br />
<br style="clear:both;"/><br />
<br />
===gamma===<br />
[[Image:Dmpfg_013.jpg|360px|right]]<br />
<small>[[Talk:A_Digital_Media_Primer_For_Geeks_(episode_1)#Video_vegetables_.28they.27re_good_for_you.21.29|Discuss this section]]</small><br />
<br />
The cathode ray tube was the only available display technology for<br />
most of the history of electronic video. A CRT's output brightness is<br />
nonlinear, approximately equal to the input controlling voltage raised<br />
to the 2.5th power. This exponent, 2.5, is designated gamma, and so<br />
it's often referred to as the gamma of a display. Cameras, though,<br />
are linear, and if you feed a CRT a linear input signal, it looks a<br />
bit like this.<br />
<br />
As there were originally to be very few cameras, which were<br />
fantastically expensive anyway, and hopefully many, many television<br />
sets which best be as inexpensive as possible, engineers decided to<br />
add the necessary [[wikipedia:Gamma_correction|gamma correction]] circuitry to the cameras rather<br />
than the sets. Video transmitted over the airwaves would thus have a<br />
nonlinear intensity using the inverse of the set's gamma exponent, so that<br />
once a camera's signal was finally displayed on the CRT, the overall<br />
response of the system from camera to set was back to linear again.<br />
<br />
Almost.<br />
<br />
There were also two other tweaks. A television camera actually uses a<br />
gamma exponent that's the inverse of 2.2, not 2.5. That's just a<br />
correction for viewing in a dim environment. Also, the exponential<br />
curve transitions to a linear ramp near black. That's just an old<br />
hack for suppressing sensor noise in the camera.<br />
<br />
Gamma correction also had a lucky benefit. It just so happens that the<br />
human eye has a perceptual gamma of about 3. This is relatively close<br />
to the CRT's gamma of 2.5. An image using gamma correction devotes<br />
more resolution to lower intensities, where the eye happens to have<br />
its finest intensity discrimination, and therefore uses the available<br />
scale resolution more efficiently. Although CRTs are currently<br />
vanishing, a standard [[wikipedia:sRGB|sRGB]] computer display still uses a nonlinear<br />
intensity curve similar to television, with a linear ramp near black,<br />
followed by an exponential curve with a gamma exponent of 2.4. This<br />
encodes a sixteen bit linear range down into eight bits.<br />
<br style="clear:both;"/><br />
<br />
===color and colorspace===<br />
[[Image:Dmpfg_014.jpg|360px|right]]<br />
<small>[[Talk:A_Digital_Media_Primer_For_Geeks_(episode_1)#Video_vegetables_.28they.27re_good_for_you.21.29|Discuss this section]]</small><br />
<br />
The human eye has three apparent color channels, red, green, and blue,<br />
and most displays use these three colors as [[wikipedia:Additive_color|additive primaries]] to<br />
produce a full range of color output. The primary pigments in<br />
printing are [[wikipedia:CMYK|Cyan, Magenta, and Yellow]] for the same reason; pigments<br />
are [[wikipedia:Subtractive_color|subtractive]], and each of these pigments subtracts one pure color<br />
from reflected light. Cyan subtracts red, magenta subtracts green, and<br />
yellow subtracts blue.<br />
<br />
Video can be, and sometimes is, represented with red, green, and blue<br />
color channels, but RGB video is atypical. The human eye is far more<br />
sensitive to [[wikipedia:Luminance_(relative)|luminosity]] than it is the color, and RGB tends to spread<br />
the energy of an image across all three color channels. That is, the<br />
red plane looks like a red version of the original picture, the green<br />
plane looks like a green version of the original picture, and the blue<br />
plane looks like a blue version of the original picture. Black and<br />
white times three. Not efficient.<br />
<br />
For those reasons and because, oh hey, television just happened to<br />
start out as black and white anyway, video usually is represented as a<br />
high resolution [[wikipedia:Luma_(video)|luma channel]]&mdash;the black & white&mdash;along with<br />
additional, often lower resolution [[wikipedia:Chrominance|chroma channels]], the color. The<br />
luma channel, Y, is produced by weighting and then adding the separate<br />
red, green and blue signals. The chroma channels U and V are then<br />
produced by subtracting the luma signal from blue and the luma signal<br />
from red.<br />
<br />
When YUV is scaled, offset, and quantized for digital video, it's<br />
usually more correctly called [[wikipedia:Y'CbCr|Y'CbCr]], but the more generic term YUV is<br />
widely used to describe all the analog and digital variants of this<br />
color model.<br />
<br style="clear:both;"/><br />
<br />
===chroma subsampling===<br />
[[Image:Dmpfg_015.jpg|360px|right]]<br />
<small>[[Talk:A_Digital_Media_Primer_For_Geeks_(episode_1)#Video_vegetables_.28they.27re_good_for_you.21.29|Discuss this section]]</small><br />
<br />
The U and V chroma channels can have the same resolution as the Y<br />
channel, but because the human eye has far less spatial color<br />
resolution than spatial luminosity resolution, chroma resolution is<br />
usually [[wikipedia:Chroma_subsampling|halved or even quartered]] in the horizontal direction, the<br />
vertical direction, or both, usually without any significant impact on the<br />
apparent raw image quality. Practically every possible subsampling<br />
variant has been used at one time or another, but the common choices<br />
today are [[wikipedia:Chroma_subsampling#4:4:4_Y.27CbCr|4:4:4]] video, which isn't actually subsampled at all, [[wikipedia:Chroma_subsampling#4:2:2|4:2:2]] video in<br />
which the horizontal resolution of the U and V channels is halved, and<br />
most common of all, [[wikipedia:Chroma_subsampling#4:2:0|4:2:0]] video in which both the horizontal and vertical<br />
resolutions of the chroma channels are halved, resulting in U and V<br />
planes that are each one quarter the size of Y.<br />
<br />
The terms 4:2:2, 4:2:0, [[wikipedia:Chroma_subsampling#4:1:1|4:1:1]], and so on and so forth, aren't complete<br />
descriptions of a chroma subsampling. There's multiple possible ways<br />
to position the chroma pixels relative to luma, and again, several<br />
variants are in active use for each subsampling. For example, [[wikipedia:Motion_Jpeg|motion<br />
JPEG]], [[wikipedia:MPEG-1#Part_2:_Video|MPEG-1 video]], [[wikipedia:MPEG-2#Video_coding_.28simplified.29|MPEG-2 video]], [[wikipedia:DV#DV_Compression|DV]], [[wikipedia:Theora|Theora]], and [[wikipedia:WebM|WebM]] all use or can<br />
use 4:2:0 subsampling, but they site the chroma pixels [http://www.mir.com/DMG/chroma.html three different ways].<br />
<br />
Motion JPEG, MPEG-1 video, Theora and WebM all site chroma pixels<br />
between luma pixels both horizontally and vertically.<br />
<br />
MPEG-2 sites chroma pixels between lines, but horizontally aligned with<br />
every other luma pixel. Interlaced modes complicate things somewhat,<br />
resulting in a siting arrangement that's a tad bizarre.<br />
<br />
And finally PAL-DV, which is always interlaced, places the chroma<br />
pixels in the same position as every other luma pixel in the<br />
horizontal direction, and vertically alternates chroma channel on<br />
each line.<br />
<br />
That's just 4:2:0 video. I'll leave the other subsamplings as homework for the<br />
viewer. Got the basic idea, moving on.<br />
<br style="clear:both;"/><br />
<br />
===pixel formats===<br />
[[Image:Dmpfg_016.jpg|360px|right]]<br />
<small>[[Talk:A_Digital_Media_Primer_For_Geeks_(episode_1)#Video_vegetables_.28they.27re_good_for_you.21.29|Discuss this section]]</small><br />
<br />
In audio, we always represent multiple channels in a PCM stream by<br />
interleaving the samples from each channel in order. Video uses both<br />
packed formats that interleave the color channels, as well as planar<br />
formats that keep the pixels from each channel together in separate<br />
planes stacked in order in the frame. There are at least [http://www.fourcc.org/yuv.php 50 different formats] in<br />
these two broad categories with possibly ten or fifteen in common use.<br />
<br />
Each chroma subsampling and different bit-depth requires a different<br />
packing arrangement, and so a different pixel format. For a given<br />
unique subsampling, there are usually also several equivalent formats<br />
that consist of trivial channel order rearrangements or repackings, due either to<br />
convenience once-upon-a-time on some particular piece of hardware, or<br />
sometimes just good old-fashioned spite.<br />
<br />
Pixels formats are described by a unique name or [[wikipedia:FourCC|fourcc]] code. There<br />
are quite a few of these and there's no sense going over each one now.<br />
Google is your friend. Be aware that fourcc codes for raw video<br />
specify the pixel arrangement and chroma subsampling, but generally<br />
don't imply anything certain about chroma siting or color space. [http://www.fourcc.org/yuv.php#YV12 YV12]<br />
video to pick one, can use JPEG, MPEG-2 or DV chroma siting, and any<br />
one of [[wikipedia:YUV#BT.709_and_BT.601|several YUV colorspace definitions]].<br />
<br style="clear:both;"/><br />
<br />
===done!===<br />
<br />
That wraps up our not-so-quick and yet very incomplete tour of raw<br />
video. The good news is we can already get quite a lot of real work<br />
done using that overview. In plenty of situations, a frame of video<br />
data is a frame of video data. The details matter, greatly, when it<br />
come time to write software, but for now I am satisfied that the<br />
esteemed viewer is broadly aware of the relevant issues.<br />
<br />
<center><div style="background-color:#DDDDFF;border-color:#CCCCDD;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
'''Going deeper…'''<br />
* YCbCr is defined in terms of RGB by the ITU in two incompatible standards: [[wikipedia:Rec. 601|Rec. 601]] and [[wikipedia:Rec. 709|Rec. 709]]. Both conversion standards are lossy, which has prompted some to adopt a lossless alternative called [http://wiki.multimedia.cx/index.php?title=YCoCg YCoCg].<br />
* Learn about [[wikipedia:High_dynamic_range_imaging|high dynamic range imaging]], which achieves better representation of the full range of brightnesses in the real world by using more than 8 bits per channel.<br />
* Learn about how [[wikipedia:Trichromatic_vision|trichromatic color vision]] works in humans, and how human color perception is encoded in the [[wikipedia:CIE 1931 color space|CIE 1931 XYZ color space]].<br />
** Compare with the [[wikipedia:Lab_color_space|Lab color space]], mathematically equivalent but structured to account for "perceptual uniformity".<br />
** If we were all [[wikipedia:Dichromacy|dichromats]] then video would only need two color channels. Some humans might be [[wikipedia:Tetrachromacy#Possibility_of_human_tetrachromats|tetrachromats]], in which case they would need an additional color channel for video to fully represent their vision.<br />
** [http://www.xritephoto.com/ph_toolframe.aspx?action=coloriq Test your color vision] (or at least your monitor).<br />
</div></center><br />
<br />
<br style="clear:both;"/><br />
<br />
==Containers==<br />
[[Image:Dmpfg_017.jpg|360px|right]]<br />
<small>[[Talk:A_Digital_Media_Primer_For_Geeks_(episode_1)#Containers|Discuss this section]]</small><br />
<br />
So. We have audio data. We have video data. What remains is the more<br />
familiar non-signal data and straight-up engineering that software<br />
developers are used to, and plenty of it.<br />
<br />
Chunks of raw audio and video data have no externally-visible<br />
structure, but they're often uniformly sized. We could just string<br />
them together in a rigid predetermined ordering for streaming and<br />
storage, and some simple systems do approximately that. Compressed<br />
frames, though, aren't necessarily a predictable size, and we usually want<br />
some flexibility in using a range of different data types in streams.<br />
If we string random formless data together, we lose the boundaries<br />
that separate frames and don't necessarily know what data belongs to<br />
which streams. A stream needs some generalized structure to be<br />
generally useful.<br />
<br />
In addition to our signal data, we also have our PCM and video<br />
parameters. There's probably plenty of other [[wikipedia:Metadata#Video|metadata]] we also want to<br />
deal with, like audio tags and video chapters and subtitles, all<br />
essential components of rich media. It makes sense to place this<br />
metadata&mdash;that is, data about the data&mdash;within the media itself.<br />
<br />
Storing and structuring formless data and disparate metadata is the<br />
job of a [[wikipedia:Container_format_(digital)|container]]. Containers provide framing for the data blobs,<br />
interleave and identify multiple data streams, provide timing<br />
information, and store the metadata necessary to parse, navigate,<br />
manipulate, and present the media. In general, any container can hold<br />
any kind of data. And data can be put into any container.<br />
<br />
<br />
<center><div style="background-color:#DDDDFF;border-color:#CCCCDD;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
'''Going deeper…'''<br />
* There are several common general-purpose container formats: [[wikipedia:Audio_Video_Interleave|AVI]], [[wikipedia:Matroska|Matroska]], [[wikipedia:Ogg|Ogg]], [[wikipedia:QuickTime_File_Format|QuickTime]], and [[wikipedia:Comparison_of_container_formats|many others]]. These can contain and interleave many different types of media streams.<br />
* Some special-purpose containers have been designed that can only hold one format:<br />
** [http://wiki.multimedia.cx/index.php?title=YUV4MPEG2 The y4m format] is the most common single-purpose container for raw YUV video. It can also be stored in a general-purpose container, for example in Ogg using [[OggYUV]].<br />
** MP3 files use a [[wikipedia:MP3#File_structure|special single-purpose file format]].<br />
** [[wikipedia:WAV|WAV]] and [[wikipedia:AIFC|AIFC]] are semi-single-purpose formats. They're audio-only, and typically contain raw PCM audio, but are occasionally used to store other kinds of audio data ... even MP3!<br />
</div></center><br />
<br />
<br style="clear:both;"/><br />
<br />
==Credits==<br />
[[Image:Dmpfg_018.jpg|360px|right]]<br />
[[Image:Dmpfg_019.png|360px|right]]<br />
<br />
In the past thirty minutes, we've covered digital audio, video, some<br />
history, some math and a little engineering. We've barely scratched the<br />
surface, but it's time for a well-earned break.<br />
<br />
There's so much more to talk about, so I hope you'll join me again in<br />
our next episode. Until then&mdash;Cheers!<br />
<br />
Written by:<br />
Christopher (Monty) Montgomery<br />
and the Xiph.Org Community<br />
<br />
Intro, title and credits music:<br><br />
"Boo Boo Coming", by Joel Forrester<br><br />
Performed by the [http://microscopicseptet.com/ Microscopic Septet]<br><br />
Used by permission of Cuneiform Records.<br><br />
Original source track All Rights Reserved.<br><br />
[http://www.cuneiformrecords.com www.cuneiformrecords.com]<br />
<br />
This Video Was Produced Entirely With Free and Open Source Software:<br><br />
<br />
[http://www.gnu.org/ GNU]<br><br />
[http://www.linux.org/ Linux]<br><br />
[http://fedoraproject.org/ Fedora]<br><br />
[http://cinelerra.org/ Cinelerra]<br><br />
[http://www.gimp.org/ The Gimp]<br><br />
[http://audacity.sourceforge.net/ Audacity]<br><br />
[http://svn.xiph.org/trunk/postfish/README Postfish]<br><br />
[http://gstreamer.freedesktop.org/ Gstreamer]<br><br />
<br />
All trademarks are the property of their respective owners. <br />
<br />
''Complete video'' [http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode CC-BY-NC-SA]<br><br />
''Text transcript and Wiki edition'' [http://creativecommons.org/licenses/by-sa/3.0/legalcode CC-BY-SA]<br><br />
<br />
A Co-Production of Xiph.Org and Red Hat Inc.<br><br />
(C) 2010, Some Rights Reserved<br><br />
<br />
<br style="clear:both;"/><hr/><br />
<center><font size="+1">''[[/making|Learn more about the making of this video…]]''</font></center></div>Gmaxwellhttps://wiki.xiph.org/index.php?title=Videos/Digital_Show_and_Tell&diff=14037Videos/Digital Show and Tell2013-02-26T11:06:07Z<p>Gmaxwell: link to source internally</p>
<hr />
<div><small>''Wiki edition''</small><br />
[[Image:dsat_001.jpg|400px|right]]<br />
<br />
Continuing in the "firehose" tradition of [[Videos/A_Digital_Media_Primer_For_Geeks|Episode 01]], Xiph.Org's second video on digital media explores multiple facets of digital audio signals and how they ''really'' behave in the real world.<br />
<br />
Demonstrations of sampling, quantization, bit-depth, and dither explore digital audio behavior on real audio equipment using both modern digital analysis and vintage analog bench equipment, just in case we can't trust those newfangled digital gizmos. You can download the source code for each demo and try it all for yourself!<br />
<br/><br/><br/><br />
<center><font size="+2">[http://www.xiph.org/video/vid2.shtml Download or Watch online]</font></center><br />
<br style="clear:both;"/><br />
Supported players: [http://www.videolan.org/vlc/ VLC 1.1+], [https://www.mozilla.com/en-US/firefox/ Firefox ], [http://www.chromium.org/Home Chrome ], [http://www.opera.com/ Opera]. Or see [http://www.webmproject.org/users/ other WebM] or [[TheoraSoftwarePlayers|other Theora]] players.<br />
<br />
If you're having trouble with playback in a modern browser or player, please visit our [[Playback_Troubleshooting|playback troubleshooting and discussion]] page.<br />
<br/><br />
<hr/><br />
<br/><br/><br/><br />
[[Image:Xiph_ep02_test.png|400px|right]]<br />
<br />
&ldquo;Hi, I'm Monty Montgomery from [http://www.redhat.com/ Red Hat] and [http://xiph.org/ Xiph.Org].<br />
<br />
&ldquo;A few months ago, I wrote<br />
[http://people.xiph.org/~xiphmont/demo/neil-young.html an article on digital audio and why 24bit/192kHz music downloads don't make sense].<br />
In the article, I<br />
mentioned--almost in passing--that a digital waveform is<br />
[http://people.xiph.org/~xiphmont/demo/neil-young.html#toc_sfam not a stairstep],<br />
and you certainly don't get a stairstep when you<br />
[[WikiPedia:Digital-to-analog_converter|convert from digital back to analog]].<br />
<br />
&ldquo;Of everything in the entire article, '''that''' was the number one thing<br />
people wrote about. In fact, more than half the mail I got was questions and<br />
comments about basic digital signal behavior. Since there's interest, let's<br />
take a little time to play with some ''simple'' digital signals. &rdquo;<br />
<br />
==Veritas ex machina==<br />
[[Image:Dsat_002.jpg|200px|right]]<br />
[[Image:Dsat_003.jpg|200px|right]]<br />
[[Image:Dsat_004.jpg|200px|right]]<br />
[[Image:Dsat_005.jpg|200px|right]]<br />
<br />
If we pretend for a moment that we have no idea how digital signals really<br />
behave, then it doesn't make sense for us to use digital test<br />
equipment. Fortunately for this exercise, there's still plenty<br />
of working analog lab equipment out there.<br />
<br />
We need a [[WikiPedia:Function_generator|signal generator]] to provide us with analog input<br />
signals--in this case, an<br />
[http://www.home.agilent.com/en/pd-3325A%3Aepsg%3Apro-pn-3325A/synthesizer-function-generator?pm=PL&nid=-536900197.536896863&cc=SE&lc=swe HP3325]<br />
from 1978.<br />
<br />
We'll observe our analog waveforms on [[WikiPedia:Oscilloscope_types#Cathode-ray_oscilloscope_.28CRO.29|analog oscilloscopes]],<br />
like this Tektronix 2246 from the mid-90s, one of the last and best analog scopes made.<br />
<br />
Finally, we'll inspect the [[WikiPedia:Spectral_density#Electrical_engineering|frequency spectrum]] of our signals using an<br />
[[WikiPedia:Spectrum_analyzer#Swept-tuned|analog spectrum analyzer]], this<br />
[http://www.home.agilent.com/en/pd-3585A%3Aepsg%3Apro-pn-3585A/spectrum-analyzer-high-perf-20hz-40mhz?pm=PL&nid=-536900197.536897319&cc=SE&lc=swe HP3585]<br />
from the same product line as<br />
the signal generator. Like the other equipment here it has<br />
[http://www.hp9845.net/9845/hardware/processors/ a rudimentary and hilariously large microcontroller],<br />
but the signal path<br />
from input to what you see on the screen is completely analog.<br />
<br />
All of this equipment is vintage, but the specs are still quite good.<br />
We start with the signal generator set to output a 1 [[WikiPedia:Hertz#SI_multiples|kHz]]<br />
sine wave at one [[WikiPedia:Volt|Volt]] [[WikiPedia:Amplitude#Root_mean_square_amplitude|RMS]].<br />
We see the sine wave on the oscilloscope, can verify that it is indeed<br />
1 kHz at 1 Volt RMS, which is 2.8 Volts<br />
[[WikiPedia:Amplitude#Peak-to-peak_amplitude|peak-to-peak]],<br />
and that matches the<br />
measurement on the spectrum analyzer as well.<br />
<br />
The analyzer also shows some low-level [[WikiPedia:White_noise|white noise]]<br />
and just a bit of [[WikiPedia:Harmonic_distortion#Harmonic_distortion|harmonic distortion]],<br />
with the highest peak about 70[[WikiPedia:Decibel|dB]] or so below<br />
[[WikiPedia:Fundamental_frequency|the fundamental]].<br />
This doesn't matter to the demos, but it's good to take notice of it now to avoid confusion later.<br />
<br />
For digital conversion, we use a boring, consumer-grade, eMagic USB1<br />
audio device. It's more than ten years old at this point, and it's<br />
getting obsolete.<br />
<br />
A recent converter can easily have an order of magnitude better specs.<br />
[[WikiPedia:Reconstruction_filter#Sampled_data_reconstruction_filters|Flatness]],<br />
[[WikiPedia:Analog-to-digital_converter#Non-linearity|linearity]],<br />
[[WikiPedia:Jitter#Sampling_jitter|jitter]],<br />
[[WikiPedia:Noise_floor|noise behavior]],<br />
[[WikiPedia:Digital-to-analog_converter#DAC_performance|everything]]...<br />
You may not<br />
have noticed. Just because we can measure an improvement doesn't<br />
mean we can hear it, and even these old consumer boxes were already at<br />
the edge of ideal transparency.<br />
<br />
The eMagic connects to my ThinkPad, which displays a digital<br />
waveform and spectrum for comparison, then the ThinkPad<br />
sends the digital signal right back out to the eMagic for<br />
re-conversion to analog and observation on the output scopes.<br />
<br />
<br style="clear:both;"/><br />
<br />
==Stairsteps==<br />
[[Image:Dsat 006.jpg|360px|right]]<br />
[[Image:Dsat 007.png|360px|right]]<br />
First demo: We begin by converting an analog signal to digital and<br />
then right back to analog again with no other steps.<br />
<br />
The signal generator is set to produce a 1kHz sine wave just like<br />
before and we can see the analog sine wave on the input-side oscilloscope. The eMagic digitizes our signal to<br />
[[Videos/A_Digital_Media_Primer_For_Geeks#Raw_.28digital_audio.29_meat|16 bit PCM at 44.1kHz]],<br />
same as on a CD. The spectrum of the digitized signal on the Thinkpad matches what we saw earlier and what we see now on the analog spectrum analyzer, aside from its <br />
[[WikiPedia:High_impedance|high-impedance input]] being just a smidge noisier. For now, the waveform display shows our digitized sine wave as a<br />
stairstep pattern, one step for each sample.<br />
<br />
When we look at the output signal that's been converted<br />
from digital back to analog, we see that it's exactly like the original sine wave. No stairsteps.<br />
<br />
1 kHz is still a fairly low frequency, so perhaps the stairsteps are just<br />
hard to see or they're being smoothed away. Next, set the signal generator to 15kHz, which is much closer to [[WikiPedia:Nyquist_frequency|Nyquist]].<br />
Now the sine wave is represented by less than three samples per cycle, and the digital waveform appears rather poor! Yet the analog output is still a perfect sine wave, exactly like the original.<br />
As we keep increasing frequency, all the way to 20kHz, the output waveform is still perfect. No jagged edges, no dropoff, no stairsteps.<br />
<br />
So where'd the stairsteps go? It's a trick question; they were never there. Drawing a digital waveform as a stairstep was wrong to begin with.<br />
<br />
A stairstep is a continuous-time function. It's jagged, and it's piecewise, but it has a defined value at every point in time.<br />
A sampled signal is entirely different. It's discrete-time; it's only got a value right at each instantaneous sample point and it's<br />
undefined, there is no value at all, everywhere between. A discrete-time signal is properly drawn as a lollipop graph.<br />
The continuous, analog counterpart of a digital signal passes smoothly through each sample point, and that's just as true for high<br />
frequencies as it is for low.<br />
<br />
[[Image:Dsat 008.png|360px|right]]<br />
The interesting and non-obvious bit is that [[WikiPedia:Nyquist%E2%80%93Shannon_sampling_theorem|there's only one<br />
bandlimited signal that passes exactly through each sample point]]; it's a unique solution. If you sample a bandlimited signal and then convert it back, the original input is also the only possible output.<br />
A signal that differs even minutely from the original includes frequency content at or beyond Nyquist, breaks the bandlimiting requirement and isn't a valid solution.<br />
<br />
So how did everyone get confused and start thinking of digital signals as stairsteps? I can think of two good reasons.<br />
<br />
First: it's easy to convert a sampled signal to a true stairstep. Just<br />
extend each sample value forward until the next sample period. This is<br />
called a [[WikiPedia:Zero-order hold|zero-order hold]], and it's an important part of how some<br />
digital-to-analog converters work, especially the simplest ones.<br />
As a result, anyone who looks up [[WikiPedia:Digital-to-analog_converter#Practical_operation|digital-to-analog converter or<br />
digital-to-analog conversion]] is probably going to see a diagram of a<br />
stairstep waveform somewhere, but that's not a finished conversion,<br />
and it's not the signal that comes out.<br />
<br />
Second, and this is probably the more likely reason, engineers who<br />
supposedly know better (yes, even I) draw stairsteps even though they're<br />
technically wrong. It's a sort of one-dimensional version of<br />
[[WikiPedia:MacPaint#Development|fat bits in an image editor]].<br />
Pixels aren't squares either, they're samples of a 2-dimensional<br />
function space and so they're also, conceptually, infinitely small<br />
points. Practically, it's a real pain in the ass to see or manipulate<br />
infinitely small anything, so big squares it is.<br />
<br />
Digital stairstep drawings are exactly the same thing. It's just a convenient drawing. The stairsteps aren't really there.<br />
<div style="clear:both"></div><br />
<br />
==Bit-depth==<br />
[[Image:Dsat_009.jpg|360px|right]]<br />
[[Image:Dsat_010.jpg|260px|right]]<br />
<br />
When we convert a digital signal back to analog, the result is<br />
''also'' smooth regardless of the [[WikiPedia:Audio_bit_depth|bit depth]]. It doesn't matter if it's 24 bits or 16 bits or 8 bits.<br />
So does that mean that the digital bit depth makes no difference at<br />
all? Of course not.<br />
<br />
Channel 2 is the same sine wave input, but we quantize it with<br />
[[WikiPedia:Dither|dither]] down to 8 bits.<br />
On the scope, we still see a nice<br />
smooth sine wave on channel 2. Look very close, and you'll also see a<br />
bit more noise. That's a clue.<br />
<br />
If we look at the spectrum of the signal, our sine wave is<br />
still there unaffected, but the noise level of the 8-bit signal on<br />
the second channel is much higher. And that's the difference, the only difference, the number of bits makes.<br />
<br />
When we digitize a signal, first we sample it. The<br />
sampling step is perfect; it loses nothing. But then we [[WikiPedia:Quantization_(sound_processing)|quantize]] it,<br />
and [[WikiPedia:Quantization_error|quantization adds noise]].<br />
The number of bits determines how much noise and so the level of the<br />
noise floor.<br />
<br />
What does this dithered quantization noise sound like?<br />
Those of you who have used analog recording equipment might think to yourselves, "My goodness! That sounds like tape hiss!"<br />
Well, it doesn't just sound like tape hiss, it acts like it too, and<br />
if we use a [[WikiPedia:Dither#Different_types|gaussian dither]] then it's<br />
[[WikiPedia:Central_limit_theorem|mathematically equivalent]] in every way. It ''is'' tape hiss.<br />
<br />
Intuitively, that means that we can measure tape hiss and thus the noise floor<br />
of [[WikiPedia:Magnetic_tape_sound_recording|magnetic audio tape]]<br />
in [[WikiPedia:Shannon–Hartley_theorem#Examples|bits instead of decibels]], in order to put things in a<br />
digital perspective. [[WikiPedia:Compact cassettes|Compact cassettes]], for those of you who are old enough to remember them, could reach as<br />
deep as 9 bits in perfect conditions. 5 to 6 bits was<br />
more typical, especially if it was a recording made on a<br />
[[WikiPedia:Cassette_deck|tape deck]]. That's right; your old mix tapes were only about 6 bits<br />
deep if you were lucky!<br />
<br />
The very best professional [[WikiPedia:Reel-to-reel_audio_tape_recording|open reel tape]] used in studios could barely<br />
hit 13 bits ''with'' [[WikiPedia:Reel-to-reel_audio_tape_recording#Noise_reduction|advanced noise reduction]]. <br />
That's why seeing '[[WikiPedia:SPARS_code|D D D]]' on a [[WikiPedia:Compact_disk|Compact Disc]] used to be such a big,<br />
high-end deal.<br />
<br />
<div style="clear:both"></div><br />
<br />
==Dither==<br />
[[Image:Dsat_011.png|360px|right]]<br />
<br />
We've been quantizing with [[Wikipedia:dither|dither]]. What is dither<br />
exactly and, more importantly, what does it do?<br />
<br />
The simplest way to quantize a signal is to choose the digital<br />
amplitude value [[WikiPedia:Rounding|closest to the original analog amplitude]].<br />
Unfortunately, the exact noise that results from this simple<br />
quantization scheme depends somewhat on the input signal.<br />
It may be inconsistent, cause distortion, or be<br />
undesirable in some other way.<br />
<br style="clear:both;"/><br />
<br />
<center><div style="background-color:#DDDDFF;border-color:#CCCCDD;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
'''Going deeper…'''<br />
*Cameron Nicklaus Christou's thesis [http://uwspace.uwaterloo.ca/bitstream/10012/3867/1/thesis.pdf Optimal Dither and Noise Shaping in Image Processing] provides an ''excellent'' explanation of dither and noise shaping.<br />
</div>&nbsp;</center><br />
<br />
Dither is specially-constructed noise that substitutes for the noise<br />
produced by simple quantization. Dither doesn't [[WikiPedia:Sound_masking|drown out or mask]]<br />
quantization noise, it replaces it with noise characteristics<br />
of our choosing that aren't influenced by the input.<br />
<br />
The signal generator has too much noise for this test so we produce a mathematically perfect sine wave with the ThinkPad and quantize it to 8 bits with dithering.<br />
We see the sine wave on waveform display and output scope, and <br />
a clean frequency peak with a uniform noise floor on both spectral displays<br />
just like before. Again, this is with dither.<br />
<br />
Now I turn dithering off.<br />
<br />
The quantization noise that dither had spread out into a nice, flat noise<br />
floor, piles up into harmonic distortion peaks. The noise floor is<br />
lower, but the level of distortion becomes nonzero, and the distortion<br />
peaks sit higher than the dithering noise did.<br />
<br />
At 8 bits this effect is exaggerated. At 16 bits,<br />
even without dither, harmonic distortion is going to be so low as to<br />
be completely inaudible. Still, we can use dither to eliminate it completely if we so choose.<br />
<br />
Turning the dither off again for a moment, you'll notice that the<br />
absolute level of distortion from undithered quantization stays<br />
approximately constant regardless of the input amplitude.<br />
But when the signal level drops below a half a bit, everything<br />
quantizes to zero.<br />
<br />
In a sense, everything quantizing to zero is just 100% distortion!<br />
Dither eliminates this distortion too. When we reenable dither, we clearly see our signal at 1/4 bit with a nice flat noise floor.<br />
<br />
The noise floor doesn't have to be flat. Dither is noise of our<br />
choosing, so it makes sense to choose a noise as [http://www.acoustics.salford.ac.uk/res/cox/sound_quality/?content=subjective inoffensive] and<br />
[[WikiPedia:Absolute_threshold_of_hearing|difficult to notice]]<br />
as possible.<br />
<br />
Human hearing is [[WikiPedia:Equal-loudness_contour|most sensitive in the midrange from 2kHz to 4kHz]]; that's where background noise is going to be the most obvious.<br />
We can [[WikiPedia:Noise_shaping|shape dithering noise]] away from sensitive frequencies to where<br />
hearing is less sensitive, usually the highest frequencies.<br />
<br />
Lastly, dithered quantization noise ''is'' higher [[WikiPedia:Sound_power|power]] overall<br />
than undithered quantization noise, even though it often sounds quieter, and<br />
you can see that on a [[WikiPedia:VU_meter|VU meter]] during passages of near-silence. However,<br />
dither isn't only an on or off choice. We can reduce the dither's<br />
power to balance less noise against a bit of distortion to minimize<br />
the overall effect.<br />
<br />
For the next test, we also [[WikiPedia:Amplitude_modulation|modulate the input signal]] like this to show how a varying input affects the quantization noise. At<br />
full dithering power, the noise is uniform, constant, and featureless<br />
just like we expect.<br />
<br />
As we reduce the dither's power, the input increasingly<br />
affects the amplitude and the character of the quantization noise.<br />
Shaped dither behaves similarly, but noise shaping lends one more nice<br />
advantage; it can use a somewhat lower<br />
dither power before the input has as much effect on the output.<br />
<br />
Despite all this text spent on dither, the differences exist 100 decibels or more below [[WikiPedia:Full_scale|full scale]]. If the CD had been<br />
[http://www.research.philips.com/technologies/projects/cd/index.html 14 bits as originally designed],<br />
perhaps dither ''might'' be<br />
more important. At 16 bits it's mostly a wash. It's reasonable to treat<br />
dither as an insurance policy that gives several extra<br />
decibels of dynamic range just in case. That said no<br />
one ever ruined a great recording by not dithering the final master.<br />
<br />
==Bandlimitation and timing==<br />
[[image:Dsat_016.jpg|360px|right]]<br />
<br />
We've been using [[WikiPedia:Sine_wave|sine waves]]. They're the obvious choice when what we<br />
want to see is a system's behavior at a given isolated frequency. Now let's look at something a bit more complex. What should we expect to happen when I change the input to a [[WikiPedia:Square_wave|square wave]]? <br />
<br />
The input scope confirms a 1kHz square wave. The output scope shows... exactly what it should.<br />
<br />
What is a square wave really? <br />
<br />
We can say it's a waveform that's some positive value for half a cycle and then transitions instantaneously to a negative value for the other half.<br />
<br />
:<math><br />
\ squarewave(t) = \begin{cases} 1, & |t| < T_1 \\ 0, & T_1 < |t| \leq {1 \over 2}T \end{cases}<br />
</math><br />
<br />
But that doesn't really tell us anything useful about how that input becomes this output.<br />
<br />
We remember that any waveform is also [[WikiPedia:Fourier_series|the sum of discrete frequencies]],<br />
and a square wave is particularly simple sum: a fundamental and an infinite series of [[WikiPedia:Even_and_odd_functions#Harmonics|odd harmonics]].<br />
<br />
[[image:Dsat_013.jpg|360px|right]]<br />
:<math>\begin{align}<br />
\ squarewave(t) = \frac{4}{\pi}\sin(\omega t) + \frac{4}{3\pi}\sin(3\omega t) + \frac{4}{5\pi}\sin(5\omega t) + \\<br />
\frac{4}{7\pi}\sin(7\omega t) + \frac{4}{9\pi}\sin(9\omega t) + \frac{4}{11\pi}\sin(11\omega t) + \\ <br />
\frac{4}{13\pi}\sin(13\omega t) + \frac{4}{15\pi}\sin(15\omega t) + \frac{4}{17\pi}\sin(17\omega t) + \\<br />
\frac{4}{19\pi}\sin(19\omega t) + \frac{4}{21\pi}\sin(21\omega t) + \frac{4}{23\pi}\sin(23\omega t) + \\<br />
\frac{4}{25\pi}\sin(25\omega t) + \frac{4}{27\pi}\sin(27\omega t) + \frac{4}{29\pi}\sin(29\omega t) + \\<br />
\frac{4}{31\pi}\sin(31\omega t) + \frac{4}{33\pi}\sin(33\omega t) + \cdots <br />
\end{align}</math><br />
<br />
At first glance, that doesn't seem very useful either; you'd have to sum an infinite number of harmonics to get the answer! However, we don't have an infinite number of harmonics.<br />
<br />
We're using a quite sharp [[WikiPedia:Low-pass_filter|anti-aliasing filter]] that cuts off right<br />
above 20kHz, so our signal is [[WikiPedia:Bandlimiting|bandlimited]]. Only the first ten terms make it through, and that's exactly what we see on the output scope.<br />
<br />
<br style="clear:both;"/><br />
<center><div style="background-color:#DDDDFF;border-color:#CCCCDD;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
'''Going deeper…'''<br />
*In modern web browsers you can program audio synthesizers directly in javascript. Use the two square wave formulas to get a square wave out of [http://js.do/blog/sound-waves-with-javascript/ this page]. (Note: The scope is not very accurate/useful.) <br />
</div></center><br />
<div>&nbsp;</div><br />
<br />
[[Image:dsat_015.jpg|360px|right]]<br />
The rippling you see around sharp edges in a bandlimited signal is called the [[WikiPedia:/Gibbs_phenomenon|Gibbs effect]]. It happens whenever you slice off part of the frequency domain in the middle of nonzero energy.<br />
<br />
The usual rule of thumb you'll hear is "the sharper the cutoff, the<br />
stronger the rippling", which is approximately true, but we have to be<br />
careful how we think about it. For example, what would you expect our quite sharp anti-aliasing filter<br />
to do if I run our signal through it a second time?<br />
<br />
Aside from adding a few fractional cycles of delay, the answer is:<br />
Nothing at all. The signal is already bandlimited. Bandlimiting it<br />
again doesn't do anything. A second pass can't remove frequencies<br />
that we already removed.<br />
<br />
That's important. People tend to think of the ripples as<br />
a kind of [[WikiPedia:Sonic_artifact|artifact]] that's added by anti-aliasing and [[WikiPedia:Reconstruction_filter|anti-imaging]]<br />
filters, implying that the ripples get worse each time the signal<br />
passes through. We see that in this case that didn't happen, so<br />
it wasn't really the filter that added the ripples the first time<br />
through. It's a subtle distinction, but Gibbs effect<br />
ripples aren't added by filters, they're just part of what a<br />
bandlimited signal ''is''.<br />
<br />
Even if we synthetically construct what looks like a perfect digital<br />
square wave it's still limited to the channel bandwidth. Remember that<br />
the stairstep representation is misleading. What we really have here are instantaneous sample points<br />
and only one bandlimited signal fits those points. All we did when we<br />
drew our apparently perfect square wave was line up the sample points<br />
just right so it appeared that there were no ripples if we played<br />
[[WikiPedia:Interpolation|connect-the-dots]]. The original bandlimited signal, complete with ripples, was<br />
still there.<br />
<br />
[[image:Dsat_014.gif|360px|right]]<br />
That leads us to one more important point. You've probably heard<br />
that the timing precision of a digital signal is limited by its sample<br />
rate; put another way, that digital signals can't represent anything that falls between the<br />
samples.. implying that [[WikiPedia:Dirac_delta_function|impulses]] or<br />
[[WikiPedia:Synthesizer#ADSR_envelope|fast attacks]] have to align exactly<br />
with a sample, or the timing gets mangled or they just disappear.<br />
At this point, we can easily see why that's wrong.<br />
<br />
Again, our input signals are bandlimited. And digital signals are<br />
samples, not stairsteps, not 'connect-the-dots'. We most certainly<br />
can, for example, put the rising edge of our bandlimited square wave<br />
anywhere we want between samples.<br />
<br />
It's represented perfectly and it's reconstructed perfectly.<br />
<br />
==Epilogue==<br />
<br />
[[Image:Moffey.jpg|360px|right]]<br />
<br />
Like in [[Videos/A_Digital_Media_Primer_For_Geeks|_A Digital Media Primer for Geeks_]], we've covered a broad range of<br />
topics, and yet barely scratched the surface of each one. If anything, my<br />
sins of omission are greater this time around.<br />
<br />
Thus I encourage you to dig deeper and experiment. I chose my<br />
demos carefully to be simple and give clear results. You can<br />
reproduce every one of them on your own if you like, but let's face<br />
it: Sometimes we learn the most about a spiffy toy by breaking it open<br />
and studying all the pieces that fall out. Play with the demo parameters, hack up the code, set up<br />
alternate experiments. The source code for everything, including the<br />
little pushbutton demo application, is at the [[Videos/Digital_Show_and_Tell#Use_The_Source_Luke|bottom of this page]].<br />
<br />
In the course of experimentation, you're likely to run into something<br />
that you didn't expect and can't explain. Don't worry! My earlier<br />
snark aside, Wikipedia is fantastic for exactly this kind of casual<br />
research. If you're really serious about understanding signals,<br />
several universities have advanced materials online, such as the<br />
[http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-003-signals-and-systems-spring-2010/index.htm 6.003]<br />
and<br />
[http://ocw.mit.edu/resources/res-6-007-signals-and-systems-spring-2011/ RES.6-007]<br />
Signals and Systems modules at MIT OpenCourseWare. And of<br />
course, there's always the [http://webchat.freenode.net/?channels=xiph community here at Xiph.Org].<br />
<br />
==Credits==<br />
[[Image:Dmpfg_019.png|360px|right]]<br />
Written by: Christopher (Monty) Montgomery and the Xiph.Org Community<br />
<br />
Special thanks to:<br />
*Heidi Baumgartner, for the second Tektronix oscilloscope<br />
*Gregory Maxwell and Dr. Timothy Terriberry, for additional technical review<br />
<br />
Intro, title and credits music:<br><br />
"[http://music.lousyrobot.com/track/andy-warhol-is-gone Andy Warhol Is Gone]", by Lousy Robot<br><br />
Used by permission of Lousy Robot.<br><br />
Original source track All Rights Reserved.<br><br />
[http://www.lousyrobot.com www.lousyrobot.com]<br />
<br />
This Video Was Produced Entirely With Free and Open Source Software:<br><br />
<br />
*[http://www.gnu.org/ GNU]<br><br />
*[http://www.linux.org/ Linux]<br><br />
*[http://fedoraproject.org/ Fedora]<br><br />
*[http://cinelerra.org/ Cinelerra]<br><br />
*[http://www.gimp.org/ The Gimp]<br><br />
*[http://audacity.sourceforge.net/ Audacity]<br><br />
*[http://svn.xiph.org/trunk/postfish/README Postfish]<br><br />
*[http://gstreamer.freedesktop.org/ Gstreamer]<br><br />
<br />
All trademarks are the property of their respective owners. <br />
<br />
*''Complete video'' [http://creativecommons.org/licenses/by-sa/3.0/legalcode CC-BY-SA]<br><br />
*''Text transcript and Wiki edition'' [http://creativecommons.org/licenses/by-sa/3.0/legalcode CC-BY-SA]<br><br />
<br />
A Co-Production of Xiph.Org and Red Hat, Inc.<br><br />
(C) 2012-2013, Some Rights Reserved<br><br />
<br />
== Use The Source Luke ==<br />
<br />
As stated in the Epilogue, everything that appears in the video demos is driven by open source software, which means the source is both available for inspection and freely usable by the community. The Thinkpad that appears in the video was running Fedora 17 and Gnome Shell (Gnome 3). The demonstration software does not require Fedora specifically, but it does require Gnu/Linux to run in its current form. In all, the video involved just under 50,000 lines of new and custom-purpose code (including contributions to non-Xiph projects such as Cinelerra and Gromit).<br />
<br />
=== The Spectrum and Waveform Viewer ===<br />
<br />
The realtime software spectrum analyzer application that appears in the video was a preexisting application that was dusted off and updated for use in the video. The waveform viewer (effectively a simple software oscilloscope) was written from scratch making use of some of the internals from the spectrum analyzer application. Both are available from Xiph.Org svn:<br />
<br />
<center><div style="background-color:#DDDDDD;border-color:#CCCCCC;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
*Source for the Spectrum and Waveform applications is found at:<br />
https://svn.xiph.org/trunk/spectrum/<br />
*The source can be checked out of svn using the following command line:<br />
svn co https://svn.xiph.org/trunk/spectrum<br />
*Trac is a convenient way to browse the source without checking out a copy:<br />
https://trac.xiph.org/browser/trunk/spectrum<br />
</div></center><br />
<br />
Spectrum and Waveform both expect an input stream on the command line, either as raw data or as a WAV file.<br />
<br />
=== GTK-Bounce ===<br />
<br />
The touch-controlled application used in the video is named 'gtk-bounce' and was custom-written for the sole purpose of the in-video demonstrations. It is so named because, for the most part, all it does is read the input from an audio device, and then immediately write the same data back out for playback. It also forwards a copy of this data to up to two external monitoring applications, and in several demos, applies simple filters or generates simple waveforms. It includes several demos not included in the video.<br />
<br />
<center><div style="background-color:#DDDDDD;border-color:#CCCCCC;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
*Source for gtk-bounce is found at:<br />
https://svn.xiph.org/trunk/Xiph-episode-II/bounce/<br />
*The source can be checked out of svn using the following command line:<br />
svn co https://svn.xiph.org/trunk/Xiph-episode-II/bounce/<br />
*Trac is a convenient way to browse the source without checking out a copy:<br />
https://trac.xiph.org/browser/Xiph-episode-II/bounce/<br />
</div></center><br />
<br />
==== Starting Gtk-bounce ====<br />
The application is somewhat hardwired for specific demo parameters, but most of the hardwired settings can be found at the top of each source file. As found in SVN, the application expects an ALSA hardware audio device at hw:1, and if none if found, it will wait for one to appear. Once a sound device is successfully initialized, it expects to find and open two pipes named pipe0 and pipe1 for output in the current directory. In the video, the waveform and spectrum applications are started to take input from pipe0 and pipe1 respectively. The output sent to the two pipes is identical, and in most demos matches the output data sent to the hardware device for conversion to analog. The only exception is the tenth demo panel (which does not appear in the video) where gtk-bounce can be set to monitor the hardware inputs instead while the outputs are used to produce test waveforms.<br />
<br />
Assuming gtk-bounce, spectrum and waveform have been checked out and built, the configuration seen in the video can be started using the following commands:<br />
<center><div style="background-color:#DDDDDD;border-color:#CCCCCC;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
* make the pipe fifos for the applications to communicate (only needs to be done once)<br />
mkfifo pipe0 pipe1<br />
* start all three applications<br />
waveform pipe0 & spectrum pipe1 & gtk-bounce &<br />
</div></center><br />
<br />
==== Using Gtk-bounce ====<br />
<br />
Gtk-bounce consists of eleven pushbutton panels (numbered zero through ten) that can be selected by scrolling up and dwon with the arrow buttons on the right side. Each panel is intended for a specific demo or part of a demo.<br />
<br />
<center><div style="background-color:#DDDDDD;border-color:#CCCCCC;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
<br />
[[Image:Dsat-panel0.png|700px|center]]<br />
* '''Panel 0''': This panel presents buttons that allow the sound card to be configured in several sampling rates and bit depths. Samples read from the audio inputs are sent to the output pipes and audio outputs for playback without modification.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel1.png|700px|center]]<br />
* '''Panel 1''': Both channels are forwarded to the outputs, however the user may select the bit depth of each channel independently. When the sound card is running in 16 bit mode and 16-bit depth is selected, the data is untouched. Requantization to a lower bit depth is performed with a flat triangle dither.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel2.png|700px|center]]<br />
* '''Panel 2''': Both channels are re-quantized to the selected bit depth. Requantization to a lower bit depth is performed with a flat triangle dither.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel3.png|700px|center]]<br />
* '''Panel 3''': 'generate sine wave' discards the audio inputs and instead internally generates a sine wave at 32 bit precision, which is then quantized to the selected bit depth, optionally with dither. The resulting signal is then forwarded to the output. <br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel4.png|700px|center]]<br />
* '''Panel 4''': gtk-bounce generates a 16-bit sine wave of the selected amplitude, optionally with dither, and forwards the resulting signal to the outputs. The audio input from the audio device is discarded. Note that the slider sets the peak amplitude, not the peak-to-peak amplitude.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel5.png|700px|center]]<br />
* '''Panel 5''': generates a 16-bit sine wave, optionally quantized using dither. The user may additionally select a flat or a shaped dither. The 'notch and gain' button applies a notch filter to the resulting signal, and boosts the gain of the remaining noise so that it's easily audible. The audio input from the audio device is discarded.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel6.png|700px|center]]<br />
* '''Panel 6''': allows the user to play with the power of the dithering noise applied before quantizing the sine wave. Shaped or flat dither are available. The sine wave may also be modulated with a varying amplitude to highlight correlations between the input and the resulting quantization noise. The 'notch and gain' button applies a notch filter to the resulting signal, and boosts the gain of the remaining noise so that it's easily audible. The audio input from the audio device is discarded.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel7.png|700px|center]]<br />
* '''Panel 7''': applies a sharper antialiasing (lowpass) filter than is likely to be built into the sound-card hardware (as there's generally no reason to use a filter quite this sharp in practice). The very sharp filter allows us to bandpass the demonstration square wave without any harmonics landing in the transition band. The input is read from the audio device, passed through this sharper filter, and then forwarded to the outputs.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel8.png|700px|center]]<br />
* '''Panel 8''': when selected, generate a synthetic 'square wave' (this is not quite equivalent to a bandlimited analog square wave; the harmonic amplitudes are a bit different) that when aligned with the sampling phase just right gives the appearance of having infinite rise and fall time. The slider allows us to shift the waveform sample alignment back and forth by +/- one sample to reveal that the underlying signal is still band-limited.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel9.png|700px|center]]<br />
* '''Panel 9''': as in panel 8, generate a 'perfect' synthetic 'square wave'. However, the slider now allows us to shift the sample alignment of the second channel with respect to the first, instead of shifting both channels. This allows us the trigger/lock the scope timing to the channel 1 waveform so we can see the fractional sample movement and alignment of the waveform on channel 2. The audio input from the audio device is discarded.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel10.png|700px|center]]<br />
* '''Panel 10''': not used in the video; The audio device is configured to 24-bit input/output. The user may produce one of a range of test signals that are output to both the external applications and the audio device on the first channel. The input on the second channel is passed-through to the applications and audio device outputs unchanged. The first channel input is unused unless 'two input mode' is selected. When two input mode is selected, both input channels are read and the data sent to the external applications. Generated test signals are sent only to the audio hardware (on the first channel). This combination of test signals and input modes allows self-references frequency response, phase, noise, distortion and crosstalk testing of a given audio device.<br />
<br />
<div style="clear: both">&nbsp;</div><br />
<br />
</div></center><br />
<br />
=== Cairo Animations ===<br />
<br />
The animations featured throughout the Episode 2 video were rapid-development spaghetti hack-jobs coded by hand in raw Cairo. Each module generated a series of PNG stills that were then stitched into an animation with Cinelerra or mplayer. In the interest of pointing and laughing at what really bad code looks like...<br />
<br />
<center><div style="background-color:#DDDDDD;border-color:#CCCCCC;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
*Source for the Cairo animations is found at:<br />
https://svn.xiph.org/trunk/Xiph-episode-II/cairo/<br />
*The source can be checked out of svn using the following command line:<br />
svn co https://svn.xiph.org/trunk/Xiph-episode-II/cairo/<br />
*Trac is a convenient way to browse the source without checking out a copy:<br />
https://trac.xiph.org/browser/Xiph-episode-II/cairo/<br />
</div></center></div>Gmaxwellhttps://wiki.xiph.org/index.php?title=Videos/Digital_Show_and_Tell&diff=14033Videos/Digital Show and Tell2013-02-26T10:58:33Z<p>Gmaxwell: /* Dither */ equal loudness curves wp link</p>
<hr />
<div><small>''Wiki edition''</small><br />
[[Image:dsat_001.jpg|400px|right]]<br />
<br />
Continuing in the "firehose" tradition of [[Videos/A_Digital_Media_Primer_For_Geeks|Episode 01]], Xiph.Org's second video on digital media explores multiple facets of digital audio signals and how they ''really'' behave in the real world.<br />
<br />
Demonstrations of sampling, quantization, bit-depth, and dither explore digital audio behavior on real audio equipment using both modern digital analysis and vintage analog bench equipment, just in case we can't trust those newfangled digital gizmos. You can download the source code for each demo and try it all for yourself!<br />
<br/><br/><br/><br />
<center><font size="+2">[http://www.xiph.org/video/vid2.shtml Download or Watch online]</font></center><br />
<br style="clear:both;"/><br />
Supported players: [http://www.videolan.org/vlc/ VLC 1.1+], [https://www.mozilla.com/en-US/firefox/ Firefox ], [http://www.chromium.org/Home Chrome ], [http://www.opera.com/ Opera]. Or see [http://www.webmproject.org/users/ other WebM] or [[TheoraSoftwarePlayers|other Theora]] players.<br />
<br />
If you're having trouble with playback in a modern browser or player, please visit our [[Playback_Troubleshooting|playback troubleshooting and discussion]] page.<br />
<br/><br />
<hr/><br />
<br/><br/><br/><br />
[[Image:Xiph_ep02_test.png|400px|right]]<br />
<br />
&ldquo;Hi, I'm Monty Montgomery from [http://www.redhat.com/ Red Hat] and [http://xiph.org/ Xiph.Org].<br />
<br />
&ldquo;A few months ago, I wrote<br />
[http://people.xiph.org/~xiphmont/demo/neil-young.html an article on digital audio and why 24bit/192kHz music downloads don't make sense].<br />
In the article, I<br />
mentioned--almost in passing--that a digital waveform is<br />
[http://people.xiph.org/~xiphmont/demo/neil-young.html#toc_sfam not a stairstep],<br />
and you certainly don't get a stairstep when you<br />
[[WikiPedia:Digital-to-analog_converter|convert from digital back to analog]].<br />
<br />
&ldquo;Of everything in the entire article, '''that''' was the number one thing<br />
people wrote about. In fact, more than half the mail I got was questions and<br />
comments about basic digital signal behavior. Since there's interest, let's<br />
take a little time to play with some ''simple'' digital signals. &rdquo;<br />
<br />
==Veritas ex machina==<br />
[[Image:Dsat_002.jpg|200px|right]]<br />
[[Image:Dsat_003.jpg|200px|right]]<br />
[[Image:Dsat_004.jpg|200px|right]]<br />
[[Image:Dsat_005.jpg|200px|right]]<br />
<br />
If we pretend for a moment that we have no idea how digital signals really<br />
behave, then it doesn't make sense for us to use digital test<br />
equipment. Fortunately for this exercise, there's still plenty<br />
of working analog lab equipment out there.<br />
<br />
We need a [[WikiPedia:Function_generator|signal generator]] to provide us with analog input<br />
signals--in this case, an<br />
[http://www.home.agilent.com/en/pd-3325A%3Aepsg%3Apro-pn-3325A/synthesizer-function-generator?pm=PL&nid=-536900197.536896863&cc=SE&lc=swe HP3325]<br />
from 1978.<br />
<br />
We'll observe our analog waveforms on [[WikiPedia:Oscilloscope_types#Cathode-ray_oscilloscope_.28CRO.29|analog oscilloscopes]],<br />
like this Tektronix 2246 from the mid-90s, one of the last and best analog scopes made.<br />
<br />
Finally, we'll inspect the [[WikiPedia:Spectral_density#Electrical_engineering|frequency spectrum]] of our signals using an<br />
[[WikiPedia:Spectrum_analyzer#Swept-tuned|analog spectrum analyzer]], this<br />
[http://www.home.agilent.com/en/pd-3585A%3Aepsg%3Apro-pn-3585A/spectrum-analyzer-high-perf-20hz-40mhz?pm=PL&nid=-536900197.536897319&cc=SE&lc=swe HP3585]<br />
from the same product line as<br />
the signal generator. Like the other equipment here it has<br />
[http://www.hp9845.net/9845/hardware/processors/ a rudimentary and hilariously large microcontroller],<br />
but the signal path<br />
from input to what you see on the screen is completely analog.<br />
<br />
All of this equipment is vintage, but the specs are still quite good.<br />
We start with the signal generator set to output a 1 [[WikiPedia:Hertz#SI_multiples|kHz]]<br />
sine wave at one [[WikiPedia:Volt|Volt]] [[WikiPedia:Amplitude#Root_mean_square_amplitude|RMS]].<br />
We see the sine wave on the oscilloscope, can verify that it is indeed<br />
1 kHz at 1 Volt RMS, which is 2.8 Volts<br />
[[WikiPedia:Amplitude#Peak-to-peak_amplitude|peak-to-peak]],<br />
and that matches the<br />
measurement on the spectrum analyzer as well.<br />
<br />
The analyzer also shows some low-level [[WikiPedia:White_noise|white noise]]<br />
and just a bit of [[WikiPedia:Harmonic_distortion#Harmonic_distortion|harmonic distortion]],<br />
with the highest peak about 70[[WikiPedia:Decibel|dB]] or so below<br />
[[WikiPedia:Fundamental_frequency|the fundamental]].<br />
This doesn't matter to the demos, but it's good to take notice of it now to avoid confusion later.<br />
<br />
For digital conversion, we use a boring, consumer-grade, eMagic USB1<br />
audio device. It's more than ten years old at this point, and it's<br />
getting obsolete.<br />
<br />
A recent converter can easily have an order of magnitude better specs.<br />
[[WikiPedia:Reconstruction_filter#Sampled_data_reconstruction_filters|Flatness]],<br />
[[WikiPedia:Analog-to-digital_converter#Non-linearity|linearity]],<br />
[[WikiPedia:Jitter#Sampling_jitter|jitter]],<br />
[[WikiPedia:Noise_floor|noise behavior]],<br />
[[WikiPedia:Digital-to-analog_converter#DAC_performance|everything]]...<br />
You may not<br />
have noticed. Just because we can measure an improvement doesn't<br />
mean we can hear it, and even these old consumer boxes were already at<br />
the edge of ideal transparency.<br />
<br />
The eMagic connects to my ThinkPad, which displays a digital<br />
waveform and spectrum for comparison, then the ThinkPad<br />
sends the digital signal right back out to the eMagic for<br />
re-conversion to analog and observation on the output scopes.<br />
<br />
<br style="clear:both;"/><br />
<br />
==Stairsteps==<br />
[[Image:Dsat 006.jpg|360px|right]]<br />
[[Image:Dsat 007.png|360px|right]]<br />
First demo: We begin by converting an analog signal to digital and<br />
then right back to analog again with no other steps.<br />
<br />
The signal generator is set to produce a 1kHz sine wave just like<br />
before and we can see the analog sine wave on the input-side oscilloscope. The eMagic digitizes our signal to<br />
[[Videos/A_Digital_Media_Primer_For_Geeks#Raw_.28digital_audio.29_meat|16 bit PCM at 44.1kHz]],<br />
same as on a CD. The spectrum of the digitized signal on the Thinkpad matches what we saw earlier and what we see now on the analog spectrum analyzer, aside from its <br />
[[WikiPedia:High_impedance|high-impedance input]] being just a smidge noisier. For now, the waveform display shows our digitized sine wave as a<br />
stairstep pattern, one step for each sample.<br />
<br />
When we look at the output signal that's been converted<br />
from digital back to analog, we see that it's exactly like the original sine wave. No stairsteps.<br />
<br />
1 kHz is still a fairly low frequency, so perhaps the stairsteps are just<br />
hard to see or they're being smoothed away. Next, set the signal generator to 15kHz, which is much closer to [[WikiPedia:Nyquist_frequency|Nyquist]].<br />
Now the sine wave is represented by less than three samples per cycle, and the digital waveform appears rather poor! Yet the analog output is still a perfect sine wave, exactly like the original.<br />
As we keep increasing frequency, all the way to 20kHz, the output waveform is still perfect. No jagged edges, no dropoff, no stairsteps.<br />
<br />
So where'd the stairsteps go? It's a trick question; they were never there. Drawing a digital waveform as a stairstep was wrong to begin with.<br />
<br />
A stairstep is a continuous-time function. It's jagged, and it's piecewise, but it has a defined value at every point in time.<br />
A sampled signal is entirely different. It's discrete-time; it's only got a value right at each instantaneous sample point and it's<br />
undefined, there is no value at all, everywhere between. A discrete-time signal is properly drawn as a lollipop graph.<br />
The continuous, analog counterpart of a digital signal passes smoothly through each sample point, and that's just as true for high<br />
frequencies as it is for low.<br />
<br />
[[Image:Dsat 008.png|360px|right]]<br />
The interesting and non-obvious bit is that [[WikiPedia:Nyquist%E2%80%93Shannon_sampling_theorem|there's only one<br />
bandlimited signal that passes exactly through each sample point]]; it's a unique solution. If you sample a bandlimited signal and then convert it back, the original input is also the only possible output.<br />
A signal that differs even minutely from the original includes frequency content at or beyond Nyquist, breaks the bandlimiting requirement and isn't a valid solution.<br />
<br />
So how did everyone get confused and start thinking of digital signals as stairsteps? I can think of two good reasons.<br />
<br />
First: it's easy to convert a sampled signal to a true stairstep. Just<br />
extend each sample value forward until the next sample period. This is<br />
called a [[WikiPedia:Zero-order hold|zero-order hold]], and it's an important part of how some<br />
digital-to-analog converters work, especially the simplest ones.<br />
As a result, anyone who looks up [[WikiPedia:Digital-to-analog_converter#Practical_operation|digital-to-analog converter or<br />
digital-to-analog conversion]] is probably going to see a diagram of a<br />
stairstep waveform somewhere, but that's not a finished conversion,<br />
and it's not the signal that comes out.<br />
<br />
Second, and this is probably the more likely reason, engineers who<br />
supposedly know better (yes, even I) draw stairsteps even though they're<br />
technically wrong. It's a sort of one-dimensional version of<br />
[[WikiPedia:MacPaint#Development|fat bits in an image editor]].<br />
Pixels aren't squares either, they're samples of a 2-dimensional<br />
function space and so they're also, conceptually, infinitely small<br />
points. Practically, it's a real pain in the ass to see or manipulate<br />
infinitely small anything, so big squares it is.<br />
<br />
Digital stairstep drawings are exactly the same thing. It's just a convenient drawing. The stairsteps aren't really there.<br />
<div style="clear:both"></div><br />
<br />
==Bit-depth==<br />
[[Image:Dsat_009.jpg|360px|right]]<br />
[[Image:Dsat_010.jpg|260px|right]]<br />
<br />
When we convert a digital signal back to analog, the result is<br />
''also'' smooth regardless of the [[WikiPedia:Audio_bit_depth|bit depth]]. It doesn't matter if it's 24 bits or 16 bits or 8 bits.<br />
So does that mean that the digital bit depth makes no difference at<br />
all? Of course not.<br />
<br />
Channel 2 is the same sine wave input, but we quantize it with<br />
[[WikiPedia:Dither|dither]] down to 8 bits.<br />
On the scope, we still see a nice<br />
smooth sine wave on channel 2. Look very close, and you'll also see a<br />
bit more noise. That's a clue.<br />
<br />
If we look at the spectrum of the signal, our sine wave is<br />
still there unaffected, but the noise level of the 8-bit signal on<br />
the second channel is much higher. And that's the difference, the only difference, the number of bits makes.<br />
<br />
When we digitize a signal, first we sample it. The<br />
sampling step is perfect; it loses nothing. But then we [[WikiPedia:Quantization_(sound_processing)|quantize]] it,<br />
and [[WikiPedia:Quantization_error|quantization adds noise]].<br />
The number of bits determines how much noise and so the level of the<br />
noise floor.<br />
<br />
What does this dithered quantization noise sound like?<br />
Those of you who have used analog recording equipment might think to yourselves, "My goodness! That sounds like tape hiss!"<br />
Well, it doesn't just sound like tape hiss, it acts like it too, and<br />
if we use a [[WikiPedia:Dither#Different_types|gaussian dither]] then it's<br />
[[WikiPedia:Central_limit_theorem|mathematically equivalent]] in every way. It ''is'' tape hiss.<br />
<br />
Intuitively, that means that we can measure tape hiss and thus the noise floor<br />
of [[WikiPedia:Magnetic_tape_sound_recording|magnetic audio tape]]<br />
in [[WikiPedia:Shannon–Hartley_theorem#Examples|bits instead of decibels]], in order to put things in a<br />
digital perspective. [[WikiPedia:Compact cassettes|Compact cassettes]], for those of you who are old enough to remember them, could reach as<br />
deep as 9 bits in perfect conditions. 5 to 6 bits was<br />
more typical, especially if it was a recording made on a<br />
[[WikiPedia:Cassette_deck|tape deck]]. That's right; your old mix tapes were only about 6 bits<br />
deep if you were lucky!<br />
<br />
The very best professional [[WikiPedia:Reel-to-reel_audio_tape_recording|open reel tape]] used in studios could barely<br />
hit 13 bits ''with'' [[WikiPedia:Reel-to-reel_audio_tape_recording#Noise_reduction|advanced noise reduction]]. <br />
That's why seeing '[[WikiPedia:SPARS_code|D D D]]' on a [[WikiPedia:Compact_disk|Compact Disc]] used to be such a big,<br />
high-end deal.<br />
<br />
<div style="clear:both"></div><br />
<br />
==Dither==<br />
[[Image:Dsat_011.png|360px|right]]<br />
<br />
We've been quantizing with [[Wikipedia:dither|dither]]. What is dither<br />
exactly and, more importantly, what does it do?<br />
<br />
The simplest way to quantize a signal is to choose the digital<br />
amplitude value [[WikiPedia:Rounding|closest to the original analog amplitude]].<br />
Unfortunately, the exact noise that results from this simple<br />
quantization scheme depends somewhat on the input signal.<br />
It may be inconsistent, cause distortion, or be<br />
undesirable in some other way.<br />
<br style="clear:both;"/><br />
<br />
<center><div style="background-color:#DDDDFF;border-color:#CCCCDD;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
'''Going deeper…'''<br />
*Cameron Nicklaus Christou's thesis [http://uwspace.uwaterloo.ca/bitstream/10012/3867/1/thesis.pdf Optimal Dither and Noise Shaping in Image Processing] provides an ''excellent'' explanation of dither and noise shaping.<br />
</div>&nbsp;</center><br />
<br />
Dither is specially-constructed noise that substitutes for the noise<br />
produced by simple quantization. Dither doesn't [[WikiPedia:Sound_masking|drown out or mask]]<br />
quantization noise, it replaces it with noise characteristics<br />
of our choosing that aren't influenced by the input.<br />
<br />
The signal generator has too much noise for this test so we produce a mathematically perfect sine wave with the ThinkPad and quantize it to 8 bits with dithering.<br />
We see the sine wave on waveform display and output scope, and <br />
a clean frequency peak with a uniform noise floor on both spectral displays<br />
just like before. Again, this is with dither.<br />
<br />
Now I turn dithering off.<br />
<br />
The quantization noise that dither had spread out into a nice, flat noise<br />
floor, piles up into harmonic distortion peaks. The noise floor is<br />
lower, but the level of distortion becomes nonzero, and the distortion<br />
peaks sit higher than the dithering noise did.<br />
<br />
At 8 bits this effect is exaggerated. At 16 bits,<br />
even without dither, harmonic distortion is going to be so low as to<br />
be completely inaudible. Still, we can use dither to eliminate it completely if we so choose.<br />
<br />
Turning the dither off again for a moment, you'll notice that the<br />
absolute level of distortion from undithered quantization stays<br />
approximately constant regardless of the input amplitude.<br />
But when the signal level drops below a half a bit, everything<br />
quantizes to zero.<br />
<br />
In a sense, everything quantizing to zero is just 100% distortion!<br />
Dither eliminates this distortion too. When we reenable dither, we clearly see our signal at 1/4 bit with a nice flat noise floor.<br />
<br />
The noise floor doesn't have to be flat. Dither is noise of our<br />
choosing, so it makes sense to choose a noise as [http://www.acoustics.salford.ac.uk/res/cox/sound_quality/?content=subjective inoffensive] and<br />
[[WikiPedia:Absolute_threshold_of_hearing|difficult to notice]]<br />
as possible.<br />
<br />
Human hearing is [[WikiPedia:Equal-loudness_contour|most sensitive in the midrange from 2kHz to 4kHz]]; that's where background noise is going to be the most obvious.<br />
We can [[WikiPedia:Noise_shaping|shape dithering noise]] away from sensitive frequencies to where<br />
hearing is less sensitive, usually the highest frequencies.<br />
<br />
Lastly, dithered quantization noise ''is'' higher [[WikiPedia:Sound_power|power]] overall<br />
than undithered quantization noise, even though it often sounds quieter, and<br />
you can see that on a [[WikiPedia:VU_meter|VU meter]] during passages of near-silence. However,<br />
dither isn't only an on or off choice. We can reduce the dither's<br />
power to balance less noise against a bit of distortion to minimize<br />
the overall effect.<br />
<br />
For the next test, we also [[WikiPedia:Amplitude_modulation|modulate the input signal]] like this to show how a varying input affects the quantization noise. At<br />
full dithering power, the noise is uniform, constant, and featureless<br />
just like we expect.<br />
<br />
As we reduce the dither's power, the input increasingly<br />
affects the amplitude and the character of the quantization noise.<br />
Shaped dither behaves similarly, but noise shaping lends one more nice<br />
advantage; it can use a somewhat lower<br />
dither power before the input has as much effect on the output.<br />
<br />
Despite all this text spent on dither, the differences exist 100 decibels or more below [[WikiPedia:Full_scale|full scale]]. If the CD had been<br />
[http://www.research.philips.com/technologies/projects/cd/index.html 14 bits as originally designed],<br />
perhaps dither ''might'' be<br />
more important. At 16 bits it's mostly a wash. It's reasonable to treat<br />
dither as an insurance policy that gives several extra<br />
decibels of dynamic range just in case. That said no<br />
one ever ruined a great recording by not dithering the final master.<br />
<br />
==Bandlimitation and timing==<br />
[[image:Dsat_016.jpg|360px|right]]<br />
<br />
We've been using [[WikiPedia:Sine_wave|sine waves]]. They're the obvious choice when what we<br />
want to see is a system's behavior at a given isolated frequency. Now let's look at something a bit more complex. What should we expect to happen when I change the input to a [[WikiPedia:Square_wave|square wave]]... The input scope confirms our 1kHz square wave. The output scope shows… Exactly what it should.<br />
<br />
What is a square wave really? <br />
<br />
Well, we can say it's a waveform that's some positive value for half a cycle and then transitions instantaneously to a negative value for the other half.<br />
<br />
:<math><br />
\ squarewave(t) = \begin{cases} 1, & |t| < T_1 \\ 0, & T_1 < |t| \leq {1 \over 2}T \end{cases}<br />
</math><br />
<br />
But that doesn't really tell us anything useful about how that input becomes this output.<br />
<br />
Then we remember that any waveform is also [[WikiPedia:Fourier_series|the sum of discrete frequencies]],<br />
and a square wave is particularly simple sum: a fundamental and an infinite series of [[WikiPedia:Even_and_odd_functions#Harmonics|odd harmonics]]. Sum them all up, you get a square wave.<br />
<br />
[[image:Dsat_013.jpg|360px|right]]<br />
:<math>\begin{align}<br />
\ squarewave(t) = \frac{4}{\pi}\sin(\omega t) + \frac{4}{3\pi}\sin(3\omega t) + \frac{4}{5\pi}\sin(5\omega t) + \\<br />
\frac{4}{7\pi}\sin(7\omega t) + \frac{4}{9\pi}\sin(9\omega t) + \frac{4}{11\pi}\sin(11\omega t) + \\ <br />
\frac{4}{13\pi}\sin(13\omega t) + \frac{4}{15\pi}\sin(15\omega t) + \frac{4}{17\pi}\sin(17\omega t) + \\<br />
\frac{4}{19\pi}\sin(19\omega t) + \frac{4}{21\pi}\sin(21\omega t) + \frac{4}{23\pi}\sin(23\omega t) + \\<br />
\frac{4}{25\pi}\sin(25\omega t) + \frac{4}{27\pi}\sin(27\omega t) + \frac{4}{29\pi}\sin(29\omega t) + \\<br />
\frac{4}{31\pi}\sin(31\omega t) + \frac{4}{33\pi}\sin(33\omega t) + \cdots <br />
\end{align}</math><br />
<br />
At first glance, that doesn't seem very useful either. You have to sum up an infinite number of harmonics to get the answer. ''Ah'', but we don't have an infinite number of harmonics.<br />
<br />
We're using a quite sharp [[WikiPedia:Low-pass_filter|anti-aliasing filter]] that cuts off right<br />
above 20kHz, so our signal is [[WikiPedia:Bandlimiting|bandlimited]] and only the first ten terms make it through.<br />
<br />
..and that's exactly what we see on the output scope.<br />
<br />
<br style="clear:both;"/><br />
<center><div style="background-color:#DDDDFF;border-color:#CCCCDD;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
'''Going deeper…'''<br />
*In modern web browsers you can program audio synthesizers directly in javascript. Use the two square wave formulas to get a square wave out of [http://js.do/blog/sound-waves-with-javascript/ this page]. (Note: The scope is not very accurate/useful.) <br />
</div></center><br />
<br />
[[Image:dsat_015.jpg|360px|right]]<br />
The rippling you see around sharp edges in a bandlimited signal is called the [[WikiPedia:/Gibbs_phenomenon|Gibbs effect]]. It happens whenever you slice off part of the frequency domain in the middle of nonzero energy.<br />
<br />
The usual rule of thumb you'll hear is "the sharper the cutoff, the<br />
stronger the rippling", which is approximately true, but we have to be<br />
careful how we think about it.<br />
<br />
<br />
For example... what would you expect our quite sharp anti-aliasing filter<br />
to do if I run our signal through it a second time?<br />
<br />
Aside from adding a few fractional cycles of delay, the answer is...<br />
nothing at all. The signal is already bandlimited. Bandlimiting it<br />
again doesn't do anything. A second pass can't remove frequencies<br />
that we already removed.<br />
<br />
And that's important. People tend to think of the ripples as<br />
a kind of [[WikiPedia:Sonic_artifact|artifact]] that's added by anti-aliasing and [[WikiPedia:Reconstruction_filter|anti-imaging]]<br />
filters, implying that the ripples get worse each time the signal<br />
passes through. We can see that in this case that didn't happen. So<br />
was it really the filter that added the ripples the first time<br />
through? No, not really. It's a subtle distinction, but Gibbs effect<br />
ripples aren't added by filters, they're just part of what a<br />
bandlimited signal ''is''.<br />
<br />
Even if we synthetically construct what looks like a perfect digital<br />
square wave,<br />
<br />
it's still limited to the channel bandwidth. Remember,<br />
the stairstep representation is misleading.<br />
<br />
What we really have here are instantaneous sample points,<br />
<br />
and only one bandlimited signal fits those points. All we did when we<br />
drew our apparently perfect square wave was line up the sample points<br />
just right so it appeared that there were no ripples if we played<br />
[[WikiPedia:Interpolation|connect-the-dots]].<br />
<br />
But the original bandlimited signal, complete with ripples, was<br />
still there.<br />
<br />
[[image:Dsat_014.gif|360px|right]]<br />
And that leads us to one more important point. You've probably heard<br />
that the timing precision of a digital signal is limited by its sample<br />
rate; put another way,<br />
<br />
that digital signals can't represent anything that falls between the<br />
samples.. implying that [[WikiPedia:Dirac_delta_function|impulses]] or<br />
[[WikiPedia:Synthesizer#ADSR_envelope|fast attacks]] have to align exactly<br />
with a sample, or the timing gets mangled... or they just disappear.<br />
<br />
At this point, we can easily see why that's wrong.<br />
<br />
Again, our input signals are bandlimited. And digital signals are<br />
samples, not stairsteps, not 'connect-the-dots'. We most certainly<br />
can, for example, put the rising edge of our bandlimited square wave<br />
anywhere we want between samples.<br />
<br />
It's represented perfectly and it's reconstructed perfectly.<br />
<br />
==Epilogue==<br />
<br />
[[Image:Moffey.jpg|360px|right]]<br />
<br />
Just like in [[Videos/A_Digital_Media_Primer_For_Geeks|the previous episode]], we've covered a broad range of<br />
topics, and yet barely scratched the surface of each one. If anything, my<br />
sins of omission are greater this time around... but this is a good<br />
stopping point.<br />
<br />
Or maybe, a good starting point. Dig deeper. Experiment. I chose my<br />
demos very carefully to be simple and give clear results. You can<br />
reproduce every one of them on your own if you like. But let's face<br />
it, sometimes we learn the most about a spiffy toy by breaking it open<br />
and studying all the pieces that fall out. And that's OK, we're<br />
engineers. Play with the demo parameters, hack up the code, set up<br />
alternate experiments. The source code for everything, including the<br />
little pushbutton demo application, is up at xiph.org.<br />
<br />
In the course of experimentation, you're likely to run into something<br />
that you didn't expect and can't explain. Don't worry! My earlier<br />
snark aside, Wikipedia is fantastic for exactly this kind of casual<br />
research. And, if you're really serious about understanding signals,<br />
several universities have advanced materials online, such as the<br />
[http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-003-signals-and-systems-spring-2010/index.htm 6.003]<br />
and<br />
[http://ocw.mit.edu/resources/res-6-007-signals-and-systems-spring-2011/ RES.6-007]<br />
Signals and Systems modules at MIT OpenCourseWare. And of<br />
course, there's always the [http://webchat.freenode.net/?channels=xiph community here at Xiph.Org].<br />
<br />
Digging deeper or not, I am out of coffee, so, until next time, happy<br />
hacking!<br />
<br />
==Credits==<br />
[[Image:Dmpfg_019.png|360px|right]]<br />
Written by: Christopher (Monty) Montgomery and the Xiph.Org Community<br />
<br />
Special thanks to:<br />
*Heidi Baumgartner, for the second Tektronix oscilloscope<br />
*Gregory Maxwell and Dr. Timothy Terriberry, for additional technical review<br />
<br />
Intro, title and credits music:<br><br />
"[http://music.lousyrobot.com/track/andy-warhol-is-gone Andy Warhol Is Gone]", by Lousy Robot<br><br />
Used by permission of Lousy Robot.<br><br />
Original source track All Rights Reserved.<br><br />
[http://www.lousyrobot.com www.lousyrobot.com]<br />
<br />
This Video Was Produced Entirely With Free and Open Source Software:<br><br />
<br />
*[http://www.gnu.org/ GNU]<br><br />
*[http://www.linux.org/ Linux]<br><br />
*[http://fedoraproject.org/ Fedora]<br><br />
*[http://cinelerra.org/ Cinelerra]<br><br />
*[http://www.gimp.org/ The Gimp]<br><br />
*[http://audacity.sourceforge.net/ Audacity]<br><br />
*[http://svn.xiph.org/trunk/postfish/README Postfish]<br><br />
*[http://gstreamer.freedesktop.org/ Gstreamer]<br><br />
<br />
All trademarks are the property of their respective owners. <br />
<br />
*''Complete video'' [http://creativecommons.org/licenses/by-sa/3.0/legalcode CC-BY-SA]<br><br />
*''Text transcript and Wiki edition'' [http://creativecommons.org/licenses/by-sa/3.0/legalcode CC-BY-SA]<br><br />
<br />
A Co-Production of Xiph.Org and Red Hat, Inc.<br><br />
(C) 2012-2013, Some Rights Reserved<br><br />
<br />
== Use The Source Luke ==<br />
<br />
As stated in the Epilogue, everything that appears in the video demos is driven by open source software, which means the source is both available for inspection and freely usable by the community. The Thinkpad that appears in the video was running Fedora 17 and Gnome Shell (Gnome 3). The demonstration software does not require Fedora specifically, but it does require Gnu/Linux to run in its current form. In all, the video involved just under 50,000 lines of new and custom-purpose code (including contributions to non-Xiph projects such as Cinelerra and Gromit).<br />
<br />
=== The Spectrum and Waveform Viewer ===<br />
<br />
The realtime software spectrum analyzer application that appears in the video was a preexisting application that was dusted off and updated for use in the video. The waveform viewer (effectively a simple software oscilloscope) was written from scratch making use of some of the internals from the spectrum analyzer application. Both are available from Xiph.Org svn:<br />
<br />
<center><div style="background-color:#DDDDDD;border-color:#CCCCCC;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
*Source for the Spectrum and Waveform applications is found at:<br />
https://svn.xiph.org/trunk/spectrum/<br />
*The source can be checked out of svn using the following command line:<br />
svn co https://svn.xiph.org/trunk/spectrum<br />
*Trac is a convenient way to browse the source without checking out a copy:<br />
https://trac.xiph.org/browser/trunk/spectrum<br />
</div></center><br />
<br />
Spectrum and Waveform both expect an input stream on the command line, either as raw data or as a WAV file.<br />
<br />
=== GTK-Bounce ===<br />
<br />
The touch-controlled application used in the video is named 'gtk-bounce' and was custom-written for the sole purpose of the in-video demonstrations. It is so named because, for the most part, all it does is read the input from an audio device, and then immediately write the same data back out for playback. It also forwards a copy of this data to up to two external monitoring applications, and in several demos, applies simple filters or generates simple waveforms. It includes several demos not included in the video.<br />
<br />
<center><div style="background-color:#DDDDDD;border-color:#CCCCCC;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
*Source for gtk-bounce is found at:<br />
https://svn.xiph.org/trunk/Xiph-episode-II/bounce/<br />
*The source can be checked out of svn using the following command line:<br />
svn co https://svn.xiph.org/trunk/Xiph-episode-II/bounce/<br />
*Trac is a convenient way to browse the source without checking out a copy:<br />
https://trac.xiph.org/browser/Xiph-episode-II/bounce/<br />
</div></center><br />
<br />
==== Starting Gtk-bounce ====<br />
The application is somewhat hardwired for specific demo parameters, but most of the hardwired settings can be found at the top of each source file. As found in SVN, the application expects an ALSA hardware audio device at hw:1, and if none if found, it will wait for one to appear. Once a sound device is successfully initialized, it expects to find and open two pipes named pipe0 and pipe1 for output in the current directory. In the video, the waveform and spectrum applications are started to take input from pipe0 and pipe1 respectively. The output sent to the two pipes is identical, and in most demos matches the output data sent to the hardware device for conversion to analog. The only exception is the tenth demo panel (which does not appear in the video) where gtk-bounce can be set to monitor the hardware inputs instead while the outputs are used to produce test waveforms.<br />
<br />
Assuming gtk-bounce, spectrum and waveform have been checked out and built, the configuration seen in the video can be started using the following commands:<br />
<center><div style="background-color:#DDDDDD;border-color:#CCCCCC;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
* make the pipe fifos for the applications to communicate (only needs to be done once)<br />
mkfifo pipe0 pipe1<br />
* start all three applications<br />
waveform pipe0 & spectrum pipe1 & gtk-bounce &<br />
</div></center><br />
<br />
==== Using Gtk-bounce ====<br />
<br />
Gtk-bounce consists of eleven pushbutton panels (numbered zero through ten) that can be selected by scrolling up and dwon with the arrow buttons on the right side. Each panel is intended for a specific demo or part of a demo.<br />
<br />
<center><div style="background-color:#DDDDDD;border-color:#CCCCCC;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
<br />
[[Image:Dsat-panel0.png|700px|center]]<br />
* '''Panel 0''': This panel presents buttons that allow the sound card to be configured in several sampling rates and bit depths. Samples read from the audio inputs are sent to the output pipes and audio outputs for playback without modification.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel1.png|700px|center]]<br />
* '''Panel 1''': Both channels are forwarded to the outputs, however the user may select the bit depth of each channel independently. When the sound card is running in 16 bit mode and 16-bit depth is selected, the data is untouched. Requantization to a lower bit depth is performed with a flat triangle dither.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel2.png|700px|center]]<br />
* '''Panel 2''': Both channels are re-quantized to the selected bit depth. Requantization to a lower bit depth is performed with a flat triangle dither.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel3.png|700px|center]]<br />
* '''Panel 3''': 'generate sine wave' discards the audio inputs and instead internally generates a sine wave at 32 bit precision, which is then quantized to the selected bit depth, optionally with dither. The resulting signal is then forwarded to the output. <br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel4.png|700px|center]]<br />
* '''Panel 4''': gtk-bounce generates a 16-bit sine wave of the selected amplitude, optionally with dither, and forwards the resulting signal to the outputs. The audio input from the audio device is discarded. Note that the slider sets the peak amplitude, not the peak-to-peak amplitude.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel5.png|700px|center]]<br />
* '''Panel 5''': generates a 16-bit sine wave, optionally quantized using dither. The user may additionally select a flat or a shaped dither. The 'notch and gain' button applies a notch filter to the resulting signal, and boosts the gain of the remaining noise so that it's easily audible. The audio input from the audio device is discarded.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel6.png|700px|center]]<br />
* '''Panel 6''': allows the user to play with the power of the dithering noise applied before quantizing the sine wave. Shaped or flat dither are available. The sine wave may also be modulated with a varying amplitude to highlight correlations between the input and the resulting quantization noise. The 'notch and gain' button applies a notch filter to the resulting signal, and boosts the gain of the remaining noise so that it's easily audible. The audio input from the audio device is discarded.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel7.png|700px|center]]<br />
* '''Panel 7''': applies a sharper antialiasing (lowpass) filter than is likely to be built into the sound-card hardware (as there's generally no reason to use a filter quite this sharp in practice). The very sharp filter allows us to bandpass the demonstration square wave without any harmonics landing in the transition band. The input is read from the audio device, passed through this sharper filter, and then forwarded to the outputs.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel8.png|700px|center]]<br />
* '''Panel 8''': when selected, generate a synthetic 'square wave' (this is not quite equivalent to a bandlimited analog square wave; the harmonic amplitudes are a bit different) that when aligned with the sampling phase just right gives the appearance of having infinite rise and fall time. The slider allows us to shift the waveform sample alignment back and forth by +/- one sample to reveal that the underlying signal is still band-limited.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel9.png|700px|center]]<br />
* '''Panel 9''': as in panel 8, generate a 'perfect' synthetic 'square wave'. However, the slider now allows us to shift the sample alignment of the second channel with respect to the first, instead of shifting both channels. This allows us the trigger/lock the scope timing to the channel 1 waveform so we can see the fractional sample movement and alignment of the waveform on channel 2. The audio input from the audio device is discarded.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel10.png|700px|center]]<br />
* '''Panel 10''': not used in the video; The audio device is configured to 24-bit input/output. The user may produce one of a range of test signals that are output to both the external applications and the audio device on the first channel. The input on the second channel is passed-through to the applications and audio device outputs unchanged. The first channel input is unused unless 'two input mode' is selected. When two input mode is selected, both input channels are read and the data sent to the external applications. Generated test signals are sent only to the audio hardware (on the first channel). This combination of test signals and input modes allows self-references frequency response, phase, noise, distortion and crosstalk testing of a given audio device.<br />
<br />
<div style="clear: both">&nbsp;</div><br />
<br />
</div></center><br />
<br />
=== Cairo Animations ===<br />
<br />
The animations featured throughout the Episode 2 video were rapid-development spaghetti hack-jobs coded by hand in raw Cairo. Each module generated a series of PNG stills that were then stitched into an animation with Cinelerra or mplayer. In the interest of pointing and laughing at what really bad code looks like...<br />
<br />
<center><div style="background-color:#DDDDDD;border-color:#CCCCCC;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
*Source for the Cairo animations is found at:<br />
https://svn.xiph.org/trunk/Xiph-episode-II/cairo/<br />
*The source can be checked out of svn using the following command line:<br />
svn co https://svn.xiph.org/trunk/Xiph-episode-II/cairo/<br />
*Trac is a convenient way to browse the source without checking out a copy:<br />
https://trac.xiph.org/browser/Xiph-episode-II/cairo/<br />
</div></center></div>Gmaxwellhttps://wiki.xiph.org/index.php?title=Talk:Videos/Digital_Show_and_Tell&diff=14032Talk:Videos/Digital Show and Tell2013-02-26T10:54:57Z<p>Gmaxwell: start the talk page</p>
<hr />
<div>Greetings, Feel free to comment here— just log in to edit— or join us on [http://webchat.freenode.net/?channels=xiph IRC chat]. --[[User:Gmaxwell|Gmaxwell]] 02:54, 26 February 2013 (PST)</div>Gmaxwellhttps://wiki.xiph.org/index.php?title=Videos/Digital_Show_and_Tell&diff=14023Videos/Digital Show and Tell2013-02-26T10:27:35Z<p>Gmaxwell: /* Bandlimitation and timing */ laxtex uniformity.</p>
<hr />
<div><small>''Wiki edition''</small><br />
[[Image:dsat_001.jpg|400px|right]]<br />
<br />
Continuing in the "firehose" tradition of [[Videos/A_Digital_Media_Primer_For_Geeks|Episode 01]], Xiph.Org's second video on digital media explores multiple facets of digital audio signals and how they ''really'' behave in the real world.<br />
<br />
Demonstrations of sampling, quantization, bit-depth, and dither explore digital audio behavior on real audio equipment using both modern digital analysis and vintage analog bench equipment, just in case we can't trust those newfangled digital gizmos. You can download the source code for each demo and try it all for yourself!<br />
<br/><br/><br/><br />
<center><font size="+2">[http://www.xiph.org/video/vid2.shtml Download or Watch online]</font></center><br />
<br style="clear:both;"/><br />
Supported players: [http://www.videolan.org/vlc/ VLC 1.1+], [https://www.mozilla.com/en-US/firefox/ Firefox ], [http://www.chromium.org/Home Chrome ], [http://www.opera.com/ Opera]. Or see [http://www.webmproject.org/users/ other WebM] or [[TheoraSoftwarePlayers|other Theora]] players.<br />
<br />
If you're having trouble with playback in a modern browser or player, please visit our [[Playback_Troubleshooting|playback troubleshooting and discussion]] page.<br />
<br/><br />
<hr/><br />
<br/><br/><br/><br />
[[Image:Xiph_ep02_test.png|400px|right]]<br />
<br />
&ldquo;Hi, I'm Monty Montgomery from [http://www.redhat.com/ Red Hat] and [http://xiph.org/ Xiph.Org].<br />
<br />
&ldquo;A few months ago, I wrote<br />
[http://people.xiph.org/~xiphmont/demo/neil-young.html an article on digital audio and why 24bit/192kHz music downloads don't make sense].<br />
In the article, I<br />
mentioned--almost in passing--that a digital waveform is<br />
[http://people.xiph.org/~xiphmont/demo/neil-young.html#toc_sfam not a stairstep],<br />
and you certainly don't get a stairstep when you<br />
[[WikiPedia:Digital-to-analog_converter|convert from digital back to analog]].<br />
<br />
&ldquo;Of everything in the entire article, '''that''' was the number one thing<br />
people wrote about. In fact, more than half the mail I got was questions and<br />
comments about basic digital signal behavior. Since there's interest, let's<br />
take a little time to play with some ''simple'' digital signals. &rdquo;<br />
<br />
==Veritas ex machina==<br />
[[Image:Dsat_002.jpg|200px|right]]<br />
[[Image:Dsat_003.jpg|200px|right]]<br />
[[Image:Dsat_004.jpg|200px|right]]<br />
[[Image:Dsat_005.jpg|200px|right]]<br />
<br />
If we pretend for a moment that we have no idea how digital signals really<br />
behave, then it doesn't make sense for us to use digital test<br />
equipment. Fortunately for this exercise, there's still plenty<br />
of working analog lab equipment out there.<br />
<br />
We need a [[WikiPedia:Function_generator|signal generator]] to provide us with analog input<br />
signals--in this case, an<br />
[http://www.home.agilent.com/en/pd-3325A%3Aepsg%3Apro-pn-3325A/synthesizer-function-generator?pm=PL&nid=-536900197.536896863&cc=SE&lc=swe HP3325]<br />
from 1978.<br />
<br />
We'll observe our analog waveforms on [[WikiPedia:Oscilloscope_types#Cathode-ray_oscilloscope_.28CRO.29|analog oscilloscopes]],<br />
like this Tektronix 2246 from the mid-90s, one of the last and best analog scopes made.<br />
<br />
Finally, we'll inspect the [[WikiPedia:Spectral_density#Electrical_engineering|frequency spectrum]] of our signals using an<br />
[[WikiPedia:Spectrum_analyzer#Swept-tuned|analog spectrum analyzer]], this<br />
[http://www.home.agilent.com/en/pd-3585A%3Aepsg%3Apro-pn-3585A/spectrum-analyzer-high-perf-20hz-40mhz?pm=PL&nid=-536900197.536897319&cc=SE&lc=swe HP3585]<br />
from the same product line as<br />
the signal generator. Like the other equipment here it has<br />
[http://www.hp9845.net/9845/hardware/processors/ a rudimentary and hilariously large microcontroller],<br />
but the signal path<br />
from input to what you see on the screen is completely analog.<br />
<br />
All of this equipment is vintage, but the specs are still quite good.<br />
We start with the signal generator set to output a 1 [[WikiPedia:Hertz#SI_multiples|kHz]]<br />
sine wave at one [[WikiPedia:Volt|Volt]] [[WikiPedia:Amplitude#Root_mean_square_amplitude|RMS]].<br />
We see the sine wave on the oscilloscope, can verify that it is indeed<br />
1 kHz at 1 Volt RMS, which is 2.8 Volts<br />
[[WikiPedia:Amplitude#Peak-to-peak_amplitude|peak-to-peak]],<br />
and that matches the<br />
measurement on the spectrum analyzer as well.<br />
<br />
The analyzer also shows some low-level [[WikiPedia:White_noise|white noise]]<br />
and just a bit of [[WikiPedia:Harmonic_distortion#Harmonic_distortion|harmonic distortion]],<br />
with the highest peak about 70[[WikiPedia:Decibel|dB]] or so below<br />
[[WikiPedia:Fundamental_frequency|the fundamental]].<br />
This doesn't matter to the demos, but it's good to take notice of it now to avoid confusion later.<br />
<br />
For digital conversion, we use a boring, consumer-grade, eMagic USB1<br />
audio device. It's more than ten years old at this point, and it's<br />
getting obsolete.<br />
<br />
A recent converter can easily have an order of magnitude better specs.<br />
[[WikiPedia:Reconstruction_filter#Sampled_data_reconstruction_filters|Flatness]],<br />
[[WikiPedia:Analog-to-digital_converter#Non-linearity|linearity]],<br />
[[WikiPedia:Jitter#Sampling_jitter|jitter]],<br />
[[WikiPedia:Noise_floor|noise behavior]],<br />
[[WikiPedia:Digital-to-analog_converter#DAC_performance|everything]]...<br />
You may not<br />
have noticed. Just because we can measure an improvement doesn't<br />
mean we can hear it, and even these old consumer boxes were already at<br />
the edge of ideal transparency.<br />
<br />
The eMagic connects to my ThinkPad, which displays a digital<br />
waveform and spectrum for comparison, then the ThinkPad<br />
sends the digital signal right back out to the eMagic for<br />
re-conversion to analog and observation on the output scopes.<br />
<br />
<br style="clear:both;"/><br />
<br />
==Stairsteps==<br />
[[Image:Dsat 006.jpg|360px|right]]<br />
[[Image:Dsat 007.png|360px|right]]<br />
&ldquo;OK, it's go time. We begin by converting an analog signal to digital and<br />
then right back to analog again with no other steps.&rdquo;<br />
<br />
&ldquo;The signal generator is set to produce a 1kHz sine wave just like<br />
before.&rdquo;<br />
<br />
&ldquo;We can see our analog sine wave on our input-side oscilloscope.&rdquo;<br />
<br />
&ldquo;We digitize our signal to<br />
[[Videos/A_Digital_Media_Primer_For_Geeks#Raw_.28digital_audio.29_meat|16 bit PCM at 44.1kHz]],<br />
same as on a CD.&rdquo;<br />
<br />
&ldquo;The spectrum of the digitized signal matches what we saw earlier and what we see now on the analog spectrum analyzer, aside from its <br />
[[WikiPedia:High_impedance|high-impedance input]] being just a smidge noisier.&rdquo;<br />
<br />
&ldquo;For now, the waveform display shows our digitized sine wave as a<br />
stairstep pattern, one step for each sample.&rdquo;<br />
<br />
&ldquo;And when we look at the output signal that's been converted<br />
from digital back to analog, we see...&rdquo;<br />
<br />
&ldquo;It's exactly like the original sine wave. No stairsteps.&rdquo;<br />
<br />
&ldquo;OK, 1 kHz is still a fairly low frequency, maybe the stairsteps are just<br />
hard to see or they're being smoothed away. Fair enough. Let's choose<br />
a higher frequency, something close to [[WikiPedia:Nyquist_frequency|Nyquist]], say 15kHz.&rdquo;<br />
<br />
&ldquo;Now the sine wave is represented by less than three samples per cycle, and... the digital waveform looks pretty awful. Well, looks<br />
can be deceiving. The analog output... is still a perfect sine wave, exactly like the original.&rdquo;<br />
<br />
&ldquo;Let's keep going up.&rdquo;<br />
<br />
&ldquo;16kHz.... 17kHz... 18kHz... 19kHz...&rdquo;<br />
<br />
&ldquo;20kHz. Welcome to the upper limits of human hearing. The output waveform is still perfect. No jagged edges, no dropoff, no stairsteps.&rdquo;<br />
<br />
&ldquo;So where'd the stairsteps go? Don't answer, it's a trick question. They were never there.&rdquo;<br />
<br />
&ldquo;Drawing a digital waveform as a stairstep was wrong to begin with.&rdquo;<br />
<br />
&ldquo;Why? A stairstep is a continuous-time function. It's jagged, and it's piecewise, but it has a defined value at every point in time.&rdquo;<br />
<br />
&ldquo;A sampled signal is entirely different. It's discrete-time; it's only got a value right at each instantaneous sample point and it's<br />
undefined, there is no value at all, everywhere between. A discrete-time signal is properly drawn as a lollipop graph.&rdquo;<br />
<br />
&ldquo;The continuous, analog counterpart of a digital signal passes smoothly through each sample point, and that's just as true for high<br />
frequencies as it is for low.&rdquo;<br />
<br />
&ldquo;Now, the interesting and not at all obvious bit is: [[WikiPedia:Nyquist%E2%80%93Shannon_sampling_theorem|there's only one<br />
bandlimited signal that passes exactly through each sample point]]. It's a unique solution. So if you sample a bandlimited signal and then convert it back, the original input is also the only possible output.&rdquo;<br />
<br />
[[Image:Dsat 008.png|360px|right]]<br />
<br />
&ldquo;And before you say, "oh, I can draw a different signal that passes through those points", well, yes you can, but if it differs even<br />
minutely from the original, it includes frequency content at or beyond Nyquist, breaks the bandlimiting requirement and isn't a valid solution.&rdquo;<br />
<br />
&ldquo;So how did everyone get confused and start thinking of digital signals as stairsteps? I can think of two good reasons.&rdquo;<br />
<br />
&ldquo;First: it's easy enough to convert a sampled signal to a true stairstep. Just<br />
extend each sample value forward until the next sample period. This is<br />
called a [[WikiPedia:Zero-order hold|zero-order hold]], and it's an important part of how some<br />
digital-to-analog converters work, especially the simplest ones.&rdquo;<br />
<br />
&ldquo;So, anyone who looks up [[WikiPedia:Digital-to-analog_converter#Practical_operation|digital-to-analog converter or<br />
digital-to-analog conversion]] is probably going to see a diagram of a<br />
stairstep waveform somewhere, but that's not a finished conversion,<br />
and it's not the signal that comes out.&rdquo;<br />
<br />
&ldquo;Second, and this is probably the more likely reason, engineers who<br />
supposedly know better, like me, draw stairsteps even though they're<br />
technically wrong. It's a sort of like a one-dimensional version of<br />
[[WikiPedia:MacPaint#Development|fat bits in an image editor]].&rdquo;<br />
<br />
&ldquo;Pixels aren't squares either, they're samples of a 2-dimensional<br />
function space and so they're also, conceptually, infinitely small<br />
points. Practically, it's a real pain in the ass to see or manipulate<br />
infinitely small anything, so big squares it is. Digital stairstep<br />
drawings are exactly the same thing.&rdquo;<br />
<br />
&ldquo;It's just a convenient drawing. The stairsteps aren't really there.&rdquo;<br />
<br />
==Bit-depth==<br />
[[Image:Dsat_009.jpg|360px|right]]<br />
[[Image:Dsat_010.jpg|260px|right]]<br />
<br />
When we convert a digital signal back to analog, the result is<br />
''also'' smooth regardless of the [[WikiPedia:Audio_bit_depth|bit depth]]. 24 bits or 16 bits...<br />
or 8 bits... it doesn't matter.<br />
<br />
So does that mean that the digital bit depth makes no difference at<br />
all? Of course not.<br />
<br />
Channel 2 here is the same sine wave input, but we quantize with<br />
[[WikiPedia:Dither|dither]] down to 8 bits.<br />
<br />
On the scope, we still see a nice<br />
smooth sine wave on channel 2. Look very close, and you'll also see a<br />
bit more noise. That's a clue.<br />
<br />
If we look at the spectrum of the signal... aha! Our sine wave is<br />
still there unaffected, but the noise level of the 8-bit signal on<br />
the second channel is much higher!<br />
<br />
And that's the difference the number of bits makes. That's it!<br />
<br />
When we digitize a signal, first we sample it. The<br />
sampling step is perfect; it loses nothing. But then we [[WikiPedia:Quantization_(sound_processing)|quantize]] it,<br />
and [[WikiPedia:Quantization_error|quantization adds noise]].<br />
<br />
The number of bits determines how much noise and so the level of the<br />
noise floor.<br />
<br />
What does this dithered quantization noise sound like? Let's listen<br />
to our 8-bit sine wave.<br />
<br />
That may have been hard to hear anything but the tone. Let's listen<br />
to just the noise after we notch out the sine wave and then bring the<br />
gain up a bit because the noise is quiet.<br />
<br />
Those of you who have used analog recording equipment may have just<br />
thought to yourselves, "My goodness! That sounds like tape hiss!"<br />
Well, it doesn't just sound like tape hiss, it acts like it too, and<br />
if we use a [[WikiPedia:Dither#Different_types|gaussian dither]] then it's<br />
[[WikiPedia:Central_limit_theorem|mathematically equivalent]] in every way. It ''is'' tape hiss.<br />
<br />
Intuitively, that means that we can measure tape hiss and thus the noise floor<br />
of [[WikiPedia:Magnetic_tape_sound_recording|magnetic audio tape]]<br />
in [[WikiPedia:Shannon–Hartley_theorem#Examples|bits instead of decibels]], in order to put things in a<br />
digital perspective. [[WikiPedia:Compact cassettes|Compact cassettes]] (for those of you who are old enough to remember them) could reach as<br />
deep as 9 bits in perfect conditions, though 5 to 6 bits was<br />
more typical, especially if it was a recording made on a<br />
[[WikiPedia:Cassette_deck|tape deck]]. That's right... your mix tapes were only about 6 bits<br />
deep... if you were lucky!<br />
<br />
The very best professional [[WikiPedia:Reel-to-reel_audio_tape_recording|open reel tape]] used in studios could barely<br />
hit... any guesses? 13 bits ''with'' [[WikiPedia:Reel-to-reel_audio_tape_recording#Noise_reduction|advanced noise reduction]]. And<br />
that's why seeing '[[WikiPedia:SPARS_code|D D D]]' on a [[WikiPedia:Compact_disk|Compact Disc]] used to be such a big,<br />
high-end deal.<br />
<br />
==Dither==<br />
[[Image:Dsat_011.png|360px|right]]<br />
<br />
I keep saying that I'm quantizing with [[Wikipedia:dither|dither]], so what is dither<br />
exactly and, more importantly, what does it do?<br />
<br />
The simple way to quantize a signal is to choose the digital<br />
amplitude value closest to the original analog amplitude. [[WikiPedia:Rounding|Obvious]],<br />
right? Unfortunately, the exact noise you get from this simple<br />
quantization scheme depends somewhat on the input signal,<br />
<br />
so we may get noise that's inconsistent, or causes distortion, or is<br />
undesirable in some other way.<br />
<br style="clear:both;"/><br />
<center><div style="background-color:#DDDDFF;border-color:#CCCCDD;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
'''Going deeper…'''<br />
*Cameron Nicklaus Christou's thesis [http://uwspace.uwaterloo.ca/bitstream/10012/3867/1/thesis.pdf Optimal Dither and Noise Shaping in Image Processing] provides an ''excellent'' explanation of dither and noise shaping.<br />
</div></center><br />
<br />
Dither is specially-constructed noise that substitutes for the noise<br />
produced by simple quantization. Dither doesn't [[WikiPedia:Sound_masking|drown out or mask]]<br />
quantization noise, it actually replaces it with noise characteristics<br />
of our choosing that aren't influenced by the input.<br />
<br />
Let's ''watch'' what dither does. The signal generator has too much noise for this test so we'll produce a mathematically perfect sine wave with the ThinkPad and quantize it to 8 bits with dithering.<br />
<br />
We see a nice sine wave on the waveform display and output scope and, once the analog spectrum analyzer catches up...<br />
a clean frequency peak with a uniform noise floor on both spectral displays<br />
just like before. Again, this is with dither.<br />
<br />
Now I turn dithering off.<br />
<br />
The quantization noise, that dither had spread out into a nice, flat noise<br />
floor, piles up into harmonic distortion peaks. The noise floor is<br />
lower, but the level of distortion becomes nonzero, and the distortion<br />
peaks sit higher than the dithering noise did.<br />
<br />
At 8 bits this effect is exaggerated. At 16 bits,<br />
even without dither, harmonic distortion is going to be so low as to<br />
be completely inaudible.<br />
<br />
Still, we can use dither to eliminate it completely if we so choose.<br />
<br />
Turning the dither off again for a moment, you'll notice that the<br />
absolute level of distortion from undithered quantization stays<br />
approximately constant regardless of the input amplitude.<br />
But when the signal level drops below a half a bit, everything<br />
quantizes to zero.<br />
<br />
In a sense, everything quantizing to zero is just 100% distortion!<br />
Dither eliminates this distortion too. We reenable dither<br />
and ... there's our signal back at 1/4 bit, with our nice flat noise floor.<br />
<br />
The noise floor doesn't have to be flat. Dither is noise of our<br />
choosing, so let's choose a noise as [http://www.acoustics.salford.ac.uk/res/cox/sound_quality/?content=subjective inoffensive] and<br />
[[WikiPedia:Absolute_threshold_of_hearing|difficult to notice]]<br />
as possible.<br />
<br />
Our hearing is most sensitive in the midrange from 2kHz to 4kHz,<br />
so that's where background noise is going to be the most obvious.<br />
We can [[WikiPedia:Noise_shaping|shape dithering noise]] away from sensitive frequencies to where<br />
hearing is less sensitive, usually the highest frequencies.<br />
<br />
16-bit dithering noise is normally much too quiet to hear at all, but<br />
let's listen to our noise shaping example, again with the gain<br />
brought way up...<br />
<br />
Lastly, dithered quantization noise ''is'' higher [[WikiPedia:Sound_power|power]] overall<br />
than undithered quantization noise even when it sounds quieter, and<br />
you can see that on a [[WikiPedia:VU_meter|VU meter]] during passages of near-silence. But<br />
dither isn't only an on or off choice. We can reduce the dither's<br />
power to balance less noise against a bit of distortion to minimize<br />
the overall effect.<br />
<br />
We'll also [[WikiPedia:Amplitude_modulation|modulate the input signal]] like this to show how a varying input affects the quantization noise. At<br />
full dithering power, the noise is uniform, constant, and featureless<br />
just like we expect:<br />
<br />
As we reduce the dither's power, the input increasingly<br />
affects the amplitude and the character of the quantization noise.<br />
Shaped dither behaves similarly, but noise shaping lends one more nice<br />
advantage. To make a long story short, it can use a somewhat lower<br />
dither power before the input has as much effect on the output.<br />
<br />
Despite all the time I just spent on dither, we're talking about<br />
differences that start 100 decibels and more below [[WikiPedia:Full_scale|full scale]]. Maybe<br />
if the CD had been<br />
[http://www.research.philips.com/technologies/projects/cd/index.html 14 bits as originally designed],<br />
dither ''might'' be<br />
more important. Maybe. At 16 bits, really, it's mostly a wash. You<br />
can think of dither as an insurance policy that gives several extra<br />
decibels of dynamic range just in case. The simple fact is, though, no<br />
one ever ruined a great recording by not dithering the final master.<br />
<br />
==Bandlimitation and timing==<br />
[[image:Dsat_016.jpg|360px|right]]<br />
<br />
We've been using [[WikiPedia:Sine_wave|sine waves]]. They're the obvious choice when what we<br />
want to see is a system's behavior at a given isolated frequency. Now let's look at something a bit more complex. What should we expect to happen when I change the input to a [[WikiPedia:Square_wave|square wave]]... The input scope confirms our 1kHz square wave. The output scope shows… Exactly what it should.<br />
<br />
What is a square wave really? <br />
<br />
Well, we can say it's a waveform that's some positive value for half a cycle and then transitions instantaneously to a negative value for the other half.<br />
<br />
:<math><br />
\ squarewave(t) = \begin{cases} 1, & |t| < T_1 \\ 0, & T_1 < |t| \leq {1 \over 2}T \end{cases}<br />
</math><br />
<br />
But that doesn't really tell us anything useful about how that input becomes this output.<br />
<br />
Then we remember that any waveform is also [[WikiPedia:Fourier_series|the sum of discrete frequencies]],<br />
and a square wave is particularly simple sum: a fundamental and an infinite series of [[WikiPedia:Even_and_odd_functions#Harmonics|odd harmonics]]. Sum them all up, you get a square wave.<br />
<br />
[[image:Dsat_013.jpg|360px|right]]<br />
:<math>\begin{align}<br />
\ squarewave(t) = \frac{4}{\pi}\sin(\omega t) + \frac{4}{3\pi}\sin(3\omega t) + \frac{4}{5\pi}\sin(5\omega t) + \\<br />
\frac{4}{7\pi}\sin(7\omega t) + \frac{4}{9\pi}\sin(9\omega t) + \frac{4}{11\pi}\sin(11\omega t) + \\ <br />
\frac{4}{13\pi}\sin(13\omega t) + \frac{4}{15\pi}\sin(15\omega t) + \frac{4}{17\pi}\sin(17\omega t) + \\<br />
\frac{4}{19\pi}\sin(19\omega t) + \frac{4}{21\pi}\sin(21\omega t) + \frac{4}{23\pi}\sin(23\omega t) + \\<br />
\frac{4}{25\pi}\sin(25\omega t) + \frac{4}{27\pi}\sin(27\omega t) + \frac{4}{29\pi}\sin(29\omega t) + \\<br />
\frac{4}{31\pi}\sin(31\omega t) + \frac{4}{33\pi}\sin(33\omega t) + \cdots <br />
\end{align}</math><br />
<br />
At first glance, that doesn't seem very useful either. You have to sum up an infinite number of harmonics to get the answer. ''Ah'', but we don't have an infinite number of harmonics.<br />
<br />
We're using a quite sharp [[WikiPedia:Low-pass_filter|anti-aliasing filter]] that cuts off right<br />
above 20kHz, so our signal is [[WikiPedia:Bandlimiting|bandlimited]] and only the first ten terms make it through.<br />
<br />
..and that's exactly what we see on the output scope.<br />
<br />
<br style="clear:both;"/><br />
<center><div style="background-color:#DDDDFF;border-color:#CCCCDD;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
'''Going deeper…'''<br />
*In modern web browsers you can program audio synthesizers directly in javascript. Use the two square wave formulas to get a square wave out of [http://js.do/blog/sound-waves-with-javascript/ this page]. (Note: The scope is not very accurate/useful.) <br />
</div></center><br />
<br />
[[Image:dsat_015.jpg|360px|right]]<br />
The rippling you see around sharp edges in a bandlimited signal is called the [[WikiPedia:/Gibbs_phenomenon|Gibbs effect]]. It happens whenever you slice off part of the frequency domain in the middle of nonzero energy.<br />
<br />
The usual rule of thumb you'll hear is "the sharper the cutoff, the<br />
stronger the rippling", which is approximately true, but we have to be<br />
careful how we think about it.<br />
<br />
<br />
For example... what would you expect our quite sharp anti-aliasing filter<br />
to do if I run our signal through it a second time?<br />
<br />
Aside from adding a few fractional cycles of delay, the answer is...<br />
nothing at all. The signal is already bandlimited. Bandlimiting it<br />
again doesn't do anything. A second pass can't remove frequencies<br />
that we already removed.<br />
<br />
And that's important. People tend to think of the ripples as<br />
a kind of [[WikiPedia:Sonic_artifact|artifact]] that's added by anti-aliasing and [[WikiPedia:Reconstruction_filter|anti-imaging]]<br />
filters, implying that the ripples get worse each time the signal<br />
passes through. We can see that in this case that didn't happen. So<br />
was it really the filter that added the ripples the first time<br />
through? No, not really. It's a subtle distinction, but Gibbs effect<br />
ripples aren't added by filters, they're just part of what a<br />
bandlimited signal ''is''.<br />
<br />
Even if we synthetically construct what looks like a perfect digital<br />
square wave,<br />
<br />
it's still limited to the channel bandwidth. Remember,<br />
the stairstep representation is misleading.<br />
<br />
What we really have here are instantaneous sample points,<br />
<br />
and only one bandlimited signal fits those points. All we did when we<br />
drew our apparently perfect square wave was line up the sample points<br />
just right so it appeared that there were no ripples if we played<br />
[[WikiPedia:Interpolation|connect-the-dots]].<br />
<br />
But the original bandlimited signal, complete with ripples, was<br />
still there.<br />
<br />
[[image:Dsat_014.gif|360px|right]]<br />
And that leads us to one more important point. You've probably heard<br />
that the timing precision of a digital signal is limited by its sample<br />
rate; put another way,<br />
<br />
that digital signals can't represent anything that falls between the<br />
samples.. implying that [[WikiPedia:Dirac_delta_function|impulses]] or<br />
[[WikiPedia:Synthesizer#ADSR_envelope|fast attacks]] have to align exactly<br />
with a sample, or the timing gets mangled... or they just disappear.<br />
<br />
At this point, we can easily see why that's wrong.<br />
<br />
Again, our input signals are bandlimited. And digital signals are<br />
samples, not stairsteps, not 'connect-the-dots'. We most certainly<br />
can, for example, put the rising edge of our bandlimited square wave<br />
anywhere we want between samples.<br />
<br />
It's represented perfectly and it's reconstructed perfectly.<br />
<br />
==Epilogue==<br />
<br />
[[Image:Moffey.jpg|360px|right]]<br />
<br />
Just like in [[Videos/A_Digital_Media_Primer_For_Geeks|the previous episode]], we've covered a broad range of<br />
topics, and yet barely scratched the surface of each one. If anything, my<br />
sins of omission are greater this time around... but this is a good<br />
stopping point.<br />
<br />
Or maybe, a good starting point. Dig deeper. Experiment. I chose my<br />
demos very carefully to be simple and give clear results. You can<br />
reproduce every one of them on your own if you like. But let's face<br />
it, sometimes we learn the most about a spiffy toy by breaking it open<br />
and studying all the pieces that fall out. And that's OK, we're<br />
engineers. Play with the demo parameters, hack up the code, set up<br />
alternate experiments. The source code for everything, including the<br />
little pushbutton demo application, is up at xiph.org.<br />
<br />
In the course of experimentation, you're likely to run into something<br />
that you didn't expect and can't explain. Don't worry! My earlier<br />
snark aside, Wikipedia is fantastic for exactly this kind of casual<br />
research. And, if you're really serious about understanding signals,<br />
several universities have advanced materials online, such as the<br />
[http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-003-signals-and-systems-spring-2010/index.htm 6.003]<br />
and<br />
[http://ocw.mit.edu/resources/res-6-007-signals-and-systems-spring-2011/ RES.6-007]<br />
Signals and Systems modules at MIT OpenCourseWare. And of<br />
course, there's always the [http://webchat.freenode.net/?channels=xiph community here at Xiph.Org].<br />
<br />
Digging deeper or not, I am out of coffee, so, until next time, happy<br />
hacking!<br />
<br />
==Credits==<br />
[[Image:Dmpfg_019.png|360px|right]]<br />
Written by: Christopher (Monty) Montgomery and the Xiph.Org Community<br />
<br />
Special thanks to:<br />
*Heidi Baumgartner, for the second Tektronix oscilloscope<br />
*Gregory Maxwell and Dr. Timothy Terriberry, for additional technical review<br />
<br />
Intro, title and credits music:<br><br />
"[http://music.lousyrobot.com/track/andy-warhol-is-gone Andy Warhol Is Gone]", by Lousy Robot<br><br />
Used by permission of Lousy Robot.<br><br />
Original source track All Rights Reserved.<br><br />
[http://www.lousyrobot.com www.lousyrobot.com]<br />
<br />
This Video Was Produced Entirely With Free and Open Source Software:<br><br />
<br />
*[http://www.gnu.org/ GNU]<br><br />
*[http://www.linux.org/ Linux]<br><br />
*[http://fedoraproject.org/ Fedora]<br><br />
*[http://cinelerra.org/ Cinelerra]<br><br />
*[http://www.gimp.org/ The Gimp]<br><br />
*[http://audacity.sourceforge.net/ Audacity]<br><br />
*[http://svn.xiph.org/trunk/postfish/README Postfish]<br><br />
*[http://gstreamer.freedesktop.org/ Gstreamer]<br><br />
<br />
All trademarks are the property of their respective owners. <br />
<br />
*''Complete video'' [http://creativecommons.org/licenses/by-sa/3.0/legalcode CC-BY-SA]<br><br />
*''Text transcript and Wiki edition'' [http://creativecommons.org/licenses/by-sa/3.0/legalcode CC-BY-SA]<br><br />
<br />
A Co-Production of Xiph.Org and Red Hat, Inc.<br><br />
(C) 2012-2013, Some Rights Reserved<br><br />
<br />
== Use The Source Luke ==<br />
<br />
As stated in the Epilogue, everything that appears in the video demos is driven by open source software, which means the source is both available for inspection and freely usable by the community. The Thinkpad that appears in the video was running Fedora 17 and Gnome Shell (Gnome 3). The demonstration software does not require Fedora specifically, but it does require Gnu/Linux to run in its current form. In all, the video involved just under 50,000 lines of new and custom-purpose code (including contributions to non-Xiph projects such as Cinelerra and Gromit).<br />
<br />
=== The Spectrum and Waveform Viewer ===<br />
<br />
The realtime software spectrum analyzer application that appears in the video was a preexisting application that was dusted off and updated for use in the video. The waveform viewer (effectively a simple software oscilloscope) was written from scratch making use of some of the internals from the spectrum analyzer application. Both are available from Xiph.Org svn:<br />
<br />
<center><div style="background-color:#DDDDDD;border-color:#CCCCCC;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
*Source for the Spectrum and Waveform applications is found at:<br />
https://svn.xiph.org/trunk/spectrum/<br />
*The source can be checked out of svn using the following command line:<br />
svn co https://svn.xiph.org/trunk/spectrum<br />
*Trac is a convenient way to browse the source without checking out a copy:<br />
https://trac.xiph.org/browser/trunk/spectrum<br />
</div></center><br />
<br />
Spectrum and Waveform both expect an input stream on the command line, either as raw data or as a WAV file.<br />
<br />
=== GTK-Bounce ===<br />
<br />
The touch-controlled application used in the video is named 'gtk-bounce' and was custom-written for the sole purpose of the in-video demonstrations. It is so named because, for the most part, all it does is read the input from an audio device, and then immediately write the same data back out for playback. It also forwards a copy of this data to up to two external monitoring applications, and in several demos, applies simple filters or generates simple waveforms. It includes several demos not included in the video.<br />
<br />
<center><div style="background-color:#DDDDDD;border-color:#CCCCCC;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
*Source for gtk-bounce is found at:<br />
https://svn.xiph.org/trunk/Xiph-episode-II/bounce/<br />
*The source can be checked out of svn using the following command line:<br />
svn co https://svn.xiph.org/trunk/Xiph-episode-II/bounce/<br />
*Trac is a convenient way to browse the source without checking out a copy:<br />
https://trac.xiph.org/browser/Xiph-episode-II/bounce/<br />
</div></center><br />
<br />
==== Starting Gtk-bounce ====<br />
The application is somewhat hardwired for specific demo parameters, but most of the hardwired settings can be found at the top of each source file. As found in SVN, the application expects an ALSA hardware audio device at hw:1, and if none if found, it will wait for one to appear. Once a sound device is successfully initialized, it expects to find and open two pipes named pipe0 and pipe1 for output in the current directory. In the video, the waveform and spectrum applications are started to take input from pipe0 and pipe1 respectively. The output sent to the two pipes is identical, and in most demos matches the output data sent to the hardware device for conversion to analog. The only exception is the tenth demo panel (which does not appear in the video) where gtk-bounce can be set to monitor the hardware inputs instead while the outputs are used to produce test waveforms.<br />
<br />
Assuming gtk-bounce, spectrum and waveform have been checked out and built, the configuration seen in the video can be started using the following commands:<br />
<center><div style="background-color:#DDDDDD;border-color:#CCCCCC;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
* make the pipe fifos for the applications to communicate (only needs to be done once)<br />
mkfifo pipe0 pipe1<br />
* start all three applications<br />
waveform pipe0 & spectrum pipe1 & gtk-bounce &<br />
</div></center><br />
<br />
==== Using Gtk-bounce ====<br />
<br />
Gtk-bounce consists of eleven pushbutton panels (numbered zero through ten) that can be selected by scrolling up and dwon with the arrow buttons on the right side. Each panel is intended for a specific demo or part of a demo.<br />
<br />
<center><div style="background-color:#DDDDDD;border-color:#CCCCCC;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
<br />
[[Image:Dsat-panel0.png|700px|center]]<br />
* '''Panel 0''': This panel presents buttons that allow the sound card to be configured in several sampling rates and bit depths. Samples read from the audio inputs are sent to the output pipes and audio outputs for playback without modification.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel1.png|700px|center]]<br />
* '''Panel 1''': Both channels are forwarded to the outputs, however the user may select the bit depth of each channel independently. When the sound card is running in 16 bit mode and 16-bit depth is selected, the data is untouched. Requantization to a lower bit depth is performed with a flat triangle dither.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel2.png|700px|center]]<br />
* '''Panel 2''': Both channels are re-quantized to the selected bit depth. Requantization to a lower bit depth is performed with a flat triangle dither.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel3.png|700px|center]]<br />
* '''Panel 3''': 'generate sine wave' discards the audio inputs and instead internally generates a sine wave at 32 bit precision, which is then quantized to the selected bit depth, optionally with dither. The resulting signal is then forwarded to the output. <br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel4.png|700px|center]]<br />
* '''Panel 4''': gtk-bounce generates a 16-bit sine wave of the selected amplitude, optionally with dither, and forwards the resulting signal to the outputs. The audio input from the audio device is discarded. Note that the slider sets the peak amplitude, not the peak-to-peak amplitude.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel5.png|700px|center]]<br />
* '''Panel 5''': generates a 16-bit sine wave, optionally quantized using dither. The user may additionally select a flat or a shaped dither. The 'notch and gain' button applies a notch filter to the resulting signal, and boosts the gain of the remaining noise so that it's easily audible. The audio input from the audio device is discarded.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel6.png|700px|center]]<br />
* '''Panel 6''': allows the user to play with the power of the dithering noise applied before quantizing the sine wave. Shaped or flat dither are available. The sine wave may also be modulated with a varying amplitude to highlight correlations between the input and the resulting quantization noise. The 'notch and gain' button applies a notch filter to the resulting signal, and boosts the gain of the remaining noise so that it's easily audible. The audio input from the audio device is discarded.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel7.png|700px|center]]<br />
* '''Panel 7''': applies a sharper antialiasing (lowpass) filter than is likely to be built into the sound-card hardware (as there's generally no reason to use a filter quite this sharp in practice). The very sharp filter allows us to bandpass the demonstration square wave without any harmonics landing in the transition band. The input is read from the audio device, passed through this sharper filter, and then forwarded to the outputs.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel8.png|700px|center]]<br />
* '''Panel 8''': when selected, generate a synthetic 'square wave' (this is not quite equivalent to a bandlimited analog square wave; the harmonic amplitudes are a bit different) that when aligned with the sampling phase just right gives the appearance of having infinite rise and fall time. The slider allows us to shift the waveform sample alignment back and forth by +/- one sample to reveal that the underlying signal is still band-limited.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel9.png|700px|center]]<br />
* '''Panel 9''': as in panel 8, generate a 'perfect' synthetic 'square wave'. However, the slider now allows us to shift the sample alignment of the second channel with respect to the first, instead of shifting both channels. This allows us the trigger/lock the scope timing to the channel 1 waveform so we can see the fractional sample movement and alignment of the waveform on channel 2. The audio input from the audio device is discarded.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel10.png|700px|center]]<br />
* '''Panel 10''': not used in the video; The audio device is configured to 24-bit input/output. The user may produce one of a range of test signals that are output to both the external applications and the audio device on the first channel. The input on the second channel is passed-through to the applications and audio device outputs unchanged. The first channel input is unused unless 'two input mode' is selected. When two input mode is selected, both input channels are read and the data sent to the external applications. Generated test signals are sent only to the audio hardware (on the first channel). This combination of test signals and input modes allows self-references frequency response, phase, noise, distortion and crosstalk testing of a given audio device.<br />
<br />
<div style="clear: both">&nbsp;</div><br />
<br />
</div></center><br />
<br />
=== Cairo Animations ===<br />
<br />
The animations featured throughout the Episode 2 video were rapid-development spaghetti hack-jobs coded by hand in raw Cairo. Each module generated a series of PNG stills that were then stitched into an animation with Cinelerra or mplayer. In the interest of pointing and laughing at what really bad code looks like...<br />
<br />
<center><div style="background-color:#DDDDDD;border-color:#CCCCCC;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
*Source for the Cairo animations is found at:<br />
https://svn.xiph.org/trunk/Xiph-episode-II/cairo/<br />
*The source can be checked out of svn using the following command line:<br />
svn co https://svn.xiph.org/trunk/Xiph-episode-II/cairo/<br />
*Trac is a convenient way to browse the source without checking out a copy:<br />
https://trac.xiph.org/browser/Xiph-episode-II/cairo/<br />
</div></center></div>Gmaxwellhttps://wiki.xiph.org/index.php?title=Videos/Digital_Show_and_Tell&diff=14019Videos/Digital Show and Tell2013-02-26T10:20:02Z<p>Gmaxwell: /* Bandlimitation and timing */ copyediting</p>
<hr />
<div><small>''Wiki edition''</small><br />
[[Image:dsat_001.jpg|400px|right]]<br />
<br />
Continuing in the "firehose" tradition of [[Videos/A_Digital_Media_Primer_For_Geeks|Episode 01]], Xiph.Org's second video on digital media explores multiple facets of digital audio signals and how they ''really'' behave in the real world.<br />
<br />
Demonstrations of sampling, quantization, bit-depth, and dither explore digital audio behavior on real audio equipment using both modern digital analysis and vintage analog bench equipment, just in case we can't trust those newfangled digital gizmos. You can download the source code for each demo and try it all for yourself!<br />
<br/><br/><br/><br />
<center><font size="+2">[http://www.xiph.org/video/vid2.shtml Download or Watch online]</font></center><br />
<br style="clear:both;"/><br />
Supported players: [http://www.videolan.org/vlc/ VLC 1.1+], [https://www.mozilla.com/en-US/firefox/ Firefox ], [http://www.chromium.org/Home Chrome ], [http://www.opera.com/ Opera]. Or see [http://www.webmproject.org/users/ other WebM] or [[TheoraSoftwarePlayers|other Theora]] players.<br />
<br />
If you're having trouble with playback in a modern browser or player, please visit our [[Playback_Troubleshooting|playback troubleshooting and discussion]] page.<br />
<br/><br />
<hr/><br />
<br/><br/><br/><br />
[[Image:Xiph_ep02_test.png|400px|right]]<br />
<br />
&rdquo;Hi, I'm Monty Montgomery from [http://www.redhat.com/ Red Hat] and [http://xiph.org/ Xiph.Org].<br />
<br />
&rdquo;A few months ago, I wrote<br />
[http://people.xiph.org/~xiphmont/demo/neil-young.html an article on digital audio and why 24bit/192kHz music downloads don't make sense].<br />
In the article, I<br />
mentioned--almost in passing--that a digital waveform is<br />
[http://people.xiph.org/~xiphmont/demo/neil-young.html#toc_sfam not a stairstep],<br />
and you certainly don't get a stairstep when you<br />
[[WikiPedia:Digital-to-analog_converter|convert from digital back to analog]].<br />
<br />
&rdquo;Of everything in the entire article, '''that''' was the number one thing<br />
people wrote about. In fact, more than half the mail I got was questions and<br />
comments about basic digital signal behavior. Since there's interest, let's<br />
take a little time to play with some ''simple'' digital signals. &ldquo;<br />
<br />
==Veritas ex machina==<br />
[[Image:Dsat_002.jpg|200px|right]]<br />
[[Image:Dsat_003.jpg|200px|right]]<br />
[[Image:Dsat_004.jpg|200px|right]]<br />
[[Image:Dsat_005.jpg|200px|right]]<br />
<br />
Pretend for a moment that we have no idea how digital signals really<br />
behave. In that case it doesn't make sense for us to use digital test<br />
equipment either. Fortunately for this exercise, there's still plenty<br />
of working analog lab equipment out there.<br />
<br />
First up, we need a [[WikiPedia:Function_generator|signal generator]] to provide us with analog input<br />
signals--in this case, an<br />
[http://www.home.agilent.com/en/pd-3325A%3Aepsg%3Apro-pn-3325A/synthesizer-function-generator?pm=PL&nid=-536900197.536896863&cc=SE&lc=swe HP3325]<br />
from 1978. It's still a pretty good<br />
generator, so if you don't mind the size, the weight, the power<br />
consumption, and the noisy fan, you can find them on eBay... occasionally<br />
for only slightly more than you'll pay for shipping.<br />
<br />
Next, we'll observe our analog waveforms on [[WikiPedia:Oscilloscope_types#Cathode-ray_oscilloscope_.28CRO.29|analog oscilloscopes]],<br />
like this Tektronix 2246 from the mid-90s, one of the last and very best analog scopes ever made. Every home lab should have one.<br />
<br />
...and finally inspect the [[WikiPedia:Spectral_density#Electrical_engineering|frequency spectrum]] of our signals using an<br />
[[WikiPedia:Spectrum_analyzer#Swept-tuned|analog spectrum analyzer]], this<br />
[http://www.home.agilent.com/en/pd-3585A%3Aepsg%3Apro-pn-3585A/spectrum-analyzer-high-perf-20hz-40mhz?pm=PL&nid=-536900197.536897319&cc=SE&lc=swe HP3585]<br />
from the same product line as<br />
the signal generator. Like the other equipment here it has<br />
[http://www.hp9845.net/9845/hardware/processors/ a rudimentary and hilariously large microcontroller],<br />
but the signal path<br />
from input to what you see on the screen is completely analog.<br />
<br />
All of this equipment is vintage, but aside from its raw tonnage, the specs are still quite good.<br />
<br />
At the moment, we have our signal generator set to output a nice 1 [[WikiPedia:Hertz#SI_multiples|kHz]]<br />
sine wave at one [[WikiPedia:Volt|Volt]] [[WikiPedia:Amplitude#Root_mean_square_amplitude|RMS]].<br />
We see the sine wave on the oscilloscope, can verify that it is indeed<br />
1 kHz at 1 Volt RMS, which is 2.8 Volts<br />
[[WikiPedia:Amplitude#Peak-to-peak_amplitude|peak-to-peak]],<br />
and that matches the<br />
measurement on the spectrum analyzer as well.<br />
<br />
The analyzer also shows some low-level [[WikiPedia:White_noise|white noise]]<br />
and just a bit of [[WikiPedia:Harmonic_distortion#Harmonic_distortion|harmonic distortion]],<br />
with the highest peak about 70[[WikiPedia:Decibel|dB]] or so below<br />
[[WikiPedia:Fundamental_frequency|the fundamental]].<br />
Now, this doesn't matter at all in our demos, but I<br />
wanted to point it out now just in case you didn't notice it until<br />
later.<br />
<br />
Now, we drop digital sampling in the middle.<br />
<br />
For the conversion, we'll use a boring, consumer-grade, eMagic USB1<br />
audio device. It's also more than ten years old at this point, and it's<br />
getting obsolete.<br />
<br />
A recent converter can easily have an order of magnitude better specs.<br />
[[WikiPedia:Reconstruction_filter#Sampled_data_reconstruction_filters|Flatness]],<br />
[[WikiPedia:Analog-to-digital_converter#Non-linearity|linearity]],<br />
[[WikiPedia:Jitter#Sampling_jitter|jitter]],<br />
[[WikiPedia:Noise_floor|noise behavior]],<br />
[[WikiPedia:Digital-to-analog_converter#DAC_performance|everything]]...<br />
you may not<br />
have noticed. Just because we can measure an improvement doesn't<br />
mean we can hear it, and even these old consumer boxes were already at<br />
the edge of ideal transparency.<br />
<br />
The eMagic connects to my ThinkPad, which displays a digital<br />
waveform and spectrum for comparison, then the ThinkPad<br />
sends the digital signal right back out to the eMagic for<br />
re-conversion to analog and observation on the output scopes.<br />
<br />
Input to output, left to right.<br />
<br style="clear:both;"/><br />
<br />
==Stairsteps==<br />
[[Image:Dsat 006.jpg|360px|right]]<br />
[[Image:Dsat 007.png|360px|right]]<br />
&ldquo;OK, it's go time. We begin by converting an analog signal to digital and<br />
then right back to analog again with no other steps.&rdquo;<br />
<br />
&ldquo;The signal generator is set to produce a 1kHz sine wave just like<br />
before.&rdquo;<br />
<br />
&ldquo;We can see our analog sine wave on our input-side oscilloscope.&rdquo;<br />
<br />
&ldquo;We digitize our signal to<br />
[[Videos/A_Digital_Media_Primer_For_Geeks#Raw_.28digital_audio.29_meat|16 bit PCM at 44.1kHz]],<br />
same as on a CD.&rdquo;<br />
<br />
&ldquo;The spectrum of the digitized signal matches what we saw earlier and what we see now on the analog spectrum analyzer, aside from its <br />
[[WikiPedia:High_impedance|high-impedance input]] being just a smidge noisier.&rdquo;<br />
<br />
&ldquo;For now, the waveform display shows our digitized sine wave as a<br />
stairstep pattern, one step for each sample.&rdquo;<br />
<br />
&ldquo;And when we look at the output signal that's been converted<br />
from digital back to analog, we see...&rdquo;<br />
<br />
&ldquo;It's exactly like the original sine wave. No stairsteps.&rdquo;<br />
<br />
&ldquo;OK, 1 kHz is still a fairly low frequency, maybe the stairsteps are just<br />
hard to see or they're being smoothed away. Fair enough. Let's choose<br />
a higher frequency, something close to [[WikiPedia:Nyquist_frequency|Nyquist]], say 15kHz.&rdquo;<br />
<br />
&ldquo;Now the sine wave is represented by less than three samples per cycle, and... the digital waveform looks pretty awful. Well, looks<br />
can be deceiving. The analog output... is still a perfect sine wave, exactly like the original.&rdquo;<br />
<br />
&ldquo;Let's keep going up.&rdquo;<br />
<br />
&ldquo;16kHz.... 17kHz... 18kHz... 19kHz...&rdquo;<br />
<br />
&ldquo;20kHz. Welcome to the upper limits of human hearing. The output waveform is still perfect. No jagged edges, no dropoff, no stairsteps.&rdquo;<br />
<br />
&ldquo;So where'd the stairsteps go? Don't answer, it's a trick question. They were never there.&rdquo;<br />
<br />
&ldquo;Drawing a digital waveform as a stairstep was wrong to begin with.&rdquo;<br />
<br />
&ldquo;Why? A stairstep is a continuous-time function. It's jagged, and it's piecewise, but it has a defined value at every point in time.&rdquo;<br />
<br />
&ldquo;A sampled signal is entirely different. It's discrete-time; it's only got a value right at each instantaneous sample point and it's<br />
undefined, there is no value at all, everywhere between. A discrete-time signal is properly drawn as a lollipop graph.&rdquo;<br />
<br />
&ldquo;The continuous, analog counterpart of a digital signal passes smoothly through each sample point, and that's just as true for high<br />
frequencies as it is for low.&rdquo;<br />
<br />
&ldquo;Now, the interesting and not at all obvious bit is: [[WikiPedia:Nyquist%E2%80%93Shannon_sampling_theorem|there's only one<br />
bandlimited signal that passes exactly through each sample point]]. It's a unique solution. So if you sample a bandlimited signal and then convert it back, the original input is also the only possible output.&rdquo;<br />
<br />
[[Image:Dsat 008.png|360px|right]]<br />
<br />
&ldquo;And before you say, "oh, I can draw a different signal that passes through those points", well, yes you can, but if it differs even<br />
minutely from the original, it includes frequency content at or beyond Nyquist, breaks the bandlimiting requirement and isn't a valid solution.&rdquo;<br />
<br />
&ldquo;So how did everyone get confused and start thinking of digital signals as stairsteps? I can think of two good reasons.&rdquo;<br />
<br />
&ldquo;First: it's easy enough to convert a sampled signal to a true stairstep. Just<br />
extend each sample value forward until the next sample period. This is<br />
called a [[WikiPedia:Zero-order hold|zero-order hold]], and it's an important part of how some<br />
digital-to-analog converters work, especially the simplest ones.&rdquo;<br />
<br />
&ldquo;So, anyone who looks up [[WikiPedia:Digital-to-analog_converter#Practical_operation|digital-to-analog converter or<br />
digital-to-analog conversion]] is probably going to see a diagram of a<br />
stairstep waveform somewhere, but that's not a finished conversion,<br />
and it's not the signal that comes out.&rdquo;<br />
<br />
&ldquo;Second, and this is probably the more likely reason, engineers who<br />
supposedly know better, like me, draw stairsteps even though they're<br />
technically wrong. It's a sort of like a one-dimensional version of<br />
[[WikiPedia:MacPaint#Development|fat bits in an image editor]].&rdquo;<br />
<br />
&ldquo;Pixels aren't squares either, they're samples of a 2-dimensional<br />
function space and so they're also, conceptually, infinitely small<br />
points. Practically, it's a real pain in the ass to see or manipulate<br />
infinitely small anything, so big squares it is. Digital stairstep<br />
drawings are exactly the same thing.&rdquo;<br />
<br />
&ldquo;It's just a convenient drawing. The stairsteps aren't really there.&rdquo;<br />
<br />
==Bit-depth==<br />
[[Image:Dsat_009.jpg|360px|right]]<br />
[[Image:Dsat_010.jpg|260px|right]]<br />
<br />
When we convert a digital signal back to analog, the result is<br />
''also'' smooth regardless of the [[WikiPedia:Audio_bit_depth|bit depth]]. 24 bits or 16 bits...<br />
or 8 bits... it doesn't matter.<br />
<br />
So does that mean that the digital bit depth makes no difference at<br />
all? Of course not.<br />
<br />
Channel 2 here is the same sine wave input, but we quantize with<br />
[[WikiPedia:Dither|dither]] down to 8 bits.<br />
<br />
On the scope, we still see a nice<br />
smooth sine wave on channel 2. Look very close, and you'll also see a<br />
bit more noise. That's a clue.<br />
<br />
If we look at the spectrum of the signal... aha! Our sine wave is<br />
still there unaffected, but the noise level of the 8-bit signal on<br />
the second channel is much higher!<br />
<br />
And that's the difference the number of bits makes. That's it!<br />
<br />
When we digitize a signal, first we sample it. The<br />
sampling step is perfect; it loses nothing. But then we [[WikiPedia:Quantization_(sound_processing)|quantize]] it,<br />
and [[WikiPedia:Quantization_error|quantization adds noise]].<br />
<br />
The number of bits determines how much noise and so the level of the<br />
noise floor.<br />
<br />
What does this dithered quantization noise sound like? Let's listen<br />
to our 8-bit sine wave.<br />
<br />
That may have been hard to hear anything but the tone. Let's listen<br />
to just the noise after we notch out the sine wave and then bring the<br />
gain up a bit because the noise is quiet.<br />
<br />
Those of you who have used analog recording equipment may have just<br />
thought to yourselves, "My goodness! That sounds like tape hiss!"<br />
Well, it doesn't just sound like tape hiss, it acts like it too, and<br />
if we use a [[WikiPedia:Dither#Different_types|gaussian dither]] then it's<br />
[[WikiPedia:Central_limit_theorem|mathematically equivalent]] in every way. It ''is'' tape hiss.<br />
<br />
Intuitively, that means that we can measure tape hiss and thus the noise floor<br />
of [[WikiPedia:Magnetic_tape_sound_recording|magnetic audio tape]]<br />
in [[WikiPedia:Shannon–Hartley_theorem#Examples|bits instead of decibels]], in order to put things in a<br />
digital perspective. [[WikiPedia:Compact cassettes|Compact cassettes]] (for those of you who are old enough to remember them) could reach as<br />
deep as 9 bits in perfect conditions, though 5 to 6 bits was<br />
more typical, especially if it was a recording made on a<br />
[[WikiPedia:Cassette_deck|tape deck]]. That's right... your mix tapes were only about 6 bits<br />
deep... if you were lucky!<br />
<br />
The very best professional [[WikiPedia:Reel-to-reel_audio_tape_recording|open reel tape]] used in studios could barely<br />
hit... any guesses? 13 bits ''with'' [[WikiPedia:Reel-to-reel_audio_tape_recording#Noise_reduction|advanced noise reduction]]. And<br />
that's why seeing '[[WikiPedia:SPARS_code|D D D]]' on a [[WikiPedia:Compact_disk|Compact Disc]] used to be such a big,<br />
high-end deal.<br />
<br />
==Dither==<br />
[[Image:Dsat_011.png|360px|right]]<br />
<br />
I keep saying that I'm quantizing with [[Wikipedia:dither|dither]], so what is dither<br />
exactly and, more importantly, what does it do?<br />
<br />
The simple way to quantize a signal is to choose the digital<br />
amplitude value closest to the original analog amplitude. [[WikiPedia:Rounding|Obvious]],<br />
right? Unfortunately, the exact noise you get from this simple<br />
quantization scheme depends somewhat on the input signal,<br />
<br />
so we may get noise that's inconsistent, or causes distortion, or is<br />
undesirable in some other way.<br />
<br style="clear:both;"/><br />
<center><div style="background-color:#DDDDFF;border-color:#CCCCDD;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
'''Going deeper…'''<br />
*Cameron Nicklaus Christou's thesis [http://uwspace.uwaterloo.ca/bitstream/10012/3867/1/thesis.pdf Optimal Dither and Noise Shaping in Image Processing] provides an ''excellent'' explanation of dither and noise shaping.<br />
</div></center><br />
<br />
Dither is specially-constructed noise that substitutes for the noise<br />
produced by simple quantization. Dither doesn't [[WikiPedia:Sound_masking|drown out or mask]]<br />
quantization noise, it actually replaces it with noise characteristics<br />
of our choosing that aren't influenced by the input.<br />
<br />
Let's ''watch'' what dither does. The signal generator has too much noise for this test so we'll produce a mathematically perfect sine wave with the ThinkPad and quantize it to 8 bits with dithering.<br />
<br />
We see a nice sine wave on the waveform display and output scope and, once the analog spectrum analyzer catches up...<br />
a clean frequency peak with a uniform noise floor on both spectral displays<br />
just like before. Again, this is with dither.<br />
<br />
Now I turn dithering off.<br />
<br />
The quantization noise, that dither had spread out into a nice, flat noise<br />
floor, piles up into harmonic distortion peaks. The noise floor is<br />
lower, but the level of distortion becomes nonzero, and the distortion<br />
peaks sit higher than the dithering noise did.<br />
<br />
At 8 bits this effect is exaggerated. At 16 bits,<br />
even without dither, harmonic distortion is going to be so low as to<br />
be completely inaudible.<br />
<br />
Still, we can use dither to eliminate it completely if we so choose.<br />
<br />
Turning the dither off again for a moment, you'll notice that the<br />
absolute level of distortion from undithered quantization stays<br />
approximately constant regardless of the input amplitude.<br />
But when the signal level drops below a half a bit, everything<br />
quantizes to zero.<br />
<br />
In a sense, everything quantizing to zero is just 100% distortion!<br />
Dither eliminates this distortion too. We reenable dither<br />
and ... there's our signal back at 1/4 bit, with our nice flat noise floor.<br />
<br />
The noise floor doesn't have to be flat. Dither is noise of our<br />
choosing, so let's choose a noise as [http://www.acoustics.salford.ac.uk/res/cox/sound_quality/?content=subjective inoffensive] and<br />
[[WikiPedia:Absolute_threshold_of_hearing|difficult to notice]]<br />
as possible.<br />
<br />
Our hearing is most sensitive in the midrange from 2kHz to 4kHz,<br />
so that's where background noise is going to be the most obvious.<br />
We can [[WikiPedia:Noise_shaping|shape dithering noise]] away from sensitive frequencies to where<br />
hearing is less sensitive, usually the highest frequencies.<br />
<br />
16-bit dithering noise is normally much too quiet to hear at all, but<br />
let's listen to our noise shaping example, again with the gain<br />
brought way up...<br />
<br />
Lastly, dithered quantization noise ''is'' higher [[WikiPedia:Sound_power|power]] overall<br />
than undithered quantization noise even when it sounds quieter, and<br />
you can see that on a [[WikiPedia:VU_meter|VU meter]] during passages of near-silence. But<br />
dither isn't only an on or off choice. We can reduce the dither's<br />
power to balance less noise against a bit of distortion to minimize<br />
the overall effect.<br />
<br />
We'll also [[WikiPedia:Amplitude_modulation|modulate the input signal]] like this to show how a varying input affects the quantization noise. At<br />
full dithering power, the noise is uniform, constant, and featureless<br />
just like we expect:<br />
<br />
As we reduce the dither's power, the input increasingly<br />
affects the amplitude and the character of the quantization noise.<br />
Shaped dither behaves similarly, but noise shaping lends one more nice<br />
advantage. To make a long story short, it can use a somewhat lower<br />
dither power before the input has as much effect on the output.<br />
<br />
Despite all the time I just spent on dither, we're talking about<br />
differences that start 100 decibels and more below [[WikiPedia:Full_scale|full scale]]. Maybe<br />
if the CD had been<br />
[http://www.research.philips.com/technologies/projects/cd/index.html 14 bits as originally designed],<br />
dither ''might'' be<br />
more important. Maybe. At 16 bits, really, it's mostly a wash. You<br />
can think of dither as an insurance policy that gives several extra<br />
decibels of dynamic range just in case. The simple fact is, though, no<br />
one ever ruined a great recording by not dithering the final master.<br />
<br />
==Bandlimitation and timing==<br />
[[image:Dsat_016.jpg|360px|right]]<br />
<br />
We've been using [[WikiPedia:Sine_wave|sine waves]]. They're the obvious choice when what we<br />
want to see is a system's behavior at a given isolated frequency. Now let's look at something a bit more complex. What should we expect to happen when I change the input to a [[WikiPedia:Square_wave|square wave]]... The input scope confirms our 1kHz square wave. The output scope shows… Exactly what it should.<br />
<br />
What is a square wave really? <br />
<br />
Well, we can say it's a waveform that's some positive value for half a cycle and then transitions instantaneously to a negative value for the other half.<br />
<br />
:<math><br />
\ x(t) = \begin{cases} 1, & |t| < T_1 \\ 0, & T_1 < |t| \leq {1 \over 2}T \end{cases}<br />
</math><br />
<br />
But that doesn't really tell us anything useful about how that input becomes this output.<br />
<br />
Then we remember that any waveform is also [[WikiPedia:Fourier_series|the sum of discrete frequencies]],<br />
and a square wave is particularly simple sum: a fundamental and an<br />
infinite series of [[WikiPedia:Even_and_odd_functions#Harmonics|odd harmonics]]. Sum them all up, you get a<br />
square wave.<br />
<br />
[[image:Dsat_013.jpg|360px|right]]<br />
:<math>\begin{align}<br />
x_{\mathrm{square}}(t) = \frac{4}{\pi}\sin(\omega t) + \frac{4}{3\pi}\sin(3\omega t) + \frac{4}{5\pi}\sin(5\omega t) + \\<br />
\frac{4}{7\pi}\sin(7\omega t) + \frac{4}{9\pi}\sin(9\omega t) + \frac{4}{11\pi}\sin(11\omega t) + \\ <br />
\frac{4}{13\pi}\sin(13\omega t) + \frac{4}{15\pi}\sin(15\omega t) + \frac{4}{17\pi}\sin(17\omega t) + \\<br />
\frac{4}{19\pi}\sin(19\omega t) + \frac{4}{21\pi}\sin(21\omega t) + \frac{4}{23\pi}\sin(23\omega t) + \\<br />
\frac{4}{25\pi}\sin(25\omega t) + \frac{4}{27\pi}\sin(27\omega t) + \frac{4}{29\pi}\sin(29\omega t) + \\<br />
\frac{4}{31\pi}\sin(31\omega t) + \frac{4}{33\pi}\sin(33\omega t) + \cdots <br />
\end{align}</math><br />
<br />
At first glance, that doesn't seem very useful either. You have to sum up an infinite number of harmonics to get the answer. ''Ah'', but we don't have an infinite number of harmonics.<br />
<br />
We're using a quite sharp [[WikiPedia:Low-pass_filter|anti-aliasing filter]] that cuts off right<br />
above 20kHz, so our signal is [[WikiPedia:Bandlimiting|bandlimited]] and only the first ten terms make it through.<br />
<br />
..and that's exactly what we see on the output scope.<br />
<br />
<br style="clear:both;"/><br />
<center><div style="background-color:#DDDDFF;border-color:#CCCCDD;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
'''Going deeper…'''<br />
*In modern web browsers you can program audio synthesizers directly in javascript. Use the two square wave formulas to get a square wave out of [http://js.do/blog/sound-waves-with-javascript/ this page]. (Note: The scope is not very accurate/useful.) <br />
</div></center><br />
<br />
[[Image:dsat_015.jpg|360px|right]]<br />
The rippling you see around sharp edges in a bandlimited signal is called the [[WikiPedia:/Gibbs_phenomenon|Gibbs effect]]. It happens whenever you slice off part of the frequency domain in the middle of nonzero energy.<br />
<br />
The usual rule of thumb you'll hear is "the sharper the cutoff, the<br />
stronger the rippling", which is approximately true, but we have to be<br />
careful how we think about it.<br />
<br />
<br />
For example... what would you expect our quite sharp anti-aliasing filter<br />
to do if I run our signal through it a second time?<br />
<br />
Aside from adding a few fractional cycles of delay, the answer is...<br />
nothing at all. The signal is already bandlimited. Bandlimiting it<br />
again doesn't do anything. A second pass can't remove frequencies<br />
that we already removed.<br />
<br />
And that's important. People tend to think of the ripples as<br />
a kind of [[WikiPedia:Sonic_artifact|artifact]] that's added by anti-aliasing and [[WikiPedia:Reconstruction_filter|anti-imaging]]<br />
filters, implying that the ripples get worse each time the signal<br />
passes through. We can see that in this case that didn't happen. So<br />
was it really the filter that added the ripples the first time<br />
through? No, not really. It's a subtle distinction, but Gibbs effect<br />
ripples aren't added by filters, they're just part of what a<br />
bandlimited signal ''is''.<br />
<br />
Even if we synthetically construct what looks like a perfect digital<br />
square wave,<br />
<br />
it's still limited to the channel bandwidth. Remember,<br />
the stairstep representation is misleading.<br />
<br />
What we really have here are instantaneous sample points,<br />
<br />
and only one bandlimited signal fits those points. All we did when we<br />
drew our apparently perfect square wave was line up the sample points<br />
just right so it appeared that there were no ripples if we played<br />
[[WikiPedia:Interpolation|connect-the-dots]].<br />
<br />
But the original bandlimited signal, complete with ripples, was<br />
still there.<br />
<br />
[[image:Dsat_014.gif|360px|right]]<br />
And that leads us to one more important point. You've probably heard<br />
that the timing precision of a digital signal is limited by its sample<br />
rate; put another way,<br />
<br />
that digital signals can't represent anything that falls between the<br />
samples.. implying that [[WikiPedia:Dirac_delta_function|impulses]] or<br />
[[WikiPedia:Synthesizer#ADSR_envelope|fast attacks]] have to align exactly<br />
with a sample, or the timing gets mangled... or they just disappear.<br />
<br />
At this point, we can easily see why that's wrong.<br />
<br />
Again, our input signals are bandlimited. And digital signals are<br />
samples, not stairsteps, not 'connect-the-dots'. We most certainly<br />
can, for example, put the rising edge of our bandlimited square wave<br />
anywhere we want between samples.<br />
<br />
It's represented perfectly and it's reconstructed perfectly.<br />
<br />
==Epilogue==<br />
<br />
[[Image:Moffey.jpg|360px|right]]<br />
<br />
Just like in [[Videos/A_Digital_Media_Primer_For_Geeks|the previous episode]], we've covered a broad range of<br />
topics, and yet barely scratched the surface of each one. If anything, my<br />
sins of omission are greater this time around... but this is a good<br />
stopping point.<br />
<br />
Or maybe, a good starting point. Dig deeper. Experiment. I chose my<br />
demos very carefully to be simple and give clear results. You can<br />
reproduce every one of them on your own if you like. But let's face<br />
it, sometimes we learn the most about a spiffy toy by breaking it open<br />
and studying all the pieces that fall out. And that's OK, we're<br />
engineers. Play with the demo parameters, hack up the code, set up<br />
alternate experiments. The source code for everything, including the<br />
little pushbutton demo application, is up at xiph.org.<br />
<br />
In the course of experimentation, you're likely to run into something<br />
that you didn't expect and can't explain. Don't worry! My earlier<br />
snark aside, Wikipedia is fantastic for exactly this kind of casual<br />
research. And, if you're really serious about understanding signals,<br />
several universities have advanced materials online, such as the<br />
[http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-003-signals-and-systems-spring-2010/index.htm 6.003]<br />
and<br />
[http://ocw.mit.edu/resources/res-6-007-signals-and-systems-spring-2011/ RES.6-007]<br />
Signals and Systems modules at MIT OpenCourseWare. And of<br />
course, there's always the [http://webchat.freenode.net/?channels=xiph community here at Xiph.Org].<br />
<br />
Digging deeper or not, I am out of coffee, so, until next time, happy<br />
hacking!<br />
<br />
==Credits==<br />
[[Image:Dmpfg_019.png|360px|right]]<br />
Written by: Christopher (Monty) Montgomery and the Xiph.Org Community<br />
<br />
Special thanks to:<br />
*Heidi Baumgartner, for the second Tektronix oscilloscope<br />
*Gregory Maxwell and Dr. Timothy Terriberry, for additional technical review<br />
<br />
Intro, title and credits music:<br><br />
"[http://music.lousyrobot.com/track/andy-warhol-is-gone Andy Warhol Is Gone]", by Lousy Robot<br><br />
Used by permission of Lousy Robot.<br><br />
Original source track All Rights Reserved.<br><br />
[http://www.lousyrobot.com www.lousyrobot.com]<br />
<br />
This Video Was Produced Entirely With Free and Open Source Software:<br><br />
<br />
*[http://www.gnu.org/ GNU]<br><br />
*[http://www.linux.org/ Linux]<br><br />
*[http://fedoraproject.org/ Fedora]<br><br />
*[http://cinelerra.org/ Cinelerra]<br><br />
*[http://www.gimp.org/ The Gimp]<br><br />
*[http://audacity.sourceforge.net/ Audacity]<br><br />
*[http://svn.xiph.org/trunk/postfish/README Postfish]<br><br />
*[http://gstreamer.freedesktop.org/ Gstreamer]<br><br />
<br />
All trademarks are the property of their respective owners. <br />
<br />
*''Complete video'' [http://creativecommons.org/licenses/by-sa/3.0/legalcode CC-BY-SA]<br><br />
*''Text transcript and Wiki edition'' [http://creativecommons.org/licenses/by-sa/3.0/legalcode CC-BY-SA]<br><br />
<br />
A Co-Production of Xiph.Org and Red Hat, Inc.<br><br />
(C) 2012-2013, Some Rights Reserved<br><br />
<br />
== Use The Source Luke ==<br />
<br />
As stated in the Epilogue, everything that appears in the video demos is driven by open source software, which means the source is both available for inspection and freely usable by the community. The Thinkpad that appears in the video was running Fedora 17 and Gnome Shell (Gnome 3). The demonstration software does not require Fedora specifically, but it does require Gnu/Linux to run in its current form. In all, the video involved just under 50,000 lines of new and custom-purpose code (including contributions to non-Xiph projects such as Cinelerra and Gromit).<br />
<br />
=== The Spectrum and Waveform Viewer ===<br />
<br />
The realtime software spectrum analyzer application that appears in the video was a preexisting application that was dusted off and updated for use in the video. The waveform viewer (effectively a simple software oscilloscope) was written from scratch making use of some of the internals from the spectrum analyzer application. Both are available from Xiph.Org svn:<br />
<br />
<center><div style="background-color:#DDDDDD;border-color:#CCCCCC;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
*Source for the Spectrum and Waveform applications is found at:<br />
https://svn.xiph.org/trunk/spectrum/<br />
*The source can be checked out of svn using the following command line:<br />
svn co https://svn.xiph.org/trunk/spectrum<br />
*Trac is a convenient way to browse the source without checking out a copy:<br />
https://trac.xiph.org/browser/trunk/spectrum<br />
</div></center><br />
<br />
Spectrum and Waveform both expect an input stream on the command line, either as raw data or as a WAV file.<br />
<br />
=== GTK-Bounce ===<br />
<br />
The touch-controlled application used in the video is named 'gtk-bounce' and was custom-written for the sole purpose of the in-video demonstrations. It is so named because, for the most part, all it does is read the input from an audio device, and then immediately write the same data back out for playback. It also forwards a copy of this data to up to two external monitoring applications, and in several demos, applies simple filters or generates simple waveforms. It includes several demos not included in the video.<br />
<br />
<center><div style="background-color:#DDDDDD;border-color:#CCCCCC;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
*Source for gtk-bounce is found at:<br />
https://svn.xiph.org/trunk/Xiph-episode-II/bounce/<br />
*The source can be checked out of svn using the following command line:<br />
svn co https://svn.xiph.org/trunk/Xiph-episode-II/bounce/<br />
*Trac is a convenient way to browse the source without checking out a copy:<br />
https://trac.xiph.org/browser/Xiph-episode-II/bounce/<br />
</div></center><br />
<br />
==== Starting Gtk-bounce ====<br />
The application is somewhat hardwired for specific demo parameters, but most of the hardwired settings can be found at the top of each source file. As found in SVN, the application expects an ALSA hardware audio device at hw:1, and if none if found, it will wait for one to appear. Once a sound device is successfully initialized, it expects to find and open two pipes named pipe0 and pipe1 for output in the current directory. In the video, the waveform and spectrum applications are started to take input from pipe0 and pipe1 respectively. The output sent to the two pipes is identical, and in most demos matches the output data sent to the hardware device for conversion to analog. The only exception is the tenth demo panel (which does not appear in the video) where gtk-bounce can be set to monitor the hardware inputs instead while the outputs are used to produce test waveforms.<br />
<br />
Assuming gtk-bounce, spectrum and waveform have been checked out and built, the configuration seen in the video can be started using the following commands:<br />
<center><div style="background-color:#DDDDDD;border-color:#CCCCCC;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
* make the pipe fifos for the applications to communicate (only needs to be done once)<br />
mkfifo pipe0 pipe1<br />
* start all three applications<br />
waveform pipe0 & spectrum pipe1 & gtk-bounce &<br />
</div></center><br />
<br />
==== Using Gtk-bounce ====<br />
<br />
Gtk-bounce consists of eleven pushbutton panels (numbered zero through ten) that can be selected by scrolling up and dwon with the arrow buttons on the right side. Each panel is intended for a specific demo or part of a demo.<br />
<br />
<center><div style="background-color:#DDDDDD;border-color:#CCCCCC;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
<br />
[[Image:Dsat-panel0.png|700px|center]]<br />
* '''Panel 0''': This panel presents buttons that allow the sound card to be configured in several sampling rates and bit depths. Samples read from the audio inputs are sent to the output pipes and audio outputs for playback without modification.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel1.png|700px|center]]<br />
* '''Panel 1''': Both channels are forwarded to the outputs, however the user may select the bit depth of each channel independently. When the sound card is running in 16 bit mode and 16-bit depth is selected, the data is untouched. Requantization to a lower bit depth is performed with a flat triangle dither.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel2.png|700px|center]]<br />
* '''Panel 2''': Both channels are re-quantized to the selected bit depth. Requantization to a lower bit depth is performed with a flat triangle dither.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel3.png|700px|center]]<br />
* '''Panel 3''': 'generate sine wave' discards the audio inputs and instead internally generates a sine wave at 32 bit precision, which is then quantized to the selected bit depth, optionally with dither. The resulting signal is then forwarded to the output. <br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel4.png|700px|center]]<br />
* '''Panel 4''': gtk-bounce generates a 16-bit sine wave of the selected amplitude, optionally with dither, and forwards the resulting signal to the outputs. The audio input from the audio device is discarded. Note that the slider sets the peak amplitude, not the peak-to-peak amplitude.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel5.png|700px|center]]<br />
* '''Panel 5''': generates a 16-bit sine wave, optionally quantized using dither. The user may additionally select a flat or a shaped dither. The 'notch and gain' button applies a notch filter to the resulting signal, and boosts the gain of the remaining noise so that it's easily audible. The audio input from the audio device is discarded.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel6.png|700px|center]]<br />
* '''Panel 6''': allows the user to play with the power of the dithering noise applied before quantizing the sine wave. Shaped or flat dither are available. The sine wave may also be modulated with a varying amplitude to highlight correlations between the input and the resulting quantization noise. The 'notch and gain' button applies a notch filter to the resulting signal, and boosts the gain of the remaining noise so that it's easily audible. The audio input from the audio device is discarded.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel7.png|700px|center]]<br />
* '''Panel 7''': applies a sharper antialiasing (lowpass) filter than is likely to be built into the sound-card hardware (as there's generally no reason to use a filter quite this sharp in practice). The very sharp filter allows us to bandpass the demonstration square wave without any harmonics landing in the transition band. The input is read from the audio device, passed through this sharper filter, and then forwarded to the outputs.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel8.png|700px|center]]<br />
* '''Panel 8''': when selected, generate a synthetic 'square wave' (this is not quite equivalent to a bandlimited analog square wave; the harmonic amplitudes are a bit different) that when aligned with the sampling phase just right gives the appearance of having infinite rise and fall time. The slider allows us to shift the waveform sample alignment back and forth by +/- one sample to reveal that the underlying signal is still band-limited.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel9.png|700px|center]]<br />
* '''Panel 9''': as in panel 8, generate a 'perfect' synthetic 'square wave'. However, the slider now allows us to shift the sample alignment of the second channel with respect to the first, instead of shifting both channels. This allows us the trigger/lock the scope timing to the channel 1 waveform so we can see the fractional sample movement and alignment of the waveform on channel 2. The audio input from the audio device is discarded.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel10.png|700px|center]]<br />
* '''Panel 10''': not used in the video; The audio device is configured to 24-bit input/output. The user may produce one of a range of test signals that are output to both the external applications and the audio device on the first channel. The input on the second channel is passed-through to the applications and audio device outputs unchanged. The first channel input is unused unless 'two input mode' is selected. When two input mode is selected, both input channels are read and the data sent to the external applications. Generated test signals are sent only to the audio hardware (on the first channel). This combination of test signals and input modes allows self-references frequency response, phase, noise, distortion and crosstalk testing of a given audio device.<br />
<br />
<div style="clear: both">&nbsp;</div><br />
<br />
</div></center><br />
<br />
=== Cairo Animations ===<br />
<br />
The animations featured throughout the Episode 2 video were rapid-development spaghetti hack-jobs coded by hand in raw Cairo. Each module generated a series of PNG stills that were then stitched into an animation with Cinelerra or mplayer. In the interest of pointing and laughing at what really bad code looks like...<br />
<br />
<center><div style="background-color:#DDDDDD;border-color:#CCCCCC;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
*Source for the Cairo animations is found at:<br />
https://svn.xiph.org/trunk/Xiph-episode-II/cairo/<br />
*The source can be checked out of svn using the following command line:<br />
svn co https://svn.xiph.org/trunk/Xiph-episode-II/cairo/<br />
*Trac is a convenient way to browse the source without checking out a copy:<br />
https://trac.xiph.org/browser/Xiph-episode-II/cairo/<br />
</div></center></div>Gmaxwellhttps://wiki.xiph.org/index.php?title=Videos/Digital_Show_and_Tell&diff=14018Videos/Digital Show and Tell2013-02-26T10:19:11Z<p>Gmaxwell: /* Bandlimitation and timing */ original square wave</p>
<hr />
<div><small>''Wiki edition''</small><br />
[[Image:dsat_001.jpg|400px|right]]<br />
<br />
Continuing in the "firehose" tradition of [[Videos/A_Digital_Media_Primer_For_Geeks|Episode 01]], Xiph.Org's second video on digital media explores multiple facets of digital audio signals and how they ''really'' behave in the real world.<br />
<br />
Demonstrations of sampling, quantization, bit-depth, and dither explore digital audio behavior on real audio equipment using both modern digital analysis and vintage analog bench equipment, just in case we can't trust those newfangled digital gizmos. You can download the source code for each demo and try it all for yourself!<br />
<br/><br/><br/><br />
<center><font size="+2">[http://www.xiph.org/video/vid2.shtml Download or Watch online]</font></center><br />
<br style="clear:both;"/><br />
Supported players: [http://www.videolan.org/vlc/ VLC 1.1+], [https://www.mozilla.com/en-US/firefox/ Firefox ], [http://www.chromium.org/Home Chrome ], [http://www.opera.com/ Opera]. Or see [http://www.webmproject.org/users/ other WebM] or [[TheoraSoftwarePlayers|other Theora]] players.<br />
<br />
If you're having trouble with playback in a modern browser or player, please visit our [[Playback_Troubleshooting|playback troubleshooting and discussion]] page.<br />
<br/><br />
<hr/><br />
<br/><br/><br/><br />
[[Image:Xiph_ep02_test.png|400px|right]]<br />
<br />
&rdquo;Hi, I'm Monty Montgomery from [http://www.redhat.com/ Red Hat] and [http://xiph.org/ Xiph.Org].<br />
<br />
&rdquo;A few months ago, I wrote<br />
[http://people.xiph.org/~xiphmont/demo/neil-young.html an article on digital audio and why 24bit/192kHz music downloads don't make sense].<br />
In the article, I<br />
mentioned--almost in passing--that a digital waveform is<br />
[http://people.xiph.org/~xiphmont/demo/neil-young.html#toc_sfam not a stairstep],<br />
and you certainly don't get a stairstep when you<br />
[[WikiPedia:Digital-to-analog_converter|convert from digital back to analog]].<br />
<br />
&rdquo;Of everything in the entire article, '''that''' was the number one thing<br />
people wrote about. In fact, more than half the mail I got was questions and<br />
comments about basic digital signal behavior. Since there's interest, let's<br />
take a little time to play with some ''simple'' digital signals. &ldquo;<br />
<br />
==Veritas ex machina==<br />
[[Image:Dsat_002.jpg|200px|right]]<br />
[[Image:Dsat_003.jpg|200px|right]]<br />
[[Image:Dsat_004.jpg|200px|right]]<br />
[[Image:Dsat_005.jpg|200px|right]]<br />
<br />
Pretend for a moment that we have no idea how digital signals really<br />
behave. In that case it doesn't make sense for us to use digital test<br />
equipment either. Fortunately for this exercise, there's still plenty<br />
of working analog lab equipment out there.<br />
<br />
First up, we need a [[WikiPedia:Function_generator|signal generator]] to provide us with analog input<br />
signals--in this case, an<br />
[http://www.home.agilent.com/en/pd-3325A%3Aepsg%3Apro-pn-3325A/synthesizer-function-generator?pm=PL&nid=-536900197.536896863&cc=SE&lc=swe HP3325]<br />
from 1978. It's still a pretty good<br />
generator, so if you don't mind the size, the weight, the power<br />
consumption, and the noisy fan, you can find them on eBay... occasionally<br />
for only slightly more than you'll pay for shipping.<br />
<br />
Next, we'll observe our analog waveforms on [[WikiPedia:Oscilloscope_types#Cathode-ray_oscilloscope_.28CRO.29|analog oscilloscopes]],<br />
like this Tektronix 2246 from the mid-90s, one of the last and very best analog scopes ever made. Every home lab should have one.<br />
<br />
...and finally inspect the [[WikiPedia:Spectral_density#Electrical_engineering|frequency spectrum]] of our signals using an<br />
[[WikiPedia:Spectrum_analyzer#Swept-tuned|analog spectrum analyzer]], this<br />
[http://www.home.agilent.com/en/pd-3585A%3Aepsg%3Apro-pn-3585A/spectrum-analyzer-high-perf-20hz-40mhz?pm=PL&nid=-536900197.536897319&cc=SE&lc=swe HP3585]<br />
from the same product line as<br />
the signal generator. Like the other equipment here it has<br />
[http://www.hp9845.net/9845/hardware/processors/ a rudimentary and hilariously large microcontroller],<br />
but the signal path<br />
from input to what you see on the screen is completely analog.<br />
<br />
All of this equipment is vintage, but aside from its raw tonnage, the specs are still quite good.<br />
<br />
At the moment, we have our signal generator set to output a nice 1 [[WikiPedia:Hertz#SI_multiples|kHz]]<br />
sine wave at one [[WikiPedia:Volt|Volt]] [[WikiPedia:Amplitude#Root_mean_square_amplitude|RMS]].<br />
We see the sine wave on the oscilloscope, can verify that it is indeed<br />
1 kHz at 1 Volt RMS, which is 2.8 Volts<br />
[[WikiPedia:Amplitude#Peak-to-peak_amplitude|peak-to-peak]],<br />
and that matches the<br />
measurement on the spectrum analyzer as well.<br />
<br />
The analyzer also shows some low-level [[WikiPedia:White_noise|white noise]]<br />
and just a bit of [[WikiPedia:Harmonic_distortion#Harmonic_distortion|harmonic distortion]],<br />
with the highest peak about 70[[WikiPedia:Decibel|dB]] or so below<br />
[[WikiPedia:Fundamental_frequency|the fundamental]].<br />
Now, this doesn't matter at all in our demos, but I<br />
wanted to point it out now just in case you didn't notice it until<br />
later.<br />
<br />
Now, we drop digital sampling in the middle.<br />
<br />
For the conversion, we'll use a boring, consumer-grade, eMagic USB1<br />
audio device. It's also more than ten years old at this point, and it's<br />
getting obsolete.<br />
<br />
A recent converter can easily have an order of magnitude better specs.<br />
[[WikiPedia:Reconstruction_filter#Sampled_data_reconstruction_filters|Flatness]],<br />
[[WikiPedia:Analog-to-digital_converter#Non-linearity|linearity]],<br />
[[WikiPedia:Jitter#Sampling_jitter|jitter]],<br />
[[WikiPedia:Noise_floor|noise behavior]],<br />
[[WikiPedia:Digital-to-analog_converter#DAC_performance|everything]]...<br />
you may not<br />
have noticed. Just because we can measure an improvement doesn't<br />
mean we can hear it, and even these old consumer boxes were already at<br />
the edge of ideal transparency.<br />
<br />
The eMagic connects to my ThinkPad, which displays a digital<br />
waveform and spectrum for comparison, then the ThinkPad<br />
sends the digital signal right back out to the eMagic for<br />
re-conversion to analog and observation on the output scopes.<br />
<br />
Input to output, left to right.<br />
<br style="clear:both;"/><br />
<br />
==Stairsteps==<br />
[[Image:Dsat 006.jpg|360px|right]]<br />
[[Image:Dsat 007.png|360px|right]]<br />
&ldquo;OK, it's go time. We begin by converting an analog signal to digital and<br />
then right back to analog again with no other steps.&rdquo;<br />
<br />
&ldquo;The signal generator is set to produce a 1kHz sine wave just like<br />
before.&rdquo;<br />
<br />
&ldquo;We can see our analog sine wave on our input-side oscilloscope.&rdquo;<br />
<br />
&ldquo;We digitize our signal to<br />
[[Videos/A_Digital_Media_Primer_For_Geeks#Raw_.28digital_audio.29_meat|16 bit PCM at 44.1kHz]],<br />
same as on a CD.&rdquo;<br />
<br />
&ldquo;The spectrum of the digitized signal matches what we saw earlier and what we see now on the analog spectrum analyzer, aside from its <br />
[[WikiPedia:High_impedance|high-impedance input]] being just a smidge noisier.&rdquo;<br />
<br />
&ldquo;For now, the waveform display shows our digitized sine wave as a<br />
stairstep pattern, one step for each sample.&rdquo;<br />
<br />
&ldquo;And when we look at the output signal that's been converted<br />
from digital back to analog, we see...&rdquo;<br />
<br />
&ldquo;It's exactly like the original sine wave. No stairsteps.&rdquo;<br />
<br />
&ldquo;OK, 1 kHz is still a fairly low frequency, maybe the stairsteps are just<br />
hard to see or they're being smoothed away. Fair enough. Let's choose<br />
a higher frequency, something close to [[WikiPedia:Nyquist_frequency|Nyquist]], say 15kHz.&rdquo;<br />
<br />
&ldquo;Now the sine wave is represented by less than three samples per cycle, and... the digital waveform looks pretty awful. Well, looks<br />
can be deceiving. The analog output... is still a perfect sine wave, exactly like the original.&rdquo;<br />
<br />
&ldquo;Let's keep going up.&rdquo;<br />
<br />
&ldquo;16kHz.... 17kHz... 18kHz... 19kHz...&rdquo;<br />
<br />
&ldquo;20kHz. Welcome to the upper limits of human hearing. The output waveform is still perfect. No jagged edges, no dropoff, no stairsteps.&rdquo;<br />
<br />
&ldquo;So where'd the stairsteps go? Don't answer, it's a trick question. They were never there.&rdquo;<br />
<br />
&ldquo;Drawing a digital waveform as a stairstep was wrong to begin with.&rdquo;<br />
<br />
&ldquo;Why? A stairstep is a continuous-time function. It's jagged, and it's piecewise, but it has a defined value at every point in time.&rdquo;<br />
<br />
&ldquo;A sampled signal is entirely different. It's discrete-time; it's only got a value right at each instantaneous sample point and it's<br />
undefined, there is no value at all, everywhere between. A discrete-time signal is properly drawn as a lollipop graph.&rdquo;<br />
<br />
&ldquo;The continuous, analog counterpart of a digital signal passes smoothly through each sample point, and that's just as true for high<br />
frequencies as it is for low.&rdquo;<br />
<br />
&ldquo;Now, the interesting and not at all obvious bit is: [[WikiPedia:Nyquist%E2%80%93Shannon_sampling_theorem|there's only one<br />
bandlimited signal that passes exactly through each sample point]]. It's a unique solution. So if you sample a bandlimited signal and then convert it back, the original input is also the only possible output.&rdquo;<br />
<br />
[[Image:Dsat 008.png|360px|right]]<br />
<br />
&ldquo;And before you say, "oh, I can draw a different signal that passes through those points", well, yes you can, but if it differs even<br />
minutely from the original, it includes frequency content at or beyond Nyquist, breaks the bandlimiting requirement and isn't a valid solution.&rdquo;<br />
<br />
&ldquo;So how did everyone get confused and start thinking of digital signals as stairsteps? I can think of two good reasons.&rdquo;<br />
<br />
&ldquo;First: it's easy enough to convert a sampled signal to a true stairstep. Just<br />
extend each sample value forward until the next sample period. This is<br />
called a [[WikiPedia:Zero-order hold|zero-order hold]], and it's an important part of how some<br />
digital-to-analog converters work, especially the simplest ones.&rdquo;<br />
<br />
&ldquo;So, anyone who looks up [[WikiPedia:Digital-to-analog_converter#Practical_operation|digital-to-analog converter or<br />
digital-to-analog conversion]] is probably going to see a diagram of a<br />
stairstep waveform somewhere, but that's not a finished conversion,<br />
and it's not the signal that comes out.&rdquo;<br />
<br />
&ldquo;Second, and this is probably the more likely reason, engineers who<br />
supposedly know better, like me, draw stairsteps even though they're<br />
technically wrong. It's a sort of like a one-dimensional version of<br />
[[WikiPedia:MacPaint#Development|fat bits in an image editor]].&rdquo;<br />
<br />
&ldquo;Pixels aren't squares either, they're samples of a 2-dimensional<br />
function space and so they're also, conceptually, infinitely small<br />
points. Practically, it's a real pain in the ass to see or manipulate<br />
infinitely small anything, so big squares it is. Digital stairstep<br />
drawings are exactly the same thing.&rdquo;<br />
<br />
&ldquo;It's just a convenient drawing. The stairsteps aren't really there.&rdquo;<br />
<br />
==Bit-depth==<br />
[[Image:Dsat_009.jpg|360px|right]]<br />
[[Image:Dsat_010.jpg|260px|right]]<br />
<br />
When we convert a digital signal back to analog, the result is<br />
''also'' smooth regardless of the [[WikiPedia:Audio_bit_depth|bit depth]]. 24 bits or 16 bits...<br />
or 8 bits... it doesn't matter.<br />
<br />
So does that mean that the digital bit depth makes no difference at<br />
all? Of course not.<br />
<br />
Channel 2 here is the same sine wave input, but we quantize with<br />
[[WikiPedia:Dither|dither]] down to 8 bits.<br />
<br />
On the scope, we still see a nice<br />
smooth sine wave on channel 2. Look very close, and you'll also see a<br />
bit more noise. That's a clue.<br />
<br />
If we look at the spectrum of the signal... aha! Our sine wave is<br />
still there unaffected, but the noise level of the 8-bit signal on<br />
the second channel is much higher!<br />
<br />
And that's the difference the number of bits makes. That's it!<br />
<br />
When we digitize a signal, first we sample it. The<br />
sampling step is perfect; it loses nothing. But then we [[WikiPedia:Quantization_(sound_processing)|quantize]] it,<br />
and [[WikiPedia:Quantization_error|quantization adds noise]].<br />
<br />
The number of bits determines how much noise and so the level of the<br />
noise floor.<br />
<br />
What does this dithered quantization noise sound like? Let's listen<br />
to our 8-bit sine wave.<br />
<br />
That may have been hard to hear anything but the tone. Let's listen<br />
to just the noise after we notch out the sine wave and then bring the<br />
gain up a bit because the noise is quiet.<br />
<br />
Those of you who have used analog recording equipment may have just<br />
thought to yourselves, "My goodness! That sounds like tape hiss!"<br />
Well, it doesn't just sound like tape hiss, it acts like it too, and<br />
if we use a [[WikiPedia:Dither#Different_types|gaussian dither]] then it's<br />
[[WikiPedia:Central_limit_theorem|mathematically equivalent]] in every way. It ''is'' tape hiss.<br />
<br />
Intuitively, that means that we can measure tape hiss and thus the noise floor<br />
of [[WikiPedia:Magnetic_tape_sound_recording|magnetic audio tape]]<br />
in [[WikiPedia:Shannon–Hartley_theorem#Examples|bits instead of decibels]], in order to put things in a<br />
digital perspective. [[WikiPedia:Compact cassettes|Compact cassettes]] (for those of you who are old enough to remember them) could reach as<br />
deep as 9 bits in perfect conditions, though 5 to 6 bits was<br />
more typical, especially if it was a recording made on a<br />
[[WikiPedia:Cassette_deck|tape deck]]. That's right... your mix tapes were only about 6 bits<br />
deep... if you were lucky!<br />
<br />
The very best professional [[WikiPedia:Reel-to-reel_audio_tape_recording|open reel tape]] used in studios could barely<br />
hit... any guesses? 13 bits ''with'' [[WikiPedia:Reel-to-reel_audio_tape_recording#Noise_reduction|advanced noise reduction]]. And<br />
that's why seeing '[[WikiPedia:SPARS_code|D D D]]' on a [[WikiPedia:Compact_disk|Compact Disc]] used to be such a big,<br />
high-end deal.<br />
<br />
==Dither==<br />
[[Image:Dsat_011.png|360px|right]]<br />
<br />
I keep saying that I'm quantizing with [[Wikipedia:dither|dither]], so what is dither<br />
exactly and, more importantly, what does it do?<br />
<br />
The simple way to quantize a signal is to choose the digital<br />
amplitude value closest to the original analog amplitude. [[WikiPedia:Rounding|Obvious]],<br />
right? Unfortunately, the exact noise you get from this simple<br />
quantization scheme depends somewhat on the input signal,<br />
<br />
so we may get noise that's inconsistent, or causes distortion, or is<br />
undesirable in some other way.<br />
<br style="clear:both;"/><br />
<center><div style="background-color:#DDDDFF;border-color:#CCCCDD;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
'''Going deeper…'''<br />
*Cameron Nicklaus Christou's thesis [http://uwspace.uwaterloo.ca/bitstream/10012/3867/1/thesis.pdf Optimal Dither and Noise Shaping in Image Processing] provides an ''excellent'' explanation of dither and noise shaping.<br />
</div></center><br />
<br />
Dither is specially-constructed noise that substitutes for the noise<br />
produced by simple quantization. Dither doesn't [[WikiPedia:Sound_masking|drown out or mask]]<br />
quantization noise, it actually replaces it with noise characteristics<br />
of our choosing that aren't influenced by the input.<br />
<br />
Let's ''watch'' what dither does. The signal generator has too much noise for this test so we'll produce a mathematically perfect sine wave with the ThinkPad and quantize it to 8 bits with dithering.<br />
<br />
We see a nice sine wave on the waveform display and output scope and, once the analog spectrum analyzer catches up...<br />
a clean frequency peak with a uniform noise floor on both spectral displays<br />
just like before. Again, this is with dither.<br />
<br />
Now I turn dithering off.<br />
<br />
The quantization noise, that dither had spread out into a nice, flat noise<br />
floor, piles up into harmonic distortion peaks. The noise floor is<br />
lower, but the level of distortion becomes nonzero, and the distortion<br />
peaks sit higher than the dithering noise did.<br />
<br />
At 8 bits this effect is exaggerated. At 16 bits,<br />
even without dither, harmonic distortion is going to be so low as to<br />
be completely inaudible.<br />
<br />
Still, we can use dither to eliminate it completely if we so choose.<br />
<br />
Turning the dither off again for a moment, you'll notice that the<br />
absolute level of distortion from undithered quantization stays<br />
approximately constant regardless of the input amplitude.<br />
But when the signal level drops below a half a bit, everything<br />
quantizes to zero.<br />
<br />
In a sense, everything quantizing to zero is just 100% distortion!<br />
Dither eliminates this distortion too. We reenable dither<br />
and ... there's our signal back at 1/4 bit, with our nice flat noise floor.<br />
<br />
The noise floor doesn't have to be flat. Dither is noise of our<br />
choosing, so let's choose a noise as [http://www.acoustics.salford.ac.uk/res/cox/sound_quality/?content=subjective inoffensive] and<br />
[[WikiPedia:Absolute_threshold_of_hearing|difficult to notice]]<br />
as possible.<br />
<br />
Our hearing is most sensitive in the midrange from 2kHz to 4kHz,<br />
so that's where background noise is going to be the most obvious.<br />
We can [[WikiPedia:Noise_shaping|shape dithering noise]] away from sensitive frequencies to where<br />
hearing is less sensitive, usually the highest frequencies.<br />
<br />
16-bit dithering noise is normally much too quiet to hear at all, but<br />
let's listen to our noise shaping example, again with the gain<br />
brought way up...<br />
<br />
Lastly, dithered quantization noise ''is'' higher [[WikiPedia:Sound_power|power]] overall<br />
than undithered quantization noise even when it sounds quieter, and<br />
you can see that on a [[WikiPedia:VU_meter|VU meter]] during passages of near-silence. But<br />
dither isn't only an on or off choice. We can reduce the dither's<br />
power to balance less noise against a bit of distortion to minimize<br />
the overall effect.<br />
<br />
We'll also [[WikiPedia:Amplitude_modulation|modulate the input signal]] like this to show how a varying input affects the quantization noise. At<br />
full dithering power, the noise is uniform, constant, and featureless<br />
just like we expect:<br />
<br />
As we reduce the dither's power, the input increasingly<br />
affects the amplitude and the character of the quantization noise.<br />
Shaped dither behaves similarly, but noise shaping lends one more nice<br />
advantage. To make a long story short, it can use a somewhat lower<br />
dither power before the input has as much effect on the output.<br />
<br />
Despite all the time I just spent on dither, we're talking about<br />
differences that start 100 decibels and more below [[WikiPedia:Full_scale|full scale]]. Maybe<br />
if the CD had been<br />
[http://www.research.philips.com/technologies/projects/cd/index.html 14 bits as originally designed],<br />
dither ''might'' be<br />
more important. Maybe. At 16 bits, really, it's mostly a wash. You<br />
can think of dither as an insurance policy that gives several extra<br />
decibels of dynamic range just in case. The simple fact is, though, no<br />
one ever ruined a great recording by not dithering the final master.<br />
<br />
==Bandlimitation and timing==<br />
[[image:Dsat_016.jpg|360px|right]]<br />
<br />
We've been using [[WikiPedia:Sine_wave|sine waves]]. They're the obvious choice when what we<br />
want to see is a system's behavior at a given isolated frequency. Now let's look at something a bit more complex. What should we expect to happen when I change the input to a [[WikiPedia:Square_wave|square wave]]... The input scope confirms our 1kHz square wave. The output scope shows… Exactly what it should.<br />
<br />
What is a square wave really? <br />
<br />
Well, we can say it's a waveform that's some positive value for half a cycle and then transitions instantaneously to a negative value for the other half.<br />
<br />
:<math><br />
\ x(t) = \begin{cases} 1, & |t| < T_1 \\ 0, & T_1 < |t| \leq {1 \over 2}T \end{cases}<br />
</math><br />
<br />
But that doesn't really tell us anything useful about how that input becomes this output.<br />
<br />
Then we remember that any waveform is also [[WikiPedia:Fourier_series|the sum of discrete frequencies]],<br />
and a square wave is particularly simple sum: a fundamental and an<br />
infinite series of [[WikiPedia:Even_and_odd_functions#Harmonics|odd harmonics]]. Sum them all up, you get a<br />
square wave.<br />
<br />
[[image:Dsat_013.jpg|360px|right]]<br />
:<math>\begin{align}<br />
x_{\mathrm{square}}(t) = \frac{4}{\pi}\sin(\omega t) + \frac{4}{3\pi}\sin(3\omega t) + \frac{4}{5\pi}\sin(5\omega t) + \\<br />
\frac{4}{7\pi}\sin(7\omega t) + \frac{4}{9\pi}\sin(9\omega t) + \frac{4}{11\pi}\sin(11\omega t) + \\ <br />
\frac{4}{13\pi}\sin(13\omega t) + \frac{4}{15\pi}\sin(15\omega t) + \frac{4}{17\pi}\sin(17\omega t) + \\<br />
\frac{4}{19\pi}\sin(19\omega t) + \frac{4}{21\pi}\sin(21\omega t) + \frac{4}{23\pi}\sin(23\omega t) + \\<br />
\frac{4}{25\pi}\sin(25\omega t) + \frac{4}{27\pi}\sin(27\omega t) + \frac{4}{29\pi}\sin(29\omega t) + \\<br />
\frac{4}{31\pi}\sin(31\omega t) + \frac{4}{33\pi}\sin(33\omega t) + \cdots <br />
\end{align}</math><br />
<br />
At first glance, that doesn't seem very useful either. You have to sum up an infinite number of harmonics to get the answer. ''Ah'', but we don't have an infinite number of harmonics.<br />
<br />
We're using a quite sharp [[WikiPedia:Low-pass_filter|anti-aliasing filter]] that cuts off right<br />
above 20kHz, so our signal is [[WikiPedia:Bandlimiting|bandlimited]], so only the first ten terms make it through.<br />
<br />
..and that's exactly what we see on the output scope.<br />
<br />
<br style="clear:both;"/><br />
<center><div style="background-color:#DDDDFF;border-color:#CCCCDD;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
'''Going deeper…'''<br />
*In modern web browsers you can program audio synthesizers directly in javascript. Use the two square wave formulas to get a square wave out of [http://js.do/blog/sound-waves-with-javascript/ this page]. (Note: The scope is not very accurate/useful.) <br />
</div></center><br />
<br />
[[Image:dsat_015.jpg|360px|right]]<br />
The rippling you see around sharp edges in a bandlimited signal is called the [[WikiPedia:/Gibbs_phenomenon|Gibbs effect]]. It happens whenever you slice off part of the frequency domain in the middle of nonzero energy.<br />
<br />
The usual rule of thumb you'll hear is "the sharper the cutoff, the<br />
stronger the rippling", which is approximately true, but we have to be<br />
careful how we think about it.<br />
<br />
<br />
For example... what would you expect our quite sharp anti-aliasing filter<br />
to do if I run our signal through it a second time?<br />
<br />
Aside from adding a few fractional cycles of delay, the answer is...<br />
nothing at all. The signal is already bandlimited. Bandlimiting it<br />
again doesn't do anything. A second pass can't remove frequencies<br />
that we already removed.<br />
<br />
And that's important. People tend to think of the ripples as<br />
a kind of [[WikiPedia:Sonic_artifact|artifact]] that's added by anti-aliasing and [[WikiPedia:Reconstruction_filter|anti-imaging]]<br />
filters, implying that the ripples get worse each time the signal<br />
passes through. We can see that in this case that didn't happen. So<br />
was it really the filter that added the ripples the first time<br />
through? No, not really. It's a subtle distinction, but Gibbs effect<br />
ripples aren't added by filters, they're just part of what a<br />
bandlimited signal ''is''.<br />
<br />
Even if we synthetically construct what looks like a perfect digital<br />
square wave,<br />
<br />
it's still limited to the channel bandwidth. Remember,<br />
the stairstep representation is misleading.<br />
<br />
What we really have here are instantaneous sample points,<br />
<br />
and only one bandlimited signal fits those points. All we did when we<br />
drew our apparently perfect square wave was line up the sample points<br />
just right so it appeared that there were no ripples if we played<br />
[[WikiPedia:Interpolation|connect-the-dots]].<br />
<br />
But the original bandlimited signal, complete with ripples, was<br />
still there.<br />
<br />
[[image:Dsat_014.gif|360px|right]]<br />
And that leads us to one more important point. You've probably heard<br />
that the timing precision of a digital signal is limited by its sample<br />
rate; put another way,<br />
<br />
that digital signals can't represent anything that falls between the<br />
samples.. implying that [[WikiPedia:Dirac_delta_function|impulses]] or<br />
[[WikiPedia:Synthesizer#ADSR_envelope|fast attacks]] have to align exactly<br />
with a sample, or the timing gets mangled... or they just disappear.<br />
<br />
At this point, we can easily see why that's wrong.<br />
<br />
Again, our input signals are bandlimited. And digital signals are<br />
samples, not stairsteps, not 'connect-the-dots'. We most certainly<br />
can, for example, put the rising edge of our bandlimited square wave<br />
anywhere we want between samples.<br />
<br />
It's represented perfectly and it's reconstructed perfectly.<br />
<br />
==Epilogue==<br />
<br />
[[Image:Moffey.jpg|360px|right]]<br />
<br />
Just like in [[Videos/A_Digital_Media_Primer_For_Geeks|the previous episode]], we've covered a broad range of<br />
topics, and yet barely scratched the surface of each one. If anything, my<br />
sins of omission are greater this time around... but this is a good<br />
stopping point.<br />
<br />
Or maybe, a good starting point. Dig deeper. Experiment. I chose my<br />
demos very carefully to be simple and give clear results. You can<br />
reproduce every one of them on your own if you like. But let's face<br />
it, sometimes we learn the most about a spiffy toy by breaking it open<br />
and studying all the pieces that fall out. And that's OK, we're<br />
engineers. Play with the demo parameters, hack up the code, set up<br />
alternate experiments. The source code for everything, including the<br />
little pushbutton demo application, is up at xiph.org.<br />
<br />
In the course of experimentation, you're likely to run into something<br />
that you didn't expect and can't explain. Don't worry! My earlier<br />
snark aside, Wikipedia is fantastic for exactly this kind of casual<br />
research. And, if you're really serious about understanding signals,<br />
several universities have advanced materials online, such as the<br />
[http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-003-signals-and-systems-spring-2010/index.htm 6.003]<br />
and<br />
[http://ocw.mit.edu/resources/res-6-007-signals-and-systems-spring-2011/ RES.6-007]<br />
Signals and Systems modules at MIT OpenCourseWare. And of<br />
course, there's always the [http://webchat.freenode.net/?channels=xiph community here at Xiph.Org].<br />
<br />
Digging deeper or not, I am out of coffee, so, until next time, happy<br />
hacking!<br />
<br />
==Credits==<br />
[[Image:Dmpfg_019.png|360px|right]]<br />
Written by: Christopher (Monty) Montgomery and the Xiph.Org Community<br />
<br />
Special thanks to:<br />
*Heidi Baumgartner, for the second Tektronix oscilloscope<br />
*Gregory Maxwell and Dr. Timothy Terriberry, for additional technical review<br />
<br />
Intro, title and credits music:<br><br />
"[http://music.lousyrobot.com/track/andy-warhol-is-gone Andy Warhol Is Gone]", by Lousy Robot<br><br />
Used by permission of Lousy Robot.<br><br />
Original source track All Rights Reserved.<br><br />
[http://www.lousyrobot.com www.lousyrobot.com]<br />
<br />
This Video Was Produced Entirely With Free and Open Source Software:<br><br />
<br />
*[http://www.gnu.org/ GNU]<br><br />
*[http://www.linux.org/ Linux]<br><br />
*[http://fedoraproject.org/ Fedora]<br><br />
*[http://cinelerra.org/ Cinelerra]<br><br />
*[http://www.gimp.org/ The Gimp]<br><br />
*[http://audacity.sourceforge.net/ Audacity]<br><br />
*[http://svn.xiph.org/trunk/postfish/README Postfish]<br><br />
*[http://gstreamer.freedesktop.org/ Gstreamer]<br><br />
<br />
All trademarks are the property of their respective owners. <br />
<br />
*''Complete video'' [http://creativecommons.org/licenses/by-sa/3.0/legalcode CC-BY-SA]<br><br />
*''Text transcript and Wiki edition'' [http://creativecommons.org/licenses/by-sa/3.0/legalcode CC-BY-SA]<br><br />
<br />
A Co-Production of Xiph.Org and Red Hat, Inc.<br><br />
(C) 2012-2013, Some Rights Reserved<br><br />
<br />
== Use The Source Luke ==<br />
<br />
As stated in the Epilogue, everything that appears in the video demos is driven by open source software, which means the source is both available for inspection and freely usable by the community. The Thinkpad that appears in the video was running Fedora 17 and Gnome Shell (Gnome 3). The demonstration software does not require Fedora specifically, but it does require Gnu/Linux to run in its current form. In all, the video involved just under 50,000 lines of new and custom-purpose code (including contributions to non-Xiph projects such as Cinelerra and Gromit).<br />
<br />
=== The Spectrum and Waveform Viewer ===<br />
<br />
The realtime software spectrum analyzer application that appears in the video was a preexisting application that was dusted off and updated for use in the video. The waveform viewer (effectively a simple software oscilloscope) was written from scratch making use of some of the internals from the spectrum analyzer application. Both are available from Xiph.Org svn:<br />
<br />
<center><div style="background-color:#DDDDDD;border-color:#CCCCCC;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
*Source for the Spectrum and Waveform applications is found at:<br />
https://svn.xiph.org/trunk/spectrum/<br />
*The source can be checked out of svn using the following command line:<br />
svn co https://svn.xiph.org/trunk/spectrum<br />
*Trac is a convenient way to browse the source without checking out a copy:<br />
https://trac.xiph.org/browser/trunk/spectrum<br />
</div></center><br />
<br />
Spectrum and Waveform both expect an input stream on the command line, either as raw data or as a WAV file.<br />
<br />
=== GTK-Bounce ===<br />
<br />
The touch-controlled application used in the video is named 'gtk-bounce' and was custom-written for the sole purpose of the in-video demonstrations. It is so named because, for the most part, all it does is read the input from an audio device, and then immediately write the same data back out for playback. It also forwards a copy of this data to up to two external monitoring applications, and in several demos, applies simple filters or generates simple waveforms. It includes several demos not included in the video.<br />
<br />
<center><div style="background-color:#DDDDDD;border-color:#CCCCCC;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
*Source for gtk-bounce is found at:<br />
https://svn.xiph.org/trunk/Xiph-episode-II/bounce/<br />
*The source can be checked out of svn using the following command line:<br />
svn co https://svn.xiph.org/trunk/Xiph-episode-II/bounce/<br />
*Trac is a convenient way to browse the source without checking out a copy:<br />
https://trac.xiph.org/browser/Xiph-episode-II/bounce/<br />
</div></center><br />
<br />
==== Starting Gtk-bounce ====<br />
The application is somewhat hardwired for specific demo parameters, but most of the hardwired settings can be found at the top of each source file. As found in SVN, the application expects an ALSA hardware audio device at hw:1, and if none if found, it will wait for one to appear. Once a sound device is successfully initialized, it expects to find and open two pipes named pipe0 and pipe1 for output in the current directory. In the video, the waveform and spectrum applications are started to take input from pipe0 and pipe1 respectively. The output sent to the two pipes is identical, and in most demos matches the output data sent to the hardware device for conversion to analog. The only exception is the tenth demo panel (which does not appear in the video) where gtk-bounce can be set to monitor the hardware inputs instead while the outputs are used to produce test waveforms.<br />
<br />
Assuming gtk-bounce, spectrum and waveform have been checked out and built, the configuration seen in the video can be started using the following commands:<br />
<center><div style="background-color:#DDDDDD;border-color:#CCCCCC;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
* make the pipe fifos for the applications to communicate (only needs to be done once)<br />
mkfifo pipe0 pipe1<br />
* start all three applications<br />
waveform pipe0 & spectrum pipe1 & gtk-bounce &<br />
</div></center><br />
<br />
==== Using Gtk-bounce ====<br />
<br />
Gtk-bounce consists of eleven pushbutton panels (numbered zero through ten) that can be selected by scrolling up and dwon with the arrow buttons on the right side. Each panel is intended for a specific demo or part of a demo.<br />
<br />
<center><div style="background-color:#DDDDDD;border-color:#CCCCCC;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
<br />
[[Image:Dsat-panel0.png|700px|center]]<br />
* '''Panel 0''': This panel presents buttons that allow the sound card to be configured in several sampling rates and bit depths. Samples read from the audio inputs are sent to the output pipes and audio outputs for playback without modification.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel1.png|700px|center]]<br />
* '''Panel 1''': Both channels are forwarded to the outputs, however the user may select the bit depth of each channel independently. When the sound card is running in 16 bit mode and 16-bit depth is selected, the data is untouched. Requantization to a lower bit depth is performed with a flat triangle dither.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel2.png|700px|center]]<br />
* '''Panel 2''': Both channels are re-quantized to the selected bit depth. Requantization to a lower bit depth is performed with a flat triangle dither.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel3.png|700px|center]]<br />
* '''Panel 3''': 'generate sine wave' discards the audio inputs and instead internally generates a sine wave at 32 bit precision, which is then quantized to the selected bit depth, optionally with dither. The resulting signal is then forwarded to the output. <br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel4.png|700px|center]]<br />
* '''Panel 4''': gtk-bounce generates a 16-bit sine wave of the selected amplitude, optionally with dither, and forwards the resulting signal to the outputs. The audio input from the audio device is discarded. Note that the slider sets the peak amplitude, not the peak-to-peak amplitude.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel5.png|700px|center]]<br />
* '''Panel 5''': generates a 16-bit sine wave, optionally quantized using dither. The user may additionally select a flat or a shaped dither. The 'notch and gain' button applies a notch filter to the resulting signal, and boosts the gain of the remaining noise so that it's easily audible. The audio input from the audio device is discarded.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel6.png|700px|center]]<br />
* '''Panel 6''': allows the user to play with the power of the dithering noise applied before quantizing the sine wave. Shaped or flat dither are available. The sine wave may also be modulated with a varying amplitude to highlight correlations between the input and the resulting quantization noise. The 'notch and gain' button applies a notch filter to the resulting signal, and boosts the gain of the remaining noise so that it's easily audible. The audio input from the audio device is discarded.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel7.png|700px|center]]<br />
* '''Panel 7''': applies a sharper antialiasing (lowpass) filter than is likely to be built into the sound-card hardware (as there's generally no reason to use a filter quite this sharp in practice). The very sharp filter allows us to bandpass the demonstration square wave without any harmonics landing in the transition band. The input is read from the audio device, passed through this sharper filter, and then forwarded to the outputs.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel8.png|700px|center]]<br />
* '''Panel 8''': when selected, generate a synthetic 'square wave' (this is not quite equivalent to a bandlimited analog square wave; the harmonic amplitudes are a bit different) that when aligned with the sampling phase just right gives the appearance of having infinite rise and fall time. The slider allows us to shift the waveform sample alignment back and forth by +/- one sample to reveal that the underlying signal is still band-limited.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel9.png|700px|center]]<br />
* '''Panel 9''': as in panel 8, generate a 'perfect' synthetic 'square wave'. However, the slider now allows us to shift the sample alignment of the second channel with respect to the first, instead of shifting both channels. This allows us the trigger/lock the scope timing to the channel 1 waveform so we can see the fractional sample movement and alignment of the waveform on channel 2. The audio input from the audio device is discarded.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel10.png|700px|center]]<br />
* '''Panel 10''': not used in the video; The audio device is configured to 24-bit input/output. The user may produce one of a range of test signals that are output to both the external applications and the audio device on the first channel. The input on the second channel is passed-through to the applications and audio device outputs unchanged. The first channel input is unused unless 'two input mode' is selected. When two input mode is selected, both input channels are read and the data sent to the external applications. Generated test signals are sent only to the audio hardware (on the first channel). This combination of test signals and input modes allows self-references frequency response, phase, noise, distortion and crosstalk testing of a given audio device.<br />
<br />
<div style="clear: both">&nbsp;</div><br />
<br />
</div></center><br />
<br />
=== Cairo Animations ===<br />
<br />
The animations featured throughout the Episode 2 video were rapid-development spaghetti hack-jobs coded by hand in raw Cairo. Each module generated a series of PNG stills that were then stitched into an animation with Cinelerra or mplayer. In the interest of pointing and laughing at what really bad code looks like...<br />
<br />
<center><div style="background-color:#DDDDDD;border-color:#CCCCCC;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
*Source for the Cairo animations is found at:<br />
https://svn.xiph.org/trunk/Xiph-episode-II/cairo/<br />
*The source can be checked out of svn using the following command line:<br />
svn co https://svn.xiph.org/trunk/Xiph-episode-II/cairo/<br />
*Trac is a convenient way to browse the source without checking out a copy:<br />
https://trac.xiph.org/browser/Xiph-episode-II/cairo/<br />
</div></center></div>Gmaxwellhttps://wiki.xiph.org/index.php?title=File:Dsat_016.jpg&diff=14017File:Dsat 016.jpg2013-02-26T10:17:29Z<p>Gmaxwell: Videos/Digital_Show_and_Tell</p>
<hr />
<div>[[Videos/Digital_Show_and_Tell]]</div>Gmaxwellhttps://wiki.xiph.org/index.php?title=Videos/Digital_Show_and_Tell&diff=14014Videos/Digital Show and Tell2013-02-26T10:13:14Z<p>Gmaxwell: /* Bandlimitation and timing */</p>
<hr />
<div><small>''Wiki edition''</small><br />
[[Image:dsat_001.jpg|400px|right]]<br />
<br />
Continuing in the "firehose" tradition of [[Videos/A_Digital_Media_Primer_For_Geeks|Episode 01]], Xiph.Org's second video on digital media explores multiple facets of digital audio signals and how they ''really'' behave in the real world.<br />
<br />
Demonstrations of sampling, quantization, bit-depth, and dither explore digital audio behavior on real audio equipment using both modern digital analysis and vintage analog bench equipment, just in case we can't trust those newfangled digital gizmos. You can download the source code for each demo and try it all for yourself!<br />
<br/><br/><br/><br />
<center><font size="+2">[http://www.xiph.org/video/vid2.shtml Download or Watch online]</font></center><br />
<br style="clear:both;"/><br />
Supported players: [http://www.videolan.org/vlc/ VLC 1.1+], [https://www.mozilla.com/en-US/firefox/ Firefox ], [http://www.chromium.org/Home Chrome ], [http://www.opera.com/ Opera]. Or see [http://www.webmproject.org/users/ other WebM] or [[TheoraSoftwarePlayers|other Theora]] players.<br />
<br />
If you're having trouble with playback in a modern browser or player, please visit our [[Playback_Troubleshooting|playback troubleshooting and discussion]] page.<br />
<br/><br />
<hr/><br />
<br/><br/><br/><br />
[[Image:Xiph_ep02_test.png|400px|right]]<br />
<br />
Hi, I'm Monty Montgomery from [http://www.redhat.com/ Red Hat] and [http://xiph.org/ Xiph.Org].<br />
<br />
A few months ago, I wrote<br />
[http://people.xiph.org/~xiphmont/demo/neil-young.html an article on digital audio and why 24bit/192kHz music downloads don't make sense].<br />
In the article, I<br />
mentioned--almost in passing--that a digital waveform is<br />
[http://people.xiph.org/~xiphmont/demo/neil-young.html#toc_sfam not a stairstep],<br />
and you certainly don't get a stairstep when you<br />
[[WikiPedia:Digital-to-analog_converter|convert from digital back to analog]].<br />
<br />
Of everything in the entire article, '''that''' was the number one thing<br />
people wrote about. In fact, more than half the mail I got was questions and<br />
comments about basic digital signal behavior. Since there's interest, let's<br />
take a little time to play with some ''simple'' digital signals.<br />
<br />
==Veritas ex machina==<br />
[[Image:Dsat_002.jpg|200px|right]]<br />
[[Image:Dsat_003.jpg|200px|right]]<br />
[[Image:Dsat_004.jpg|200px|right]]<br />
[[Image:Dsat_005.jpg|200px|right]]<br />
<br />
Pretend for a moment that we have no idea how digital signals really<br />
behave. In that case it doesn't make sense for us to use digital test<br />
equipment either. Fortunately for this exercise, there's still plenty<br />
of working analog lab equipment out there.<br />
<br />
First up, we need a [[WikiPedia:Function_generator|signal generator]] to provide us with analog input<br />
signals--in this case, an<br />
[http://www.home.agilent.com/en/pd-3325A%3Aepsg%3Apro-pn-3325A/synthesizer-function-generator?pm=PL&nid=-536900197.536896863&cc=SE&lc=swe HP3325]<br />
from 1978. It's still a pretty good<br />
generator, so if you don't mind the size, the weight, the power<br />
consumption, and the noisy fan, you can find them on eBay... occasionally<br />
for only slightly more than you'll pay for shipping.<br />
<br />
Next, we'll observe our analog waveforms on [[WikiPedia:Oscilloscope_types#Cathode-ray_oscilloscope_.28CRO.29|analog oscilloscopes]],<br />
like this Tektronix 2246 from the mid-90s, one of the last and very best analog scopes ever made. Every home lab should have one.<br />
<br />
...and finally inspect the [[WikiPedia:Spectral_density#Electrical_engineering|frequency spectrum]] of our signals using an<br />
[[WikiPedia:Spectrum_analyzer#Swept-tuned|analog spectrum analyzer]], this<br />
[http://www.home.agilent.com/en/pd-3585A%3Aepsg%3Apro-pn-3585A/spectrum-analyzer-high-perf-20hz-40mhz?pm=PL&nid=-536900197.536897319&cc=SE&lc=swe HP3585]<br />
from the same product line as<br />
the signal generator. Like the other equipment here it has<br />
[http://www.hp9845.net/9845/hardware/processors/ a rudimentary and hilariously large microcontroller],<br />
but the signal path<br />
from input to what you see on the screen is completely analog.<br />
<br />
All of this equipment is vintage, but aside from its raw tonnage, the specs are still quite good.<br />
<br />
At the moment, we have our signal generator set to output a nice 1 [[WikiPedia:Hertz#SI_multiples|kHz]]<br />
sine wave at one [[WikiPedia:Volt|Volt]] [[WikiPedia:Amplitude#Root_mean_square_amplitude|RMS]].<br />
We see the sine wave on the oscilloscope, can verify that it is indeed<br />
1 kHz at 1 Volt RMS, which is 2.8 Volts<br />
[[WikiPedia:Amplitude#Peak-to-peak_amplitude|peak-to-peak]],<br />
and that matches the<br />
measurement on the spectrum analyzer as well.<br />
<br />
The analyzer also shows some low-level [[WikiPedia:White_noise|white noise]]<br />
and just a bit of [[WikiPedia:Harmonic_distortion#Harmonic_distortion|harmonic distortion]],<br />
with the highest peak about 70[[WikiPedia:Decibel|dB]] or so below<br />
[[WikiPedia:Fundamental_frequency|the fundamental]].<br />
Now, this doesn't matter at all in our demos, but I<br />
wanted to point it out now just in case you didn't notice it until<br />
later.<br />
<br />
Now, we drop digital sampling in the middle.<br />
<br />
For the conversion, we'll use a boring, consumer-grade, eMagic USB1<br />
audio device. It's also more than ten years old at this point, and it's<br />
getting obsolete.<br />
<br />
A recent converter can easily have an order of magnitude better specs.<br />
[[WikiPedia:Reconstruction_filter#Sampled_data_reconstruction_filters|Flatness]],<br />
[[WikiPedia:Analog-to-digital_converter#Non-linearity|linearity]],<br />
[[WikiPedia:Jitter#Sampling_jitter|jitter]],<br />
[[WikiPedia:Noise_floor|noise behavior]],<br />
[[WikiPedia:Digital-to-analog_converter#DAC_performance|everything]]...<br />
you may not<br />
have noticed. Just because we can measure an improvement doesn't<br />
mean we can hear it, and even these old consumer boxes were already at<br />
the edge of ideal transparency.<br />
<br />
The eMagic connects to my ThinkPad, which displays a digital<br />
waveform and spectrum for comparison, then the ThinkPad<br />
sends the digital signal right back out to the eMagic for<br />
re-conversion to analog and observation on the output scopes.<br />
<br />
Input to output, left to right.<br />
<br style="clear:both;"/><br />
<br />
==Stairsteps==<br />
[[Image:Dsat 006.jpg|360px|right]]<br />
[[Image:Dsat 007.png|360px|right]]<br />
&ldquo;OK, it's go time. We begin by converting an analog signal to digital and<br />
then right back to analog again with no other steps.&rdquo;<br />
<br />
&ldquo;The signal generator is set to produce a 1kHz sine wave just like<br />
before.&rdquo;<br />
<br />
&ldquo;We can see our analog sine wave on our input-side oscilloscope.&rdquo;<br />
<br />
&ldquo;We digitize our signal to<br />
[[Videos/A_Digital_Media_Primer_For_Geeks#Raw_.28digital_audio.29_meat|16 bit PCM at 44.1kHz]],<br />
same as on a CD.&rdquo;<br />
<br />
&ldquo;The spectrum of the digitized signal matches what we saw earlier and what we see now on the analog spectrum analyzer, aside from its <br />
[[WikiPedia:High_impedance|high-impedance input]] being just a smidge noisier.&rdquo;<br />
<br />
&ldquo;For now, the waveform display shows our digitized sine wave as a<br />
stairstep pattern, one step for each sample.&rdquo;<br />
<br />
&ldquo;And when we look at the output signal that's been converted<br />
from digital back to analog, we see...&rdquo;<br />
<br />
&ldquo;It's exactly like the original sine wave. No stairsteps.&rdquo;<br />
<br />
&ldquo;OK, 1 kHz is still a fairly low frequency, maybe the stairsteps are just<br />
hard to see or they're being smoothed away. Fair enough. Let's choose<br />
a higher frequency, something close to [[WikiPedia:Nyquist_frequency|Nyquist]], say 15kHz.&rdquo;<br />
<br />
&ldquo;Now the sine wave is represented by less than three samples per cycle, and... the digital waveform looks pretty awful. Well, looks<br />
can be deceiving. The analog output... is still a perfect sine wave, exactly like the original.&rdquo;<br />
<br />
&ldquo;Let's keep going up.&rdquo;<br />
<br />
&ldquo;16kHz.... 17kHz... 18kHz... 19kHz...&rdquo;<br />
<br />
&ldquo;20kHz. Welcome to the upper limits of human hearing. The output waveform is still perfect. No jagged edges, no dropoff, no stairsteps.&rdquo;<br />
<br />
&ldquo;So where'd the stairsteps go? Don't answer, it's a trick question. They were never there.&rdquo;<br />
<br />
&ldquo;Drawing a digital waveform as a stairstep was wrong to begin with.&rdquo;<br />
<br />
&ldquo;Why? A stairstep is a continuous-time function. It's jagged, and it's piecewise, but it has a defined value at every point in time.&rdquo;<br />
<br />
&ldquo;A sampled signal is entirely different. It's discrete-time; it's only got a value right at each instantaneous sample point and it's<br />
undefined, there is no value at all, everywhere between. A discrete-time signal is properly drawn as a lollipop graph.&rdquo;<br />
<br />
&ldquo;The continuous, analog counterpart of a digital signal passes smoothly through each sample point, and that's just as true for high<br />
frequencies as it is for low.&rdquo;<br />
<br />
&ldquo;Now, the interesting and not at all obvious bit is: [[WikiPedia:Nyquist%E2%80%93Shannon_sampling_theorem|there's only one<br />
bandlimited signal that passes exactly through each sample point]]. It's a unique solution. So if you sample a bandlimited signal and then convert it back, the original input is also the only possible output.&rdquo;<br />
<br />
[[Image:Dsat 008.png|360px|right]]<br />
<br />
&ldquo;And before you say, "oh, I can draw a different signal that passes through those points", well, yes you can, but if it differs even<br />
minutely from the original, it includes frequency content at or beyond Nyquist, breaks the bandlimiting requirement and isn't a valid solution.&rdquo;<br />
<br />
&ldquo;So how did everyone get confused and start thinking of digital signals as stairsteps? I can think of two good reasons.&rdquo;<br />
<br />
&ldquo;First: it's easy enough to convert a sampled signal to a true stairstep. Just<br />
extend each sample value forward until the next sample period. This is<br />
called a [[WikiPedia:Zero-order hold|zero-order hold]], and it's an important part of how some<br />
digital-to-analog converters work, especially the simplest ones.&rdquo;<br />
<br />
&ldquo;So, anyone who looks up [[WikiPedia:Digital-to-analog_converter#Practical_operation|digital-to-analog converter or<br />
digital-to-analog conversion]] is probably going to see a diagram of a<br />
stairstep waveform somewhere, but that's not a finished conversion,<br />
and it's not the signal that comes out.&rdquo;<br />
<br />
&ldquo;Second, and this is probably the more likely reason, engineers who<br />
supposedly know better, like me, draw stairsteps even though they're<br />
technically wrong. It's a sort of like a one-dimensional version of<br />
[[WikiPedia:MacPaint#Development|fat bits in an image editor]].&rdquo;<br />
<br />
&ldquo;Pixels aren't squares either, they're samples of a 2-dimensional<br />
function space and so they're also, conceptually, infinitely small<br />
points. Practically, it's a real pain in the ass to see or manipulate<br />
infinitely small anything, so big squares it is. Digital stairstep<br />
drawings are exactly the same thing.&rdquo;<br />
<br />
&ldquo;It's just a convenient drawing. The stairsteps aren't really there.&rdquo;<br />
<br />
==Bit-depth==<br />
[[Image:Dsat_009.jpg|360px|right]]<br />
[[Image:Dsat_010.jpg|260px|right]]<br />
<br />
When we convert a digital signal back to analog, the result is<br />
''also'' smooth regardless of the [[WikiPedia:Audio_bit_depth|bit depth]]. 24 bits or 16 bits...<br />
or 8 bits... it doesn't matter.<br />
<br />
So does that mean that the digital bit depth makes no difference at<br />
all? Of course not.<br />
<br />
Channel 2 here is the same sine wave input, but we quantize with<br />
[[WikiPedia:Dither|dither]] down to 8 bits.<br />
<br />
On the scope, we still see a nice<br />
smooth sine wave on channel 2. Look very close, and you'll also see a<br />
bit more noise. That's a clue.<br />
<br />
If we look at the spectrum of the signal... aha! Our sine wave is<br />
still there unaffected, but the noise level of the 8-bit signal on<br />
the second channel is much higher!<br />
<br />
And that's the difference the number of bits makes. That's it!<br />
<br />
When we digitize a signal, first we sample it. The<br />
sampling step is perfect; it loses nothing. But then we [[WikiPedia:Quantization_(sound_processing)|quantize]] it,<br />
and [[WikiPedia:Quantization_error|quantization adds noise]].<br />
<br />
The number of bits determines how much noise and so the level of the<br />
noise floor.<br />
<br />
What does this dithered quantization noise sound like? Let's listen<br />
to our 8-bit sine wave.<br />
<br />
That may have been hard to hear anything but the tone. Let's listen<br />
to just the noise after we notch out the sine wave and then bring the<br />
gain up a bit because the noise is quiet.<br />
<br />
Those of you who have used analog recording equipment may have just<br />
thought to yourselves, "My goodness! That sounds like tape hiss!"<br />
Well, it doesn't just sound like tape hiss, it acts like it too, and<br />
if we use a [[WikiPedia:Dither#Different_types|gaussian dither]] then it's<br />
[[WikiPedia:Central_limit_theorem|mathematically equivalent]] in every way. It ''is'' tape hiss.<br />
<br />
Intuitively, that means that we can measure tape hiss and thus the noise floor<br />
of [[WikiPedia:Magnetic_tape_sound_recording|magnetic audio tape]]<br />
in [[WikiPedia:Shannon–Hartley_theorem#Examples|bits instead of decibels]], in order to put things in a<br />
digital perspective. [[WikiPedia:Compact cassettes|Compact cassettes]] (for those of you who are old enough to remember them) could reach as<br />
deep as 9 bits in perfect conditions, though 5 to 6 bits was<br />
more typical, especially if it was a recording made on a<br />
[[WikiPedia:Cassette_deck|tape deck]]. That's right... your mix tapes were only about 6 bits<br />
deep... if you were lucky!<br />
<br />
The very best professional [[WikiPedia:Reel-to-reel_audio_tape_recording|open reel tape]] used in studios could barely<br />
hit... any guesses? 13 bits ''with'' [[WikiPedia:Reel-to-reel_audio_tape_recording#Noise_reduction|advanced noise reduction]]. And<br />
that's why seeing '[[WikiPedia:SPARS_code|D D D]]' on a [[WikiPedia:Compact_disk|Compact Disc]] used to be such a big,<br />
high-end deal.<br />
<br />
==Dither==<br />
[[Image:Dsat_011.png|360px|right]]<br />
<br />
I keep saying that I'm quantizing with [[Wikipedia:dither|dither]], so what is dither<br />
exactly and, more importantly, what does it do?<br />
<br />
The simple way to quantize a signal is to choose the digital<br />
amplitude value closest to the original analog amplitude. [[WikiPedia:Rounding|Obvious]],<br />
right? Unfortunately, the exact noise you get from this simple<br />
quantization scheme depends somewhat on the input signal,<br />
<br />
so we may get noise that's inconsistent, or causes distortion, or is<br />
undesirable in some other way.<br />
<br style="clear:both;"/><br />
<center><div style="background-color:#DDDDFF;border-color:#CCCCDD;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
'''Going deeper…'''<br />
*Cameron Nicklaus Christou's thesis [http://uwspace.uwaterloo.ca/bitstream/10012/3867/1/thesis.pdf Optimal Dither and Noise Shaping in Image Processing] provides an ''excellent'' explanation of dither and noise shaping.<br />
</div></center><br />
<br />
Dither is specially-constructed noise that substitutes for the noise<br />
produced by simple quantization. Dither doesn't [[WikiPedia:Sound_masking|drown out or mask]]<br />
quantization noise, it actually replaces it with noise characteristics<br />
of our choosing that aren't influenced by the input.<br />
<br />
Let's ''watch'' what dither does. The signal generator has too much noise for this test so we'll produce a mathematically perfect sine wave with the ThinkPad and quantize it to 8 bits with dithering.<br />
<br />
We see a nice sine wave on the waveform display and output scope and, once the analog spectrum analyzer catches up...<br />
a clean frequency peak with a uniform noise floor on both spectral displays<br />
just like before. Again, this is with dither.<br />
<br />
Now I turn dithering off.<br />
<br />
The quantization noise, that dither had spread out into a nice, flat noise<br />
floor, piles up into harmonic distortion peaks. The noise floor is<br />
lower, but the level of distortion becomes nonzero, and the distortion<br />
peaks sit higher than the dithering noise did.<br />
<br />
At 8 bits this effect is exaggerated. At 16 bits,<br />
even without dither, harmonic distortion is going to be so low as to<br />
be completely inaudible.<br />
<br />
Still, we can use dither to eliminate it completely if we so choose.<br />
<br />
Turning the dither off again for a moment, you'll notice that the<br />
absolute level of distortion from undithered quantization stays<br />
approximately constant regardless of the input amplitude.<br />
But when the signal level drops below a half a bit, everything<br />
quantizes to zero.<br />
<br />
In a sense, everything quantizing to zero is just 100% distortion!<br />
Dither eliminates this distortion too. We reenable dither<br />
and ... there's our signal back at 1/4 bit, with our nice flat noise floor.<br />
<br />
The noise floor doesn't have to be flat. Dither is noise of our<br />
choosing, so let's choose a noise as [http://www.acoustics.salford.ac.uk/res/cox/sound_quality/?content=subjective inoffensive] and<br />
[[WikiPedia:Absolute_threshold_of_hearing|difficult to notice]]<br />
as possible.<br />
<br />
Our hearing is most sensitive in the midrange from 2kHz to 4kHz,<br />
so that's where background noise is going to be the most obvious.<br />
We can [[WikiPedia:Noise_shaping|shape dithering noise]] away from sensitive frequencies to where<br />
hearing is less sensitive, usually the highest frequencies.<br />
<br />
16-bit dithering noise is normally much too quiet to hear at all, but<br />
let's listen to our noise shaping example, again with the gain<br />
brought way up...<br />
<br />
Lastly, dithered quantization noise ''is'' higher [[WikiPedia:Sound_power|power]] overall<br />
than undithered quantization noise even when it sounds quieter, and<br />
you can see that on a [[WikiPedia:VU_meter|VU meter]] during passages of near-silence. But<br />
dither isn't only an on or off choice. We can reduce the dither's<br />
power to balance less noise against a bit of distortion to minimize<br />
the overall effect.<br />
<br />
We'll also [[WikiPedia:Amplitude_modulation|modulate the input signal]] like this to show how a varying input affects the quantization noise. At<br />
full dithering power, the noise is uniform, constant, and featureless<br />
just like we expect:<br />
<br />
As we reduce the dither's power, the input increasingly<br />
affects the amplitude and the character of the quantization noise.<br />
Shaped dither behaves similarly, but noise shaping lends one more nice<br />
advantage. To make a long story short, it can use a somewhat lower<br />
dither power before the input has as much effect on the output.<br />
<br />
Despite all the time I just spent on dither, we're talking about<br />
differences that start 100 decibels and more below [[WikiPedia:Full_scale|full scale]]. Maybe<br />
if the CD had been<br />
[http://www.research.philips.com/technologies/projects/cd/index.html 14 bits as originally designed],<br />
dither ''might'' be<br />
more important. Maybe. At 16 bits, really, it's mostly a wash. You<br />
can think of dither as an insurance policy that gives several extra<br />
decibels of dynamic range just in case. The simple fact is, though, no<br />
one ever ruined a great recording by not dithering the final master.<br />
<br />
==Bandlimitation and timing==<br />
[[image:Dsat_013.jpg|360px|right]]<br />
<br />
We've been using [[WikiPedia:Sine_wave|sine waves]]. They're the obvious choice when what we<br />
want to see is a system's behavior at a given isolated frequency. Now let's look at something a bit more complex. What should we expect to happen when I change the input to a [[WikiPedia:Square_wave|square wave]]... The input scope confirms our 1kHz square wave. The output scope shows… Exactly what it should.<br />
<br />
What is a square wave really? <br />
<br />
Well, we can say it's a waveform that's some positive value for half a cycle and then transitions instantaneously to a negative value for the other half.<br />
<br />
:<math><br />
\ x(t) = \begin{cases} 1, & |t| < T_1 \\ 0, & T_1 < |t| \leq {1 \over 2}T \end{cases}<br />
</math><br />
<br />
But that doesn't really tell us anything useful about how that input becomes this output.<br />
<br />
Then we remember that any waveform is also [[WikiPedia:Fourier_series|the sum of discrete frequencies]],<br />
and a square wave is particularly simple sum: a fundamental and an<br />
infinite series of [[WikiPedia:Even_and_odd_functions#Harmonics|odd harmonics]]. Sum them all up, you get a<br />
square wave.<br />
<br />
[[Image:dsat_015.jpg|360px|right]]<br />
:<math>\begin{align}<br />
x_{\mathrm{square}}(t) = \frac{4}{\pi}\sin(\omega t) + \frac{4}{3\pi}\sin(3\omega t) + \frac{4}{5\pi}\sin(5\omega t) + \\<br />
\frac{4}{7\pi}\sin(7\omega t) + \frac{4}{9\pi}\sin(9\omega t) + \frac{4}{11\pi}\sin(11\omega t) + \\ <br />
\frac{4}{13\pi}\sin(13\omega t) + \frac{4}{15\pi}\sin(15\omega t) + \frac{4}{17\pi}\sin(17\omega t) + \\<br />
\frac{4}{19\pi}\sin(19\omega t) + \frac{4}{21\pi}\sin(21\omega t) + \frac{4}{23\pi}\sin(23\omega t) + \\<br />
\frac{4}{25\pi}\sin(25\omega t) + \frac{4}{27\pi}\sin(27\omega t) + \frac{4}{29\pi}\sin(29\omega t) + \\<br />
\frac{4}{31\pi}\sin(31\omega t) + \frac{4}{33\pi}\sin(33\omega t) + \cdots <br />
\end{align}</math><br />
<br />
At first glance, that doesn't seem very useful either. You have to sum up an infinite number of harmonics to get the answer. ''Ah'', but we don't have an infinite number of harmonics.<br />
<br />
We're using a quite sharp [[WikiPedia:Low-pass_filter|anti-aliasing filter]] that cuts off right<br />
above 20kHz, so our signal is [[WikiPedia:Bandlimiting|bandlimited]], so only the first ten terms make it through.<br />
<br />
..and that's exactly what we see on the output scope.<br />
<br />
<br style="clear:both;"/><br />
<center><div style="background-color:#DDDDFF;border-color:#CCCCDD;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
'''Going deeper…'''<br />
*In modern web browsers you can program audio synthesizers directly in javascript. Use the two square wave formulas to get a square wave out of [http://js.do/blog/sound-waves-with-javascript/ this page]. (Note: The scope is not very accurate/useful.) <br />
</div></center><br />
<br />
The rippling you see around sharp edges in a bandlimited signal is called the [[WikiPedia:/Gibbs_phenomenon|Gibbs effect]]. It happens whenever you slice off part of the frequency domain in the middle of nonzero energy.<br />
<br />
The usual rule of thumb you'll hear is "the sharper the cutoff, the<br />
stronger the rippling", which is approximately true, but we have to be<br />
careful how we think about it.<br />
For example... what would you expect our quite sharp anti-aliasing filter<br />
to do if I run our signal through it a second time?<br />
<br />
Aside from adding a few fractional cycles of delay, the answer is...<br />
nothing at all. The signal is already bandlimited. Bandlimiting it<br />
again doesn't do anything. A second pass can't remove frequencies<br />
that we already removed.<br />
<br />
And that's important. People tend to think of the ripples as<br />
a kind of [[WikiPedia:Sonic_artifact|artifact]] that's added by anti-aliasing and [[WikiPedia:Reconstruction_filter|anti-imaging]]<br />
filters, implying that the ripples get worse each time the signal<br />
passes through. We can see that in this case that didn't happen. So<br />
was it really the filter that added the ripples the first time<br />
through? No, not really. It's a subtle distinction, but Gibbs effect<br />
ripples aren't added by filters, they're just part of what a<br />
bandlimited signal ''is''.<br />
<br />
Even if we synthetically construct what looks like a perfect digital<br />
square wave,<br />
<br />
it's still limited to the channel bandwidth. Remember,<br />
the stairstep representation is misleading.<br />
<br />
What we really have here are instantaneous sample points,<br />
<br />
and only one bandlimited signal fits those points. All we did when we<br />
drew our apparently perfect square wave was line up the sample points<br />
just right so it appeared that there were no ripples if we played<br />
[[WikiPedia:Interpolation|connect-the-dots]].<br />
<br />
But the original bandlimited signal, complete with ripples, was<br />
still there.<br />
<br />
[[image:Dsat_014.gif|360px|right]]<br />
And that leads us to one more important point. You've probably heard<br />
that the timing precision of a digital signal is limited by its sample<br />
rate; put another way,<br />
<br />
that digital signals can't represent anything that falls between the<br />
samples.. implying that [[WikiPedia:Dirac_delta_function|impulses]] or<br />
[[WikiPedia:Synthesizer#ADSR_envelope|fast attacks]] have to align exactly<br />
with a sample, or the timing gets mangled... or they just disappear.<br />
<br />
At this point, we can easily see why that's wrong.<br />
<br />
Again, our input signals are bandlimited. And digital signals are<br />
samples, not stairsteps, not 'connect-the-dots'. We most certainly<br />
can, for example, put the rising edge of our bandlimited square wave<br />
anywhere we want between samples.<br />
<br />
It's represented perfectly and it's reconstructed perfectly.<br />
<br />
==Epilogue==<br />
<br />
[[Image:Moffey.jpg|360px|right]]<br />
<br />
Just like in [[Videos/A_Digital_Media_Primer_For_Geeks|the previous episode]], we've covered a broad range of<br />
topics, and yet barely scratched the surface of each one. If anything, my<br />
sins of omission are greater this time around... but this is a good<br />
stopping point.<br />
<br />
Or maybe, a good starting point. Dig deeper. Experiment. I chose my<br />
demos very carefully to be simple and give clear results. You can<br />
reproduce every one of them on your own if you like. But let's face<br />
it, sometimes we learn the most about a spiffy toy by breaking it open<br />
and studying all the pieces that fall out. And that's OK, we're<br />
engineers. Play with the demo parameters, hack up the code, set up<br />
alternate experiments. The source code for everything, including the<br />
little pushbutton demo application, is up at xiph.org.<br />
<br />
In the course of experimentation, you're likely to run into something<br />
that you didn't expect and can't explain. Don't worry! My earlier<br />
snark aside, Wikipedia is fantastic for exactly this kind of casual<br />
research. And, if you're really serious about understanding signals,<br />
several universities have advanced materials online, such as the<br />
[http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-003-signals-and-systems-spring-2010/index.htm 6.003]<br />
and<br />
[http://ocw.mit.edu/resources/res-6-007-signals-and-systems-spring-2011/ RES.6-007]<br />
Signals and Systems modules at MIT OpenCourseWare. And of<br />
course, there's always the [http://webchat.freenode.net/?channels=xiph community here at Xiph.Org].<br />
<br />
Digging deeper or not, I am out of coffee, so, until next time, happy<br />
hacking!<br />
<br />
==Credits==<br />
[[Image:Dmpfg_019.png|360px|right]]<br />
Written by: Christopher (Monty) Montgomery and the Xiph.Org Community<br />
<br />
Special thanks to:<br />
*Heidi Baumgartner, for the second Tektronix oscilloscope<br />
*Gregory Maxwell and Dr. Timothy Terriberry, for additional technical review<br />
<br />
Intro, title and credits music:<br><br />
"[http://music.lousyrobot.com/track/andy-warhol-is-gone Andy Warhol Is Gone]", by Lousy Robot<br><br />
Used by permission of Lousy Robot.<br><br />
Original source track All Rights Reserved.<br><br />
[http://www.lousyrobot.com www.lousyrobot.com]<br />
<br />
This Video Was Produced Entirely With Free and Open Source Software:<br><br />
<br />
*[http://www.gnu.org/ GNU]<br><br />
*[http://www.linux.org/ Linux]<br><br />
*[http://fedoraproject.org/ Fedora]<br><br />
*[http://cinelerra.org/ Cinelerra]<br><br />
*[http://www.gimp.org/ The Gimp]<br><br />
*[http://audacity.sourceforge.net/ Audacity]<br><br />
*[http://svn.xiph.org/trunk/postfish/README Postfish]<br><br />
*[http://gstreamer.freedesktop.org/ Gstreamer]<br><br />
<br />
All trademarks are the property of their respective owners. <br />
<br />
*''Complete video'' [http://creativecommons.org/licenses/by-sa/3.0/legalcode CC-BY-SA]<br><br />
*''Text transcript and Wiki edition'' [http://creativecommons.org/licenses/by-sa/3.0/legalcode CC-BY-SA]<br><br />
<br />
A Co-Production of Xiph.Org and Red Hat, Inc.<br><br />
(C) 2012-2013, Some Rights Reserved<br><br />
<br />
== Use The Source Luke ==<br />
<br />
As stated in the Epilogue, everything that appears in the video demos is driven by open source software, which means the source is both available for inspection and freely usable by the community. The Thinkpad that appears in the video was running Fedora 17 and Gnome Shell (Gnome 3). The demonstration software does not require Fedora specifically, but it does require Gnu/Linux to run in its current form. In all, the video involved just under 50,000 lines of new and custom-purpose code (including contributions to non-Xiph projects such as Cinelerra and Gromit).<br />
<br />
=== The Spectrum and Waveform Viewer ===<br />
<br />
The realtime software spectrum analyzer application that appears in the video was a preexisting application that was dusted off and updated for use in the video. The waveform viewer (effectively a simple software oscilloscope) was written from scratch making use of some of the internals from the spectrum analyzer application. Both are available from Xiph.Org svn:<br />
<br />
<center><div style="background-color:#DDDDDD;border-color:#CCCCCC;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
*Source for the Spectrum and Waveform applications is found at:<br />
https://svn.xiph.org/trunk/spectrum/<br />
*The source can be checked out of svn using the following command line:<br />
svn co https://svn.xiph.org/trunk/spectrum<br />
*Trac is a convenient way to browse the source without checking out a copy:<br />
https://trac.xiph.org/browser/trunk/spectrum<br />
</div></center><br />
<br />
Spectrum and Waveform both expect an input stream on the command line, either as raw data or as a WAV file.<br />
<br />
=== GTK-Bounce ===<br />
<br />
The touch-controlled application used in the video is named 'gtk-bounce' and was custom-written for the sole purpose of the in-video demonstrations. It is so named because, for the most part, all it does is read the input from an audio device, and then immediately write the same data back out for playback. It also forwards a copy of this data to up to two external monitoring applications, and in several demos, applies simple filters or generates simple waveforms. It includes several demos not included in the video.<br />
<br />
<center><div style="background-color:#DDDDDD;border-color:#CCCCCC;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
*Source for gtk-bounce is found at:<br />
https://svn.xiph.org/trunk/Xiph-episode-II/bounce/<br />
*The source can be checked out of svn using the following command line:<br />
svn co https://svn.xiph.org/trunk/Xiph-episode-II/bounce/<br />
*Trac is a convenient way to browse the source without checking out a copy:<br />
https://trac.xiph.org/browser/Xiph-episode-II/bounce/<br />
</div></center><br />
<br />
==== Starting Gtk-bounce ====<br />
The application is somewhat hardwired for specific demo parameters, but most of the hardwired settings can be found at the top of each source file. As found in SVN, the application expects an ALSA hardware audio device at hw:1, and if none if found, it will wait for one to appear. Once a sound device is successfully initialized, it expects to find and open two pipes named pipe0 and pipe1 for output in the current directory. In the video, the waveform and spectrum applications are started to take input from pipe0 and pipe1 respectively. The output sent to the two pipes is identical, and in most demos matches the output data sent to the hardware device for conversion to analog. The only exception is the tenth demo panel (which does not appear in the video) where gtk-bounce can be set to monitor the hardware inputs instead while the outputs are used to produce test waveforms.<br />
<br />
Assuming gtk-bounce, spectrum and waveform have been checked out and built, the configuration seen in the video can be started using the following commands:<br />
<center><div style="background-color:#DDDDDD;border-color:#CCCCCC;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
* make the pipe fifos for the applications to communicate (only needs to be done once)<br />
mkfifo pipe0 pipe1<br />
* start all three applications<br />
waveform pipe0 & spectrum pipe1 & gtk-bounce &<br />
</div></center><br />
<br />
==== Using Gtk-bounce ====<br />
<br />
Gtk-bounce consists of eleven pushbutton panels (numbered zero through ten) that can be selected by scrolling up and dwon with the arrow buttons on the right side. Each panel is intended for a specific demo or part of a demo.<br />
<br />
<center><div style="background-color:#DDDDDD;border-color:#CCCCCC;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
<br />
[[Image:Dsat-panel0.png|700px|center]]<br />
* '''Panel 0''': This panel presents buttons that allow the sound card to be configured in several sampling rates and bit depths. Samples read from the audio inputs are sent to the output pipes and audio outputs for playback without modification.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel1.png|700px|center]]<br />
* '''Panel 1''': Both channels are forwarded to the outputs, however the user may select the bit depth of each channel independently. When the sound card is running in 16 bit mode and 16-bit depth is selected, the data is untouched. Requantization to a lower bit depth is performed with a flat triangle dither.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel2.png|700px|center]]<br />
* '''Panel 2''': Both channels are re-quantized to the selected bit depth. Requantization to a lower bit depth is performed with a flat triangle dither.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel3.png|700px|center]]<br />
* '''Panel 3''': 'generate sine wave' discards the audio inputs and instead internally generates a sine wave at 32 bit precision, which is then quantized to the selected bit depth, optionally with dither. The resulting signal is then forwarded to the output. <br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel4.png|700px|center]]<br />
* '''Panel 4''': gtk-bounce generates a 16-bit sine wave of the selected amplitude, optionally with dither, and forwards the resulting signal to the outputs. The audio input from the audio device is discarded. Note that the slider sets the peak amplitude, not the peak-to-peak amplitude.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel5.png|700px|center]]<br />
* '''Panel 5''': generates a 16-bit sine wave, optionally quantized using dither. The user may additionally select a flat or a shaped dither. The 'notch and gain' button applies a notch filter to the resulting signal, and boosts the gain of the remaining noise so that it's easily audible. The audio input from the audio device is discarded.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel6.png|700px|center]]<br />
* '''Panel 6''': allows the user to play with the power of the dithering noise applied before quantizating the sine wave. Shaped or flat dither are available. The sine wave may also be modulated with a varying amplitude to highlight correlations between the input and the resulting quantization noise. The 'notch and gain' button applies a notch filter to the resulting signal, and boosts the gain of the remaining noise so that it's easily audible. The audio input from the audio device is discarded.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel7.png|700px|center]]<br />
* '''Panel 7''': applies a sharper antialiasing (lowpass) filter than is likely to be built into the sound-card hardware (as there's generally no reason to use a filter quite this sharp in practice). The very sharp filter allows us to bandpass the demonstration squarewave without any harmonics landing in the transition band. <br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel8.png|700px|center]]<br />
* '''Panel 8''': when selected, generate a synthetic 'squarewave' (this is not quite equivalent to a bandlimited analog squarewave; the harmonic amplitudes are a bit different) that when aligned with the sampling phase just right gives the appearance of having infinite rise and fall time. The slider allows us to shift the waveform sample alignment back and forth by +/- one sample to reveal that the underlying signal is still band-limited.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel9.png|700px|center]]<br />
* '''Panel 9''': <br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel10.png|700px|center]]<br />
* '''Panel 10''': <br />
<div style="clear: both">&nbsp;</div><br />
<br />
</div></center><br />
<br />
=== Cairo Animations ===<br />
<br />
The animations featured throughout the Episode 2 video were rapid-development spaghetti hack-jobs coded by hand in raw Cairo. Each module generated a series of PNG stills that were then stitched into an animation with Cinelerra or mplayer. In the interest of pointing and laughing at what really bad code looks like...<br />
<br />
<center><div style="background-color:#DDDDDD;border-color:#CCCCCC;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
*Source for the Cairo animations is found at:<br />
https://svn.xiph.org/trunk/Xiph-episode-II/cairo/<br />
*The source can be checked out of svn using the following command line:<br />
svn co https://svn.xiph.org/trunk/Xiph-episode-II/cairo/<br />
*Trac is a convenient way to browse the source without checking out a copy:<br />
https://trac.xiph.org/browser/Xiph-episode-II/cairo/<br />
</div></center></div>Gmaxwellhttps://wiki.xiph.org/index.php?title=Videos/Digital_Show_and_Tell&diff=14013Videos/Digital Show and Tell2013-02-26T10:12:12Z<p>Gmaxwell: /* Bandlimitation and timing */</p>
<hr />
<div><small>''Wiki edition''</small><br />
[[Image:dsat_001.jpg|400px|right]]<br />
<br />
Continuing in the "firehose" tradition of [[Videos/A_Digital_Media_Primer_For_Geeks|Episode 01]], Xiph.Org's second video on digital media explores multiple facets of digital audio signals and how they ''really'' behave in the real world.<br />
<br />
Demonstrations of sampling, quantization, bit-depth, and dither explore digital audio behavior on real audio equipment using both modern digital analysis and vintage analog bench equipment, just in case we can't trust those newfangled digital gizmos. You can download the source code for each demo and try it all for yourself!<br />
<br/><br/><br/><br />
<center><font size="+2">[http://www.xiph.org/video/vid2.shtml Download or Watch online]</font></center><br />
<br style="clear:both;"/><br />
Supported players: [http://www.videolan.org/vlc/ VLC 1.1+], [https://www.mozilla.com/en-US/firefox/ Firefox ], [http://www.chromium.org/Home Chrome ], [http://www.opera.com/ Opera]. Or see [http://www.webmproject.org/users/ other WebM] or [[TheoraSoftwarePlayers|other Theora]] players.<br />
<br />
If you're having trouble with playback in a modern browser or player, please visit our [[Playback_Troubleshooting|playback troubleshooting and discussion]] page.<br />
<br/><br />
<hr/><br />
<br/><br/><br/><br />
[[Image:Xiph_ep02_test.png|400px|right]]<br />
<br />
Hi, I'm Monty Montgomery from [http://www.redhat.com/ Red Hat] and [http://xiph.org/ Xiph.Org].<br />
<br />
A few months ago, I wrote<br />
[http://people.xiph.org/~xiphmont/demo/neil-young.html an article on digital audio and why 24bit/192kHz music downloads don't make sense].<br />
In the article, I<br />
mentioned--almost in passing--that a digital waveform is<br />
[http://people.xiph.org/~xiphmont/demo/neil-young.html#toc_sfam not a stairstep],<br />
and you certainly don't get a stairstep when you<br />
[[WikiPedia:Digital-to-analog_converter|convert from digital back to analog]].<br />
<br />
Of everything in the entire article, '''that''' was the number one thing<br />
people wrote about. In fact, more than half the mail I got was questions and<br />
comments about basic digital signal behavior. Since there's interest, let's<br />
take a little time to play with some ''simple'' digital signals.<br />
<br />
==Veritas ex machina==<br />
[[Image:Dsat_002.jpg|200px|right]]<br />
[[Image:Dsat_003.jpg|200px|right]]<br />
[[Image:Dsat_004.jpg|200px|right]]<br />
[[Image:Dsat_005.jpg|200px|right]]<br />
<br />
Pretend for a moment that we have no idea how digital signals really<br />
behave. In that case it doesn't make sense for us to use digital test<br />
equipment either. Fortunately for this exercise, there's still plenty<br />
of working analog lab equipment out there.<br />
<br />
First up, we need a [[WikiPedia:Function_generator|signal generator]] to provide us with analog input<br />
signals--in this case, an<br />
[http://www.home.agilent.com/en/pd-3325A%3Aepsg%3Apro-pn-3325A/synthesizer-function-generator?pm=PL&nid=-536900197.536896863&cc=SE&lc=swe HP3325]<br />
from 1978. It's still a pretty good<br />
generator, so if you don't mind the size, the weight, the power<br />
consumption, and the noisy fan, you can find them on eBay... occasionally<br />
for only slightly more than you'll pay for shipping.<br />
<br />
Next, we'll observe our analog waveforms on [[WikiPedia:Oscilloscope_types#Cathode-ray_oscilloscope_.28CRO.29|analog oscilloscopes]],<br />
like this Tektronix 2246 from the mid-90s, one of the last and very best analog scopes ever made. Every home lab should have one.<br />
<br />
...and finally inspect the [[WikiPedia:Spectral_density#Electrical_engineering|frequency spectrum]] of our signals using an<br />
[[WikiPedia:Spectrum_analyzer#Swept-tuned|analog spectrum analyzer]], this<br />
[http://www.home.agilent.com/en/pd-3585A%3Aepsg%3Apro-pn-3585A/spectrum-analyzer-high-perf-20hz-40mhz?pm=PL&nid=-536900197.536897319&cc=SE&lc=swe HP3585]<br />
from the same product line as<br />
the signal generator. Like the other equipment here it has<br />
[http://www.hp9845.net/9845/hardware/processors/ a rudimentary and hilariously large microcontroller],<br />
but the signal path<br />
from input to what you see on the screen is completely analog.<br />
<br />
All of this equipment is vintage, but aside from its raw tonnage, the specs are still quite good.<br />
<br />
At the moment, we have our signal generator set to output a nice 1 [[WikiPedia:Hertz#SI_multiples|kHz]]<br />
sine wave at one [[WikiPedia:Volt|Volt]] [[WikiPedia:Amplitude#Root_mean_square_amplitude|RMS]].<br />
We see the sine wave on the oscilloscope, can verify that it is indeed<br />
1 kHz at 1 Volt RMS, which is 2.8 Volts<br />
[[WikiPedia:Amplitude#Peak-to-peak_amplitude|peak-to-peak]],<br />
and that matches the<br />
measurement on the spectrum analyzer as well.<br />
<br />
The analyzer also shows some low-level [[WikiPedia:White_noise|white noise]]<br />
and just a bit of [[WikiPedia:Harmonic_distortion#Harmonic_distortion|harmonic distortion]],<br />
with the highest peak about 70[[WikiPedia:Decibel|dB]] or so below<br />
[[WikiPedia:Fundamental_frequency|the fundamental]].<br />
Now, this doesn't matter at all in our demos, but I<br />
wanted to point it out now just in case you didn't notice it until<br />
later.<br />
<br />
Now, we drop digital sampling in the middle.<br />
<br />
For the conversion, we'll use a boring, consumer-grade, eMagic USB1<br />
audio device. It's also more than ten years old at this point, and it's<br />
getting obsolete.<br />
<br />
A recent converter can easily have an order of magnitude better specs.<br />
[[WikiPedia:Reconstruction_filter#Sampled_data_reconstruction_filters|Flatness]],<br />
[[WikiPedia:Analog-to-digital_converter#Non-linearity|linearity]],<br />
[[WikiPedia:Jitter#Sampling_jitter|jitter]],<br />
[[WikiPedia:Noise_floor|noise behavior]],<br />
[[WikiPedia:Digital-to-analog_converter#DAC_performance|everything]]...<br />
you may not<br />
have noticed. Just because we can measure an improvement doesn't<br />
mean we can hear it, and even these old consumer boxes were already at<br />
the edge of ideal transparency.<br />
<br />
The eMagic connects to my ThinkPad, which displays a digital<br />
waveform and spectrum for comparison, then the ThinkPad<br />
sends the digital signal right back out to the eMagic for<br />
re-conversion to analog and observation on the output scopes.<br />
<br />
Input to output, left to right.<br />
<br style="clear:both;"/><br />
<br />
==Stairsteps==<br />
[[Image:Dsat 006.jpg|360px|right]]<br />
[[Image:Dsat 007.png|360px|right]]<br />
&ldquo;OK, it's go time. We begin by converting an analog signal to digital and<br />
then right back to analog again with no other steps.&rdquo;<br />
<br />
&ldquo;The signal generator is set to produce a 1kHz sine wave just like<br />
before.&rdquo;<br />
<br />
&ldquo;We can see our analog sine wave on our input-side oscilloscope.&rdquo;<br />
<br />
&ldquo;We digitize our signal to<br />
[[Videos/A_Digital_Media_Primer_For_Geeks#Raw_.28digital_audio.29_meat|16 bit PCM at 44.1kHz]],<br />
same as on a CD.&rdquo;<br />
<br />
&ldquo;The spectrum of the digitized signal matches what we saw earlier and what we see now on the analog spectrum analyzer, aside from its <br />
[[WikiPedia:High_impedance|high-impedance input]] being just a smidge noisier.&rdquo;<br />
<br />
&ldquo;For now, the waveform display shows our digitized sine wave as a<br />
stairstep pattern, one step for each sample.&rdquo;<br />
<br />
&ldquo;And when we look at the output signal that's been converted<br />
from digital back to analog, we see...&rdquo;<br />
<br />
&ldquo;It's exactly like the original sine wave. No stairsteps.&rdquo;<br />
<br />
&ldquo;OK, 1 kHz is still a fairly low frequency, maybe the stairsteps are just<br />
hard to see or they're being smoothed away. Fair enough. Let's choose<br />
a higher frequency, something close to [[WikiPedia:Nyquist_frequency|Nyquist]], say 15kHz.&rdquo;<br />
<br />
&ldquo;Now the sine wave is represented by less than three samples per cycle, and... the digital waveform looks pretty awful. Well, looks<br />
can be deceiving. The analog output... is still a perfect sine wave, exactly like the original.&rdquo;<br />
<br />
&ldquo;Let's keep going up.&rdquo;<br />
<br />
&ldquo;16kHz.... 17kHz... 18kHz... 19kHz...&rdquo;<br />
<br />
&ldquo;20kHz. Welcome to the upper limits of human hearing. The output waveform is still perfect. No jagged edges, no dropoff, no stairsteps.&rdquo;<br />
<br />
&ldquo;So where'd the stairsteps go? Don't answer, it's a trick question. They were never there.&rdquo;<br />
<br />
&ldquo;Drawing a digital waveform as a stairstep was wrong to begin with.&rdquo;<br />
<br />
&ldquo;Why? A stairstep is a continuous-time function. It's jagged, and it's piecewise, but it has a defined value at every point in time.&rdquo;<br />
<br />
&ldquo;A sampled signal is entirely different. It's discrete-time; it's only got a value right at each instantaneous sample point and it's<br />
undefined, there is no value at all, everywhere between. A discrete-time signal is properly drawn as a lollipop graph.&rdquo;<br />
<br />
&ldquo;The continuous, analog counterpart of a digital signal passes smoothly through each sample point, and that's just as true for high<br />
frequencies as it is for low.&rdquo;<br />
<br />
&ldquo;Now, the interesting and not at all obvious bit is: [[WikiPedia:Nyquist%E2%80%93Shannon_sampling_theorem|there's only one<br />
bandlimited signal that passes exactly through each sample point]]. It's a unique solution. So if you sample a bandlimited signal and then convert it back, the original input is also the only possible output.&rdquo;<br />
<br />
[[Image:Dsat 008.png|360px|right]]<br />
<br />
&ldquo;And before you say, "oh, I can draw a different signal that passes through those points", well, yes you can, but if it differs even<br />
minutely from the original, it includes frequency content at or beyond Nyquist, breaks the bandlimiting requirement and isn't a valid solution.&rdquo;<br />
<br />
&ldquo;So how did everyone get confused and start thinking of digital signals as stairsteps? I can think of two good reasons.&rdquo;<br />
<br />
&ldquo;First: it's easy enough to convert a sampled signal to a true stairstep. Just<br />
extend each sample value forward until the next sample period. This is<br />
called a [[WikiPedia:Zero-order hold|zero-order hold]], and it's an important part of how some<br />
digital-to-analog converters work, especially the simplest ones.&rdquo;<br />
<br />
&ldquo;So, anyone who looks up [[WikiPedia:Digital-to-analog_converter#Practical_operation|digital-to-analog converter or<br />
digital-to-analog conversion]] is probably going to see a diagram of a<br />
stairstep waveform somewhere, but that's not a finished conversion,<br />
and it's not the signal that comes out.&rdquo;<br />
<br />
&ldquo;Second, and this is probably the more likely reason, engineers who<br />
supposedly know better, like me, draw stairsteps even though they're<br />
technically wrong. It's a sort of like a one-dimensional version of<br />
[[WikiPedia:MacPaint#Development|fat bits in an image editor]].&rdquo;<br />
<br />
&ldquo;Pixels aren't squares either, they're samples of a 2-dimensional<br />
function space and so they're also, conceptually, infinitely small<br />
points. Practically, it's a real pain in the ass to see or manipulate<br />
infinitely small anything, so big squares it is. Digital stairstep<br />
drawings are exactly the same thing.&rdquo;<br />
<br />
&ldquo;It's just a convenient drawing. The stairsteps aren't really there.&rdquo;<br />
<br />
==Bit-depth==<br />
[[Image:Dsat_009.jpg|360px|right]]<br />
[[Image:Dsat_010.jpg|260px|right]]<br />
<br />
When we convert a digital signal back to analog, the result is<br />
''also'' smooth regardless of the [[WikiPedia:Audio_bit_depth|bit depth]]. 24 bits or 16 bits...<br />
or 8 bits... it doesn't matter.<br />
<br />
So does that mean that the digital bit depth makes no difference at<br />
all? Of course not.<br />
<br />
Channel 2 here is the same sine wave input, but we quantize with<br />
[[WikiPedia:Dither|dither]] down to 8 bits.<br />
<br />
On the scope, we still see a nice<br />
smooth sine wave on channel 2. Look very close, and you'll also see a<br />
bit more noise. That's a clue.<br />
<br />
If we look at the spectrum of the signal... aha! Our sine wave is<br />
still there unaffected, but the noise level of the 8-bit signal on<br />
the second channel is much higher!<br />
<br />
And that's the difference the number of bits makes. That's it!<br />
<br />
When we digitize a signal, first we sample it. The<br />
sampling step is perfect; it loses nothing. But then we [[WikiPedia:Quantization_(sound_processing)|quantize]] it,<br />
and [[WikiPedia:Quantization_error|quantization adds noise]].<br />
<br />
The number of bits determines how much noise and so the level of the<br />
noise floor.<br />
<br />
What does this dithered quantization noise sound like? Let's listen<br />
to our 8-bit sine wave.<br />
<br />
That may have been hard to hear anything but the tone. Let's listen<br />
to just the noise after we notch out the sine wave and then bring the<br />
gain up a bit because the noise is quiet.<br />
<br />
Those of you who have used analog recording equipment may have just<br />
thought to yourselves, "My goodness! That sounds like tape hiss!"<br />
Well, it doesn't just sound like tape hiss, it acts like it too, and<br />
if we use a [[WikiPedia:Dither#Different_types|gaussian dither]] then it's<br />
[[WikiPedia:Central_limit_theorem|mathematically equivalent]] in every way. It ''is'' tape hiss.<br />
<br />
Intuitively, that means that we can measure tape hiss and thus the noise floor<br />
of [[WikiPedia:Magnetic_tape_sound_recording|magnetic audio tape]]<br />
in [[WikiPedia:Shannon–Hartley_theorem#Examples|bits instead of decibels]], in order to put things in a<br />
digital perspective. [[WikiPedia:Compact cassettes|Compact cassettes]] (for those of you who are old enough to remember them) could reach as<br />
deep as 9 bits in perfect conditions, though 5 to 6 bits was<br />
more typical, especially if it was a recording made on a<br />
[[WikiPedia:Cassette_deck|tape deck]]. That's right... your mix tapes were only about 6 bits<br />
deep... if you were lucky!<br />
<br />
The very best professional [[WikiPedia:Reel-to-reel_audio_tape_recording|open reel tape]] used in studios could barely<br />
hit... any guesses? 13 bits ''with'' [[WikiPedia:Reel-to-reel_audio_tape_recording#Noise_reduction|advanced noise reduction]]. And<br />
that's why seeing '[[WikiPedia:SPARS_code|D D D]]' on a [[WikiPedia:Compact_disk|Compact Disc]] used to be such a big,<br />
high-end deal.<br />
<br />
==Dither==<br />
[[Image:Dsat_011.png|360px|right]]<br />
<br />
I keep saying that I'm quantizing with [[Wikipedia:dither|dither]], so what is dither<br />
exactly and, more importantly, what does it do?<br />
<br />
The simple way to quantize a signal is to choose the digital<br />
amplitude value closest to the original analog amplitude. [[WikiPedia:Rounding|Obvious]],<br />
right? Unfortunately, the exact noise you get from this simple<br />
quantization scheme depends somewhat on the input signal,<br />
<br />
so we may get noise that's inconsistent, or causes distortion, or is<br />
undesirable in some other way.<br />
<br style="clear:both;"/><br />
<center><div style="background-color:#DDDDFF;border-color:#CCCCDD;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
'''Going deeper…'''<br />
*Cameron Nicklaus Christou's thesis [http://uwspace.uwaterloo.ca/bitstream/10012/3867/1/thesis.pdf Optimal Dither and Noise Shaping in Image Processing] provides an ''excellent'' explanation of dither and noise shaping.<br />
</div></center><br />
<br />
Dither is specially-constructed noise that substitutes for the noise<br />
produced by simple quantization. Dither doesn't [[WikiPedia:Sound_masking|drown out or mask]]<br />
quantization noise, it actually replaces it with noise characteristics<br />
of our choosing that aren't influenced by the input.<br />
<br />
Let's ''watch'' what dither does. The signal generator has too much noise for this test so we'll produce a mathematically perfect sine wave with the ThinkPad and quantize it to 8 bits with dithering.<br />
<br />
We see a nice sine wave on the waveform display and output scope and, once the analog spectrum analyzer catches up...<br />
a clean frequency peak with a uniform noise floor on both spectral displays<br />
just like before. Again, this is with dither.<br />
<br />
Now I turn dithering off.<br />
<br />
The quantization noise, that dither had spread out into a nice, flat noise<br />
floor, piles up into harmonic distortion peaks. The noise floor is<br />
lower, but the level of distortion becomes nonzero, and the distortion<br />
peaks sit higher than the dithering noise did.<br />
<br />
At 8 bits this effect is exaggerated. At 16 bits,<br />
even without dither, harmonic distortion is going to be so low as to<br />
be completely inaudible.<br />
<br />
Still, we can use dither to eliminate it completely if we so choose.<br />
<br />
Turning the dither off again for a moment, you'll notice that the<br />
absolute level of distortion from undithered quantization stays<br />
approximately constant regardless of the input amplitude.<br />
But when the signal level drops below a half a bit, everything<br />
quantizes to zero.<br />
<br />
In a sense, everything quantizing to zero is just 100% distortion!<br />
Dither eliminates this distortion too. We reenable dither<br />
and ... there's our signal back at 1/4 bit, with our nice flat noise floor.<br />
<br />
The noise floor doesn't have to be flat. Dither is noise of our<br />
choosing, so let's choose a noise as [http://www.acoustics.salford.ac.uk/res/cox/sound_quality/?content=subjective inoffensive] and<br />
[[WikiPedia:Absolute_threshold_of_hearing|difficult to notice]]<br />
as possible.<br />
<br />
Our hearing is most sensitive in the midrange from 2kHz to 4kHz,<br />
so that's where background noise is going to be the most obvious.<br />
We can [[WikiPedia:Noise_shaping|shape dithering noise]] away from sensitive frequencies to where<br />
hearing is less sensitive, usually the highest frequencies.<br />
<br />
16-bit dithering noise is normally much too quiet to hear at all, but<br />
let's listen to our noise shaping example, again with the gain<br />
brought way up...<br />
<br />
Lastly, dithered quantization noise ''is'' higher [[WikiPedia:Sound_power|power]] overall<br />
than undithered quantization noise even when it sounds quieter, and<br />
you can see that on a [[WikiPedia:VU_meter|VU meter]] during passages of near-silence. But<br />
dither isn't only an on or off choice. We can reduce the dither's<br />
power to balance less noise against a bit of distortion to minimize<br />
the overall effect.<br />
<br />
We'll also [[WikiPedia:Amplitude_modulation|modulate the input signal]] like this to show how a varying input affects the quantization noise. At<br />
full dithering power, the noise is uniform, constant, and featureless<br />
just like we expect:<br />
<br />
As we reduce the dither's power, the input increasingly<br />
affects the amplitude and the character of the quantization noise.<br />
Shaped dither behaves similarly, but noise shaping lends one more nice<br />
advantage. To make a long story short, it can use a somewhat lower<br />
dither power before the input has as much effect on the output.<br />
<br />
Despite all the time I just spent on dither, we're talking about<br />
differences that start 100 decibels and more below [[WikiPedia:Full_scale|full scale]]. Maybe<br />
if the CD had been<br />
[http://www.research.philips.com/technologies/projects/cd/index.html 14 bits as originally designed],<br />
dither ''might'' be<br />
more important. Maybe. At 16 bits, really, it's mostly a wash. You<br />
can think of dither as an insurance policy that gives several extra<br />
decibels of dynamic range just in case. The simple fact is, though, no<br />
one ever ruined a great recording by not dithering the final master.<br />
<br />
==Bandlimitation and timing==<br />
[[image:Dsat_013.jpg|360px|right]]<br />
<br />
We've been using [[WikiPedia:Sine_wave|sine waves]]. They're the obvious choice when what we<br />
want to see is a system's behavior at a given isolated frequency. Now<br />
let's look at something a bit more complex. What should we expect to<br />
happen when I change the input to a [[WikiPedia:Square_wave|square wave]]...<br />
<br />
The input scope confirms our 1kHz square wave. The output scope shows..<br />
<br />
<br />
Exactly what it should.<br />
...<br />
What is a square wave really? <br />
<br />
<br />
Well, we can say it's a waveform that's some positive value for half a cycle and then transitions instantaneously to a negative value for the other half.<br />
<br />
:<math><br />
\ x(t) = \begin{cases} 1, & |t| < T_1 \\ 0, & T_1 < |t| \leq {1 \over 2}T \end{cases}<br />
</math><br />
<br />
But that doesn't really tell us anything useful about how that input becomes this output.<br />
<br />
Then we remember that any waveform is also [[WikiPedia:Fourier_series|the sum of discrete frequencies]],<br />
and a square wave is particularly simple sum: a fundamental and an<br />
infinite series of [[WikiPedia:Even_and_odd_functions#Harmonics|odd harmonics]]. Sum them all up, you get a<br />
square wave.<br />
<br />
[[Image:dsat_015.jpg|360px|right]]<br />
:<math>\begin{align}<br />
x_{\mathrm{square}}(t) = \frac{4}{\pi}\sin(\omega t) + \frac{4}{3\pi}\sin(3\omega t) + \frac{4}{5\pi}\sin(5\omega t) + \\<br />
\frac{4}{7\pi}\sin(7\omega t) + \frac{4}{9\pi}\sin(9\omega t) + \frac{4}{11\pi}\sin(11\omega t) + \\ <br />
\frac{4}{13\pi}\sin(13\omega t) + \frac{4}{15\pi}\sin(15\omega t) + \frac{4}{17\pi}\sin(17\omega t) + \\<br />
\frac{4}{19\pi}\sin(19\omega t) + \frac{4}{21\pi}\sin(21\omega t) + \frac{4}{23\pi}\sin(23\omega t) + \\<br />
\frac{4}{25\pi}\sin(25\omega t) + \frac{4}{27\pi}\sin(27\omega t) + \frac{4}{29\pi}\sin(29\omega t) + \\<br />
\frac{4}{31\pi}\sin(31\omega t) + \frac{4}{33\pi}\sin(33\omega t) + \cdots <br />
\end{align}</math><br />
<br />
At first glance, that doesn't seem very useful either. You have to sum up an infinite number of harmonics to get the answer. ''Ah'', but we don't have an infinite number of harmonics.<br />
<br />
We're using a quite sharp [[WikiPedia:Low-pass_filter|anti-aliasing filter]] that cuts off right<br />
above 20kHz, so our signal is [[WikiPedia:Bandlimiting|bandlimited]], so only the first ten terms make it through.<br />
<br />
..and that's exactly what we see on the output scope.<br />
<br />
<br style="clear:both;"/><br />
<center><div style="background-color:#DDDDFF;border-color:#CCCCDD;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
'''Going deeper…'''<br />
*In modern web browsers you can program audio synthesizers directly in javascript. Use the two square wave formulas to get a square wave out of [http://js.do/blog/sound-waves-with-javascript/ this page]. (Note: The scope is not very accurate/useful.) <br />
</div></center><br />
<br />
The rippling you see around sharp edges in a bandlimited signal is called the [[WikiPedia:/Gibbs_phenomenon|Gibbs effect]]. It happens whenever you slice off part of the frequency domain in the middle of nonzero energy.<br />
<br />
The usual rule of thumb you'll hear is "the sharper the cutoff, the<br />
stronger the rippling", which is approximately true, but we have to be<br />
careful how we think about it.<br />
For example... what would you expect our quite sharp anti-aliasing filter<br />
to do if I run our signal through it a second time?<br />
<br />
Aside from adding a few fractional cycles of delay, the answer is...<br />
nothing at all. The signal is already bandlimited. Bandlimiting it<br />
again doesn't do anything. A second pass can't remove frequencies<br />
that we already removed.<br />
<br />
And that's important. People tend to think of the ripples as<br />
a kind of [[WikiPedia:Sonic_artifact|artifact]] that's added by anti-aliasing and [[WikiPedia:Reconstruction_filter|anti-imaging]]<br />
filters, implying that the ripples get worse each time the signal<br />
passes through. We can see that in this case that didn't happen. So<br />
was it really the filter that added the ripples the first time<br />
through? No, not really. It's a subtle distinction, but Gibbs effect<br />
ripples aren't added by filters, they're just part of what a<br />
bandlimited signal ''is''.<br />
<br />
Even if we synthetically construct what looks like a perfect digital<br />
square wave,<br />
<br />
it's still limited to the channel bandwidth. Remember,<br />
the stairstep representation is misleading.<br />
<br />
What we really have here are instantaneous sample points,<br />
<br />
and only one bandlimited signal fits those points. All we did when we<br />
drew our apparently perfect square wave was line up the sample points<br />
just right so it appeared that there were no ripples if we played<br />
[[WikiPedia:Interpolation|connect-the-dots]].<br />
<br />
But the original bandlimited signal, complete with ripples, was<br />
still there.<br />
<br />
[[image:Dsat_014.gif|360px|right]]<br />
And that leads us to one more important point. You've probably heard<br />
that the timing precision of a digital signal is limited by its sample<br />
rate; put another way,<br />
<br />
that digital signals can't represent anything that falls between the<br />
samples.. implying that [[WikiPedia:Dirac_delta_function|impulses]] or<br />
[[WikiPedia:Synthesizer#ADSR_envelope|fast attacks]] have to align exactly<br />
with a sample, or the timing gets mangled... or they just disappear.<br />
<br />
At this point, we can easily see why that's wrong.<br />
<br />
Again, our input signals are bandlimited. And digital signals are<br />
samples, not stairsteps, not 'connect-the-dots'. We most certainly<br />
can, for example, put the rising edge of our bandlimited square wave<br />
anywhere we want between samples.<br />
<br />
It's represented perfectly and it's reconstructed perfectly.<br />
<br />
==Epilogue==<br />
<br />
[[Image:Moffey.jpg|360px|right]]<br />
<br />
Just like in [[Videos/A_Digital_Media_Primer_For_Geeks|the previous episode]], we've covered a broad range of<br />
topics, and yet barely scratched the surface of each one. If anything, my<br />
sins of omission are greater this time around... but this is a good<br />
stopping point.<br />
<br />
Or maybe, a good starting point. Dig deeper. Experiment. I chose my<br />
demos very carefully to be simple and give clear results. You can<br />
reproduce every one of them on your own if you like. But let's face<br />
it, sometimes we learn the most about a spiffy toy by breaking it open<br />
and studying all the pieces that fall out. And that's OK, we're<br />
engineers. Play with the demo parameters, hack up the code, set up<br />
alternate experiments. The source code for everything, including the<br />
little pushbutton demo application, is up at xiph.org.<br />
<br />
In the course of experimentation, you're likely to run into something<br />
that you didn't expect and can't explain. Don't worry! My earlier<br />
snark aside, Wikipedia is fantastic for exactly this kind of casual<br />
research. And, if you're really serious about understanding signals,<br />
several universities have advanced materials online, such as the<br />
[http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-003-signals-and-systems-spring-2010/index.htm 6.003]<br />
and<br />
[http://ocw.mit.edu/resources/res-6-007-signals-and-systems-spring-2011/ RES.6-007]<br />
Signals and Systems modules at MIT OpenCourseWare. And of<br />
course, there's always the [http://webchat.freenode.net/?channels=xiph community here at Xiph.Org].<br />
<br />
Digging deeper or not, I am out of coffee, so, until next time, happy<br />
hacking!<br />
<br />
==Credits==<br />
[[Image:Dmpfg_019.png|360px|right]]<br />
Written by: Christopher (Monty) Montgomery and the Xiph.Org Community<br />
<br />
Special thanks to:<br />
*Heidi Baumgartner, for the second Tektronix oscilloscope<br />
*Gregory Maxwell and Dr. Timothy Terriberry, for additional technical review<br />
<br />
Intro, title and credits music:<br><br />
"[http://music.lousyrobot.com/track/andy-warhol-is-gone Andy Warhol Is Gone]", by Lousy Robot<br><br />
Used by permission of Lousy Robot.<br><br />
Original source track All Rights Reserved.<br><br />
[http://www.lousyrobot.com www.lousyrobot.com]<br />
<br />
This Video Was Produced Entirely With Free and Open Source Software:<br><br />
<br />
*[http://www.gnu.org/ GNU]<br><br />
*[http://www.linux.org/ Linux]<br><br />
*[http://fedoraproject.org/ Fedora]<br><br />
*[http://cinelerra.org/ Cinelerra]<br><br />
*[http://www.gimp.org/ The Gimp]<br><br />
*[http://audacity.sourceforge.net/ Audacity]<br><br />
*[http://svn.xiph.org/trunk/postfish/README Postfish]<br><br />
*[http://gstreamer.freedesktop.org/ Gstreamer]<br><br />
<br />
All trademarks are the property of their respective owners. <br />
<br />
*''Complete video'' [http://creativecommons.org/licenses/by-sa/3.0/legalcode CC-BY-SA]<br><br />
*''Text transcript and Wiki edition'' [http://creativecommons.org/licenses/by-sa/3.0/legalcode CC-BY-SA]<br><br />
<br />
A Co-Production of Xiph.Org and Red Hat, Inc.<br><br />
(C) 2012-2013, Some Rights Reserved<br><br />
<br />
== Use The Source Luke ==<br />
<br />
As stated in the Epilogue, everything that appears in the video demos is driven by open source software, which means the source is both available for inspection and freely usable by the community. The Thinkpad that appears in the video was running Fedora 17 and Gnome Shell (Gnome 3). The demonstration software does not require Fedora specifically, but it does require Gnu/Linux to run in its current form. In all, the video involved just under 50,000 lines of new and custom-purpose code (including contributions to non-Xiph projects such as Cinelerra and Gromit).<br />
<br />
=== The Spectrum and Waveform Viewer ===<br />
<br />
The realtime software spectrum analyzer application that appears in the video was a preexisting application that was dusted off and updated for use in the video. The waveform viewer (effectively a simple software oscilloscope) was written from scratch making use of some of the internals from the spectrum analyzer application. Both are available from Xiph.Org svn:<br />
<br />
<center><div style="background-color:#DDDDDD;border-color:#CCCCCC;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
*Source for the Spectrum and Waveform applications is found at:<br />
https://svn.xiph.org/trunk/spectrum/<br />
*The source can be checked out of svn using the following command line:<br />
svn co https://svn.xiph.org/trunk/spectrum<br />
*Trac is a convenient way to browse the source without checking out a copy:<br />
https://trac.xiph.org/browser/trunk/spectrum<br />
</div></center><br />
<br />
Spectrum and Waveform both expect an input stream on the command line, either as raw data or as a WAV file.<br />
<br />
=== GTK-Bounce ===<br />
<br />
The touch-controlled application used in the video is named 'gtk-bounce' and was custom-written for the sole purpose of the in-video demonstrations. It is so named because, for the most part, all it does is read the input from an audio device, and then immediately write the same data back out for playback. It also forwards a copy of this data to up to two external monitoring applications, and in several demos, applies simple filters or generates simple waveforms. It includes several demos not included in the video.<br />
<br />
<center><div style="background-color:#DDDDDD;border-color:#CCCCCC;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
*Source for gtk-bounce is found at:<br />
https://svn.xiph.org/trunk/Xiph-episode-II/bounce/<br />
*The source can be checked out of svn using the following command line:<br />
svn co https://svn.xiph.org/trunk/Xiph-episode-II/bounce/<br />
*Trac is a convenient way to browse the source without checking out a copy:<br />
https://trac.xiph.org/browser/Xiph-episode-II/bounce/<br />
</div></center><br />
<br />
==== Starting Gtk-bounce ====<br />
The application is somewhat hardwired for specific demo parameters, but most of the hardwired settings can be found at the top of each source file. As found in SVN, the application expects an ALSA hardware audio device at hw:1, and if none if found, it will wait for one to appear. Once a sound device is successfully initialized, it expects to find and open two pipes named pipe0 and pipe1 for output in the current directory. In the video, the waveform and spectrum applications are started to take input from pipe0 and pipe1 respectively. The output sent to the two pipes is identical, and in most demos matches the output data sent to the hardware device for conversion to analog. The only exception is the tenth demo panel (which does not appear in the video) where gtk-bounce can be set to monitor the hardware inputs instead while the outputs are used to produce test waveforms.<br />
<br />
Assuming gtk-bounce, spectrum and waveform have been checked out and built, the configuration seen in the video can be started using the following commands:<br />
<center><div style="background-color:#DDDDDD;border-color:#CCCCCC;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
* make the pipe fifos for the applications to communicate (only needs to be done once)<br />
mkfifo pipe0 pipe1<br />
* start all three applications<br />
waveform pipe0 & spectrum pipe1 & gtk-bounce &<br />
</div></center><br />
<br />
==== Using Gtk-bounce ====<br />
<br />
Gtk-bounce consists of eleven pushbutton panels (numbered zero through ten) that can be selected by scrolling up and dwon with the arrow buttons on the right side. Each panel is intended for a specific demo or part of a demo.<br />
<br />
<center><div style="background-color:#DDDDDD;border-color:#CCCCCC;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
<br />
[[Image:Dsat-panel0.png|700px|center]]<br />
* '''Panel 0''': This panel presents buttons that allow the sound card to be configured in several sampling rates and bit depths. Samples read from the audio inputs are sent to the output pipes and audio outputs for playback without modification.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel1.png|700px|center]]<br />
* '''Panel 1''': Both channels are forwarded to the outputs, however the user may select the bit depth of each channel independently. When the sound card is running in 16 bit mode and 16-bit depth is selected, the data is untouched. Requantization to a lower bit depth is performed with a flat triangle dither.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel2.png|700px|center]]<br />
* '''Panel 2''': Both channels are re-quantized to the selected bit depth. Requantization to a lower bit depth is performed with a flat triangle dither.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel3.png|700px|center]]<br />
* '''Panel 3''': 'generate sine wave' discards the audio inputs and instead internally generates a sine wave at 32 bit precision, which is then quantized to the selected bit depth, optionally with dither. The resulting signal is then forwarded to the output. <br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel4.png|700px|center]]<br />
* '''Panel 4''': gtk-bounce generates a 16-bit sine wave of the selected amplitude, optionally with dither, and forwards the resulting signal to the outputs. The audio input from the audio device is discarded. Note that the slider sets the peak amplitude, not the peak-to-peak amplitude.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel5.png|700px|center]]<br />
* '''Panel 5''': generates a 16-bit sine wave, optionally quantized using dither. The user may additionally select a flat or a shaped dither. The 'notch and gain' button applies a notch filter to the resulting signal, and boosts the gain of the remaining noise so that it's easily audible. The audio input from the audio device is discarded.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel6.png|700px|center]]<br />
* '''Panel 6''': allows the user to play with the power of the dithering noise applied before quantizating the sine wave. Shaped or flat dither are available. The sine wave may also be modulated with a varying amplitude to highlight correlations between the input and the resulting quantization noise. The 'notch and gain' button applies a notch filter to the resulting signal, and boosts the gain of the remaining noise so that it's easily audible. The audio input from the audio device is discarded.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel7.png|700px|center]]<br />
* '''Panel 7''': applies a sharper antialiasing (lowpass) filter than is likely to be built into the sound-card hardware (as there's generally no reason to use a filter quite this sharp in practice). The very sharp filter allows us to bandpass the demonstration squarewave without any harmonics landing in the transition band. <br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel8.png|700px|center]]<br />
* '''Panel 8''': when selected, generate a synthetic 'squarewave' (this is not quite equivalent to a bandlimited analog squarewave; the harmonic amplitudes are a bit different) that when aligned with the sampling phase just right gives the appearance of having infinite rise and fall time. The slider allows us to shift the waveform sample alignment back and forth by +/- one sample to reveal that the underlying signal is still band-limited.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel9.png|700px|center]]<br />
* '''Panel 9''': <br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel10.png|700px|center]]<br />
* '''Panel 10''': <br />
<div style="clear: both">&nbsp;</div><br />
<br />
</div></center><br />
<br />
=== Cairo Animations ===<br />
<br />
The animations featured throughout the Episode 2 video were rapid-development spaghetti hack-jobs coded by hand in raw Cairo. Each module generated a series of PNG stills that were then stitched into an animation with Cinelerra or mplayer. In the interest of pointing and laughing at what really bad code looks like...<br />
<br />
<center><div style="background-color:#DDDDDD;border-color:#CCCCCC;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
*Source for the Cairo animations is found at:<br />
https://svn.xiph.org/trunk/Xiph-episode-II/cairo/<br />
*The source can be checked out of svn using the following command line:<br />
svn co https://svn.xiph.org/trunk/Xiph-episode-II/cairo/<br />
*Trac is a convenient way to browse the source without checking out a copy:<br />
https://trac.xiph.org/browser/Xiph-episode-II/cairo/<br />
</div></center></div>Gmaxwellhttps://wiki.xiph.org/index.php?title=Videos/Digital_Show_and_Tell&diff=14012Videos/Digital Show and Tell2013-02-26T10:10:52Z<p>Gmaxwell: /* Starting Gtk-bounce */ gray all the boxes!</p>
<hr />
<div><small>''Wiki edition''</small><br />
[[Image:dsat_001.jpg|400px|right]]<br />
<br />
Continuing in the "firehose" tradition of [[Videos/A_Digital_Media_Primer_For_Geeks|Episode 01]], Xiph.Org's second video on digital media explores multiple facets of digital audio signals and how they ''really'' behave in the real world.<br />
<br />
Demonstrations of sampling, quantization, bit-depth, and dither explore digital audio behavior on real audio equipment using both modern digital analysis and vintage analog bench equipment, just in case we can't trust those newfangled digital gizmos. You can download the source code for each demo and try it all for yourself!<br />
<br/><br/><br/><br />
<center><font size="+2">[http://www.xiph.org/video/vid2.shtml Download or Watch online]</font></center><br />
<br style="clear:both;"/><br />
Supported players: [http://www.videolan.org/vlc/ VLC 1.1+], [https://www.mozilla.com/en-US/firefox/ Firefox ], [http://www.chromium.org/Home Chrome ], [http://www.opera.com/ Opera]. Or see [http://www.webmproject.org/users/ other WebM] or [[TheoraSoftwarePlayers|other Theora]] players.<br />
<br />
If you're having trouble with playback in a modern browser or player, please visit our [[Playback_Troubleshooting|playback troubleshooting and discussion]] page.<br />
<br/><br />
<hr/><br />
<br/><br/><br/><br />
[[Image:Xiph_ep02_test.png|400px|right]]<br />
<br />
Hi, I'm Monty Montgomery from [http://www.redhat.com/ Red Hat] and [http://xiph.org/ Xiph.Org].<br />
<br />
A few months ago, I wrote<br />
[http://people.xiph.org/~xiphmont/demo/neil-young.html an article on digital audio and why 24bit/192kHz music downloads don't make sense].<br />
In the article, I<br />
mentioned--almost in passing--that a digital waveform is<br />
[http://people.xiph.org/~xiphmont/demo/neil-young.html#toc_sfam not a stairstep],<br />
and you certainly don't get a stairstep when you<br />
[[WikiPedia:Digital-to-analog_converter|convert from digital back to analog]].<br />
<br />
Of everything in the entire article, '''that''' was the number one thing<br />
people wrote about. In fact, more than half the mail I got was questions and<br />
comments about basic digital signal behavior. Since there's interest, let's<br />
take a little time to play with some ''simple'' digital signals.<br />
<br />
==Veritas ex machina==<br />
[[Image:Dsat_002.jpg|200px|right]]<br />
[[Image:Dsat_003.jpg|200px|right]]<br />
[[Image:Dsat_004.jpg|200px|right]]<br />
[[Image:Dsat_005.jpg|200px|right]]<br />
<br />
Pretend for a moment that we have no idea how digital signals really<br />
behave. In that case it doesn't make sense for us to use digital test<br />
equipment either. Fortunately for this exercise, there's still plenty<br />
of working analog lab equipment out there.<br />
<br />
First up, we need a [[WikiPedia:Function_generator|signal generator]] to provide us with analog input<br />
signals--in this case, an<br />
[http://www.home.agilent.com/en/pd-3325A%3Aepsg%3Apro-pn-3325A/synthesizer-function-generator?pm=PL&nid=-536900197.536896863&cc=SE&lc=swe HP3325]<br />
from 1978. It's still a pretty good<br />
generator, so if you don't mind the size, the weight, the power<br />
consumption, and the noisy fan, you can find them on eBay... occasionally<br />
for only slightly more than you'll pay for shipping.<br />
<br />
Next, we'll observe our analog waveforms on [[WikiPedia:Oscilloscope_types#Cathode-ray_oscilloscope_.28CRO.29|analog oscilloscopes]],<br />
like this Tektronix 2246 from the mid-90s, one of the last and very best analog scopes ever made. Every home lab should have one.<br />
<br />
...and finally inspect the [[WikiPedia:Spectral_density#Electrical_engineering|frequency spectrum]] of our signals using an<br />
[[WikiPedia:Spectrum_analyzer#Swept-tuned|analog spectrum analyzer]], this<br />
[http://www.home.agilent.com/en/pd-3585A%3Aepsg%3Apro-pn-3585A/spectrum-analyzer-high-perf-20hz-40mhz?pm=PL&nid=-536900197.536897319&cc=SE&lc=swe HP3585]<br />
from the same product line as<br />
the signal generator. Like the other equipment here it has<br />
[http://www.hp9845.net/9845/hardware/processors/ a rudimentary and hilariously large microcontroller],<br />
but the signal path<br />
from input to what you see on the screen is completely analog.<br />
<br />
All of this equipment is vintage, but aside from its raw tonnage, the specs are still quite good.<br />
<br />
At the moment, we have our signal generator set to output a nice 1 [[WikiPedia:Hertz#SI_multiples|kHz]]<br />
sine wave at one [[WikiPedia:Volt|Volt]] [[WikiPedia:Amplitude#Root_mean_square_amplitude|RMS]].<br />
We see the sine wave on the oscilloscope, can verify that it is indeed<br />
1 kHz at 1 Volt RMS, which is 2.8 Volts<br />
[[WikiPedia:Amplitude#Peak-to-peak_amplitude|peak-to-peak]],<br />
and that matches the<br />
measurement on the spectrum analyzer as well.<br />
<br />
The analyzer also shows some low-level [[WikiPedia:White_noise|white noise]]<br />
and just a bit of [[WikiPedia:Harmonic_distortion#Harmonic_distortion|harmonic distortion]],<br />
with the highest peak about 70[[WikiPedia:Decibel|dB]] or so below<br />
[[WikiPedia:Fundamental_frequency|the fundamental]].<br />
Now, this doesn't matter at all in our demos, but I<br />
wanted to point it out now just in case you didn't notice it until<br />
later.<br />
<br />
Now, we drop digital sampling in the middle.<br />
<br />
For the conversion, we'll use a boring, consumer-grade, eMagic USB1<br />
audio device. It's also more than ten years old at this point, and it's<br />
getting obsolete.<br />
<br />
A recent converter can easily have an order of magnitude better specs.<br />
[[WikiPedia:Reconstruction_filter#Sampled_data_reconstruction_filters|Flatness]],<br />
[[WikiPedia:Analog-to-digital_converter#Non-linearity|linearity]],<br />
[[WikiPedia:Jitter#Sampling_jitter|jitter]],<br />
[[WikiPedia:Noise_floor|noise behavior]],<br />
[[WikiPedia:Digital-to-analog_converter#DAC_performance|everything]]...<br />
you may not<br />
have noticed. Just because we can measure an improvement doesn't<br />
mean we can hear it, and even these old consumer boxes were already at<br />
the edge of ideal transparency.<br />
<br />
The eMagic connects to my ThinkPad, which displays a digital<br />
waveform and spectrum for comparison, then the ThinkPad<br />
sends the digital signal right back out to the eMagic for<br />
re-conversion to analog and observation on the output scopes.<br />
<br />
Input to output, left to right.<br />
<br style="clear:both;"/><br />
<br />
==Stairsteps==<br />
[[Image:Dsat 006.jpg|360px|right]]<br />
[[Image:Dsat 007.png|360px|right]]<br />
&ldquo;OK, it's go time. We begin by converting an analog signal to digital and<br />
then right back to analog again with no other steps.&rdquo;<br />
<br />
&ldquo;The signal generator is set to produce a 1kHz sine wave just like<br />
before.&rdquo;<br />
<br />
&ldquo;We can see our analog sine wave on our input-side oscilloscope.&rdquo;<br />
<br />
&ldquo;We digitize our signal to<br />
[[Videos/A_Digital_Media_Primer_For_Geeks#Raw_.28digital_audio.29_meat|16 bit PCM at 44.1kHz]],<br />
same as on a CD.&rdquo;<br />
<br />
&ldquo;The spectrum of the digitized signal matches what we saw earlier and what we see now on the analog spectrum analyzer, aside from its <br />
[[WikiPedia:High_impedance|high-impedance input]] being just a smidge noisier.&rdquo;<br />
<br />
&ldquo;For now, the waveform display shows our digitized sine wave as a<br />
stairstep pattern, one step for each sample.&rdquo;<br />
<br />
&ldquo;And when we look at the output signal that's been converted<br />
from digital back to analog, we see...&rdquo;<br />
<br />
&ldquo;It's exactly like the original sine wave. No stairsteps.&rdquo;<br />
<br />
&ldquo;OK, 1 kHz is still a fairly low frequency, maybe the stairsteps are just<br />
hard to see or they're being smoothed away. Fair enough. Let's choose<br />
a higher frequency, something close to [[WikiPedia:Nyquist_frequency|Nyquist]], say 15kHz.&rdquo;<br />
<br />
&ldquo;Now the sine wave is represented by less than three samples per cycle, and... the digital waveform looks pretty awful. Well, looks<br />
can be deceiving. The analog output... is still a perfect sine wave, exactly like the original.&rdquo;<br />
<br />
&ldquo;Let's keep going up.&rdquo;<br />
<br />
&ldquo;16kHz.... 17kHz... 18kHz... 19kHz...&rdquo;<br />
<br />
&ldquo;20kHz. Welcome to the upper limits of human hearing. The output waveform is still perfect. No jagged edges, no dropoff, no stairsteps.&rdquo;<br />
<br />
&ldquo;So where'd the stairsteps go? Don't answer, it's a trick question. They were never there.&rdquo;<br />
<br />
&ldquo;Drawing a digital waveform as a stairstep was wrong to begin with.&rdquo;<br />
<br />
&ldquo;Why? A stairstep is a continuous-time function. It's jagged, and it's piecewise, but it has a defined value at every point in time.&rdquo;<br />
<br />
&ldquo;A sampled signal is entirely different. It's discrete-time; it's only got a value right at each instantaneous sample point and it's<br />
undefined, there is no value at all, everywhere between. A discrete-time signal is properly drawn as a lollipop graph.&rdquo;<br />
<br />
&ldquo;The continuous, analog counterpart of a digital signal passes smoothly through each sample point, and that's just as true for high<br />
frequencies as it is for low.&rdquo;<br />
<br />
&ldquo;Now, the interesting and not at all obvious bit is: [[WikiPedia:Nyquist%E2%80%93Shannon_sampling_theorem|there's only one<br />
bandlimited signal that passes exactly through each sample point]]. It's a unique solution. So if you sample a bandlimited signal and then convert it back, the original input is also the only possible output.&rdquo;<br />
<br />
[[Image:Dsat 008.png|360px|right]]<br />
<br />
&ldquo;And before you say, "oh, I can draw a different signal that passes through those points", well, yes you can, but if it differs even<br />
minutely from the original, it includes frequency content at or beyond Nyquist, breaks the bandlimiting requirement and isn't a valid solution.&rdquo;<br />
<br />
&ldquo;So how did everyone get confused and start thinking of digital signals as stairsteps? I can think of two good reasons.&rdquo;<br />
<br />
&ldquo;First: it's easy enough to convert a sampled signal to a true stairstep. Just<br />
extend each sample value forward until the next sample period. This is<br />
called a [[WikiPedia:Zero-order hold|zero-order hold]], and it's an important part of how some<br />
digital-to-analog converters work, especially the simplest ones.&rdquo;<br />
<br />
&ldquo;So, anyone who looks up [[WikiPedia:Digital-to-analog_converter#Practical_operation|digital-to-analog converter or<br />
digital-to-analog conversion]] is probably going to see a diagram of a<br />
stairstep waveform somewhere, but that's not a finished conversion,<br />
and it's not the signal that comes out.&rdquo;<br />
<br />
&ldquo;Second, and this is probably the more likely reason, engineers who<br />
supposedly know better, like me, draw stairsteps even though they're<br />
technically wrong. It's a sort of like a one-dimensional version of<br />
[[WikiPedia:MacPaint#Development|fat bits in an image editor]].&rdquo;<br />
<br />
&ldquo;Pixels aren't squares either, they're samples of a 2-dimensional<br />
function space and so they're also, conceptually, infinitely small<br />
points. Practically, it's a real pain in the ass to see or manipulate<br />
infinitely small anything, so big squares it is. Digital stairstep<br />
drawings are exactly the same thing.&rdquo;<br />
<br />
&ldquo;It's just a convenient drawing. The stairsteps aren't really there.&rdquo;<br />
<br />
==Bit-depth==<br />
[[Image:Dsat_009.jpg|360px|right]]<br />
[[Image:Dsat_010.jpg|260px|right]]<br />
<br />
When we convert a digital signal back to analog, the result is<br />
''also'' smooth regardless of the [[WikiPedia:Audio_bit_depth|bit depth]]. 24 bits or 16 bits...<br />
or 8 bits... it doesn't matter.<br />
<br />
So does that mean that the digital bit depth makes no difference at<br />
all? Of course not.<br />
<br />
Channel 2 here is the same sine wave input, but we quantize with<br />
[[WikiPedia:Dither|dither]] down to 8 bits.<br />
<br />
On the scope, we still see a nice<br />
smooth sine wave on channel 2. Look very close, and you'll also see a<br />
bit more noise. That's a clue.<br />
<br />
If we look at the spectrum of the signal... aha! Our sine wave is<br />
still there unaffected, but the noise level of the 8-bit signal on<br />
the second channel is much higher!<br />
<br />
And that's the difference the number of bits makes. That's it!<br />
<br />
When we digitize a signal, first we sample it. The<br />
sampling step is perfect; it loses nothing. But then we [[WikiPedia:Quantization_(sound_processing)|quantize]] it,<br />
and [[WikiPedia:Quantization_error|quantization adds noise]].<br />
<br />
The number of bits determines how much noise and so the level of the<br />
noise floor.<br />
<br />
What does this dithered quantization noise sound like? Let's listen<br />
to our 8-bit sine wave.<br />
<br />
That may have been hard to hear anything but the tone. Let's listen<br />
to just the noise after we notch out the sine wave and then bring the<br />
gain up a bit because the noise is quiet.<br />
<br />
Those of you who have used analog recording equipment may have just<br />
thought to yourselves, "My goodness! That sounds like tape hiss!"<br />
Well, it doesn't just sound like tape hiss, it acts like it too, and<br />
if we use a [[WikiPedia:Dither#Different_types|gaussian dither]] then it's<br />
[[WikiPedia:Central_limit_theorem|mathematically equivalent]] in every way. It ''is'' tape hiss.<br />
<br />
Intuitively, that means that we can measure tape hiss and thus the noise floor<br />
of [[WikiPedia:Magnetic_tape_sound_recording|magnetic audio tape]]<br />
in [[WikiPedia:Shannon–Hartley_theorem#Examples|bits instead of decibels]], in order to put things in a<br />
digital perspective. [[WikiPedia:Compact cassettes|Compact cassettes]] (for those of you who are old enough to remember them) could reach as<br />
deep as 9 bits in perfect conditions, though 5 to 6 bits was<br />
more typical, especially if it was a recording made on a<br />
[[WikiPedia:Cassette_deck|tape deck]]. That's right... your mix tapes were only about 6 bits<br />
deep... if you were lucky!<br />
<br />
The very best professional [[WikiPedia:Reel-to-reel_audio_tape_recording|open reel tape]] used in studios could barely<br />
hit... any guesses? 13 bits ''with'' [[WikiPedia:Reel-to-reel_audio_tape_recording#Noise_reduction|advanced noise reduction]]. And<br />
that's why seeing '[[WikiPedia:SPARS_code|D D D]]' on a [[WikiPedia:Compact_disk|Compact Disc]] used to be such a big,<br />
high-end deal.<br />
<br />
==Dither==<br />
[[Image:Dsat_011.png|360px|right]]<br />
<br />
I keep saying that I'm quantizing with [[Wikipedia:dither|dither]], so what is dither<br />
exactly and, more importantly, what does it do?<br />
<br />
The simple way to quantize a signal is to choose the digital<br />
amplitude value closest to the original analog amplitude. [[WikiPedia:Rounding|Obvious]],<br />
right? Unfortunately, the exact noise you get from this simple<br />
quantization scheme depends somewhat on the input signal,<br />
<br />
so we may get noise that's inconsistent, or causes distortion, or is<br />
undesirable in some other way.<br />
<br style="clear:both;"/><br />
<center><div style="background-color:#DDDDFF;border-color:#CCCCDD;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
'''Going deeper…'''<br />
*Cameron Nicklaus Christou's thesis [http://uwspace.uwaterloo.ca/bitstream/10012/3867/1/thesis.pdf Optimal Dither and Noise Shaping in Image Processing] provides an ''excellent'' explanation of dither and noise shaping.<br />
</div></center><br />
<br />
Dither is specially-constructed noise that substitutes for the noise<br />
produced by simple quantization. Dither doesn't [[WikiPedia:Sound_masking|drown out or mask]]<br />
quantization noise, it actually replaces it with noise characteristics<br />
of our choosing that aren't influenced by the input.<br />
<br />
Let's ''watch'' what dither does. The signal generator has too much noise for this test so we'll produce a mathematically perfect sine wave with the ThinkPad and quantize it to 8 bits with dithering.<br />
<br />
We see a nice sine wave on the waveform display and output scope and, once the analog spectrum analyzer catches up...<br />
a clean frequency peak with a uniform noise floor on both spectral displays<br />
just like before. Again, this is with dither.<br />
<br />
Now I turn dithering off.<br />
<br />
The quantization noise, that dither had spread out into a nice, flat noise<br />
floor, piles up into harmonic distortion peaks. The noise floor is<br />
lower, but the level of distortion becomes nonzero, and the distortion<br />
peaks sit higher than the dithering noise did.<br />
<br />
At 8 bits this effect is exaggerated. At 16 bits,<br />
even without dither, harmonic distortion is going to be so low as to<br />
be completely inaudible.<br />
<br />
Still, we can use dither to eliminate it completely if we so choose.<br />
<br />
Turning the dither off again for a moment, you'll notice that the<br />
absolute level of distortion from undithered quantization stays<br />
approximately constant regardless of the input amplitude.<br />
But when the signal level drops below a half a bit, everything<br />
quantizes to zero.<br />
<br />
In a sense, everything quantizing to zero is just 100% distortion!<br />
Dither eliminates this distortion too. We reenable dither<br />
and ... there's our signal back at 1/4 bit, with our nice flat noise floor.<br />
<br />
The noise floor doesn't have to be flat. Dither is noise of our<br />
choosing, so let's choose a noise as [http://www.acoustics.salford.ac.uk/res/cox/sound_quality/?content=subjective inoffensive] and<br />
[[WikiPedia:Absolute_threshold_of_hearing|difficult to notice]]<br />
as possible.<br />
<br />
Our hearing is most sensitive in the midrange from 2kHz to 4kHz,<br />
so that's where background noise is going to be the most obvious.<br />
We can [[WikiPedia:Noise_shaping|shape dithering noise]] away from sensitive frequencies to where<br />
hearing is less sensitive, usually the highest frequencies.<br />
<br />
16-bit dithering noise is normally much too quiet to hear at all, but<br />
let's listen to our noise shaping example, again with the gain<br />
brought way up...<br />
<br />
Lastly, dithered quantization noise ''is'' higher [[WikiPedia:Sound_power|power]] overall<br />
than undithered quantization noise even when it sounds quieter, and<br />
you can see that on a [[WikiPedia:VU_meter|VU meter]] during passages of near-silence. But<br />
dither isn't only an on or off choice. We can reduce the dither's<br />
power to balance less noise against a bit of distortion to minimize<br />
the overall effect.<br />
<br />
We'll also [[WikiPedia:Amplitude_modulation|modulate the input signal]] like this to show how a varying input affects the quantization noise. At<br />
full dithering power, the noise is uniform, constant, and featureless<br />
just like we expect:<br />
<br />
As we reduce the dither's power, the input increasingly<br />
affects the amplitude and the character of the quantization noise.<br />
Shaped dither behaves similarly, but noise shaping lends one more nice<br />
advantage. To make a long story short, it can use a somewhat lower<br />
dither power before the input has as much effect on the output.<br />
<br />
Despite all the time I just spent on dither, we're talking about<br />
differences that start 100 decibels and more below [[WikiPedia:Full_scale|full scale]]. Maybe<br />
if the CD had been<br />
[http://www.research.philips.com/technologies/projects/cd/index.html 14 bits as originally designed],<br />
dither ''might'' be<br />
more important. Maybe. At 16 bits, really, it's mostly a wash. You<br />
can think of dither as an insurance policy that gives several extra<br />
decibels of dynamic range just in case. The simple fact is, though, no<br />
one ever ruined a great recording by not dithering the final master.<br />
<br />
==Bandlimitation and timing==<br />
[[image:Dsat_013.jpg|360px|right]]<br />
<br />
We've been using [[WikiPedia:Sine_wave|sine waves]]. They're the obvious choice when what we<br />
want to see is a system's behavior at a given isolated frequency. Now<br />
let's look at something a bit more complex. What should we expect to<br />
happen when I change the input to a [[WikiPedia:Square_wave|square wave]]...<br />
<br />
The input scope confirms our 1kHz square wave. The output scope shows..<br />
<br />
<br />
Exactly what it should.<br />
...<br />
What is a square wave really? <br />
<br />
<br />
Well, we can say it's a waveform that's some positive value for half a cycle and then transitions instantaneously to a negative value for the other half.<br />
<br />
:<math><br />
\ x(t) = \begin{cases} 1, & |t| < T_1 \\ 0, & T_1 < |t| \leq {1 \over 2}T \end{cases}<br />
</math><br />
<br />
But that doesn't really tell us anything useful about how that input becomes this output.<br />
<br />
Then we remember that any waveform is also [[WikiPedia:Fourier_series|the sum of discrete frequencies]],<br />
and a square wave is particularly simple sum: a fundamental and an<br />
infinite series of [[WikiPedia:Even_and_odd_functions#Harmonics|odd harmonics]]. Sum them all up, you get a<br />
square wave.<br />
<br />
[[Image:dsat_015.jpg|360px|right]]<br />
:<math>\begin{align}<br />
x_{\mathrm{square}}(t) = \frac{4}{\pi}\sin(\omega t) + \frac{4}{3\pi}\sin(3\omega t) + \frac{4}{5\pi}\sin(5\omega t) + \\<br />
\frac{4}{7\pi}\sin(7\omega t) + \frac{4}{9\pi}\sin(9\omega t) + \frac{4}{11\pi}\sin(11\omega t) + \\ <br />
\frac{4}{13\pi}\sin(13\omega t) + \frac{4}{15\pi}\sin(15\omega t) + \frac{4}{17\pi}\sin(17\omega t) + \\<br />
\frac{4}{19\pi}\sin(19\omega t) + \frac{4}{21\pi}\sin(21\omega t) + \frac{4}{23\pi}\sin(23\omega t) + \\<br />
\frac{4}{25\pi}\sin(25\omega t) + \frac{4}{27\pi}\sin(27\omega t) + \frac{4}{29\pi}\sin(29\omega t) + \\<br />
\frac{4}{31\pi}\sin(31\omega t) + \frac{4}{33\pi}\sin(33\omega t) + \cdots <br />
\end{align}</math><br />
<br />
At first glance, that doesn't seem very useful either. You have to sum up an infinite number of harmonics to get the answer. ''Ah'', but we don't have an infinite number of harmonics.<br />
<br />
We're using a quite sharp [[WikiPedia:Low-pass_filter|anti-aliasing filter]] that cuts off right<br />
above 20kHz, so our signal is [[WikiPedia:Bandlimiting|bandlimited]], so only the first ten terms make it through.<br />
<br />
..and that's exactly what we see on the output scope.<br />
<br />
<br style="clear:both;"/><br />
<center><div style="background-color:#DDDDFF;border-color:#CCCCDD;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
'''Going deeper…'''<br />
*In modern web browsers you can program audio synthesizers directly in javascript. Use the two square wave formulas to get a square wave out of [http://js.do/blog/sound-waves-with-javascript/ this page]. (Note: The scope is not very useful.) <br />
</div></center><br />
<br />
The rippling you see around sharp edges in a bandlimited signal is called the [[WikiPedia:/Gibbs_phenomenon|Gibbs effect]]. It happens whenever you slice off part of the frequency domain in the middle of nonzero energy.<br />
<br />
The usual rule of thumb you'll hear is "the sharper the cutoff, the<br />
stronger the rippling", which is approximately true, but we have to be<br />
careful how we think about it.<br />
For example... what would you expect our quite sharp anti-aliasing filter<br />
to do if I run our signal through it a second time?<br />
<br />
Aside from adding a few fractional cycles of delay, the answer is...<br />
nothing at all. The signal is already bandlimited. Bandlimiting it<br />
again doesn't do anything. A second pass can't remove frequencies<br />
that we already removed.<br />
<br />
And that's important. People tend to think of the ripples as<br />
a kind of [[WikiPedia:Sonic_artifact|artifact]] that's added by anti-aliasing and [[WikiPedia:Reconstruction_filter|anti-imaging]]<br />
filters, implying that the ripples get worse each time the signal<br />
passes through. We can see that in this case that didn't happen. So<br />
was it really the filter that added the ripples the first time<br />
through? No, not really. It's a subtle distinction, but Gibbs effect<br />
ripples aren't added by filters, they're just part of what a<br />
bandlimited signal ''is''.<br />
<br />
Even if we synthetically construct what looks like a perfect digital<br />
square wave,<br />
<br />
it's still limited to the channel bandwidth. Remember,<br />
the stairstep representation is misleading.<br />
<br />
What we really have here are instantaneous sample points,<br />
<br />
and only one bandlimited signal fits those points. All we did when we<br />
drew our apparently perfect square wave was line up the sample points<br />
just right so it appeared that there were no ripples if we played<br />
[[WikiPedia:Interpolation|connect-the-dots]].<br />
<br />
But the original bandlimited signal, complete with ripples, was<br />
still there.<br />
<br />
[[image:Dsat_014.gif|360px|right]]<br />
And that leads us to one more important point. You've probably heard<br />
that the timing precision of a digital signal is limited by its sample<br />
rate; put another way,<br />
<br />
that digital signals can't represent anything that falls between the<br />
samples.. implying that [[WikiPedia:Dirac_delta_function|impulses]] or<br />
[[WikiPedia:Synthesizer#ADSR_envelope|fast attacks]] have to align exactly<br />
with a sample, or the timing gets mangled... or they just disappear.<br />
<br />
At this point, we can easily see why that's wrong.<br />
<br />
Again, our input signals are bandlimited. And digital signals are<br />
samples, not stairsteps, not 'connect-the-dots'. We most certainly<br />
can, for example, put the rising edge of our bandlimited square wave<br />
anywhere we want between samples.<br />
<br />
It's represented perfectly and it's reconstructed perfectly.<br />
<br />
==Epilogue==<br />
<br />
[[Image:Moffey.jpg|360px|right]]<br />
<br />
Just like in [[Videos/A_Digital_Media_Primer_For_Geeks|the previous episode]], we've covered a broad range of<br />
topics, and yet barely scratched the surface of each one. If anything, my<br />
sins of omission are greater this time around... but this is a good<br />
stopping point.<br />
<br />
Or maybe, a good starting point. Dig deeper. Experiment. I chose my<br />
demos very carefully to be simple and give clear results. You can<br />
reproduce every one of them on your own if you like. But let's face<br />
it, sometimes we learn the most about a spiffy toy by breaking it open<br />
and studying all the pieces that fall out. And that's OK, we're<br />
engineers. Play with the demo parameters, hack up the code, set up<br />
alternate experiments. The source code for everything, including the<br />
little pushbutton demo application, is up at xiph.org.<br />
<br />
In the course of experimentation, you're likely to run into something<br />
that you didn't expect and can't explain. Don't worry! My earlier<br />
snark aside, Wikipedia is fantastic for exactly this kind of casual<br />
research. And, if you're really serious about understanding signals,<br />
several universities have advanced materials online, such as the<br />
[http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-003-signals-and-systems-spring-2010/index.htm 6.003]<br />
and<br />
[http://ocw.mit.edu/resources/res-6-007-signals-and-systems-spring-2011/ RES.6-007]<br />
Signals and Systems modules at MIT OpenCourseWare. And of<br />
course, there's always the [http://webchat.freenode.net/?channels=xiph community here at Xiph.Org].<br />
<br />
Digging deeper or not, I am out of coffee, so, until next time, happy<br />
hacking!<br />
<br />
==Credits==<br />
[[Image:Dmpfg_019.png|360px|right]]<br />
Written by: Christopher (Monty) Montgomery and the Xiph.Org Community<br />
<br />
Special thanks to:<br />
*Heidi Baumgartner, for the second Tektronix oscilloscope<br />
*Gregory Maxwell and Dr. Timothy Terriberry, for additional technical review<br />
<br />
Intro, title and credits music:<br><br />
"[http://music.lousyrobot.com/track/andy-warhol-is-gone Andy Warhol Is Gone]", by Lousy Robot<br><br />
Used by permission of Lousy Robot.<br><br />
Original source track All Rights Reserved.<br><br />
[http://www.lousyrobot.com www.lousyrobot.com]<br />
<br />
This Video Was Produced Entirely With Free and Open Source Software:<br><br />
<br />
*[http://www.gnu.org/ GNU]<br><br />
*[http://www.linux.org/ Linux]<br><br />
*[http://fedoraproject.org/ Fedora]<br><br />
*[http://cinelerra.org/ Cinelerra]<br><br />
*[http://www.gimp.org/ The Gimp]<br><br />
*[http://audacity.sourceforge.net/ Audacity]<br><br />
*[http://svn.xiph.org/trunk/postfish/README Postfish]<br><br />
*[http://gstreamer.freedesktop.org/ Gstreamer]<br><br />
<br />
All trademarks are the property of their respective owners. <br />
<br />
*''Complete video'' [http://creativecommons.org/licenses/by-sa/3.0/legalcode CC-BY-SA]<br><br />
*''Text transcript and Wiki edition'' [http://creativecommons.org/licenses/by-sa/3.0/legalcode CC-BY-SA]<br><br />
<br />
A Co-Production of Xiph.Org and Red Hat, Inc.<br><br />
(C) 2012-2013, Some Rights Reserved<br><br />
<br />
== Use The Source Luke ==<br />
<br />
As stated in the Epilogue, everything that appears in the video demos is driven by open source software, which means the source is both available for inspection and freely usable by the community. The Thinkpad that appears in the video was running Fedora 17 and Gnome Shell (Gnome 3). The demonstration software does not require Fedora specifically, but it does require Gnu/Linux to run in its current form. In all, the video involved just under 50,000 lines of new and custom-purpose code (including contributions to non-Xiph projects such as Cinelerra and Gromit).<br />
<br />
=== The Spectrum and Waveform Viewer ===<br />
<br />
The realtime software spectrum analyzer application that appears in the video was a preexisting application that was dusted off and updated for use in the video. The waveform viewer (effectively a simple software oscilloscope) was written from scratch making use of some of the internals from the spectrum analyzer application. Both are available from Xiph.Org svn:<br />
<br />
<center><div style="background-color:#DDDDDD;border-color:#CCCCCC;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
*Source for the Spectrum and Waveform applications is found at:<br />
https://svn.xiph.org/trunk/spectrum/<br />
*The source can be checked out of svn using the following command line:<br />
svn co https://svn.xiph.org/trunk/spectrum<br />
*Trac is a convenient way to browse the source without checking out a copy:<br />
https://trac.xiph.org/browser/trunk/spectrum<br />
</div></center><br />
<br />
Spectrum and Waveform both expect an input stream on the command line, either as raw data or as a WAV file.<br />
<br />
=== GTK-Bounce ===<br />
<br />
The touch-controlled application used in the video is named 'gtk-bounce' and was custom-written for the sole purpose of the in-video demonstrations. It is so named because, for the most part, all it does is read the input from an audio device, and then immediately write the same data back out for playback. It also forwards a copy of this data to up to two external monitoring applications, and in several demos, applies simple filters or generates simple waveforms. It includes several demos not included in the video.<br />
<br />
<center><div style="background-color:#DDDDDD;border-color:#CCCCCC;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
*Source for gtk-bounce is found at:<br />
https://svn.xiph.org/trunk/Xiph-episode-II/bounce/<br />
*The source can be checked out of svn using the following command line:<br />
svn co https://svn.xiph.org/trunk/Xiph-episode-II/bounce/<br />
*Trac is a convenient way to browse the source without checking out a copy:<br />
https://trac.xiph.org/browser/Xiph-episode-II/bounce/<br />
</div></center><br />
<br />
==== Starting Gtk-bounce ====<br />
The application is somewhat hardwired for specific demo parameters, but most of the hardwired settings can be found at the top of each source file. As found in SVN, the application expects an ALSA hardware audio device at hw:1, and if none if found, it will wait for one to appear. Once a sound device is successfully initialized, it expects to find and open two pipes named pipe0 and pipe1 for output in the current directory. In the video, the waveform and spectrum applications are started to take input from pipe0 and pipe1 respectively. The output sent to the two pipes is identical, and in most demos matches the output data sent to the hardware device for conversion to analog. The only exception is the tenth demo panel (which does not appear in the video) where gtk-bounce can be set to monitor the hardware inputs instead while the outputs are used to produce test waveforms.<br />
<br />
Assuming gtk-bounce, spectrum and waveform have been checked out and built, the configuration seen in the video can be started using the following commands:<br />
<center><div style="background-color:#DDDDDD;border-color:#CCCCCC;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
* make the pipe fifos for the applications to communicate (only needs to be done once)<br />
mkfifo pipe0 pipe1<br />
* start all three applications<br />
waveform pipe0 & spectrum pipe1 & gtk-bounce &<br />
</div></center><br />
<br />
==== Using Gtk-bounce ====<br />
<br />
Gtk-bounce consists of eleven pushbutton panels (numbered zero through ten) that can be selected by scrolling up and dwon with the arrow buttons on the right side. Each panel is intended for a specific demo or part of a demo.<br />
<br />
<center><div style="background-color:#DDDDDD;border-color:#CCCCCC;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
<br />
[[Image:Dsat-panel0.png|700px|center]]<br />
* '''Panel 0''': This panel presents buttons that allow the sound card to be configured in several sampling rates and bit depths. Samples read from the audio inputs are sent to the output pipes and audio outputs for playback without modification.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel1.png|700px|center]]<br />
* '''Panel 1''': Both channels are forwarded to the outputs, however the user may select the bit depth of each channel independently. When the sound card is running in 16 bit mode and 16-bit depth is selected, the data is untouched. Requantization to a lower bit depth is performed with a flat triangle dither.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel2.png|700px|center]]<br />
* '''Panel 2''': Both channels are re-quantized to the selected bit depth. Requantization to a lower bit depth is performed with a flat triangle dither.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel3.png|700px|center]]<br />
* '''Panel 3''': 'generate sine wave' discards the audio inputs and instead internally generates a sine wave at 32 bit precision, which is then quantized to the selected bit depth, optionally with dither. The resulting signal is then forwarded to the output. <br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel4.png|700px|center]]<br />
* '''Panel 4''': gtk-bounce generates a 16-bit sine wave of the selected amplitude, optionally with dither, and forwards the resulting signal to the outputs. The audio input from the audio device is discarded. Note that the slider sets the peak amplitude, not the peak-to-peak amplitude.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel5.png|700px|center]]<br />
* '''Panel 5''': generates a 16-bit sine wave, optionally quantized using dither. The user may additionally select a flat or a shaped dither. The 'notch and gain' button applies a notch filter to the resulting signal, and boosts the gain of the remaining noise so that it's easily audible. The audio input from the audio device is discarded.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel6.png|700px|center]]<br />
* '''Panel 6''': allows the user to play with the power of the dithering noise applied before quantizating the sine wave. Shaped or flat dither are available. The sine wave may also be modulated with a varying amplitude to highlight correlations between the input and the resulting quantization noise. The 'notch and gain' button applies a notch filter to the resulting signal, and boosts the gain of the remaining noise so that it's easily audible. The audio input from the audio device is discarded.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel7.png|700px|center]]<br />
* '''Panel 7''': applies a sharper antialiasing (lowpass) filter than is likely to be built into the sound-card hardware (as there's generally no reason to use a filter quite this sharp in practice). The very sharp filter allows us to bandpass the demonstration squarewave without any harmonics landing in the transition band. <br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel8.png|700px|center]]<br />
* '''Panel 8''': when selected, generate a synthetic 'squarewave' (this is not quite equivalent to a bandlimited analog squarewave; the harmonic amplitudes are a bit different) that when aligned with the sampling phase just right gives the appearance of having infinite rise and fall time. The slider allows us to shift the waveform sample alignment back and forth by +/- one sample to reveal that the underlying signal is still band-limited.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel9.png|700px|center]]<br />
* '''Panel 9''': <br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel10.png|700px|center]]<br />
* '''Panel 10''': <br />
<div style="clear: both">&nbsp;</div><br />
<br />
</div></center><br />
<br />
=== Cairo Animations ===<br />
<br />
The animations featured throughout the Episode 2 video were rapid-development spaghetti hack-jobs coded by hand in raw Cairo. Each module generated a series of PNG stills that were then stitched into an animation with Cinelerra or mplayer. In the interest of pointing and laughing at what really bad code looks like...<br />
<br />
<center><div style="background-color:#DDDDDD;border-color:#CCCCCC;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
*Source for the Cairo animations is found at:<br />
https://svn.xiph.org/trunk/Xiph-episode-II/cairo/<br />
*The source can be checked out of svn using the following command line:<br />
svn co https://svn.xiph.org/trunk/Xiph-episode-II/cairo/<br />
*Trac is a convenient way to browse the source without checking out a copy:<br />
https://trac.xiph.org/browser/Xiph-episode-II/cairo/<br />
</div></center></div>Gmaxwellhttps://wiki.xiph.org/index.php?title=Videos/Digital_Show_and_Tell&diff=14011Videos/Digital Show and Tell2013-02-26T10:10:26Z<p>Gmaxwell: /* Using Gtk-bounce */ this gray too? ogg paint good.</p>
<hr />
<div><small>''Wiki edition''</small><br />
[[Image:dsat_001.jpg|400px|right]]<br />
<br />
Continuing in the "firehose" tradition of [[Videos/A_Digital_Media_Primer_For_Geeks|Episode 01]], Xiph.Org's second video on digital media explores multiple facets of digital audio signals and how they ''really'' behave in the real world.<br />
<br />
Demonstrations of sampling, quantization, bit-depth, and dither explore digital audio behavior on real audio equipment using both modern digital analysis and vintage analog bench equipment, just in case we can't trust those newfangled digital gizmos. You can download the source code for each demo and try it all for yourself!<br />
<br/><br/><br/><br />
<center><font size="+2">[http://www.xiph.org/video/vid2.shtml Download or Watch online]</font></center><br />
<br style="clear:both;"/><br />
Supported players: [http://www.videolan.org/vlc/ VLC 1.1+], [https://www.mozilla.com/en-US/firefox/ Firefox ], [http://www.chromium.org/Home Chrome ], [http://www.opera.com/ Opera]. Or see [http://www.webmproject.org/users/ other WebM] or [[TheoraSoftwarePlayers|other Theora]] players.<br />
<br />
If you're having trouble with playback in a modern browser or player, please visit our [[Playback_Troubleshooting|playback troubleshooting and discussion]] page.<br />
<br/><br />
<hr/><br />
<br/><br/><br/><br />
[[Image:Xiph_ep02_test.png|400px|right]]<br />
<br />
Hi, I'm Monty Montgomery from [http://www.redhat.com/ Red Hat] and [http://xiph.org/ Xiph.Org].<br />
<br />
A few months ago, I wrote<br />
[http://people.xiph.org/~xiphmont/demo/neil-young.html an article on digital audio and why 24bit/192kHz music downloads don't make sense].<br />
In the article, I<br />
mentioned--almost in passing--that a digital waveform is<br />
[http://people.xiph.org/~xiphmont/demo/neil-young.html#toc_sfam not a stairstep],<br />
and you certainly don't get a stairstep when you<br />
[[WikiPedia:Digital-to-analog_converter|convert from digital back to analog]].<br />
<br />
Of everything in the entire article, '''that''' was the number one thing<br />
people wrote about. In fact, more than half the mail I got was questions and<br />
comments about basic digital signal behavior. Since there's interest, let's<br />
take a little time to play with some ''simple'' digital signals.<br />
<br />
==Veritas ex machina==<br />
[[Image:Dsat_002.jpg|200px|right]]<br />
[[Image:Dsat_003.jpg|200px|right]]<br />
[[Image:Dsat_004.jpg|200px|right]]<br />
[[Image:Dsat_005.jpg|200px|right]]<br />
<br />
Pretend for a moment that we have no idea how digital signals really<br />
behave. In that case it doesn't make sense for us to use digital test<br />
equipment either. Fortunately for this exercise, there's still plenty<br />
of working analog lab equipment out there.<br />
<br />
First up, we need a [[WikiPedia:Function_generator|signal generator]] to provide us with analog input<br />
signals--in this case, an<br />
[http://www.home.agilent.com/en/pd-3325A%3Aepsg%3Apro-pn-3325A/synthesizer-function-generator?pm=PL&nid=-536900197.536896863&cc=SE&lc=swe HP3325]<br />
from 1978. It's still a pretty good<br />
generator, so if you don't mind the size, the weight, the power<br />
consumption, and the noisy fan, you can find them on eBay... occasionally<br />
for only slightly more than you'll pay for shipping.<br />
<br />
Next, we'll observe our analog waveforms on [[WikiPedia:Oscilloscope_types#Cathode-ray_oscilloscope_.28CRO.29|analog oscilloscopes]],<br />
like this Tektronix 2246 from the mid-90s, one of the last and very best analog scopes ever made. Every home lab should have one.<br />
<br />
...and finally inspect the [[WikiPedia:Spectral_density#Electrical_engineering|frequency spectrum]] of our signals using an<br />
[[WikiPedia:Spectrum_analyzer#Swept-tuned|analog spectrum analyzer]], this<br />
[http://www.home.agilent.com/en/pd-3585A%3Aepsg%3Apro-pn-3585A/spectrum-analyzer-high-perf-20hz-40mhz?pm=PL&nid=-536900197.536897319&cc=SE&lc=swe HP3585]<br />
from the same product line as<br />
the signal generator. Like the other equipment here it has<br />
[http://www.hp9845.net/9845/hardware/processors/ a rudimentary and hilariously large microcontroller],<br />
but the signal path<br />
from input to what you see on the screen is completely analog.<br />
<br />
All of this equipment is vintage, but aside from its raw tonnage, the specs are still quite good.<br />
<br />
At the moment, we have our signal generator set to output a nice 1 [[WikiPedia:Hertz#SI_multiples|kHz]]<br />
sine wave at one [[WikiPedia:Volt|Volt]] [[WikiPedia:Amplitude#Root_mean_square_amplitude|RMS]].<br />
We see the sine wave on the oscilloscope, can verify that it is indeed<br />
1 kHz at 1 Volt RMS, which is 2.8 Volts<br />
[[WikiPedia:Amplitude#Peak-to-peak_amplitude|peak-to-peak]],<br />
and that matches the<br />
measurement on the spectrum analyzer as well.<br />
<br />
The analyzer also shows some low-level [[WikiPedia:White_noise|white noise]]<br />
and just a bit of [[WikiPedia:Harmonic_distortion#Harmonic_distortion|harmonic distortion]],<br />
with the highest peak about 70[[WikiPedia:Decibel|dB]] or so below<br />
[[WikiPedia:Fundamental_frequency|the fundamental]].<br />
Now, this doesn't matter at all in our demos, but I<br />
wanted to point it out now just in case you didn't notice it until<br />
later.<br />
<br />
Now, we drop digital sampling in the middle.<br />
<br />
For the conversion, we'll use a boring, consumer-grade, eMagic USB1<br />
audio device. It's also more than ten years old at this point, and it's<br />
getting obsolete.<br />
<br />
A recent converter can easily have an order of magnitude better specs.<br />
[[WikiPedia:Reconstruction_filter#Sampled_data_reconstruction_filters|Flatness]],<br />
[[WikiPedia:Analog-to-digital_converter#Non-linearity|linearity]],<br />
[[WikiPedia:Jitter#Sampling_jitter|jitter]],<br />
[[WikiPedia:Noise_floor|noise behavior]],<br />
[[WikiPedia:Digital-to-analog_converter#DAC_performance|everything]]...<br />
you may not<br />
have noticed. Just because we can measure an improvement doesn't<br />
mean we can hear it, and even these old consumer boxes were already at<br />
the edge of ideal transparency.<br />
<br />
The eMagic connects to my ThinkPad, which displays a digital<br />
waveform and spectrum for comparison, then the ThinkPad<br />
sends the digital signal right back out to the eMagic for<br />
re-conversion to analog and observation on the output scopes.<br />
<br />
Input to output, left to right.<br />
<br style="clear:both;"/><br />
<br />
==Stairsteps==<br />
[[Image:Dsat 006.jpg|360px|right]]<br />
[[Image:Dsat 007.png|360px|right]]<br />
&ldquo;OK, it's go time. We begin by converting an analog signal to digital and<br />
then right back to analog again with no other steps.&rdquo;<br />
<br />
&ldquo;The signal generator is set to produce a 1kHz sine wave just like<br />
before.&rdquo;<br />
<br />
&ldquo;We can see our analog sine wave on our input-side oscilloscope.&rdquo;<br />
<br />
&ldquo;We digitize our signal to<br />
[[Videos/A_Digital_Media_Primer_For_Geeks#Raw_.28digital_audio.29_meat|16 bit PCM at 44.1kHz]],<br />
same as on a CD.&rdquo;<br />
<br />
&ldquo;The spectrum of the digitized signal matches what we saw earlier and what we see now on the analog spectrum analyzer, aside from its <br />
[[WikiPedia:High_impedance|high-impedance input]] being just a smidge noisier.&rdquo;<br />
<br />
&ldquo;For now, the waveform display shows our digitized sine wave as a<br />
stairstep pattern, one step for each sample.&rdquo;<br />
<br />
&ldquo;And when we look at the output signal that's been converted<br />
from digital back to analog, we see...&rdquo;<br />
<br />
&ldquo;It's exactly like the original sine wave. No stairsteps.&rdquo;<br />
<br />
&ldquo;OK, 1 kHz is still a fairly low frequency, maybe the stairsteps are just<br />
hard to see or they're being smoothed away. Fair enough. Let's choose<br />
a higher frequency, something close to [[WikiPedia:Nyquist_frequency|Nyquist]], say 15kHz.&rdquo;<br />
<br />
&ldquo;Now the sine wave is represented by less than three samples per cycle, and... the digital waveform looks pretty awful. Well, looks<br />
can be deceiving. The analog output... is still a perfect sine wave, exactly like the original.&rdquo;<br />
<br />
&ldquo;Let's keep going up.&rdquo;<br />
<br />
&ldquo;16kHz.... 17kHz... 18kHz... 19kHz...&rdquo;<br />
<br />
&ldquo;20kHz. Welcome to the upper limits of human hearing. The output waveform is still perfect. No jagged edges, no dropoff, no stairsteps.&rdquo;<br />
<br />
&ldquo;So where'd the stairsteps go? Don't answer, it's a trick question. They were never there.&rdquo;<br />
<br />
&ldquo;Drawing a digital waveform as a stairstep was wrong to begin with.&rdquo;<br />
<br />
&ldquo;Why? A stairstep is a continuous-time function. It's jagged, and it's piecewise, but it has a defined value at every point in time.&rdquo;<br />
<br />
&ldquo;A sampled signal is entirely different. It's discrete-time; it's only got a value right at each instantaneous sample point and it's<br />
undefined, there is no value at all, everywhere between. A discrete-time signal is properly drawn as a lollipop graph.&rdquo;<br />
<br />
&ldquo;The continuous, analog counterpart of a digital signal passes smoothly through each sample point, and that's just as true for high<br />
frequencies as it is for low.&rdquo;<br />
<br />
&ldquo;Now, the interesting and not at all obvious bit is: [[WikiPedia:Nyquist%E2%80%93Shannon_sampling_theorem|there's only one<br />
bandlimited signal that passes exactly through each sample point]]. It's a unique solution. So if you sample a bandlimited signal and then convert it back, the original input is also the only possible output.&rdquo;<br />
<br />
[[Image:Dsat 008.png|360px|right]]<br />
<br />
&ldquo;And before you say, "oh, I can draw a different signal that passes through those points", well, yes you can, but if it differs even<br />
minutely from the original, it includes frequency content at or beyond Nyquist, breaks the bandlimiting requirement and isn't a valid solution.&rdquo;<br />
<br />
&ldquo;So how did everyone get confused and start thinking of digital signals as stairsteps? I can think of two good reasons.&rdquo;<br />
<br />
&ldquo;First: it's easy enough to convert a sampled signal to a true stairstep. Just<br />
extend each sample value forward until the next sample period. This is<br />
called a [[WikiPedia:Zero-order hold|zero-order hold]], and it's an important part of how some<br />
digital-to-analog converters work, especially the simplest ones.&rdquo;<br />
<br />
&ldquo;So, anyone who looks up [[WikiPedia:Digital-to-analog_converter#Practical_operation|digital-to-analog converter or<br />
digital-to-analog conversion]] is probably going to see a diagram of a<br />
stairstep waveform somewhere, but that's not a finished conversion,<br />
and it's not the signal that comes out.&rdquo;<br />
<br />
&ldquo;Second, and this is probably the more likely reason, engineers who<br />
supposedly know better, like me, draw stairsteps even though they're<br />
technically wrong. It's a sort of like a one-dimensional version of<br />
[[WikiPedia:MacPaint#Development|fat bits in an image editor]].&rdquo;<br />
<br />
&ldquo;Pixels aren't squares either, they're samples of a 2-dimensional<br />
function space and so they're also, conceptually, infinitely small<br />
points. Practically, it's a real pain in the ass to see or manipulate<br />
infinitely small anything, so big squares it is. Digital stairstep<br />
drawings are exactly the same thing.&rdquo;<br />
<br />
&ldquo;It's just a convenient drawing. The stairsteps aren't really there.&rdquo;<br />
<br />
==Bit-depth==<br />
[[Image:Dsat_009.jpg|360px|right]]<br />
[[Image:Dsat_010.jpg|260px|right]]<br />
<br />
When we convert a digital signal back to analog, the result is<br />
''also'' smooth regardless of the [[WikiPedia:Audio_bit_depth|bit depth]]. 24 bits or 16 bits...<br />
or 8 bits... it doesn't matter.<br />
<br />
So does that mean that the digital bit depth makes no difference at<br />
all? Of course not.<br />
<br />
Channel 2 here is the same sine wave input, but we quantize with<br />
[[WikiPedia:Dither|dither]] down to 8 bits.<br />
<br />
On the scope, we still see a nice<br />
smooth sine wave on channel 2. Look very close, and you'll also see a<br />
bit more noise. That's a clue.<br />
<br />
If we look at the spectrum of the signal... aha! Our sine wave is<br />
still there unaffected, but the noise level of the 8-bit signal on<br />
the second channel is much higher!<br />
<br />
And that's the difference the number of bits makes. That's it!<br />
<br />
When we digitize a signal, first we sample it. The<br />
sampling step is perfect; it loses nothing. But then we [[WikiPedia:Quantization_(sound_processing)|quantize]] it,<br />
and [[WikiPedia:Quantization_error|quantization adds noise]].<br />
<br />
The number of bits determines how much noise and so the level of the<br />
noise floor.<br />
<br />
What does this dithered quantization noise sound like? Let's listen<br />
to our 8-bit sine wave.<br />
<br />
That may have been hard to hear anything but the tone. Let's listen<br />
to just the noise after we notch out the sine wave and then bring the<br />
gain up a bit because the noise is quiet.<br />
<br />
Those of you who have used analog recording equipment may have just<br />
thought to yourselves, "My goodness! That sounds like tape hiss!"<br />
Well, it doesn't just sound like tape hiss, it acts like it too, and<br />
if we use a [[WikiPedia:Dither#Different_types|gaussian dither]] then it's<br />
[[WikiPedia:Central_limit_theorem|mathematically equivalent]] in every way. It ''is'' tape hiss.<br />
<br />
Intuitively, that means that we can measure tape hiss and thus the noise floor<br />
of [[WikiPedia:Magnetic_tape_sound_recording|magnetic audio tape]]<br />
in [[WikiPedia:Shannon–Hartley_theorem#Examples|bits instead of decibels]], in order to put things in a<br />
digital perspective. [[WikiPedia:Compact cassettes|Compact cassettes]] (for those of you who are old enough to remember them) could reach as<br />
deep as 9 bits in perfect conditions, though 5 to 6 bits was<br />
more typical, especially if it was a recording made on a<br />
[[WikiPedia:Cassette_deck|tape deck]]. That's right... your mix tapes were only about 6 bits<br />
deep... if you were lucky!<br />
<br />
The very best professional [[WikiPedia:Reel-to-reel_audio_tape_recording|open reel tape]] used in studios could barely<br />
hit... any guesses? 13 bits ''with'' [[WikiPedia:Reel-to-reel_audio_tape_recording#Noise_reduction|advanced noise reduction]]. And<br />
that's why seeing '[[WikiPedia:SPARS_code|D D D]]' on a [[WikiPedia:Compact_disk|Compact Disc]] used to be such a big,<br />
high-end deal.<br />
<br />
==Dither==<br />
[[Image:Dsat_011.png|360px|right]]<br />
<br />
I keep saying that I'm quantizing with [[Wikipedia:dither|dither]], so what is dither<br />
exactly and, more importantly, what does it do?<br />
<br />
The simple way to quantize a signal is to choose the digital<br />
amplitude value closest to the original analog amplitude. [[WikiPedia:Rounding|Obvious]],<br />
right? Unfortunately, the exact noise you get from this simple<br />
quantization scheme depends somewhat on the input signal,<br />
<br />
so we may get noise that's inconsistent, or causes distortion, or is<br />
undesirable in some other way.<br />
<br style="clear:both;"/><br />
<center><div style="background-color:#DDDDFF;border-color:#CCCCDD;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
'''Going deeper…'''<br />
*Cameron Nicklaus Christou's thesis [http://uwspace.uwaterloo.ca/bitstream/10012/3867/1/thesis.pdf Optimal Dither and Noise Shaping in Image Processing] provides an ''excellent'' explanation of dither and noise shaping.<br />
</div></center><br />
<br />
Dither is specially-constructed noise that substitutes for the noise<br />
produced by simple quantization. Dither doesn't [[WikiPedia:Sound_masking|drown out or mask]]<br />
quantization noise, it actually replaces it with noise characteristics<br />
of our choosing that aren't influenced by the input.<br />
<br />
Let's ''watch'' what dither does. The signal generator has too much noise for this test so we'll produce a mathematically perfect sine wave with the ThinkPad and quantize it to 8 bits with dithering.<br />
<br />
We see a nice sine wave on the waveform display and output scope and, once the analog spectrum analyzer catches up...<br />
a clean frequency peak with a uniform noise floor on both spectral displays<br />
just like before. Again, this is with dither.<br />
<br />
Now I turn dithering off.<br />
<br />
The quantization noise, that dither had spread out into a nice, flat noise<br />
floor, piles up into harmonic distortion peaks. The noise floor is<br />
lower, but the level of distortion becomes nonzero, and the distortion<br />
peaks sit higher than the dithering noise did.<br />
<br />
At 8 bits this effect is exaggerated. At 16 bits,<br />
even without dither, harmonic distortion is going to be so low as to<br />
be completely inaudible.<br />
<br />
Still, we can use dither to eliminate it completely if we so choose.<br />
<br />
Turning the dither off again for a moment, you'll notice that the<br />
absolute level of distortion from undithered quantization stays<br />
approximately constant regardless of the input amplitude.<br />
But when the signal level drops below a half a bit, everything<br />
quantizes to zero.<br />
<br />
In a sense, everything quantizing to zero is just 100% distortion!<br />
Dither eliminates this distortion too. We reenable dither<br />
and ... there's our signal back at 1/4 bit, with our nice flat noise floor.<br />
<br />
The noise floor doesn't have to be flat. Dither is noise of our<br />
choosing, so let's choose a noise as [http://www.acoustics.salford.ac.uk/res/cox/sound_quality/?content=subjective inoffensive] and<br />
[[WikiPedia:Absolute_threshold_of_hearing|difficult to notice]]<br />
as possible.<br />
<br />
Our hearing is most sensitive in the midrange from 2kHz to 4kHz,<br />
so that's where background noise is going to be the most obvious.<br />
We can [[WikiPedia:Noise_shaping|shape dithering noise]] away from sensitive frequencies to where<br />
hearing is less sensitive, usually the highest frequencies.<br />
<br />
16-bit dithering noise is normally much too quiet to hear at all, but<br />
let's listen to our noise shaping example, again with the gain<br />
brought way up...<br />
<br />
Lastly, dithered quantization noise ''is'' higher [[WikiPedia:Sound_power|power]] overall<br />
than undithered quantization noise even when it sounds quieter, and<br />
you can see that on a [[WikiPedia:VU_meter|VU meter]] during passages of near-silence. But<br />
dither isn't only an on or off choice. We can reduce the dither's<br />
power to balance less noise against a bit of distortion to minimize<br />
the overall effect.<br />
<br />
We'll also [[WikiPedia:Amplitude_modulation|modulate the input signal]] like this to show how a varying input affects the quantization noise. At<br />
full dithering power, the noise is uniform, constant, and featureless<br />
just like we expect:<br />
<br />
As we reduce the dither's power, the input increasingly<br />
affects the amplitude and the character of the quantization noise.<br />
Shaped dither behaves similarly, but noise shaping lends one more nice<br />
advantage. To make a long story short, it can use a somewhat lower<br />
dither power before the input has as much effect on the output.<br />
<br />
Despite all the time I just spent on dither, we're talking about<br />
differences that start 100 decibels and more below [[WikiPedia:Full_scale|full scale]]. Maybe<br />
if the CD had been<br />
[http://www.research.philips.com/technologies/projects/cd/index.html 14 bits as originally designed],<br />
dither ''might'' be<br />
more important. Maybe. At 16 bits, really, it's mostly a wash. You<br />
can think of dither as an insurance policy that gives several extra<br />
decibels of dynamic range just in case. The simple fact is, though, no<br />
one ever ruined a great recording by not dithering the final master.<br />
<br />
==Bandlimitation and timing==<br />
[[image:Dsat_013.jpg|360px|right]]<br />
<br />
We've been using [[WikiPedia:Sine_wave|sine waves]]. They're the obvious choice when what we<br />
want to see is a system's behavior at a given isolated frequency. Now<br />
let's look at something a bit more complex. What should we expect to<br />
happen when I change the input to a [[WikiPedia:Square_wave|square wave]]...<br />
<br />
The input scope confirms our 1kHz square wave. The output scope shows..<br />
<br />
<br />
Exactly what it should.<br />
...<br />
What is a square wave really? <br />
<br />
<br />
Well, we can say it's a waveform that's some positive value for half a cycle and then transitions instantaneously to a negative value for the other half.<br />
<br />
:<math><br />
\ x(t) = \begin{cases} 1, & |t| < T_1 \\ 0, & T_1 < |t| \leq {1 \over 2}T \end{cases}<br />
</math><br />
<br />
But that doesn't really tell us anything useful about how that input becomes this output.<br />
<br />
Then we remember that any waveform is also [[WikiPedia:Fourier_series|the sum of discrete frequencies]],<br />
and a square wave is particularly simple sum: a fundamental and an<br />
infinite series of [[WikiPedia:Even_and_odd_functions#Harmonics|odd harmonics]]. Sum them all up, you get a<br />
square wave.<br />
<br />
[[Image:dsat_015.jpg|360px|right]]<br />
:<math>\begin{align}<br />
x_{\mathrm{square}}(t) = \frac{4}{\pi}\sin(\omega t) + \frac{4}{3\pi}\sin(3\omega t) + \frac{4}{5\pi}\sin(5\omega t) + \\<br />
\frac{4}{7\pi}\sin(7\omega t) + \frac{4}{9\pi}\sin(9\omega t) + \frac{4}{11\pi}\sin(11\omega t) + \\ <br />
\frac{4}{13\pi}\sin(13\omega t) + \frac{4}{15\pi}\sin(15\omega t) + \frac{4}{17\pi}\sin(17\omega t) + \\<br />
\frac{4}{19\pi}\sin(19\omega t) + \frac{4}{21\pi}\sin(21\omega t) + \frac{4}{23\pi}\sin(23\omega t) + \\<br />
\frac{4}{25\pi}\sin(25\omega t) + \frac{4}{27\pi}\sin(27\omega t) + \frac{4}{29\pi}\sin(29\omega t) + \\<br />
\frac{4}{31\pi}\sin(31\omega t) + \frac{4}{33\pi}\sin(33\omega t) + \cdots <br />
\end{align}</math><br />
<br />
At first glance, that doesn't seem very useful either. You have to sum up an infinite number of harmonics to get the answer. ''Ah'', but we don't have an infinite number of harmonics.<br />
<br />
We're using a quite sharp [[WikiPedia:Low-pass_filter|anti-aliasing filter]] that cuts off right<br />
above 20kHz, so our signal is [[WikiPedia:Bandlimiting|bandlimited]], so only the first ten terms make it through.<br />
<br />
..and that's exactly what we see on the output scope.<br />
<br />
<br style="clear:both;"/><br />
<center><div style="background-color:#DDDDFF;border-color:#CCCCDD;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
'''Going deeper…'''<br />
*In modern web browsers you can program audio synthesizers directly in javascript. Use the two square wave formulas to get a square wave out of [http://js.do/blog/sound-waves-with-javascript/ this page]. (Note: The scope is not very useful.) <br />
</div></center><br />
<br />
The rippling you see around sharp edges in a bandlimited signal is called the [[WikiPedia:/Gibbs_phenomenon|Gibbs effect]]. It happens whenever you slice off part of the frequency domain in the middle of nonzero energy.<br />
<br />
The usual rule of thumb you'll hear is "the sharper the cutoff, the<br />
stronger the rippling", which is approximately true, but we have to be<br />
careful how we think about it.<br />
For example... what would you expect our quite sharp anti-aliasing filter<br />
to do if I run our signal through it a second time?<br />
<br />
Aside from adding a few fractional cycles of delay, the answer is...<br />
nothing at all. The signal is already bandlimited. Bandlimiting it<br />
again doesn't do anything. A second pass can't remove frequencies<br />
that we already removed.<br />
<br />
And that's important. People tend to think of the ripples as<br />
a kind of [[WikiPedia:Sonic_artifact|artifact]] that's added by anti-aliasing and [[WikiPedia:Reconstruction_filter|anti-imaging]]<br />
filters, implying that the ripples get worse each time the signal<br />
passes through. We can see that in this case that didn't happen. So<br />
was it really the filter that added the ripples the first time<br />
through? No, not really. It's a subtle distinction, but Gibbs effect<br />
ripples aren't added by filters, they're just part of what a<br />
bandlimited signal ''is''.<br />
<br />
Even if we synthetically construct what looks like a perfect digital<br />
square wave,<br />
<br />
it's still limited to the channel bandwidth. Remember,<br />
the stairstep representation is misleading.<br />
<br />
What we really have here are instantaneous sample points,<br />
<br />
and only one bandlimited signal fits those points. All we did when we<br />
drew our apparently perfect square wave was line up the sample points<br />
just right so it appeared that there were no ripples if we played<br />
[[WikiPedia:Interpolation|connect-the-dots]].<br />
<br />
But the original bandlimited signal, complete with ripples, was<br />
still there.<br />
<br />
[[image:Dsat_014.gif|360px|right]]<br />
And that leads us to one more important point. You've probably heard<br />
that the timing precision of a digital signal is limited by its sample<br />
rate; put another way,<br />
<br />
that digital signals can't represent anything that falls between the<br />
samples.. implying that [[WikiPedia:Dirac_delta_function|impulses]] or<br />
[[WikiPedia:Synthesizer#ADSR_envelope|fast attacks]] have to align exactly<br />
with a sample, or the timing gets mangled... or they just disappear.<br />
<br />
At this point, we can easily see why that's wrong.<br />
<br />
Again, our input signals are bandlimited. And digital signals are<br />
samples, not stairsteps, not 'connect-the-dots'. We most certainly<br />
can, for example, put the rising edge of our bandlimited square wave<br />
anywhere we want between samples.<br />
<br />
It's represented perfectly and it's reconstructed perfectly.<br />
<br />
==Epilogue==<br />
<br />
[[Image:Moffey.jpg|360px|right]]<br />
<br />
Just like in [[Videos/A_Digital_Media_Primer_For_Geeks|the previous episode]], we've covered a broad range of<br />
topics, and yet barely scratched the surface of each one. If anything, my<br />
sins of omission are greater this time around... but this is a good<br />
stopping point.<br />
<br />
Or maybe, a good starting point. Dig deeper. Experiment. I chose my<br />
demos very carefully to be simple and give clear results. You can<br />
reproduce every one of them on your own if you like. But let's face<br />
it, sometimes we learn the most about a spiffy toy by breaking it open<br />
and studying all the pieces that fall out. And that's OK, we're<br />
engineers. Play with the demo parameters, hack up the code, set up<br />
alternate experiments. The source code for everything, including the<br />
little pushbutton demo application, is up at xiph.org.<br />
<br />
In the course of experimentation, you're likely to run into something<br />
that you didn't expect and can't explain. Don't worry! My earlier<br />
snark aside, Wikipedia is fantastic for exactly this kind of casual<br />
research. And, if you're really serious about understanding signals,<br />
several universities have advanced materials online, such as the<br />
[http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-003-signals-and-systems-spring-2010/index.htm 6.003]<br />
and<br />
[http://ocw.mit.edu/resources/res-6-007-signals-and-systems-spring-2011/ RES.6-007]<br />
Signals and Systems modules at MIT OpenCourseWare. And of<br />
course, there's always the [http://webchat.freenode.net/?channels=xiph community here at Xiph.Org].<br />
<br />
Digging deeper or not, I am out of coffee, so, until next time, happy<br />
hacking!<br />
<br />
==Credits==<br />
[[Image:Dmpfg_019.png|360px|right]]<br />
Written by: Christopher (Monty) Montgomery and the Xiph.Org Community<br />
<br />
Special thanks to:<br />
*Heidi Baumgartner, for the second Tektronix oscilloscope<br />
*Gregory Maxwell and Dr. Timothy Terriberry, for additional technical review<br />
<br />
Intro, title and credits music:<br><br />
"[http://music.lousyrobot.com/track/andy-warhol-is-gone Andy Warhol Is Gone]", by Lousy Robot<br><br />
Used by permission of Lousy Robot.<br><br />
Original source track All Rights Reserved.<br><br />
[http://www.lousyrobot.com www.lousyrobot.com]<br />
<br />
This Video Was Produced Entirely With Free and Open Source Software:<br><br />
<br />
*[http://www.gnu.org/ GNU]<br><br />
*[http://www.linux.org/ Linux]<br><br />
*[http://fedoraproject.org/ Fedora]<br><br />
*[http://cinelerra.org/ Cinelerra]<br><br />
*[http://www.gimp.org/ The Gimp]<br><br />
*[http://audacity.sourceforge.net/ Audacity]<br><br />
*[http://svn.xiph.org/trunk/postfish/README Postfish]<br><br />
*[http://gstreamer.freedesktop.org/ Gstreamer]<br><br />
<br />
All trademarks are the property of their respective owners. <br />
<br />
*''Complete video'' [http://creativecommons.org/licenses/by-sa/3.0/legalcode CC-BY-SA]<br><br />
*''Text transcript and Wiki edition'' [http://creativecommons.org/licenses/by-sa/3.0/legalcode CC-BY-SA]<br><br />
<br />
A Co-Production of Xiph.Org and Red Hat, Inc.<br><br />
(C) 2012-2013, Some Rights Reserved<br><br />
<br />
== Use The Source Luke ==<br />
<br />
As stated in the Epilogue, everything that appears in the video demos is driven by open source software, which means the source is both available for inspection and freely usable by the community. The Thinkpad that appears in the video was running Fedora 17 and Gnome Shell (Gnome 3). The demonstration software does not require Fedora specifically, but it does require Gnu/Linux to run in its current form. In all, the video involved just under 50,000 lines of new and custom-purpose code (including contributions to non-Xiph projects such as Cinelerra and Gromit).<br />
<br />
=== The Spectrum and Waveform Viewer ===<br />
<br />
The realtime software spectrum analyzer application that appears in the video was a preexisting application that was dusted off and updated for use in the video. The waveform viewer (effectively a simple software oscilloscope) was written from scratch making use of some of the internals from the spectrum analyzer application. Both are available from Xiph.Org svn:<br />
<br />
<center><div style="background-color:#DDDDDD;border-color:#CCCCCC;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
*Source for the Spectrum and Waveform applications is found at:<br />
https://svn.xiph.org/trunk/spectrum/<br />
*The source can be checked out of svn using the following command line:<br />
svn co https://svn.xiph.org/trunk/spectrum<br />
*Trac is a convenient way to browse the source without checking out a copy:<br />
https://trac.xiph.org/browser/trunk/spectrum<br />
</div></center><br />
<br />
Spectrum and Waveform both expect an input stream on the command line, either as raw data or as a WAV file.<br />
<br />
=== GTK-Bounce ===<br />
<br />
The touch-controlled application used in the video is named 'gtk-bounce' and was custom-written for the sole purpose of the in-video demonstrations. It is so named because, for the most part, all it does is read the input from an audio device, and then immediately write the same data back out for playback. It also forwards a copy of this data to up to two external monitoring applications, and in several demos, applies simple filters or generates simple waveforms. It includes several demos not included in the video.<br />
<br />
<center><div style="background-color:#DDDDDD;border-color:#CCCCCC;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
*Source for gtk-bounce is found at:<br />
https://svn.xiph.org/trunk/Xiph-episode-II/bounce/<br />
*The source can be checked out of svn using the following command line:<br />
svn co https://svn.xiph.org/trunk/Xiph-episode-II/bounce/<br />
*Trac is a convenient way to browse the source without checking out a copy:<br />
https://trac.xiph.org/browser/Xiph-episode-II/bounce/<br />
</div></center><br />
<br />
==== Starting Gtk-bounce ====<br />
The application is somewhat hardwired for specific demo parameters, but most of the hardwired settings can be found at the top of each source file. As found in SVN, the application expects an ALSA hardware audio device at hw:1, and if none if found, it will wait for one to appear. Once a sound device is successfully initialized, it expects to find and open two pipes named pipe0 and pipe1 for output in the current directory. In the video, the waveform and spectrum applications are started to take input from pipe0 and pipe1 respectively. The output sent to the two pipes is identical, and in most demos matches the output data sent to the hardware device for conversion to analog. The only exception is the tenth demo panel (which does not appear in the video) where gtk-bounce can be set to monitor the hardware inputs instead while the outputs are used to produce test waveforms.<br />
<br />
Assuming gtk-bounce, spectrum and waveform have been checked out and built, the configuration seen in the video can be started using the following commands:<br />
<center><div style="background-color:#DDDDFF;border-color:#CCCCDD;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
* make the pipe fifos for the applications to communicate (only needs to be done once)<br />
mkfifo pipe0 pipe1<br />
* start all three applications<br />
waveform pipe0 & spectrum pipe1 & gtk-bounce &<br />
</div></center><br />
<br />
==== Using Gtk-bounce ====<br />
<br />
Gtk-bounce consists of eleven pushbutton panels (numbered zero through ten) that can be selected by scrolling up and dwon with the arrow buttons on the right side. Each panel is intended for a specific demo or part of a demo.<br />
<br />
<center><div style="background-color:#DDDDDD;border-color:#CCCCCC;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
<br />
[[Image:Dsat-panel0.png|700px|center]]<br />
* '''Panel 0''': This panel presents buttons that allow the sound card to be configured in several sampling rates and bit depths. Samples read from the audio inputs are sent to the output pipes and audio outputs for playback without modification.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel1.png|700px|center]]<br />
* '''Panel 1''': Both channels are forwarded to the outputs, however the user may select the bit depth of each channel independently. When the sound card is running in 16 bit mode and 16-bit depth is selected, the data is untouched. Requantization to a lower bit depth is performed with a flat triangle dither.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel2.png|700px|center]]<br />
* '''Panel 2''': Both channels are re-quantized to the selected bit depth. Requantization to a lower bit depth is performed with a flat triangle dither.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel3.png|700px|center]]<br />
* '''Panel 3''': 'generate sine wave' discards the audio inputs and instead internally generates a sine wave at 32 bit precision, which is then quantized to the selected bit depth, optionally with dither. The resulting signal is then forwarded to the output. <br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel4.png|700px|center]]<br />
* '''Panel 4''': gtk-bounce generates a 16-bit sine wave of the selected amplitude, optionally with dither, and forwards the resulting signal to the outputs. The audio input from the audio device is discarded. Note that the slider sets the peak amplitude, not the peak-to-peak amplitude.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel5.png|700px|center]]<br />
* '''Panel 5''': generates a 16-bit sine wave, optionally quantized using dither. The user may additionally select a flat or a shaped dither. The 'notch and gain' button applies a notch filter to the resulting signal, and boosts the gain of the remaining noise so that it's easily audible. The audio input from the audio device is discarded.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel6.png|700px|center]]<br />
* '''Panel 6''': allows the user to play with the power of the dithering noise applied before quantizating the sine wave. Shaped or flat dither are available. The sine wave may also be modulated with a varying amplitude to highlight correlations between the input and the resulting quantization noise. The 'notch and gain' button applies a notch filter to the resulting signal, and boosts the gain of the remaining noise so that it's easily audible. The audio input from the audio device is discarded.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel7.png|700px|center]]<br />
* '''Panel 7''': applies a sharper antialiasing (lowpass) filter than is likely to be built into the sound-card hardware (as there's generally no reason to use a filter quite this sharp in practice). The very sharp filter allows us to bandpass the demonstration squarewave without any harmonics landing in the transition band. <br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel8.png|700px|center]]<br />
* '''Panel 8''': when selected, generate a synthetic 'squarewave' (this is not quite equivalent to a bandlimited analog squarewave; the harmonic amplitudes are a bit different) that when aligned with the sampling phase just right gives the appearance of having infinite rise and fall time. The slider allows us to shift the waveform sample alignment back and forth by +/- one sample to reveal that the underlying signal is still band-limited.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel9.png|700px|center]]<br />
* '''Panel 9''': <br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel10.png|700px|center]]<br />
* '''Panel 10''': <br />
<div style="clear: both">&nbsp;</div><br />
<br />
</div></center><br />
<br />
=== Cairo Animations ===<br />
<br />
The animations featured throughout the Episode 2 video were rapid-development spaghetti hack-jobs coded by hand in raw Cairo. Each module generated a series of PNG stills that were then stitched into an animation with Cinelerra or mplayer. In the interest of pointing and laughing at what really bad code looks like...<br />
<br />
<center><div style="background-color:#DDDDDD;border-color:#CCCCCC;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
*Source for the Cairo animations is found at:<br />
https://svn.xiph.org/trunk/Xiph-episode-II/cairo/<br />
*The source can be checked out of svn using the following command line:<br />
svn co https://svn.xiph.org/trunk/Xiph-episode-II/cairo/<br />
*Trac is a convenient way to browse the source without checking out a copy:<br />
https://trac.xiph.org/browser/Xiph-episode-II/cairo/<br />
</div></center></div>Gmaxwellhttps://wiki.xiph.org/index.php?title=Videos/Digital_Show_and_Tell&diff=14010Videos/Digital Show and Tell2013-02-26T10:09:45Z<p>Gmaxwell: /* Cairo Animations */ source box gray</p>
<hr />
<div><small>''Wiki edition''</small><br />
[[Image:dsat_001.jpg|400px|right]]<br />
<br />
Continuing in the "firehose" tradition of [[Videos/A_Digital_Media_Primer_For_Geeks|Episode 01]], Xiph.Org's second video on digital media explores multiple facets of digital audio signals and how they ''really'' behave in the real world.<br />
<br />
Demonstrations of sampling, quantization, bit-depth, and dither explore digital audio behavior on real audio equipment using both modern digital analysis and vintage analog bench equipment, just in case we can't trust those newfangled digital gizmos. You can download the source code for each demo and try it all for yourself!<br />
<br/><br/><br/><br />
<center><font size="+2">[http://www.xiph.org/video/vid2.shtml Download or Watch online]</font></center><br />
<br style="clear:both;"/><br />
Supported players: [http://www.videolan.org/vlc/ VLC 1.1+], [https://www.mozilla.com/en-US/firefox/ Firefox ], [http://www.chromium.org/Home Chrome ], [http://www.opera.com/ Opera]. Or see [http://www.webmproject.org/users/ other WebM] or [[TheoraSoftwarePlayers|other Theora]] players.<br />
<br />
If you're having trouble with playback in a modern browser or player, please visit our [[Playback_Troubleshooting|playback troubleshooting and discussion]] page.<br />
<br/><br />
<hr/><br />
<br/><br/><br/><br />
[[Image:Xiph_ep02_test.png|400px|right]]<br />
<br />
Hi, I'm Monty Montgomery from [http://www.redhat.com/ Red Hat] and [http://xiph.org/ Xiph.Org].<br />
<br />
A few months ago, I wrote<br />
[http://people.xiph.org/~xiphmont/demo/neil-young.html an article on digital audio and why 24bit/192kHz music downloads don't make sense].<br />
In the article, I<br />
mentioned--almost in passing--that a digital waveform is<br />
[http://people.xiph.org/~xiphmont/demo/neil-young.html#toc_sfam not a stairstep],<br />
and you certainly don't get a stairstep when you<br />
[[WikiPedia:Digital-to-analog_converter|convert from digital back to analog]].<br />
<br />
Of everything in the entire article, '''that''' was the number one thing<br />
people wrote about. In fact, more than half the mail I got was questions and<br />
comments about basic digital signal behavior. Since there's interest, let's<br />
take a little time to play with some ''simple'' digital signals.<br />
<br />
==Veritas ex machina==<br />
[[Image:Dsat_002.jpg|200px|right]]<br />
[[Image:Dsat_003.jpg|200px|right]]<br />
[[Image:Dsat_004.jpg|200px|right]]<br />
[[Image:Dsat_005.jpg|200px|right]]<br />
<br />
Pretend for a moment that we have no idea how digital signals really<br />
behave. In that case it doesn't make sense for us to use digital test<br />
equipment either. Fortunately for this exercise, there's still plenty<br />
of working analog lab equipment out there.<br />
<br />
First up, we need a [[WikiPedia:Function_generator|signal generator]] to provide us with analog input<br />
signals--in this case, an<br />
[http://www.home.agilent.com/en/pd-3325A%3Aepsg%3Apro-pn-3325A/synthesizer-function-generator?pm=PL&nid=-536900197.536896863&cc=SE&lc=swe HP3325]<br />
from 1978. It's still a pretty good<br />
generator, so if you don't mind the size, the weight, the power<br />
consumption, and the noisy fan, you can find them on eBay... occasionally<br />
for only slightly more than you'll pay for shipping.<br />
<br />
Next, we'll observe our analog waveforms on [[WikiPedia:Oscilloscope_types#Cathode-ray_oscilloscope_.28CRO.29|analog oscilloscopes]],<br />
like this Tektronix 2246 from the mid-90s, one of the last and very best analog scopes ever made. Every home lab should have one.<br />
<br />
...and finally inspect the [[WikiPedia:Spectral_density#Electrical_engineering|frequency spectrum]] of our signals using an<br />
[[WikiPedia:Spectrum_analyzer#Swept-tuned|analog spectrum analyzer]], this<br />
[http://www.home.agilent.com/en/pd-3585A%3Aepsg%3Apro-pn-3585A/spectrum-analyzer-high-perf-20hz-40mhz?pm=PL&nid=-536900197.536897319&cc=SE&lc=swe HP3585]<br />
from the same product line as<br />
the signal generator. Like the other equipment here it has<br />
[http://www.hp9845.net/9845/hardware/processors/ a rudimentary and hilariously large microcontroller],<br />
but the signal path<br />
from input to what you see on the screen is completely analog.<br />
<br />
All of this equipment is vintage, but aside from its raw tonnage, the specs are still quite good.<br />
<br />
At the moment, we have our signal generator set to output a nice 1 [[WikiPedia:Hertz#SI_multiples|kHz]]<br />
sine wave at one [[WikiPedia:Volt|Volt]] [[WikiPedia:Amplitude#Root_mean_square_amplitude|RMS]].<br />
We see the sine wave on the oscilloscope, can verify that it is indeed<br />
1 kHz at 1 Volt RMS, which is 2.8 Volts<br />
[[WikiPedia:Amplitude#Peak-to-peak_amplitude|peak-to-peak]],<br />
and that matches the<br />
measurement on the spectrum analyzer as well.<br />
<br />
The analyzer also shows some low-level [[WikiPedia:White_noise|white noise]]<br />
and just a bit of [[WikiPedia:Harmonic_distortion#Harmonic_distortion|harmonic distortion]],<br />
with the highest peak about 70[[WikiPedia:Decibel|dB]] or so below<br />
[[WikiPedia:Fundamental_frequency|the fundamental]].<br />
Now, this doesn't matter at all in our demos, but I<br />
wanted to point it out now just in case you didn't notice it until<br />
later.<br />
<br />
Now, we drop digital sampling in the middle.<br />
<br />
For the conversion, we'll use a boring, consumer-grade, eMagic USB1<br />
audio device. It's also more than ten years old at this point, and it's<br />
getting obsolete.<br />
<br />
A recent converter can easily have an order of magnitude better specs.<br />
[[WikiPedia:Reconstruction_filter#Sampled_data_reconstruction_filters|Flatness]],<br />
[[WikiPedia:Analog-to-digital_converter#Non-linearity|linearity]],<br />
[[WikiPedia:Jitter#Sampling_jitter|jitter]],<br />
[[WikiPedia:Noise_floor|noise behavior]],<br />
[[WikiPedia:Digital-to-analog_converter#DAC_performance|everything]]...<br />
you may not<br />
have noticed. Just because we can measure an improvement doesn't<br />
mean we can hear it, and even these old consumer boxes were already at<br />
the edge of ideal transparency.<br />
<br />
The eMagic connects to my ThinkPad, which displays a digital<br />
waveform and spectrum for comparison, then the ThinkPad<br />
sends the digital signal right back out to the eMagic for<br />
re-conversion to analog and observation on the output scopes.<br />
<br />
Input to output, left to right.<br />
<br style="clear:both;"/><br />
<br />
==Stairsteps==<br />
[[Image:Dsat 006.jpg|360px|right]]<br />
[[Image:Dsat 007.png|360px|right]]<br />
&ldquo;OK, it's go time. We begin by converting an analog signal to digital and<br />
then right back to analog again with no other steps.&rdquo;<br />
<br />
&ldquo;The signal generator is set to produce a 1kHz sine wave just like<br />
before.&rdquo;<br />
<br />
&ldquo;We can see our analog sine wave on our input-side oscilloscope.&rdquo;<br />
<br />
&ldquo;We digitize our signal to<br />
[[Videos/A_Digital_Media_Primer_For_Geeks#Raw_.28digital_audio.29_meat|16 bit PCM at 44.1kHz]],<br />
same as on a CD.&rdquo;<br />
<br />
&ldquo;The spectrum of the digitized signal matches what we saw earlier and what we see now on the analog spectrum analyzer, aside from its <br />
[[WikiPedia:High_impedance|high-impedance input]] being just a smidge noisier.&rdquo;<br />
<br />
&ldquo;For now, the waveform display shows our digitized sine wave as a<br />
stairstep pattern, one step for each sample.&rdquo;<br />
<br />
&ldquo;And when we look at the output signal that's been converted<br />
from digital back to analog, we see...&rdquo;<br />
<br />
&ldquo;It's exactly like the original sine wave. No stairsteps.&rdquo;<br />
<br />
&ldquo;OK, 1 kHz is still a fairly low frequency, maybe the stairsteps are just<br />
hard to see or they're being smoothed away. Fair enough. Let's choose<br />
a higher frequency, something close to [[WikiPedia:Nyquist_frequency|Nyquist]], say 15kHz.&rdquo;<br />
<br />
&ldquo;Now the sine wave is represented by less than three samples per cycle, and... the digital waveform looks pretty awful. Well, looks<br />
can be deceiving. The analog output... is still a perfect sine wave, exactly like the original.&rdquo;<br />
<br />
&ldquo;Let's keep going up.&rdquo;<br />
<br />
&ldquo;16kHz.... 17kHz... 18kHz... 19kHz...&rdquo;<br />
<br />
&ldquo;20kHz. Welcome to the upper limits of human hearing. The output waveform is still perfect. No jagged edges, no dropoff, no stairsteps.&rdquo;<br />
<br />
&ldquo;So where'd the stairsteps go? Don't answer, it's a trick question. They were never there.&rdquo;<br />
<br />
&ldquo;Drawing a digital waveform as a stairstep was wrong to begin with.&rdquo;<br />
<br />
&ldquo;Why? A stairstep is a continuous-time function. It's jagged, and it's piecewise, but it has a defined value at every point in time.&rdquo;<br />
<br />
&ldquo;A sampled signal is entirely different. It's discrete-time; it's only got a value right at each instantaneous sample point and it's<br />
undefined, there is no value at all, everywhere between. A discrete-time signal is properly drawn as a lollipop graph.&rdquo;<br />
<br />
&ldquo;The continuous, analog counterpart of a digital signal passes smoothly through each sample point, and that's just as true for high<br />
frequencies as it is for low.&rdquo;<br />
<br />
&ldquo;Now, the interesting and not at all obvious bit is: [[WikiPedia:Nyquist%E2%80%93Shannon_sampling_theorem|there's only one<br />
bandlimited signal that passes exactly through each sample point]]. It's a unique solution. So if you sample a bandlimited signal and then convert it back, the original input is also the only possible output.&rdquo;<br />
<br />
[[Image:Dsat 008.png|360px|right]]<br />
<br />
&ldquo;And before you say, "oh, I can draw a different signal that passes through those points", well, yes you can, but if it differs even<br />
minutely from the original, it includes frequency content at or beyond Nyquist, breaks the bandlimiting requirement and isn't a valid solution.&rdquo;<br />
<br />
&ldquo;So how did everyone get confused and start thinking of digital signals as stairsteps? I can think of two good reasons.&rdquo;<br />
<br />
&ldquo;First: it's easy enough to convert a sampled signal to a true stairstep. Just<br />
extend each sample value forward until the next sample period. This is<br />
called a [[WikiPedia:Zero-order hold|zero-order hold]], and it's an important part of how some<br />
digital-to-analog converters work, especially the simplest ones.&rdquo;<br />
<br />
&ldquo;So, anyone who looks up [[WikiPedia:Digital-to-analog_converter#Practical_operation|digital-to-analog converter or<br />
digital-to-analog conversion]] is probably going to see a diagram of a<br />
stairstep waveform somewhere, but that's not a finished conversion,<br />
and it's not the signal that comes out.&rdquo;<br />
<br />
&ldquo;Second, and this is probably the more likely reason, engineers who<br />
supposedly know better, like me, draw stairsteps even though they're<br />
technically wrong. It's a sort of like a one-dimensional version of<br />
[[WikiPedia:MacPaint#Development|fat bits in an image editor]].&rdquo;<br />
<br />
&ldquo;Pixels aren't squares either, they're samples of a 2-dimensional<br />
function space and so they're also, conceptually, infinitely small<br />
points. Practically, it's a real pain in the ass to see or manipulate<br />
infinitely small anything, so big squares it is. Digital stairstep<br />
drawings are exactly the same thing.&rdquo;<br />
<br />
&ldquo;It's just a convenient drawing. The stairsteps aren't really there.&rdquo;<br />
<br />
==Bit-depth==<br />
[[Image:Dsat_009.jpg|360px|right]]<br />
[[Image:Dsat_010.jpg|260px|right]]<br />
<br />
When we convert a digital signal back to analog, the result is<br />
''also'' smooth regardless of the [[WikiPedia:Audio_bit_depth|bit depth]]. 24 bits or 16 bits...<br />
or 8 bits... it doesn't matter.<br />
<br />
So does that mean that the digital bit depth makes no difference at<br />
all? Of course not.<br />
<br />
Channel 2 here is the same sine wave input, but we quantize with<br />
[[WikiPedia:Dither|dither]] down to 8 bits.<br />
<br />
On the scope, we still see a nice<br />
smooth sine wave on channel 2. Look very close, and you'll also see a<br />
bit more noise. That's a clue.<br />
<br />
If we look at the spectrum of the signal... aha! Our sine wave is<br />
still there unaffected, but the noise level of the 8-bit signal on<br />
the second channel is much higher!<br />
<br />
And that's the difference the number of bits makes. That's it!<br />
<br />
When we digitize a signal, first we sample it. The<br />
sampling step is perfect; it loses nothing. But then we [[WikiPedia:Quantization_(sound_processing)|quantize]] it,<br />
and [[WikiPedia:Quantization_error|quantization adds noise]].<br />
<br />
The number of bits determines how much noise and so the level of the<br />
noise floor.<br />
<br />
What does this dithered quantization noise sound like? Let's listen<br />
to our 8-bit sine wave.<br />
<br />
That may have been hard to hear anything but the tone. Let's listen<br />
to just the noise after we notch out the sine wave and then bring the<br />
gain up a bit because the noise is quiet.<br />
<br />
Those of you who have used analog recording equipment may have just<br />
thought to yourselves, "My goodness! That sounds like tape hiss!"<br />
Well, it doesn't just sound like tape hiss, it acts like it too, and<br />
if we use a [[WikiPedia:Dither#Different_types|gaussian dither]] then it's<br />
[[WikiPedia:Central_limit_theorem|mathematically equivalent]] in every way. It ''is'' tape hiss.<br />
<br />
Intuitively, that means that we can measure tape hiss and thus the noise floor<br />
of [[WikiPedia:Magnetic_tape_sound_recording|magnetic audio tape]]<br />
in [[WikiPedia:Shannon–Hartley_theorem#Examples|bits instead of decibels]], in order to put things in a<br />
digital perspective. [[WikiPedia:Compact cassettes|Compact cassettes]] (for those of you who are old enough to remember them) could reach as<br />
deep as 9 bits in perfect conditions, though 5 to 6 bits was<br />
more typical, especially if it was a recording made on a<br />
[[WikiPedia:Cassette_deck|tape deck]]. That's right... your mix tapes were only about 6 bits<br />
deep... if you were lucky!<br />
<br />
The very best professional [[WikiPedia:Reel-to-reel_audio_tape_recording|open reel tape]] used in studios could barely<br />
hit... any guesses? 13 bits ''with'' [[WikiPedia:Reel-to-reel_audio_tape_recording#Noise_reduction|advanced noise reduction]]. And<br />
that's why seeing '[[WikiPedia:SPARS_code|D D D]]' on a [[WikiPedia:Compact_disk|Compact Disc]] used to be such a big,<br />
high-end deal.<br />
<br />
==Dither==<br />
[[Image:Dsat_011.png|360px|right]]<br />
<br />
I keep saying that I'm quantizing with [[Wikipedia:dither|dither]], so what is dither<br />
exactly and, more importantly, what does it do?<br />
<br />
The simple way to quantize a signal is to choose the digital<br />
amplitude value closest to the original analog amplitude. [[WikiPedia:Rounding|Obvious]],<br />
right? Unfortunately, the exact noise you get from this simple<br />
quantization scheme depends somewhat on the input signal,<br />
<br />
so we may get noise that's inconsistent, or causes distortion, or is<br />
undesirable in some other way.<br />
<br style="clear:both;"/><br />
<center><div style="background-color:#DDDDFF;border-color:#CCCCDD;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
'''Going deeper…'''<br />
*Cameron Nicklaus Christou's thesis [http://uwspace.uwaterloo.ca/bitstream/10012/3867/1/thesis.pdf Optimal Dither and Noise Shaping in Image Processing] provides an ''excellent'' explanation of dither and noise shaping.<br />
</div></center><br />
<br />
Dither is specially-constructed noise that substitutes for the noise<br />
produced by simple quantization. Dither doesn't [[WikiPedia:Sound_masking|drown out or mask]]<br />
quantization noise, it actually replaces it with noise characteristics<br />
of our choosing that aren't influenced by the input.<br />
<br />
Let's ''watch'' what dither does. The signal generator has too much noise for this test so we'll produce a mathematically perfect sine wave with the ThinkPad and quantize it to 8 bits with dithering.<br />
<br />
We see a nice sine wave on the waveform display and output scope and, once the analog spectrum analyzer catches up...<br />
a clean frequency peak with a uniform noise floor on both spectral displays<br />
just like before. Again, this is with dither.<br />
<br />
Now I turn dithering off.<br />
<br />
The quantization noise, that dither had spread out into a nice, flat noise<br />
floor, piles up into harmonic distortion peaks. The noise floor is<br />
lower, but the level of distortion becomes nonzero, and the distortion<br />
peaks sit higher than the dithering noise did.<br />
<br />
At 8 bits this effect is exaggerated. At 16 bits,<br />
even without dither, harmonic distortion is going to be so low as to<br />
be completely inaudible.<br />
<br />
Still, we can use dither to eliminate it completely if we so choose.<br />
<br />
Turning the dither off again for a moment, you'll notice that the<br />
absolute level of distortion from undithered quantization stays<br />
approximately constant regardless of the input amplitude.<br />
But when the signal level drops below a half a bit, everything<br />
quantizes to zero.<br />
<br />
In a sense, everything quantizing to zero is just 100% distortion!<br />
Dither eliminates this distortion too. We reenable dither<br />
and ... there's our signal back at 1/4 bit, with our nice flat noise floor.<br />
<br />
The noise floor doesn't have to be flat. Dither is noise of our<br />
choosing, so let's choose a noise as [http://www.acoustics.salford.ac.uk/res/cox/sound_quality/?content=subjective inoffensive] and<br />
[[WikiPedia:Absolute_threshold_of_hearing|difficult to notice]]<br />
as possible.<br />
<br />
Our hearing is most sensitive in the midrange from 2kHz to 4kHz,<br />
so that's where background noise is going to be the most obvious.<br />
We can [[WikiPedia:Noise_shaping|shape dithering noise]] away from sensitive frequencies to where<br />
hearing is less sensitive, usually the highest frequencies.<br />
<br />
16-bit dithering noise is normally much too quiet to hear at all, but<br />
let's listen to our noise shaping example, again with the gain<br />
brought way up...<br />
<br />
Lastly, dithered quantization noise ''is'' higher [[WikiPedia:Sound_power|power]] overall<br />
than undithered quantization noise even when it sounds quieter, and<br />
you can see that on a [[WikiPedia:VU_meter|VU meter]] during passages of near-silence. But<br />
dither isn't only an on or off choice. We can reduce the dither's<br />
power to balance less noise against a bit of distortion to minimize<br />
the overall effect.<br />
<br />
We'll also [[WikiPedia:Amplitude_modulation|modulate the input signal]] like this to show how a varying input affects the quantization noise. At<br />
full dithering power, the noise is uniform, constant, and featureless<br />
just like we expect:<br />
<br />
As we reduce the dither's power, the input increasingly<br />
affects the amplitude and the character of the quantization noise.<br />
Shaped dither behaves similarly, but noise shaping lends one more nice<br />
advantage. To make a long story short, it can use a somewhat lower<br />
dither power before the input has as much effect on the output.<br />
<br />
Despite all the time I just spent on dither, we're talking about<br />
differences that start 100 decibels and more below [[WikiPedia:Full_scale|full scale]]. Maybe<br />
if the CD had been<br />
[http://www.research.philips.com/technologies/projects/cd/index.html 14 bits as originally designed],<br />
dither ''might'' be<br />
more important. Maybe. At 16 bits, really, it's mostly a wash. You<br />
can think of dither as an insurance policy that gives several extra<br />
decibels of dynamic range just in case. The simple fact is, though, no<br />
one ever ruined a great recording by not dithering the final master.<br />
<br />
==Bandlimitation and timing==<br />
[[image:Dsat_013.jpg|360px|right]]<br />
<br />
We've been using [[WikiPedia:Sine_wave|sine waves]]. They're the obvious choice when what we<br />
want to see is a system's behavior at a given isolated frequency. Now<br />
let's look at something a bit more complex. What should we expect to<br />
happen when I change the input to a [[WikiPedia:Square_wave|square wave]]...<br />
<br />
The input scope confirms our 1kHz square wave. The output scope shows..<br />
<br />
<br />
Exactly what it should.<br />
...<br />
What is a square wave really? <br />
<br />
<br />
Well, we can say it's a waveform that's some positive value for half a cycle and then transitions instantaneously to a negative value for the other half.<br />
<br />
:<math><br />
\ x(t) = \begin{cases} 1, & |t| < T_1 \\ 0, & T_1 < |t| \leq {1 \over 2}T \end{cases}<br />
</math><br />
<br />
But that doesn't really tell us anything useful about how that input becomes this output.<br />
<br />
Then we remember that any waveform is also [[WikiPedia:Fourier_series|the sum of discrete frequencies]],<br />
and a square wave is particularly simple sum: a fundamental and an<br />
infinite series of [[WikiPedia:Even_and_odd_functions#Harmonics|odd harmonics]]. Sum them all up, you get a<br />
square wave.<br />
<br />
[[Image:dsat_015.jpg|360px|right]]<br />
:<math>\begin{align}<br />
x_{\mathrm{square}}(t) = \frac{4}{\pi}\sin(\omega t) + \frac{4}{3\pi}\sin(3\omega t) + \frac{4}{5\pi}\sin(5\omega t) + \\<br />
\frac{4}{7\pi}\sin(7\omega t) + \frac{4}{9\pi}\sin(9\omega t) + \frac{4}{11\pi}\sin(11\omega t) + \\ <br />
\frac{4}{13\pi}\sin(13\omega t) + \frac{4}{15\pi}\sin(15\omega t) + \frac{4}{17\pi}\sin(17\omega t) + \\<br />
\frac{4}{19\pi}\sin(19\omega t) + \frac{4}{21\pi}\sin(21\omega t) + \frac{4}{23\pi}\sin(23\omega t) + \\<br />
\frac{4}{25\pi}\sin(25\omega t) + \frac{4}{27\pi}\sin(27\omega t) + \frac{4}{29\pi}\sin(29\omega t) + \\<br />
\frac{4}{31\pi}\sin(31\omega t) + \frac{4}{33\pi}\sin(33\omega t) + \cdots <br />
\end{align}</math><br />
<br />
At first glance, that doesn't seem very useful either. You have to sum up an infinite number of harmonics to get the answer. ''Ah'', but we don't have an infinite number of harmonics.<br />
<br />
We're using a quite sharp [[WikiPedia:Low-pass_filter|anti-aliasing filter]] that cuts off right<br />
above 20kHz, so our signal is [[WikiPedia:Bandlimiting|bandlimited]], so only the first ten terms make it through.<br />
<br />
..and that's exactly what we see on the output scope.<br />
<br />
<br style="clear:both;"/><br />
<center><div style="background-color:#DDDDFF;border-color:#CCCCDD;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
'''Going deeper…'''<br />
*In modern web browsers you can program audio synthesizers directly in javascript. Use the two square wave formulas to get a square wave out of [http://js.do/blog/sound-waves-with-javascript/ this page]. (Note: The scope is not very useful.) <br />
</div></center><br />
<br />
The rippling you see around sharp edges in a bandlimited signal is called the [[WikiPedia:/Gibbs_phenomenon|Gibbs effect]]. It happens whenever you slice off part of the frequency domain in the middle of nonzero energy.<br />
<br />
The usual rule of thumb you'll hear is "the sharper the cutoff, the<br />
stronger the rippling", which is approximately true, but we have to be<br />
careful how we think about it.<br />
For example... what would you expect our quite sharp anti-aliasing filter<br />
to do if I run our signal through it a second time?<br />
<br />
Aside from adding a few fractional cycles of delay, the answer is...<br />
nothing at all. The signal is already bandlimited. Bandlimiting it<br />
again doesn't do anything. A second pass can't remove frequencies<br />
that we already removed.<br />
<br />
And that's important. People tend to think of the ripples as<br />
a kind of [[WikiPedia:Sonic_artifact|artifact]] that's added by anti-aliasing and [[WikiPedia:Reconstruction_filter|anti-imaging]]<br />
filters, implying that the ripples get worse each time the signal<br />
passes through. We can see that in this case that didn't happen. So<br />
was it really the filter that added the ripples the first time<br />
through? No, not really. It's a subtle distinction, but Gibbs effect<br />
ripples aren't added by filters, they're just part of what a<br />
bandlimited signal ''is''.<br />
<br />
Even if we synthetically construct what looks like a perfect digital<br />
square wave,<br />
<br />
it's still limited to the channel bandwidth. Remember,<br />
the stairstep representation is misleading.<br />
<br />
What we really have here are instantaneous sample points,<br />
<br />
and only one bandlimited signal fits those points. All we did when we<br />
drew our apparently perfect square wave was line up the sample points<br />
just right so it appeared that there were no ripples if we played<br />
[[WikiPedia:Interpolation|connect-the-dots]].<br />
<br />
But the original bandlimited signal, complete with ripples, was<br />
still there.<br />
<br />
[[image:Dsat_014.gif|360px|right]]<br />
And that leads us to one more important point. You've probably heard<br />
that the timing precision of a digital signal is limited by its sample<br />
rate; put another way,<br />
<br />
that digital signals can't represent anything that falls between the<br />
samples.. implying that [[WikiPedia:Dirac_delta_function|impulses]] or<br />
[[WikiPedia:Synthesizer#ADSR_envelope|fast attacks]] have to align exactly<br />
with a sample, or the timing gets mangled... or they just disappear.<br />
<br />
At this point, we can easily see why that's wrong.<br />
<br />
Again, our input signals are bandlimited. And digital signals are<br />
samples, not stairsteps, not 'connect-the-dots'. We most certainly<br />
can, for example, put the rising edge of our bandlimited square wave<br />
anywhere we want between samples.<br />
<br />
It's represented perfectly and it's reconstructed perfectly.<br />
<br />
==Epilogue==<br />
<br />
[[Image:Moffey.jpg|360px|right]]<br />
<br />
Just like in [[Videos/A_Digital_Media_Primer_For_Geeks|the previous episode]], we've covered a broad range of<br />
topics, and yet barely scratched the surface of each one. If anything, my<br />
sins of omission are greater this time around... but this is a good<br />
stopping point.<br />
<br />
Or maybe, a good starting point. Dig deeper. Experiment. I chose my<br />
demos very carefully to be simple and give clear results. You can<br />
reproduce every one of them on your own if you like. But let's face<br />
it, sometimes we learn the most about a spiffy toy by breaking it open<br />
and studying all the pieces that fall out. And that's OK, we're<br />
engineers. Play with the demo parameters, hack up the code, set up<br />
alternate experiments. The source code for everything, including the<br />
little pushbutton demo application, is up at xiph.org.<br />
<br />
In the course of experimentation, you're likely to run into something<br />
that you didn't expect and can't explain. Don't worry! My earlier<br />
snark aside, Wikipedia is fantastic for exactly this kind of casual<br />
research. And, if you're really serious about understanding signals,<br />
several universities have advanced materials online, such as the<br />
[http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-003-signals-and-systems-spring-2010/index.htm 6.003]<br />
and<br />
[http://ocw.mit.edu/resources/res-6-007-signals-and-systems-spring-2011/ RES.6-007]<br />
Signals and Systems modules at MIT OpenCourseWare. And of<br />
course, there's always the [http://webchat.freenode.net/?channels=xiph community here at Xiph.Org].<br />
<br />
Digging deeper or not, I am out of coffee, so, until next time, happy<br />
hacking!<br />
<br />
==Credits==<br />
[[Image:Dmpfg_019.png|360px|right]]<br />
Written by: Christopher (Monty) Montgomery and the Xiph.Org Community<br />
<br />
Special thanks to:<br />
*Heidi Baumgartner, for the second Tektronix oscilloscope<br />
*Gregory Maxwell and Dr. Timothy Terriberry, for additional technical review<br />
<br />
Intro, title and credits music:<br><br />
"[http://music.lousyrobot.com/track/andy-warhol-is-gone Andy Warhol Is Gone]", by Lousy Robot<br><br />
Used by permission of Lousy Robot.<br><br />
Original source track All Rights Reserved.<br><br />
[http://www.lousyrobot.com www.lousyrobot.com]<br />
<br />
This Video Was Produced Entirely With Free and Open Source Software:<br><br />
<br />
*[http://www.gnu.org/ GNU]<br><br />
*[http://www.linux.org/ Linux]<br><br />
*[http://fedoraproject.org/ Fedora]<br><br />
*[http://cinelerra.org/ Cinelerra]<br><br />
*[http://www.gimp.org/ The Gimp]<br><br />
*[http://audacity.sourceforge.net/ Audacity]<br><br />
*[http://svn.xiph.org/trunk/postfish/README Postfish]<br><br />
*[http://gstreamer.freedesktop.org/ Gstreamer]<br><br />
<br />
All trademarks are the property of their respective owners. <br />
<br />
*''Complete video'' [http://creativecommons.org/licenses/by-sa/3.0/legalcode CC-BY-SA]<br><br />
*''Text transcript and Wiki edition'' [http://creativecommons.org/licenses/by-sa/3.0/legalcode CC-BY-SA]<br><br />
<br />
A Co-Production of Xiph.Org and Red Hat, Inc.<br><br />
(C) 2012-2013, Some Rights Reserved<br><br />
<br />
== Use The Source Luke ==<br />
<br />
As stated in the Epilogue, everything that appears in the video demos is driven by open source software, which means the source is both available for inspection and freely usable by the community. The Thinkpad that appears in the video was running Fedora 17 and Gnome Shell (Gnome 3). The demonstration software does not require Fedora specifically, but it does require Gnu/Linux to run in its current form. In all, the video involved just under 50,000 lines of new and custom-purpose code (including contributions to non-Xiph projects such as Cinelerra and Gromit).<br />
<br />
=== The Spectrum and Waveform Viewer ===<br />
<br />
The realtime software spectrum analyzer application that appears in the video was a preexisting application that was dusted off and updated for use in the video. The waveform viewer (effectively a simple software oscilloscope) was written from scratch making use of some of the internals from the spectrum analyzer application. Both are available from Xiph.Org svn:<br />
<br />
<center><div style="background-color:#DDDDDD;border-color:#CCCCCC;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
*Source for the Spectrum and Waveform applications is found at:<br />
https://svn.xiph.org/trunk/spectrum/<br />
*The source can be checked out of svn using the following command line:<br />
svn co https://svn.xiph.org/trunk/spectrum<br />
*Trac is a convenient way to browse the source without checking out a copy:<br />
https://trac.xiph.org/browser/trunk/spectrum<br />
</div></center><br />
<br />
Spectrum and Waveform both expect an input stream on the command line, either as raw data or as a WAV file.<br />
<br />
=== GTK-Bounce ===<br />
<br />
The touch-controlled application used in the video is named 'gtk-bounce' and was custom-written for the sole purpose of the in-video demonstrations. It is so named because, for the most part, all it does is read the input from an audio device, and then immediately write the same data back out for playback. It also forwards a copy of this data to up to two external monitoring applications, and in several demos, applies simple filters or generates simple waveforms. It includes several demos not included in the video.<br />
<br />
<center><div style="background-color:#DDDDDD;border-color:#CCCCCC;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
*Source for gtk-bounce is found at:<br />
https://svn.xiph.org/trunk/Xiph-episode-II/bounce/<br />
*The source can be checked out of svn using the following command line:<br />
svn co https://svn.xiph.org/trunk/Xiph-episode-II/bounce/<br />
*Trac is a convenient way to browse the source without checking out a copy:<br />
https://trac.xiph.org/browser/Xiph-episode-II/bounce/<br />
</div></center><br />
<br />
==== Starting Gtk-bounce ====<br />
The application is somewhat hardwired for specific demo parameters, but most of the hardwired settings can be found at the top of each source file. As found in SVN, the application expects an ALSA hardware audio device at hw:1, and if none if found, it will wait for one to appear. Once a sound device is successfully initialized, it expects to find and open two pipes named pipe0 and pipe1 for output in the current directory. In the video, the waveform and spectrum applications are started to take input from pipe0 and pipe1 respectively. The output sent to the two pipes is identical, and in most demos matches the output data sent to the hardware device for conversion to analog. The only exception is the tenth demo panel (which does not appear in the video) where gtk-bounce can be set to monitor the hardware inputs instead while the outputs are used to produce test waveforms.<br />
<br />
Assuming gtk-bounce, spectrum and waveform have been checked out and built, the configuration seen in the video can be started using the following commands:<br />
<center><div style="background-color:#DDDDFF;border-color:#CCCCDD;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
* make the pipe fifos for the applications to communicate (only needs to be done once)<br />
mkfifo pipe0 pipe1<br />
* start all three applications<br />
waveform pipe0 & spectrum pipe1 & gtk-bounce &<br />
</div></center><br />
<br />
==== Using Gtk-bounce ====<br />
<br />
Gtk-bounce consists of eleven pushbutton panels (numbered zero through ten) that can be selected by scrolling up and dwon with the arrow buttons on the right side. Each panel is intended for a specific demo or part of a demo.<br />
<br />
<center><div style="background-color:#DDDDFF;border-color:#CCCCDD;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
<br />
[[Image:Dsat-panel0.png|700px|center]]<br />
* '''Panel 0''': This panel presents buttons that allow the sound card to be configured in several sampling rates and bit depths. Samples read from the audio inputs are sent to the output pipes and audio outputs for playback without modification.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel1.png|700px|center]]<br />
* '''Panel 1''': Both channels are forwarded to the outputs, however the user may select the bit depth of each channel independently. When the sound card is running in 16 bit mode and 16-bit depth is selected, the data is untouched. Requantization to a lower bit depth is performed with a flat triangle dither.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel2.png|700px|center]]<br />
* '''Panel 2''': Both channels are re-quantized to the selected bit depth. Requantization to a lower bit depth is performed with a flat triangle dither.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel3.png|700px|center]]<br />
* '''Panel 3''': 'generate sine wave' discards the audio inputs and instead internally generates a sine wave at 32 bit precision, which is then quantized to the selected bit depth, optionally with dither. The resulting signal is then forwarded to the output. <br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel4.png|700px|center]]<br />
* '''Panel 4''': gtk-bounce generates a 16-bit sine wave of the selected amplitude, optionally with dither, and forwards the resulting signal to the outputs. The audio input from the audio device is discarded. Note that the slider sets the peak amplitude, not the peak-to-peak amplitude.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel5.png|700px|center]]<br />
* '''Panel 5''': generates a 16-bit sine wave, optionally quantized using dither. The user may additionally select a flat or a shaped dither. The 'notch and gain' button applies a notch filter to the resulting signal, and boosts the gain of the remaining noise so that it's easily audible. The audio input from the audio device is discarded.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel6.png|700px|center]]<br />
* '''Panel 6''': allows the user to play with the power of the dithering noise applied before quantizating the sine wave. Shaped or flat dither are available. The sine wave may also be modulated with a varying amplitude to highlight correlations between the input and the resulting quantization noise. The 'notch and gain' button applies a notch filter to the resulting signal, and boosts the gain of the remaining noise so that it's easily audible. The audio input from the audio device is discarded.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel7.png|700px|center]]<br />
* '''Panel 7''': applies a sharper antialiasing (lowpass) filter than is likely to be built into the sound-card hardware (as there's generally no reason to use a filter quite this sharp in practice). The very sharp filter allows us to bandpass the demonstration squarewave without any harmonics landing in the transition band. <br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel8.png|700px|center]]<br />
* '''Panel 8''': when selected, generate a synthetic 'squarewave' (this is not quite equivalent to a bandlimited analog squarewave; the harmonic amplitudes are a bit different) that when aligned with the sampling phase just right gives the appearance of having infinite rise and fall time. The slider allows us to shift the waveform sample alignment back and forth by +/- one sample to reveal that the underlying signal is still band-limited.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel9.png|700px|center]]<br />
* '''Panel 9''': <br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel10.png|700px|center]]<br />
* '''Panel 10''': <br />
<div style="clear: both">&nbsp;</div><br />
<br />
</div></center><br />
<br />
=== Cairo Animations ===<br />
<br />
The animations featured throughout the Episode 2 video were rapid-development spaghetti hack-jobs coded by hand in raw Cairo. Each module generated a series of PNG stills that were then stitched into an animation with Cinelerra or mplayer. In the interest of pointing and laughing at what really bad code looks like...<br />
<br />
<center><div style="background-color:#DDDDDD;border-color:#CCCCCC;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
*Source for the Cairo animations is found at:<br />
https://svn.xiph.org/trunk/Xiph-episode-II/cairo/<br />
*The source can be checked out of svn using the following command line:<br />
svn co https://svn.xiph.org/trunk/Xiph-episode-II/cairo/<br />
*Trac is a convenient way to browse the source without checking out a copy:<br />
https://trac.xiph.org/browser/Xiph-episode-II/cairo/<br />
</div></center></div>Gmaxwellhttps://wiki.xiph.org/index.php?title=Videos/Digital_Show_and_Tell&diff=14009Videos/Digital Show and Tell2013-02-26T10:08:57Z<p>Gmaxwell: /* GTK-Bounce */ source boxes gray</p>
<hr />
<div><small>''Wiki edition''</small><br />
[[Image:dsat_001.jpg|400px|right]]<br />
<br />
Continuing in the "firehose" tradition of [[Videos/A_Digital_Media_Primer_For_Geeks|Episode 01]], Xiph.Org's second video on digital media explores multiple facets of digital audio signals and how they ''really'' behave in the real world.<br />
<br />
Demonstrations of sampling, quantization, bit-depth, and dither explore digital audio behavior on real audio equipment using both modern digital analysis and vintage analog bench equipment, just in case we can't trust those newfangled digital gizmos. You can download the source code for each demo and try it all for yourself!<br />
<br/><br/><br/><br />
<center><font size="+2">[http://www.xiph.org/video/vid2.shtml Download or Watch online]</font></center><br />
<br style="clear:both;"/><br />
Supported players: [http://www.videolan.org/vlc/ VLC 1.1+], [https://www.mozilla.com/en-US/firefox/ Firefox ], [http://www.chromium.org/Home Chrome ], [http://www.opera.com/ Opera]. Or see [http://www.webmproject.org/users/ other WebM] or [[TheoraSoftwarePlayers|other Theora]] players.<br />
<br />
If you're having trouble with playback in a modern browser or player, please visit our [[Playback_Troubleshooting|playback troubleshooting and discussion]] page.<br />
<br/><br />
<hr/><br />
<br/><br/><br/><br />
[[Image:Xiph_ep02_test.png|400px|right]]<br />
<br />
Hi, I'm Monty Montgomery from [http://www.redhat.com/ Red Hat] and [http://xiph.org/ Xiph.Org].<br />
<br />
A few months ago, I wrote<br />
[http://people.xiph.org/~xiphmont/demo/neil-young.html an article on digital audio and why 24bit/192kHz music downloads don't make sense].<br />
In the article, I<br />
mentioned--almost in passing--that a digital waveform is<br />
[http://people.xiph.org/~xiphmont/demo/neil-young.html#toc_sfam not a stairstep],<br />
and you certainly don't get a stairstep when you<br />
[[WikiPedia:Digital-to-analog_converter|convert from digital back to analog]].<br />
<br />
Of everything in the entire article, '''that''' was the number one thing<br />
people wrote about. In fact, more than half the mail I got was questions and<br />
comments about basic digital signal behavior. Since there's interest, let's<br />
take a little time to play with some ''simple'' digital signals.<br />
<br />
==Veritas ex machina==<br />
[[Image:Dsat_002.jpg|200px|right]]<br />
[[Image:Dsat_003.jpg|200px|right]]<br />
[[Image:Dsat_004.jpg|200px|right]]<br />
[[Image:Dsat_005.jpg|200px|right]]<br />
<br />
Pretend for a moment that we have no idea how digital signals really<br />
behave. In that case it doesn't make sense for us to use digital test<br />
equipment either. Fortunately for this exercise, there's still plenty<br />
of working analog lab equipment out there.<br />
<br />
First up, we need a [[WikiPedia:Function_generator|signal generator]] to provide us with analog input<br />
signals--in this case, an<br />
[http://www.home.agilent.com/en/pd-3325A%3Aepsg%3Apro-pn-3325A/synthesizer-function-generator?pm=PL&nid=-536900197.536896863&cc=SE&lc=swe HP3325]<br />
from 1978. It's still a pretty good<br />
generator, so if you don't mind the size, the weight, the power<br />
consumption, and the noisy fan, you can find them on eBay... occasionally<br />
for only slightly more than you'll pay for shipping.<br />
<br />
Next, we'll observe our analog waveforms on [[WikiPedia:Oscilloscope_types#Cathode-ray_oscilloscope_.28CRO.29|analog oscilloscopes]],<br />
like this Tektronix 2246 from the mid-90s, one of the last and very best analog scopes ever made. Every home lab should have one.<br />
<br />
...and finally inspect the [[WikiPedia:Spectral_density#Electrical_engineering|frequency spectrum]] of our signals using an<br />
[[WikiPedia:Spectrum_analyzer#Swept-tuned|analog spectrum analyzer]], this<br />
[http://www.home.agilent.com/en/pd-3585A%3Aepsg%3Apro-pn-3585A/spectrum-analyzer-high-perf-20hz-40mhz?pm=PL&nid=-536900197.536897319&cc=SE&lc=swe HP3585]<br />
from the same product line as<br />
the signal generator. Like the other equipment here it has<br />
[http://www.hp9845.net/9845/hardware/processors/ a rudimentary and hilariously large microcontroller],<br />
but the signal path<br />
from input to what you see on the screen is completely analog.<br />
<br />
All of this equipment is vintage, but aside from its raw tonnage, the specs are still quite good.<br />
<br />
At the moment, we have our signal generator set to output a nice 1 [[WikiPedia:Hertz#SI_multiples|kHz]]<br />
sine wave at one [[WikiPedia:Volt|Volt]] [[WikiPedia:Amplitude#Root_mean_square_amplitude|RMS]].<br />
We see the sine wave on the oscilloscope, can verify that it is indeed<br />
1 kHz at 1 Volt RMS, which is 2.8 Volts<br />
[[WikiPedia:Amplitude#Peak-to-peak_amplitude|peak-to-peak]],<br />
and that matches the<br />
measurement on the spectrum analyzer as well.<br />
<br />
The analyzer also shows some low-level [[WikiPedia:White_noise|white noise]]<br />
and just a bit of [[WikiPedia:Harmonic_distortion#Harmonic_distortion|harmonic distortion]],<br />
with the highest peak about 70[[WikiPedia:Decibel|dB]] or so below<br />
[[WikiPedia:Fundamental_frequency|the fundamental]].<br />
Now, this doesn't matter at all in our demos, but I<br />
wanted to point it out now just in case you didn't notice it until<br />
later.<br />
<br />
Now, we drop digital sampling in the middle.<br />
<br />
For the conversion, we'll use a boring, consumer-grade, eMagic USB1<br />
audio device. It's also more than ten years old at this point, and it's<br />
getting obsolete.<br />
<br />
A recent converter can easily have an order of magnitude better specs.<br />
[[WikiPedia:Reconstruction_filter#Sampled_data_reconstruction_filters|Flatness]],<br />
[[WikiPedia:Analog-to-digital_converter#Non-linearity|linearity]],<br />
[[WikiPedia:Jitter#Sampling_jitter|jitter]],<br />
[[WikiPedia:Noise_floor|noise behavior]],<br />
[[WikiPedia:Digital-to-analog_converter#DAC_performance|everything]]...<br />
you may not<br />
have noticed. Just because we can measure an improvement doesn't<br />
mean we can hear it, and even these old consumer boxes were already at<br />
the edge of ideal transparency.<br />
<br />
The eMagic connects to my ThinkPad, which displays a digital<br />
waveform and spectrum for comparison, then the ThinkPad<br />
sends the digital signal right back out to the eMagic for<br />
re-conversion to analog and observation on the output scopes.<br />
<br />
Input to output, left to right.<br />
<br style="clear:both;"/><br />
<br />
==Stairsteps==<br />
[[Image:Dsat 006.jpg|360px|right]]<br />
[[Image:Dsat 007.png|360px|right]]<br />
&ldquo;OK, it's go time. We begin by converting an analog signal to digital and<br />
then right back to analog again with no other steps.&rdquo;<br />
<br />
&ldquo;The signal generator is set to produce a 1kHz sine wave just like<br />
before.&rdquo;<br />
<br />
&ldquo;We can see our analog sine wave on our input-side oscilloscope.&rdquo;<br />
<br />
&ldquo;We digitize our signal to<br />
[[Videos/A_Digital_Media_Primer_For_Geeks#Raw_.28digital_audio.29_meat|16 bit PCM at 44.1kHz]],<br />
same as on a CD.&rdquo;<br />
<br />
&ldquo;The spectrum of the digitized signal matches what we saw earlier and what we see now on the analog spectrum analyzer, aside from its <br />
[[WikiPedia:High_impedance|high-impedance input]] being just a smidge noisier.&rdquo;<br />
<br />
&ldquo;For now, the waveform display shows our digitized sine wave as a<br />
stairstep pattern, one step for each sample.&rdquo;<br />
<br />
&ldquo;And when we look at the output signal that's been converted<br />
from digital back to analog, we see...&rdquo;<br />
<br />
&ldquo;It's exactly like the original sine wave. No stairsteps.&rdquo;<br />
<br />
&ldquo;OK, 1 kHz is still a fairly low frequency, maybe the stairsteps are just<br />
hard to see or they're being smoothed away. Fair enough. Let's choose<br />
a higher frequency, something close to [[WikiPedia:Nyquist_frequency|Nyquist]], say 15kHz.&rdquo;<br />
<br />
&ldquo;Now the sine wave is represented by less than three samples per cycle, and... the digital waveform looks pretty awful. Well, looks<br />
can be deceiving. The analog output... is still a perfect sine wave, exactly like the original.&rdquo;<br />
<br />
&ldquo;Let's keep going up.&rdquo;<br />
<br />
&ldquo;16kHz.... 17kHz... 18kHz... 19kHz...&rdquo;<br />
<br />
&ldquo;20kHz. Welcome to the upper limits of human hearing. The output waveform is still perfect. No jagged edges, no dropoff, no stairsteps.&rdquo;<br />
<br />
&ldquo;So where'd the stairsteps go? Don't answer, it's a trick question. They were never there.&rdquo;<br />
<br />
&ldquo;Drawing a digital waveform as a stairstep was wrong to begin with.&rdquo;<br />
<br />
&ldquo;Why? A stairstep is a continuous-time function. It's jagged, and it's piecewise, but it has a defined value at every point in time.&rdquo;<br />
<br />
&ldquo;A sampled signal is entirely different. It's discrete-time; it's only got a value right at each instantaneous sample point and it's<br />
undefined, there is no value at all, everywhere between. A discrete-time signal is properly drawn as a lollipop graph.&rdquo;<br />
<br />
&ldquo;The continuous, analog counterpart of a digital signal passes smoothly through each sample point, and that's just as true for high<br />
frequencies as it is for low.&rdquo;<br />
<br />
&ldquo;Now, the interesting and not at all obvious bit is: [[WikiPedia:Nyquist%E2%80%93Shannon_sampling_theorem|there's only one<br />
bandlimited signal that passes exactly through each sample point]]. It's a unique solution. So if you sample a bandlimited signal and then convert it back, the original input is also the only possible output.&rdquo;<br />
<br />
[[Image:Dsat 008.png|360px|right]]<br />
<br />
&ldquo;And before you say, "oh, I can draw a different signal that passes through those points", well, yes you can, but if it differs even<br />
minutely from the original, it includes frequency content at or beyond Nyquist, breaks the bandlimiting requirement and isn't a valid solution.&rdquo;<br />
<br />
&ldquo;So how did everyone get confused and start thinking of digital signals as stairsteps? I can think of two good reasons.&rdquo;<br />
<br />
&ldquo;First: it's easy enough to convert a sampled signal to a true stairstep. Just<br />
extend each sample value forward until the next sample period. This is<br />
called a [[WikiPedia:Zero-order hold|zero-order hold]], and it's an important part of how some<br />
digital-to-analog converters work, especially the simplest ones.&rdquo;<br />
<br />
&ldquo;So, anyone who looks up [[WikiPedia:Digital-to-analog_converter#Practical_operation|digital-to-analog converter or<br />
digital-to-analog conversion]] is probably going to see a diagram of a<br />
stairstep waveform somewhere, but that's not a finished conversion,<br />
and it's not the signal that comes out.&rdquo;<br />
<br />
&ldquo;Second, and this is probably the more likely reason, engineers who<br />
supposedly know better, like me, draw stairsteps even though they're<br />
technically wrong. It's a sort of like a one-dimensional version of<br />
[[WikiPedia:MacPaint#Development|fat bits in an image editor]].&rdquo;<br />
<br />
&ldquo;Pixels aren't squares either, they're samples of a 2-dimensional<br />
function space and so they're also, conceptually, infinitely small<br />
points. Practically, it's a real pain in the ass to see or manipulate<br />
infinitely small anything, so big squares it is. Digital stairstep<br />
drawings are exactly the same thing.&rdquo;<br />
<br />
&ldquo;It's just a convenient drawing. The stairsteps aren't really there.&rdquo;<br />
<br />
==Bit-depth==<br />
[[Image:Dsat_009.jpg|360px|right]]<br />
[[Image:Dsat_010.jpg|260px|right]]<br />
<br />
When we convert a digital signal back to analog, the result is<br />
''also'' smooth regardless of the [[WikiPedia:Audio_bit_depth|bit depth]]. 24 bits or 16 bits...<br />
or 8 bits... it doesn't matter.<br />
<br />
So does that mean that the digital bit depth makes no difference at<br />
all? Of course not.<br />
<br />
Channel 2 here is the same sine wave input, but we quantize with<br />
[[WikiPedia:Dither|dither]] down to 8 bits.<br />
<br />
On the scope, we still see a nice<br />
smooth sine wave on channel 2. Look very close, and you'll also see a<br />
bit more noise. That's a clue.<br />
<br />
If we look at the spectrum of the signal... aha! Our sine wave is<br />
still there unaffected, but the noise level of the 8-bit signal on<br />
the second channel is much higher!<br />
<br />
And that's the difference the number of bits makes. That's it!<br />
<br />
When we digitize a signal, first we sample it. The<br />
sampling step is perfect; it loses nothing. But then we [[WikiPedia:Quantization_(sound_processing)|quantize]] it,<br />
and [[WikiPedia:Quantization_error|quantization adds noise]].<br />
<br />
The number of bits determines how much noise and so the level of the<br />
noise floor.<br />
<br />
What does this dithered quantization noise sound like? Let's listen<br />
to our 8-bit sine wave.<br />
<br />
That may have been hard to hear anything but the tone. Let's listen<br />
to just the noise after we notch out the sine wave and then bring the<br />
gain up a bit because the noise is quiet.<br />
<br />
Those of you who have used analog recording equipment may have just<br />
thought to yourselves, "My goodness! That sounds like tape hiss!"<br />
Well, it doesn't just sound like tape hiss, it acts like it too, and<br />
if we use a [[WikiPedia:Dither#Different_types|gaussian dither]] then it's<br />
[[WikiPedia:Central_limit_theorem|mathematically equivalent]] in every way. It ''is'' tape hiss.<br />
<br />
Intuitively, that means that we can measure tape hiss and thus the noise floor<br />
of [[WikiPedia:Magnetic_tape_sound_recording|magnetic audio tape]]<br />
in [[WikiPedia:Shannon–Hartley_theorem#Examples|bits instead of decibels]], in order to put things in a<br />
digital perspective. [[WikiPedia:Compact cassettes|Compact cassettes]] (for those of you who are old enough to remember them) could reach as<br />
deep as 9 bits in perfect conditions, though 5 to 6 bits was<br />
more typical, especially if it was a recording made on a<br />
[[WikiPedia:Cassette_deck|tape deck]]. That's right... your mix tapes were only about 6 bits<br />
deep... if you were lucky!<br />
<br />
The very best professional [[WikiPedia:Reel-to-reel_audio_tape_recording|open reel tape]] used in studios could barely<br />
hit... any guesses? 13 bits ''with'' [[WikiPedia:Reel-to-reel_audio_tape_recording#Noise_reduction|advanced noise reduction]]. And<br />
that's why seeing '[[WikiPedia:SPARS_code|D D D]]' on a [[WikiPedia:Compact_disk|Compact Disc]] used to be such a big,<br />
high-end deal.<br />
<br />
==Dither==<br />
[[Image:Dsat_011.png|360px|right]]<br />
<br />
I keep saying that I'm quantizing with [[Wikipedia:dither|dither]], so what is dither<br />
exactly and, more importantly, what does it do?<br />
<br />
The simple way to quantize a signal is to choose the digital<br />
amplitude value closest to the original analog amplitude. [[WikiPedia:Rounding|Obvious]],<br />
right? Unfortunately, the exact noise you get from this simple<br />
quantization scheme depends somewhat on the input signal,<br />
<br />
so we may get noise that's inconsistent, or causes distortion, or is<br />
undesirable in some other way.<br />
<br style="clear:both;"/><br />
<center><div style="background-color:#DDDDFF;border-color:#CCCCDD;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
'''Going deeper…'''<br />
*Cameron Nicklaus Christou's thesis [http://uwspace.uwaterloo.ca/bitstream/10012/3867/1/thesis.pdf Optimal Dither and Noise Shaping in Image Processing] provides an ''excellent'' explanation of dither and noise shaping.<br />
</div></center><br />
<br />
Dither is specially-constructed noise that substitutes for the noise<br />
produced by simple quantization. Dither doesn't [[WikiPedia:Sound_masking|drown out or mask]]<br />
quantization noise, it actually replaces it with noise characteristics<br />
of our choosing that aren't influenced by the input.<br />
<br />
Let's ''watch'' what dither does. The signal generator has too much noise for this test so we'll produce a mathematically perfect sine wave with the ThinkPad and quantize it to 8 bits with dithering.<br />
<br />
We see a nice sine wave on the waveform display and output scope and, once the analog spectrum analyzer catches up...<br />
a clean frequency peak with a uniform noise floor on both spectral displays<br />
just like before. Again, this is with dither.<br />
<br />
Now I turn dithering off.<br />
<br />
The quantization noise, that dither had spread out into a nice, flat noise<br />
floor, piles up into harmonic distortion peaks. The noise floor is<br />
lower, but the level of distortion becomes nonzero, and the distortion<br />
peaks sit higher than the dithering noise did.<br />
<br />
At 8 bits this effect is exaggerated. At 16 bits,<br />
even without dither, harmonic distortion is going to be so low as to<br />
be completely inaudible.<br />
<br />
Still, we can use dither to eliminate it completely if we so choose.<br />
<br />
Turning the dither off again for a moment, you'll notice that the<br />
absolute level of distortion from undithered quantization stays<br />
approximately constant regardless of the input amplitude.<br />
But when the signal level drops below a half a bit, everything<br />
quantizes to zero.<br />
<br />
In a sense, everything quantizing to zero is just 100% distortion!<br />
Dither eliminates this distortion too. We reenable dither<br />
and ... there's our signal back at 1/4 bit, with our nice flat noise floor.<br />
<br />
The noise floor doesn't have to be flat. Dither is noise of our<br />
choosing, so let's choose a noise as [http://www.acoustics.salford.ac.uk/res/cox/sound_quality/?content=subjective inoffensive] and<br />
[[WikiPedia:Absolute_threshold_of_hearing|difficult to notice]]<br />
as possible.<br />
<br />
Our hearing is most sensitive in the midrange from 2kHz to 4kHz,<br />
so that's where background noise is going to be the most obvious.<br />
We can [[WikiPedia:Noise_shaping|shape dithering noise]] away from sensitive frequencies to where<br />
hearing is less sensitive, usually the highest frequencies.<br />
<br />
16-bit dithering noise is normally much too quiet to hear at all, but<br />
let's listen to our noise shaping example, again with the gain<br />
brought way up...<br />
<br />
Lastly, dithered quantization noise ''is'' higher [[WikiPedia:Sound_power|power]] overall<br />
than undithered quantization noise even when it sounds quieter, and<br />
you can see that on a [[WikiPedia:VU_meter|VU meter]] during passages of near-silence. But<br />
dither isn't only an on or off choice. We can reduce the dither's<br />
power to balance less noise against a bit of distortion to minimize<br />
the overall effect.<br />
<br />
We'll also [[WikiPedia:Amplitude_modulation|modulate the input signal]] like this to show how a varying input affects the quantization noise. At<br />
full dithering power, the noise is uniform, constant, and featureless<br />
just like we expect:<br />
<br />
As we reduce the dither's power, the input increasingly<br />
affects the amplitude and the character of the quantization noise.<br />
Shaped dither behaves similarly, but noise shaping lends one more nice<br />
advantage. To make a long story short, it can use a somewhat lower<br />
dither power before the input has as much effect on the output.<br />
<br />
Despite all the time I just spent on dither, we're talking about<br />
differences that start 100 decibels and more below [[WikiPedia:Full_scale|full scale]]. Maybe<br />
if the CD had been<br />
[http://www.research.philips.com/technologies/projects/cd/index.html 14 bits as originally designed],<br />
dither ''might'' be<br />
more important. Maybe. At 16 bits, really, it's mostly a wash. You<br />
can think of dither as an insurance policy that gives several extra<br />
decibels of dynamic range just in case. The simple fact is, though, no<br />
one ever ruined a great recording by not dithering the final master.<br />
<br />
==Bandlimitation and timing==<br />
[[image:Dsat_013.jpg|360px|right]]<br />
<br />
We've been using [[WikiPedia:Sine_wave|sine waves]]. They're the obvious choice when what we<br />
want to see is a system's behavior at a given isolated frequency. Now<br />
let's look at something a bit more complex. What should we expect to<br />
happen when I change the input to a [[WikiPedia:Square_wave|square wave]]...<br />
<br />
The input scope confirms our 1kHz square wave. The output scope shows..<br />
<br />
<br />
Exactly what it should.<br />
...<br />
What is a square wave really? <br />
<br />
<br />
Well, we can say it's a waveform that's some positive value for half a cycle and then transitions instantaneously to a negative value for the other half.<br />
<br />
:<math><br />
\ x(t) = \begin{cases} 1, & |t| < T_1 \\ 0, & T_1 < |t| \leq {1 \over 2}T \end{cases}<br />
</math><br />
<br />
But that doesn't really tell us anything useful about how that input becomes this output.<br />
<br />
Then we remember that any waveform is also [[WikiPedia:Fourier_series|the sum of discrete frequencies]],<br />
and a square wave is particularly simple sum: a fundamental and an<br />
infinite series of [[WikiPedia:Even_and_odd_functions#Harmonics|odd harmonics]]. Sum them all up, you get a<br />
square wave.<br />
<br />
[[Image:dsat_015.jpg|360px|right]]<br />
:<math>\begin{align}<br />
x_{\mathrm{square}}(t) = \frac{4}{\pi}\sin(\omega t) + \frac{4}{3\pi}\sin(3\omega t) + \frac{4}{5\pi}\sin(5\omega t) + \\<br />
\frac{4}{7\pi}\sin(7\omega t) + \frac{4}{9\pi}\sin(9\omega t) + \frac{4}{11\pi}\sin(11\omega t) + \\ <br />
\frac{4}{13\pi}\sin(13\omega t) + \frac{4}{15\pi}\sin(15\omega t) + \frac{4}{17\pi}\sin(17\omega t) + \\<br />
\frac{4}{19\pi}\sin(19\omega t) + \frac{4}{21\pi}\sin(21\omega t) + \frac{4}{23\pi}\sin(23\omega t) + \\<br />
\frac{4}{25\pi}\sin(25\omega t) + \frac{4}{27\pi}\sin(27\omega t) + \frac{4}{29\pi}\sin(29\omega t) + \\<br />
\frac{4}{31\pi}\sin(31\omega t) + \frac{4}{33\pi}\sin(33\omega t) + \cdots <br />
\end{align}</math><br />
<br />
At first glance, that doesn't seem very useful either. You have to sum up an infinite number of harmonics to get the answer. ''Ah'', but we don't have an infinite number of harmonics.<br />
<br />
We're using a quite sharp [[WikiPedia:Low-pass_filter|anti-aliasing filter]] that cuts off right<br />
above 20kHz, so our signal is [[WikiPedia:Bandlimiting|bandlimited]], so only the first ten terms make it through.<br />
<br />
..and that's exactly what we see on the output scope.<br />
<br />
<br style="clear:both;"/><br />
<center><div style="background-color:#DDDDFF;border-color:#CCCCDD;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
'''Going deeper…'''<br />
*In modern web browsers you can program audio synthesizers directly in javascript. Use the two square wave formulas to get a square wave out of [http://js.do/blog/sound-waves-with-javascript/ this page]. (Note: The scope is not very useful.) <br />
</div></center><br />
<br />
The rippling you see around sharp edges in a bandlimited signal is called the [[WikiPedia:/Gibbs_phenomenon|Gibbs effect]]. It happens whenever you slice off part of the frequency domain in the middle of nonzero energy.<br />
<br />
The usual rule of thumb you'll hear is "the sharper the cutoff, the<br />
stronger the rippling", which is approximately true, but we have to be<br />
careful how we think about it.<br />
For example... what would you expect our quite sharp anti-aliasing filter<br />
to do if I run our signal through it a second time?<br />
<br />
Aside from adding a few fractional cycles of delay, the answer is...<br />
nothing at all. The signal is already bandlimited. Bandlimiting it<br />
again doesn't do anything. A second pass can't remove frequencies<br />
that we already removed.<br />
<br />
And that's important. People tend to think of the ripples as<br />
a kind of [[WikiPedia:Sonic_artifact|artifact]] that's added by anti-aliasing and [[WikiPedia:Reconstruction_filter|anti-imaging]]<br />
filters, implying that the ripples get worse each time the signal<br />
passes through. We can see that in this case that didn't happen. So<br />
was it really the filter that added the ripples the first time<br />
through? No, not really. It's a subtle distinction, but Gibbs effect<br />
ripples aren't added by filters, they're just part of what a<br />
bandlimited signal ''is''.<br />
<br />
Even if we synthetically construct what looks like a perfect digital<br />
square wave,<br />
<br />
it's still limited to the channel bandwidth. Remember,<br />
the stairstep representation is misleading.<br />
<br />
What we really have here are instantaneous sample points,<br />
<br />
and only one bandlimited signal fits those points. All we did when we<br />
drew our apparently perfect square wave was line up the sample points<br />
just right so it appeared that there were no ripples if we played<br />
[[WikiPedia:Interpolation|connect-the-dots]].<br />
<br />
But the original bandlimited signal, complete with ripples, was<br />
still there.<br />
<br />
[[image:Dsat_014.gif|360px|right]]<br />
And that leads us to one more important point. You've probably heard<br />
that the timing precision of a digital signal is limited by its sample<br />
rate; put another way,<br />
<br />
that digital signals can't represent anything that falls between the<br />
samples.. implying that [[WikiPedia:Dirac_delta_function|impulses]] or<br />
[[WikiPedia:Synthesizer#ADSR_envelope|fast attacks]] have to align exactly<br />
with a sample, or the timing gets mangled... or they just disappear.<br />
<br />
At this point, we can easily see why that's wrong.<br />
<br />
Again, our input signals are bandlimited. And digital signals are<br />
samples, not stairsteps, not 'connect-the-dots'. We most certainly<br />
can, for example, put the rising edge of our bandlimited square wave<br />
anywhere we want between samples.<br />
<br />
It's represented perfectly and it's reconstructed perfectly.<br />
<br />
==Epilogue==<br />
<br />
[[Image:Moffey.jpg|360px|right]]<br />
<br />
Just like in [[Videos/A_Digital_Media_Primer_For_Geeks|the previous episode]], we've covered a broad range of<br />
topics, and yet barely scratched the surface of each one. If anything, my<br />
sins of omission are greater this time around... but this is a good<br />
stopping point.<br />
<br />
Or maybe, a good starting point. Dig deeper. Experiment. I chose my<br />
demos very carefully to be simple and give clear results. You can<br />
reproduce every one of them on your own if you like. But let's face<br />
it, sometimes we learn the most about a spiffy toy by breaking it open<br />
and studying all the pieces that fall out. And that's OK, we're<br />
engineers. Play with the demo parameters, hack up the code, set up<br />
alternate experiments. The source code for everything, including the<br />
little pushbutton demo application, is up at xiph.org.<br />
<br />
In the course of experimentation, you're likely to run into something<br />
that you didn't expect and can't explain. Don't worry! My earlier<br />
snark aside, Wikipedia is fantastic for exactly this kind of casual<br />
research. And, if you're really serious about understanding signals,<br />
several universities have advanced materials online, such as the<br />
[http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-003-signals-and-systems-spring-2010/index.htm 6.003]<br />
and<br />
[http://ocw.mit.edu/resources/res-6-007-signals-and-systems-spring-2011/ RES.6-007]<br />
Signals and Systems modules at MIT OpenCourseWare. And of<br />
course, there's always the [http://webchat.freenode.net/?channels=xiph community here at Xiph.Org].<br />
<br />
Digging deeper or not, I am out of coffee, so, until next time, happy<br />
hacking!<br />
<br />
==Credits==<br />
[[Image:Dmpfg_019.png|360px|right]]<br />
Written by: Christopher (Monty) Montgomery and the Xiph.Org Community<br />
<br />
Special thanks to:<br />
*Heidi Baumgartner, for the second Tektronix oscilloscope<br />
*Gregory Maxwell and Dr. Timothy Terriberry, for additional technical review<br />
<br />
Intro, title and credits music:<br><br />
"[http://music.lousyrobot.com/track/andy-warhol-is-gone Andy Warhol Is Gone]", by Lousy Robot<br><br />
Used by permission of Lousy Robot.<br><br />
Original source track All Rights Reserved.<br><br />
[http://www.lousyrobot.com www.lousyrobot.com]<br />
<br />
This Video Was Produced Entirely With Free and Open Source Software:<br><br />
<br />
*[http://www.gnu.org/ GNU]<br><br />
*[http://www.linux.org/ Linux]<br><br />
*[http://fedoraproject.org/ Fedora]<br><br />
*[http://cinelerra.org/ Cinelerra]<br><br />
*[http://www.gimp.org/ The Gimp]<br><br />
*[http://audacity.sourceforge.net/ Audacity]<br><br />
*[http://svn.xiph.org/trunk/postfish/README Postfish]<br><br />
*[http://gstreamer.freedesktop.org/ Gstreamer]<br><br />
<br />
All trademarks are the property of their respective owners. <br />
<br />
*''Complete video'' [http://creativecommons.org/licenses/by-sa/3.0/legalcode CC-BY-SA]<br><br />
*''Text transcript and Wiki edition'' [http://creativecommons.org/licenses/by-sa/3.0/legalcode CC-BY-SA]<br><br />
<br />
A Co-Production of Xiph.Org and Red Hat, Inc.<br><br />
(C) 2012-2013, Some Rights Reserved<br><br />
<br />
== Use The Source Luke ==<br />
<br />
As stated in the Epilogue, everything that appears in the video demos is driven by open source software, which means the source is both available for inspection and freely usable by the community. The Thinkpad that appears in the video was running Fedora 17 and Gnome Shell (Gnome 3). The demonstration software does not require Fedora specifically, but it does require Gnu/Linux to run in its current form. In all, the video involved just under 50,000 lines of new and custom-purpose code (including contributions to non-Xiph projects such as Cinelerra and Gromit).<br />
<br />
=== The Spectrum and Waveform Viewer ===<br />
<br />
The realtime software spectrum analyzer application that appears in the video was a preexisting application that was dusted off and updated for use in the video. The waveform viewer (effectively a simple software oscilloscope) was written from scratch making use of some of the internals from the spectrum analyzer application. Both are available from Xiph.Org svn:<br />
<br />
<center><div style="background-color:#DDDDDD;border-color:#CCCCCC;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
*Source for the Spectrum and Waveform applications is found at:<br />
https://svn.xiph.org/trunk/spectrum/<br />
*The source can be checked out of svn using the following command line:<br />
svn co https://svn.xiph.org/trunk/spectrum<br />
*Trac is a convenient way to browse the source without checking out a copy:<br />
https://trac.xiph.org/browser/trunk/spectrum<br />
</div></center><br />
<br />
Spectrum and Waveform both expect an input stream on the command line, either as raw data or as a WAV file.<br />
<br />
=== GTK-Bounce ===<br />
<br />
The touch-controlled application used in the video is named 'gtk-bounce' and was custom-written for the sole purpose of the in-video demonstrations. It is so named because, for the most part, all it does is read the input from an audio device, and then immediately write the same data back out for playback. It also forwards a copy of this data to up to two external monitoring applications, and in several demos, applies simple filters or generates simple waveforms. It includes several demos not included in the video.<br />
<br />
<center><div style="background-color:#DDDDDD;border-color:#CCCCCC;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
*Source for gtk-bounce is found at:<br />
https://svn.xiph.org/trunk/Xiph-episode-II/bounce/<br />
*The source can be checked out of svn using the following command line:<br />
svn co https://svn.xiph.org/trunk/Xiph-episode-II/bounce/<br />
*Trac is a convenient way to browse the source without checking out a copy:<br />
https://trac.xiph.org/browser/Xiph-episode-II/bounce/<br />
</div></center><br />
<br />
==== Starting Gtk-bounce ====<br />
The application is somewhat hardwired for specific demo parameters, but most of the hardwired settings can be found at the top of each source file. As found in SVN, the application expects an ALSA hardware audio device at hw:1, and if none if found, it will wait for one to appear. Once a sound device is successfully initialized, it expects to find and open two pipes named pipe0 and pipe1 for output in the current directory. In the video, the waveform and spectrum applications are started to take input from pipe0 and pipe1 respectively. The output sent to the two pipes is identical, and in most demos matches the output data sent to the hardware device for conversion to analog. The only exception is the tenth demo panel (which does not appear in the video) where gtk-bounce can be set to monitor the hardware inputs instead while the outputs are used to produce test waveforms.<br />
<br />
Assuming gtk-bounce, spectrum and waveform have been checked out and built, the configuration seen in the video can be started using the following commands:<br />
<center><div style="background-color:#DDDDFF;border-color:#CCCCDD;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
* make the pipe fifos for the applications to communicate (only needs to be done once)<br />
mkfifo pipe0 pipe1<br />
* start all three applications<br />
waveform pipe0 & spectrum pipe1 & gtk-bounce &<br />
</div></center><br />
<br />
==== Using Gtk-bounce ====<br />
<br />
Gtk-bounce consists of eleven pushbutton panels (numbered zero through ten) that can be selected by scrolling up and dwon with the arrow buttons on the right side. Each panel is intended for a specific demo or part of a demo.<br />
<br />
<center><div style="background-color:#DDDDFF;border-color:#CCCCDD;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
<br />
[[Image:Dsat-panel0.png|700px|center]]<br />
* '''Panel 0''': This panel presents buttons that allow the sound card to be configured in several sampling rates and bit depths. Samples read from the audio inputs are sent to the output pipes and audio outputs for playback without modification.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel1.png|700px|center]]<br />
* '''Panel 1''': Both channels are forwarded to the outputs, however the user may select the bit depth of each channel independently. When the sound card is running in 16 bit mode and 16-bit depth is selected, the data is untouched. Requantization to a lower bit depth is performed with a flat triangle dither.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel2.png|700px|center]]<br />
* '''Panel 2''': Both channels are re-quantized to the selected bit depth. Requantization to a lower bit depth is performed with a flat triangle dither.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel3.png|700px|center]]<br />
* '''Panel 3''': 'generate sine wave' discards the audio inputs and instead internally generates a sine wave at 32 bit precision, which is then quantized to the selected bit depth, optionally with dither. The resulting signal is then forwarded to the output. <br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel4.png|700px|center]]<br />
* '''Panel 4''': gtk-bounce generates a 16-bit sine wave of the selected amplitude, optionally with dither, and forwards the resulting signal to the outputs. The audio input from the audio device is discarded. Note that the slider sets the peak amplitude, not the peak-to-peak amplitude.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel5.png|700px|center]]<br />
* '''Panel 5''': generates a 16-bit sine wave, optionally quantized using dither. The user may additionally select a flat or a shaped dither. The 'notch and gain' button applies a notch filter to the resulting signal, and boosts the gain of the remaining noise so that it's easily audible. The audio input from the audio device is discarded.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel6.png|700px|center]]<br />
* '''Panel 6''': allows the user to play with the power of the dithering noise applied before quantizating the sine wave. Shaped or flat dither are available. The sine wave may also be modulated with a varying amplitude to highlight correlations between the input and the resulting quantization noise. The 'notch and gain' button applies a notch filter to the resulting signal, and boosts the gain of the remaining noise so that it's easily audible. The audio input from the audio device is discarded.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel7.png|700px|center]]<br />
* '''Panel 7''': applies a sharper antialiasing (lowpass) filter than is likely to be built into the sound-card hardware (as there's generally no reason to use a filter quite this sharp in practice). The very sharp filter allows us to bandpass the demonstration squarewave without any harmonics landing in the transition band. <br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel8.png|700px|center]]<br />
* '''Panel 8''': when selected, generate a synthetic 'squarewave' (this is not quite equivalent to a bandlimited analog squarewave; the harmonic amplitudes are a bit different) that when aligned with the sampling phase just right gives the appearance of having infinite rise and fall time. The slider allows us to shift the waveform sample alignment back and forth by +/- one sample to reveal that the underlying signal is still band-limited.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel9.png|700px|center]]<br />
* '''Panel 9''': <br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel10.png|700px|center]]<br />
* '''Panel 10''': <br />
<div style="clear: both">&nbsp;</div><br />
<br />
</div></center><br />
<br />
=== Cairo Animations ===<br />
<br />
The animations featured throughout the Episode 2 video were rapid-development spaghetti hack-jobs coded by hand in raw Cairo. Each module generated a series of PNG stills that were then stitched into an animation with Cinelerra or mplayer. In the interest of pointing and laughing at what really bad code looks like...<br />
<br />
<center><div style="background-color:#DDDDFF;border-color:#CCCCDD;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
*Source for the Cairo animations is found at:<br />
https://svn.xiph.org/trunk/Xiph-episode-II/cairo/<br />
*The source can be checked out of svn using the following command line:<br />
svn co https://svn.xiph.org/trunk/Xiph-episode-II/cairo/<br />
*Trac is a convenient way to browse the source without checking out a copy:<br />
https://trac.xiph.org/browser/Xiph-episode-II/cairo/<br />
</div></center></div>Gmaxwellhttps://wiki.xiph.org/index.php?title=Videos/Digital_Show_and_Tell&diff=14008Videos/Digital Show and Tell2013-02-26T10:08:32Z<p>Gmaxwell: /* The Spectrum and Waveform Viewer */ source boxes grey?</p>
<hr />
<div><small>''Wiki edition''</small><br />
[[Image:dsat_001.jpg|400px|right]]<br />
<br />
Continuing in the "firehose" tradition of [[Videos/A_Digital_Media_Primer_For_Geeks|Episode 01]], Xiph.Org's second video on digital media explores multiple facets of digital audio signals and how they ''really'' behave in the real world.<br />
<br />
Demonstrations of sampling, quantization, bit-depth, and dither explore digital audio behavior on real audio equipment using both modern digital analysis and vintage analog bench equipment, just in case we can't trust those newfangled digital gizmos. You can download the source code for each demo and try it all for yourself!<br />
<br/><br/><br/><br />
<center><font size="+2">[http://www.xiph.org/video/vid2.shtml Download or Watch online]</font></center><br />
<br style="clear:both;"/><br />
Supported players: [http://www.videolan.org/vlc/ VLC 1.1+], [https://www.mozilla.com/en-US/firefox/ Firefox ], [http://www.chromium.org/Home Chrome ], [http://www.opera.com/ Opera]. Or see [http://www.webmproject.org/users/ other WebM] or [[TheoraSoftwarePlayers|other Theora]] players.<br />
<br />
If you're having trouble with playback in a modern browser or player, please visit our [[Playback_Troubleshooting|playback troubleshooting and discussion]] page.<br />
<br/><br />
<hr/><br />
<br/><br/><br/><br />
[[Image:Xiph_ep02_test.png|400px|right]]<br />
<br />
Hi, I'm Monty Montgomery from [http://www.redhat.com/ Red Hat] and [http://xiph.org/ Xiph.Org].<br />
<br />
A few months ago, I wrote<br />
[http://people.xiph.org/~xiphmont/demo/neil-young.html an article on digital audio and why 24bit/192kHz music downloads don't make sense].<br />
In the article, I<br />
mentioned--almost in passing--that a digital waveform is<br />
[http://people.xiph.org/~xiphmont/demo/neil-young.html#toc_sfam not a stairstep],<br />
and you certainly don't get a stairstep when you<br />
[[WikiPedia:Digital-to-analog_converter|convert from digital back to analog]].<br />
<br />
Of everything in the entire article, '''that''' was the number one thing<br />
people wrote about. In fact, more than half the mail I got was questions and<br />
comments about basic digital signal behavior. Since there's interest, let's<br />
take a little time to play with some ''simple'' digital signals.<br />
<br />
==Veritas ex machina==<br />
[[Image:Dsat_002.jpg|200px|right]]<br />
[[Image:Dsat_003.jpg|200px|right]]<br />
[[Image:Dsat_004.jpg|200px|right]]<br />
[[Image:Dsat_005.jpg|200px|right]]<br />
<br />
Pretend for a moment that we have no idea how digital signals really<br />
behave. In that case it doesn't make sense for us to use digital test<br />
equipment either. Fortunately for this exercise, there's still plenty<br />
of working analog lab equipment out there.<br />
<br />
First up, we need a [[WikiPedia:Function_generator|signal generator]] to provide us with analog input<br />
signals--in this case, an<br />
[http://www.home.agilent.com/en/pd-3325A%3Aepsg%3Apro-pn-3325A/synthesizer-function-generator?pm=PL&nid=-536900197.536896863&cc=SE&lc=swe HP3325]<br />
from 1978. It's still a pretty good<br />
generator, so if you don't mind the size, the weight, the power<br />
consumption, and the noisy fan, you can find them on eBay... occasionally<br />
for only slightly more than you'll pay for shipping.<br />
<br />
Next, we'll observe our analog waveforms on [[WikiPedia:Oscilloscope_types#Cathode-ray_oscilloscope_.28CRO.29|analog oscilloscopes]],<br />
like this Tektronix 2246 from the mid-90s, one of the last and very best analog scopes ever made. Every home lab should have one.<br />
<br />
...and finally inspect the [[WikiPedia:Spectral_density#Electrical_engineering|frequency spectrum]] of our signals using an<br />
[[WikiPedia:Spectrum_analyzer#Swept-tuned|analog spectrum analyzer]], this<br />
[http://www.home.agilent.com/en/pd-3585A%3Aepsg%3Apro-pn-3585A/spectrum-analyzer-high-perf-20hz-40mhz?pm=PL&nid=-536900197.536897319&cc=SE&lc=swe HP3585]<br />
from the same product line as<br />
the signal generator. Like the other equipment here it has<br />
[http://www.hp9845.net/9845/hardware/processors/ a rudimentary and hilariously large microcontroller],<br />
but the signal path<br />
from input to what you see on the screen is completely analog.<br />
<br />
All of this equipment is vintage, but aside from its raw tonnage, the specs are still quite good.<br />
<br />
At the moment, we have our signal generator set to output a nice 1 [[WikiPedia:Hertz#SI_multiples|kHz]]<br />
sine wave at one [[WikiPedia:Volt|Volt]] [[WikiPedia:Amplitude#Root_mean_square_amplitude|RMS]].<br />
We see the sine wave on the oscilloscope, can verify that it is indeed<br />
1 kHz at 1 Volt RMS, which is 2.8 Volts<br />
[[WikiPedia:Amplitude#Peak-to-peak_amplitude|peak-to-peak]],<br />
and that matches the<br />
measurement on the spectrum analyzer as well.<br />
<br />
The analyzer also shows some low-level [[WikiPedia:White_noise|white noise]]<br />
and just a bit of [[WikiPedia:Harmonic_distortion#Harmonic_distortion|harmonic distortion]],<br />
with the highest peak about 70[[WikiPedia:Decibel|dB]] or so below<br />
[[WikiPedia:Fundamental_frequency|the fundamental]].<br />
Now, this doesn't matter at all in our demos, but I<br />
wanted to point it out now just in case you didn't notice it until<br />
later.<br />
<br />
Now, we drop digital sampling in the middle.<br />
<br />
For the conversion, we'll use a boring, consumer-grade, eMagic USB1<br />
audio device. It's also more than ten years old at this point, and it's<br />
getting obsolete.<br />
<br />
A recent converter can easily have an order of magnitude better specs.<br />
[[WikiPedia:Reconstruction_filter#Sampled_data_reconstruction_filters|Flatness]],<br />
[[WikiPedia:Analog-to-digital_converter#Non-linearity|linearity]],<br />
[[WikiPedia:Jitter#Sampling_jitter|jitter]],<br />
[[WikiPedia:Noise_floor|noise behavior]],<br />
[[WikiPedia:Digital-to-analog_converter#DAC_performance|everything]]...<br />
you may not<br />
have noticed. Just because we can measure an improvement doesn't<br />
mean we can hear it, and even these old consumer boxes were already at<br />
the edge of ideal transparency.<br />
<br />
The eMagic connects to my ThinkPad, which displays a digital<br />
waveform and spectrum for comparison, then the ThinkPad<br />
sends the digital signal right back out to the eMagic for<br />
re-conversion to analog and observation on the output scopes.<br />
<br />
Input to output, left to right.<br />
<br style="clear:both;"/><br />
<br />
==Stairsteps==<br />
[[Image:Dsat 006.jpg|360px|right]]<br />
[[Image:Dsat 007.png|360px|right]]<br />
&ldquo;OK, it's go time. We begin by converting an analog signal to digital and<br />
then right back to analog again with no other steps.&rdquo;<br />
<br />
&ldquo;The signal generator is set to produce a 1kHz sine wave just like<br />
before.&rdquo;<br />
<br />
&ldquo;We can see our analog sine wave on our input-side oscilloscope.&rdquo;<br />
<br />
&ldquo;We digitize our signal to<br />
[[Videos/A_Digital_Media_Primer_For_Geeks#Raw_.28digital_audio.29_meat|16 bit PCM at 44.1kHz]],<br />
same as on a CD.&rdquo;<br />
<br />
&ldquo;The spectrum of the digitized signal matches what we saw earlier and what we see now on the analog spectrum analyzer, aside from its <br />
[[WikiPedia:High_impedance|high-impedance input]] being just a smidge noisier.&rdquo;<br />
<br />
&ldquo;For now, the waveform display shows our digitized sine wave as a<br />
stairstep pattern, one step for each sample.&rdquo;<br />
<br />
&ldquo;And when we look at the output signal that's been converted<br />
from digital back to analog, we see...&rdquo;<br />
<br />
&ldquo;It's exactly like the original sine wave. No stairsteps.&rdquo;<br />
<br />
&ldquo;OK, 1 kHz is still a fairly low frequency, maybe the stairsteps are just<br />
hard to see or they're being smoothed away. Fair enough. Let's choose<br />
a higher frequency, something close to [[WikiPedia:Nyquist_frequency|Nyquist]], say 15kHz.&rdquo;<br />
<br />
&ldquo;Now the sine wave is represented by less than three samples per cycle, and... the digital waveform looks pretty awful. Well, looks<br />
can be deceiving. The analog output... is still a perfect sine wave, exactly like the original.&rdquo;<br />
<br />
&ldquo;Let's keep going up.&rdquo;<br />
<br />
&ldquo;16kHz.... 17kHz... 18kHz... 19kHz...&rdquo;<br />
<br />
&ldquo;20kHz. Welcome to the upper limits of human hearing. The output waveform is still perfect. No jagged edges, no dropoff, no stairsteps.&rdquo;<br />
<br />
&ldquo;So where'd the stairsteps go? Don't answer, it's a trick question. They were never there.&rdquo;<br />
<br />
&ldquo;Drawing a digital waveform as a stairstep was wrong to begin with.&rdquo;<br />
<br />
&ldquo;Why? A stairstep is a continuous-time function. It's jagged, and it's piecewise, but it has a defined value at every point in time.&rdquo;<br />
<br />
&ldquo;A sampled signal is entirely different. It's discrete-time; it's only got a value right at each instantaneous sample point and it's<br />
undefined, there is no value at all, everywhere between. A discrete-time signal is properly drawn as a lollipop graph.&rdquo;<br />
<br />
&ldquo;The continuous, analog counterpart of a digital signal passes smoothly through each sample point, and that's just as true for high<br />
frequencies as it is for low.&rdquo;<br />
<br />
&ldquo;Now, the interesting and not at all obvious bit is: [[WikiPedia:Nyquist%E2%80%93Shannon_sampling_theorem|there's only one<br />
bandlimited signal that passes exactly through each sample point]]. It's a unique solution. So if you sample a bandlimited signal and then convert it back, the original input is also the only possible output.&rdquo;<br />
<br />
[[Image:Dsat 008.png|360px|right]]<br />
<br />
&ldquo;And before you say, "oh, I can draw a different signal that passes through those points", well, yes you can, but if it differs even<br />
minutely from the original, it includes frequency content at or beyond Nyquist, breaks the bandlimiting requirement and isn't a valid solution.&rdquo;<br />
<br />
&ldquo;So how did everyone get confused and start thinking of digital signals as stairsteps? I can think of two good reasons.&rdquo;<br />
<br />
&ldquo;First: it's easy enough to convert a sampled signal to a true stairstep. Just<br />
extend each sample value forward until the next sample period. This is<br />
called a [[WikiPedia:Zero-order hold|zero-order hold]], and it's an important part of how some<br />
digital-to-analog converters work, especially the simplest ones.&rdquo;<br />
<br />
&ldquo;So, anyone who looks up [[WikiPedia:Digital-to-analog_converter#Practical_operation|digital-to-analog converter or<br />
digital-to-analog conversion]] is probably going to see a diagram of a<br />
stairstep waveform somewhere, but that's not a finished conversion,<br />
and it's not the signal that comes out.&rdquo;<br />
<br />
&ldquo;Second, and this is probably the more likely reason, engineers who<br />
supposedly know better, like me, draw stairsteps even though they're<br />
technically wrong. It's a sort of like a one-dimensional version of<br />
[[WikiPedia:MacPaint#Development|fat bits in an image editor]].&rdquo;<br />
<br />
&ldquo;Pixels aren't squares either, they're samples of a 2-dimensional<br />
function space and so they're also, conceptually, infinitely small<br />
points. Practically, it's a real pain in the ass to see or manipulate<br />
infinitely small anything, so big squares it is. Digital stairstep<br />
drawings are exactly the same thing.&rdquo;<br />
<br />
&ldquo;It's just a convenient drawing. The stairsteps aren't really there.&rdquo;<br />
<br />
==Bit-depth==<br />
[[Image:Dsat_009.jpg|360px|right]]<br />
[[Image:Dsat_010.jpg|260px|right]]<br />
<br />
When we convert a digital signal back to analog, the result is<br />
''also'' smooth regardless of the [[WikiPedia:Audio_bit_depth|bit depth]]. 24 bits or 16 bits...<br />
or 8 bits... it doesn't matter.<br />
<br />
So does that mean that the digital bit depth makes no difference at<br />
all? Of course not.<br />
<br />
Channel 2 here is the same sine wave input, but we quantize with<br />
[[WikiPedia:Dither|dither]] down to 8 bits.<br />
<br />
On the scope, we still see a nice<br />
smooth sine wave on channel 2. Look very close, and you'll also see a<br />
bit more noise. That's a clue.<br />
<br />
If we look at the spectrum of the signal... aha! Our sine wave is<br />
still there unaffected, but the noise level of the 8-bit signal on<br />
the second channel is much higher!<br />
<br />
And that's the difference the number of bits makes. That's it!<br />
<br />
When we digitize a signal, first we sample it. The<br />
sampling step is perfect; it loses nothing. But then we [[WikiPedia:Quantization_(sound_processing)|quantize]] it,<br />
and [[WikiPedia:Quantization_error|quantization adds noise]].<br />
<br />
The number of bits determines how much noise and so the level of the<br />
noise floor.<br />
<br />
What does this dithered quantization noise sound like? Let's listen<br />
to our 8-bit sine wave.<br />
<br />
That may have been hard to hear anything but the tone. Let's listen<br />
to just the noise after we notch out the sine wave and then bring the<br />
gain up a bit because the noise is quiet.<br />
<br />
Those of you who have used analog recording equipment may have just<br />
thought to yourselves, "My goodness! That sounds like tape hiss!"<br />
Well, it doesn't just sound like tape hiss, it acts like it too, and<br />
if we use a [[WikiPedia:Dither#Different_types|gaussian dither]] then it's<br />
[[WikiPedia:Central_limit_theorem|mathematically equivalent]] in every way. It ''is'' tape hiss.<br />
<br />
Intuitively, that means that we can measure tape hiss and thus the noise floor<br />
of [[WikiPedia:Magnetic_tape_sound_recording|magnetic audio tape]]<br />
in [[WikiPedia:Shannon–Hartley_theorem#Examples|bits instead of decibels]], in order to put things in a<br />
digital perspective. [[WikiPedia:Compact cassettes|Compact cassettes]] (for those of you who are old enough to remember them) could reach as<br />
deep as 9 bits in perfect conditions, though 5 to 6 bits was<br />
more typical, especially if it was a recording made on a<br />
[[WikiPedia:Cassette_deck|tape deck]]. That's right... your mix tapes were only about 6 bits<br />
deep... if you were lucky!<br />
<br />
The very best professional [[WikiPedia:Reel-to-reel_audio_tape_recording|open reel tape]] used in studios could barely<br />
hit... any guesses? 13 bits ''with'' [[WikiPedia:Reel-to-reel_audio_tape_recording#Noise_reduction|advanced noise reduction]]. And<br />
that's why seeing '[[WikiPedia:SPARS_code|D D D]]' on a [[WikiPedia:Compact_disk|Compact Disc]] used to be such a big,<br />
high-end deal.<br />
<br />
==Dither==<br />
[[Image:Dsat_011.png|360px|right]]<br />
<br />
I keep saying that I'm quantizing with [[Wikipedia:dither|dither]], so what is dither<br />
exactly and, more importantly, what does it do?<br />
<br />
The simple way to quantize a signal is to choose the digital<br />
amplitude value closest to the original analog amplitude. [[WikiPedia:Rounding|Obvious]],<br />
right? Unfortunately, the exact noise you get from this simple<br />
quantization scheme depends somewhat on the input signal,<br />
<br />
so we may get noise that's inconsistent, or causes distortion, or is<br />
undesirable in some other way.<br />
<br style="clear:both;"/><br />
<center><div style="background-color:#DDDDFF;border-color:#CCCCDD;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
'''Going deeper…'''<br />
*Cameron Nicklaus Christou's thesis [http://uwspace.uwaterloo.ca/bitstream/10012/3867/1/thesis.pdf Optimal Dither and Noise Shaping in Image Processing] provides an ''excellent'' explanation of dither and noise shaping.<br />
</div></center><br />
<br />
Dither is specially-constructed noise that substitutes for the noise<br />
produced by simple quantization. Dither doesn't [[WikiPedia:Sound_masking|drown out or mask]]<br />
quantization noise, it actually replaces it with noise characteristics<br />
of our choosing that aren't influenced by the input.<br />
<br />
Let's ''watch'' what dither does. The signal generator has too much noise for this test so we'll produce a mathematically perfect sine wave with the ThinkPad and quantize it to 8 bits with dithering.<br />
<br />
We see a nice sine wave on the waveform display and output scope and, once the analog spectrum analyzer catches up...<br />
a clean frequency peak with a uniform noise floor on both spectral displays<br />
just like before. Again, this is with dither.<br />
<br />
Now I turn dithering off.<br />
<br />
The quantization noise, that dither had spread out into a nice, flat noise<br />
floor, piles up into harmonic distortion peaks. The noise floor is<br />
lower, but the level of distortion becomes nonzero, and the distortion<br />
peaks sit higher than the dithering noise did.<br />
<br />
At 8 bits this effect is exaggerated. At 16 bits,<br />
even without dither, harmonic distortion is going to be so low as to<br />
be completely inaudible.<br />
<br />
Still, we can use dither to eliminate it completely if we so choose.<br />
<br />
Turning the dither off again for a moment, you'll notice that the<br />
absolute level of distortion from undithered quantization stays<br />
approximately constant regardless of the input amplitude.<br />
But when the signal level drops below a half a bit, everything<br />
quantizes to zero.<br />
<br />
In a sense, everything quantizing to zero is just 100% distortion!<br />
Dither eliminates this distortion too. We reenable dither<br />
and ... there's our signal back at 1/4 bit, with our nice flat noise floor.<br />
<br />
The noise floor doesn't have to be flat. Dither is noise of our<br />
choosing, so let's choose a noise as [http://www.acoustics.salford.ac.uk/res/cox/sound_quality/?content=subjective inoffensive] and<br />
[[WikiPedia:Absolute_threshold_of_hearing|difficult to notice]]<br />
as possible.<br />
<br />
Our hearing is most sensitive in the midrange from 2kHz to 4kHz,<br />
so that's where background noise is going to be the most obvious.<br />
We can [[WikiPedia:Noise_shaping|shape dithering noise]] away from sensitive frequencies to where<br />
hearing is less sensitive, usually the highest frequencies.<br />
<br />
16-bit dithering noise is normally much too quiet to hear at all, but<br />
let's listen to our noise shaping example, again with the gain<br />
brought way up...<br />
<br />
Lastly, dithered quantization noise ''is'' higher [[WikiPedia:Sound_power|power]] overall<br />
than undithered quantization noise even when it sounds quieter, and<br />
you can see that on a [[WikiPedia:VU_meter|VU meter]] during passages of near-silence. But<br />
dither isn't only an on or off choice. We can reduce the dither's<br />
power to balance less noise against a bit of distortion to minimize<br />
the overall effect.<br />
<br />
We'll also [[WikiPedia:Amplitude_modulation|modulate the input signal]] like this to show how a varying input affects the quantization noise. At<br />
full dithering power, the noise is uniform, constant, and featureless<br />
just like we expect:<br />
<br />
As we reduce the dither's power, the input increasingly<br />
affects the amplitude and the character of the quantization noise.<br />
Shaped dither behaves similarly, but noise shaping lends one more nice<br />
advantage. To make a long story short, it can use a somewhat lower<br />
dither power before the input has as much effect on the output.<br />
<br />
Despite all the time I just spent on dither, we're talking about<br />
differences that start 100 decibels and more below [[WikiPedia:Full_scale|full scale]]. Maybe<br />
if the CD had been<br />
[http://www.research.philips.com/technologies/projects/cd/index.html 14 bits as originally designed],<br />
dither ''might'' be<br />
more important. Maybe. At 16 bits, really, it's mostly a wash. You<br />
can think of dither as an insurance policy that gives several extra<br />
decibels of dynamic range just in case. The simple fact is, though, no<br />
one ever ruined a great recording by not dithering the final master.<br />
<br />
==Bandlimitation and timing==<br />
[[image:Dsat_013.jpg|360px|right]]<br />
<br />
We've been using [[WikiPedia:Sine_wave|sine waves]]. They're the obvious choice when what we<br />
want to see is a system's behavior at a given isolated frequency. Now<br />
let's look at something a bit more complex. What should we expect to<br />
happen when I change the input to a [[WikiPedia:Square_wave|square wave]]...<br />
<br />
The input scope confirms our 1kHz square wave. The output scope shows..<br />
<br />
<br />
Exactly what it should.<br />
...<br />
What is a square wave really? <br />
<br />
<br />
Well, we can say it's a waveform that's some positive value for half a cycle and then transitions instantaneously to a negative value for the other half.<br />
<br />
:<math><br />
\ x(t) = \begin{cases} 1, & |t| < T_1 \\ 0, & T_1 < |t| \leq {1 \over 2}T \end{cases}<br />
</math><br />
<br />
But that doesn't really tell us anything useful about how that input becomes this output.<br />
<br />
Then we remember that any waveform is also [[WikiPedia:Fourier_series|the sum of discrete frequencies]],<br />
and a square wave is particularly simple sum: a fundamental and an<br />
infinite series of [[WikiPedia:Even_and_odd_functions#Harmonics|odd harmonics]]. Sum them all up, you get a<br />
square wave.<br />
<br />
[[Image:dsat_015.jpg|360px|right]]<br />
:<math>\begin{align}<br />
x_{\mathrm{square}}(t) = \frac{4}{\pi}\sin(\omega t) + \frac{4}{3\pi}\sin(3\omega t) + \frac{4}{5\pi}\sin(5\omega t) + \\<br />
\frac{4}{7\pi}\sin(7\omega t) + \frac{4}{9\pi}\sin(9\omega t) + \frac{4}{11\pi}\sin(11\omega t) + \\ <br />
\frac{4}{13\pi}\sin(13\omega t) + \frac{4}{15\pi}\sin(15\omega t) + \frac{4}{17\pi}\sin(17\omega t) + \\<br />
\frac{4}{19\pi}\sin(19\omega t) + \frac{4}{21\pi}\sin(21\omega t) + \frac{4}{23\pi}\sin(23\omega t) + \\<br />
\frac{4}{25\pi}\sin(25\omega t) + \frac{4}{27\pi}\sin(27\omega t) + \frac{4}{29\pi}\sin(29\omega t) + \\<br />
\frac{4}{31\pi}\sin(31\omega t) + \frac{4}{33\pi}\sin(33\omega t) + \cdots <br />
\end{align}</math><br />
<br />
At first glance, that doesn't seem very useful either. You have to sum up an infinite number of harmonics to get the answer. ''Ah'', but we don't have an infinite number of harmonics.<br />
<br />
We're using a quite sharp [[WikiPedia:Low-pass_filter|anti-aliasing filter]] that cuts off right<br />
above 20kHz, so our signal is [[WikiPedia:Bandlimiting|bandlimited]], so only the first ten terms make it through.<br />
<br />
..and that's exactly what we see on the output scope.<br />
<br />
<br style="clear:both;"/><br />
<center><div style="background-color:#DDDDFF;border-color:#CCCCDD;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
'''Going deeper…'''<br />
*In modern web browsers you can program audio synthesizers directly in javascript. Use the two square wave formulas to get a square wave out of [http://js.do/blog/sound-waves-with-javascript/ this page]. (Note: The scope is not very useful.) <br />
</div></center><br />
<br />
The rippling you see around sharp edges in a bandlimited signal is called the [[WikiPedia:/Gibbs_phenomenon|Gibbs effect]]. It happens whenever you slice off part of the frequency domain in the middle of nonzero energy.<br />
<br />
The usual rule of thumb you'll hear is "the sharper the cutoff, the<br />
stronger the rippling", which is approximately true, but we have to be<br />
careful how we think about it.<br />
For example... what would you expect our quite sharp anti-aliasing filter<br />
to do if I run our signal through it a second time?<br />
<br />
Aside from adding a few fractional cycles of delay, the answer is...<br />
nothing at all. The signal is already bandlimited. Bandlimiting it<br />
again doesn't do anything. A second pass can't remove frequencies<br />
that we already removed.<br />
<br />
And that's important. People tend to think of the ripples as<br />
a kind of [[WikiPedia:Sonic_artifact|artifact]] that's added by anti-aliasing and [[WikiPedia:Reconstruction_filter|anti-imaging]]<br />
filters, implying that the ripples get worse each time the signal<br />
passes through. We can see that in this case that didn't happen. So<br />
was it really the filter that added the ripples the first time<br />
through? No, not really. It's a subtle distinction, but Gibbs effect<br />
ripples aren't added by filters, they're just part of what a<br />
bandlimited signal ''is''.<br />
<br />
Even if we synthetically construct what looks like a perfect digital<br />
square wave,<br />
<br />
it's still limited to the channel bandwidth. Remember,<br />
the stairstep representation is misleading.<br />
<br />
What we really have here are instantaneous sample points,<br />
<br />
and only one bandlimited signal fits those points. All we did when we<br />
drew our apparently perfect square wave was line up the sample points<br />
just right so it appeared that there were no ripples if we played<br />
[[WikiPedia:Interpolation|connect-the-dots]].<br />
<br />
But the original bandlimited signal, complete with ripples, was<br />
still there.<br />
<br />
[[image:Dsat_014.gif|360px|right]]<br />
And that leads us to one more important point. You've probably heard<br />
that the timing precision of a digital signal is limited by its sample<br />
rate; put another way,<br />
<br />
that digital signals can't represent anything that falls between the<br />
samples.. implying that [[WikiPedia:Dirac_delta_function|impulses]] or<br />
[[WikiPedia:Synthesizer#ADSR_envelope|fast attacks]] have to align exactly<br />
with a sample, or the timing gets mangled... or they just disappear.<br />
<br />
At this point, we can easily see why that's wrong.<br />
<br />
Again, our input signals are bandlimited. And digital signals are<br />
samples, not stairsteps, not 'connect-the-dots'. We most certainly<br />
can, for example, put the rising edge of our bandlimited square wave<br />
anywhere we want between samples.<br />
<br />
It's represented perfectly and it's reconstructed perfectly.<br />
<br />
==Epilogue==<br />
<br />
[[Image:Moffey.jpg|360px|right]]<br />
<br />
Just like in [[Videos/A_Digital_Media_Primer_For_Geeks|the previous episode]], we've covered a broad range of<br />
topics, and yet barely scratched the surface of each one. If anything, my<br />
sins of omission are greater this time around... but this is a good<br />
stopping point.<br />
<br />
Or maybe, a good starting point. Dig deeper. Experiment. I chose my<br />
demos very carefully to be simple and give clear results. You can<br />
reproduce every one of them on your own if you like. But let's face<br />
it, sometimes we learn the most about a spiffy toy by breaking it open<br />
and studying all the pieces that fall out. And that's OK, we're<br />
engineers. Play with the demo parameters, hack up the code, set up<br />
alternate experiments. The source code for everything, including the<br />
little pushbutton demo application, is up at xiph.org.<br />
<br />
In the course of experimentation, you're likely to run into something<br />
that you didn't expect and can't explain. Don't worry! My earlier<br />
snark aside, Wikipedia is fantastic for exactly this kind of casual<br />
research. And, if you're really serious about understanding signals,<br />
several universities have advanced materials online, such as the<br />
[http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-003-signals-and-systems-spring-2010/index.htm 6.003]<br />
and<br />
[http://ocw.mit.edu/resources/res-6-007-signals-and-systems-spring-2011/ RES.6-007]<br />
Signals and Systems modules at MIT OpenCourseWare. And of<br />
course, there's always the [http://webchat.freenode.net/?channels=xiph community here at Xiph.Org].<br />
<br />
Digging deeper or not, I am out of coffee, so, until next time, happy<br />
hacking!<br />
<br />
==Credits==<br />
[[Image:Dmpfg_019.png|360px|right]]<br />
Written by: Christopher (Monty) Montgomery and the Xiph.Org Community<br />
<br />
Special thanks to:<br />
*Heidi Baumgartner, for the second Tektronix oscilloscope<br />
*Gregory Maxwell and Dr. Timothy Terriberry, for additional technical review<br />
<br />
Intro, title and credits music:<br><br />
"[http://music.lousyrobot.com/track/andy-warhol-is-gone Andy Warhol Is Gone]", by Lousy Robot<br><br />
Used by permission of Lousy Robot.<br><br />
Original source track All Rights Reserved.<br><br />
[http://www.lousyrobot.com www.lousyrobot.com]<br />
<br />
This Video Was Produced Entirely With Free and Open Source Software:<br><br />
<br />
*[http://www.gnu.org/ GNU]<br><br />
*[http://www.linux.org/ Linux]<br><br />
*[http://fedoraproject.org/ Fedora]<br><br />
*[http://cinelerra.org/ Cinelerra]<br><br />
*[http://www.gimp.org/ The Gimp]<br><br />
*[http://audacity.sourceforge.net/ Audacity]<br><br />
*[http://svn.xiph.org/trunk/postfish/README Postfish]<br><br />
*[http://gstreamer.freedesktop.org/ Gstreamer]<br><br />
<br />
All trademarks are the property of their respective owners. <br />
<br />
*''Complete video'' [http://creativecommons.org/licenses/by-sa/3.0/legalcode CC-BY-SA]<br><br />
*''Text transcript and Wiki edition'' [http://creativecommons.org/licenses/by-sa/3.0/legalcode CC-BY-SA]<br><br />
<br />
A Co-Production of Xiph.Org and Red Hat, Inc.<br><br />
(C) 2012-2013, Some Rights Reserved<br><br />
<br />
== Use The Source Luke ==<br />
<br />
As stated in the Epilogue, everything that appears in the video demos is driven by open source software, which means the source is both available for inspection and freely usable by the community. The Thinkpad that appears in the video was running Fedora 17 and Gnome Shell (Gnome 3). The demonstration software does not require Fedora specifically, but it does require Gnu/Linux to run in its current form. In all, the video involved just under 50,000 lines of new and custom-purpose code (including contributions to non-Xiph projects such as Cinelerra and Gromit).<br />
<br />
=== The Spectrum and Waveform Viewer ===<br />
<br />
The realtime software spectrum analyzer application that appears in the video was a preexisting application that was dusted off and updated for use in the video. The waveform viewer (effectively a simple software oscilloscope) was written from scratch making use of some of the internals from the spectrum analyzer application. Both are available from Xiph.Org svn:<br />
<br />
<center><div style="background-color:#DDDDDD;border-color:#CCCCCC;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
*Source for the Spectrum and Waveform applications is found at:<br />
https://svn.xiph.org/trunk/spectrum/<br />
*The source can be checked out of svn using the following command line:<br />
svn co https://svn.xiph.org/trunk/spectrum<br />
*Trac is a convenient way to browse the source without checking out a copy:<br />
https://trac.xiph.org/browser/trunk/spectrum<br />
</div></center><br />
<br />
Spectrum and Waveform both expect an input stream on the command line, either as raw data or as a WAV file.<br />
<br />
=== GTK-Bounce ===<br />
<br />
The touch-controlled application used in the video is named 'gtk-bounce' and was custom-written for the sole purpose of the in-video demonstrations. It is so named because, for the most part, all it does is read the input from an audio device, and then immediately write the same data back out for playback. It also forwards a copy of this data to up to two external monitoring applications, and in several demos, applies simple filters or generates simple waveforms. It includes several demos not included in the video.<br />
<br />
<center><div style="background-color:#DDDDFF;border-color:#CCCCDD;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
*Source for gtk-bounce is found at:<br />
https://svn.xiph.org/trunk/Xiph-episode-II/bounce/<br />
*The source can be checked out of svn using the following command line:<br />
svn co https://svn.xiph.org/trunk/Xiph-episode-II/bounce/<br />
*Trac is a convenient way to browse the source without checking out a copy:<br />
https://trac.xiph.org/browser/Xiph-episode-II/bounce/<br />
</div></center><br />
<br />
==== Starting Gtk-bounce ====<br />
The application is somewhat hardwired for specific demo parameters, but most of the hardwired settings can be found at the top of each source file. As found in SVN, the application expects an ALSA hardware audio device at hw:1, and if none if found, it will wait for one to appear. Once a sound device is successfully initialized, it expects to find and open two pipes named pipe0 and pipe1 for output in the current directory. In the video, the waveform and spectrum applications are started to take input from pipe0 and pipe1 respectively. The output sent to the two pipes is identical, and in most demos matches the output data sent to the hardware device for conversion to analog. The only exception is the tenth demo panel (which does not appear in the video) where gtk-bounce can be set to monitor the hardware inputs instead while the outputs are used to produce test waveforms.<br />
<br />
Assuming gtk-bounce, spectrum and waveform have been checked out and built, the configuration seen in the video can be started using the following commands:<br />
<center><div style="background-color:#DDDDFF;border-color:#CCCCDD;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
* make the pipe fifos for the applications to communicate (only needs to be done once)<br />
mkfifo pipe0 pipe1<br />
* start all three applications<br />
waveform pipe0 & spectrum pipe1 & gtk-bounce &<br />
</div></center><br />
<br />
==== Using Gtk-bounce ====<br />
<br />
Gtk-bounce consists of eleven pushbutton panels (numbered zero through ten) that can be selected by scrolling up and dwon with the arrow buttons on the right side. Each panel is intended for a specific demo or part of a demo.<br />
<br />
<center><div style="background-color:#DDDDFF;border-color:#CCCCDD;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
<br />
[[Image:Dsat-panel0.png|700px|center]]<br />
* '''Panel 0''': This panel presents buttons that allow the sound card to be configured in several sampling rates and bit depths. Samples read from the audio inputs are sent to the output pipes and audio outputs for playback without modification.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel1.png|700px|center]]<br />
* '''Panel 1''': Both channels are forwarded to the outputs, however the user may select the bit depth of each channel independently. When the sound card is running in 16 bit mode and 16-bit depth is selected, the data is untouched. Requantization to a lower bit depth is performed with a flat triangle dither.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel2.png|700px|center]]<br />
* '''Panel 2''': Both channels are re-quantized to the selected bit depth. Requantization to a lower bit depth is performed with a flat triangle dither.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel3.png|700px|center]]<br />
* '''Panel 3''': 'generate sine wave' discards the audio inputs and instead internally generates a sine wave at 32 bit precision, which is then quantized to the selected bit depth, optionally with dither. The resulting signal is then forwarded to the output. <br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel4.png|700px|center]]<br />
* '''Panel 4''': gtk-bounce generates a 16-bit sine wave of the selected amplitude, optionally with dither, and forwards the resulting signal to the outputs. The audio input from the audio device is discarded. Note that the slider sets the peak amplitude, not the peak-to-peak amplitude.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel5.png|700px|center]]<br />
* '''Panel 5''': generates a 16-bit sine wave, optionally quantized using dither. The user may additionally select a flat or a shaped dither. The 'notch and gain' button applies a notch filter to the resulting signal, and boosts the gain of the remaining noise so that it's easily audible. The audio input from the audio device is discarded.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel6.png|700px|center]]<br />
* '''Panel 6''': allows the user to play with the power of the dithering noise applied before quantizating the sine wave. Shaped or flat dither are available. The sine wave may also be modulated with a varying amplitude to highlight correlations between the input and the resulting quantization noise. The 'notch and gain' button applies a notch filter to the resulting signal, and boosts the gain of the remaining noise so that it's easily audible. The audio input from the audio device is discarded.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel7.png|700px|center]]<br />
* '''Panel 7''': applies a sharper antialiasing (lowpass) filter than is likely to be built into the sound-card hardware (as there's generally no reason to use a filter quite this sharp in practice). The very sharp filter allows us to bandpass the demonstration squarewave without any harmonics landing in the transition band. <br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel8.png|700px|center]]<br />
* '''Panel 8''': when selected, generate a synthetic 'squarewave' (this is not quite equivalent to a bandlimited analog squarewave; the harmonic amplitudes are a bit different) that when aligned with the sampling phase just right gives the appearance of having infinite rise and fall time. The slider allows us to shift the waveform sample alignment back and forth by +/- one sample to reveal that the underlying signal is still band-limited.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel9.png|700px|center]]<br />
* '''Panel 9''': <br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel10.png|700px|center]]<br />
* '''Panel 10''': <br />
<div style="clear: both">&nbsp;</div><br />
<br />
</div></center><br />
<br />
=== Cairo Animations ===<br />
<br />
The animations featured throughout the Episode 2 video were rapid-development spaghetti hack-jobs coded by hand in raw Cairo. Each module generated a series of PNG stills that were then stitched into an animation with Cinelerra or mplayer. In the interest of pointing and laughing at what really bad code looks like...<br />
<br />
<center><div style="background-color:#DDDDFF;border-color:#CCCCDD;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
*Source for the Cairo animations is found at:<br />
https://svn.xiph.org/trunk/Xiph-episode-II/cairo/<br />
*The source can be checked out of svn using the following command line:<br />
svn co https://svn.xiph.org/trunk/Xiph-episode-II/cairo/<br />
*Trac is a convenient way to browse the source without checking out a copy:<br />
https://trac.xiph.org/browser/Xiph-episode-II/cairo/<br />
</div></center></div>Gmaxwellhttps://wiki.xiph.org/index.php?title=Videos/Digital_Show_and_Tell&diff=14007Videos/Digital Show and Tell2013-02-26T10:06:41Z<p>Gmaxwell: /* Stairsteps */ is this really what you want?</p>
<hr />
<div><small>''Wiki edition''</small><br />
[[Image:dsat_001.jpg|400px|right]]<br />
<br />
Continuing in the "firehose" tradition of [[Videos/A_Digital_Media_Primer_For_Geeks|Episode 01]], Xiph.Org's second video on digital media explores multiple facets of digital audio signals and how they ''really'' behave in the real world.<br />
<br />
Demonstrations of sampling, quantization, bit-depth, and dither explore digital audio behavior on real audio equipment using both modern digital analysis and vintage analog bench equipment, just in case we can't trust those newfangled digital gizmos. You can download the source code for each demo and try it all for yourself!<br />
<br/><br/><br/><br />
<center><font size="+2">[http://www.xiph.org/video/vid2.shtml Download or Watch online]</font></center><br />
<br style="clear:both;"/><br />
Supported players: [http://www.videolan.org/vlc/ VLC 1.1+], [https://www.mozilla.com/en-US/firefox/ Firefox ], [http://www.chromium.org/Home Chrome ], [http://www.opera.com/ Opera]. Or see [http://www.webmproject.org/users/ other WebM] or [[TheoraSoftwarePlayers|other Theora]] players.<br />
<br />
If you're having trouble with playback in a modern browser or player, please visit our [[Playback_Troubleshooting|playback troubleshooting and discussion]] page.<br />
<br/><br />
<hr/><br />
<br/><br/><br/><br />
[[Image:Xiph_ep02_test.png|400px|right]]<br />
<br />
Hi, I'm Monty Montgomery from [http://www.redhat.com/ Red Hat] and [http://xiph.org/ Xiph.Org].<br />
<br />
A few months ago, I wrote<br />
[http://people.xiph.org/~xiphmont/demo/neil-young.html an article on digital audio and why 24bit/192kHz music downloads don't make sense].<br />
In the article, I<br />
mentioned--almost in passing--that a digital waveform is<br />
[http://people.xiph.org/~xiphmont/demo/neil-young.html#toc_sfam not a stairstep],<br />
and you certainly don't get a stairstep when you<br />
[[WikiPedia:Digital-to-analog_converter|convert from digital back to analog]].<br />
<br />
Of everything in the entire article, '''that''' was the number one thing<br />
people wrote about. In fact, more than half the mail I got was questions and<br />
comments about basic digital signal behavior. Since there's interest, let's<br />
take a little time to play with some ''simple'' digital signals.<br />
<br />
==Veritas ex machina==<br />
[[Image:Dsat_002.jpg|200px|right]]<br />
[[Image:Dsat_003.jpg|200px|right]]<br />
[[Image:Dsat_004.jpg|200px|right]]<br />
[[Image:Dsat_005.jpg|200px|right]]<br />
<br />
Pretend for a moment that we have no idea how digital signals really<br />
behave. In that case it doesn't make sense for us to use digital test<br />
equipment either. Fortunately for this exercise, there's still plenty<br />
of working analog lab equipment out there.<br />
<br />
First up, we need a [[WikiPedia:Function_generator|signal generator]] to provide us with analog input<br />
signals--in this case, an<br />
[http://www.home.agilent.com/en/pd-3325A%3Aepsg%3Apro-pn-3325A/synthesizer-function-generator?pm=PL&nid=-536900197.536896863&cc=SE&lc=swe HP3325]<br />
from 1978. It's still a pretty good<br />
generator, so if you don't mind the size, the weight, the power<br />
consumption, and the noisy fan, you can find them on eBay... occasionally<br />
for only slightly more than you'll pay for shipping.<br />
<br />
Next, we'll observe our analog waveforms on [[WikiPedia:Oscilloscope_types#Cathode-ray_oscilloscope_.28CRO.29|analog oscilloscopes]],<br />
like this Tektronix 2246 from the mid-90s, one of the last and very best analog scopes ever made. Every home lab should have one.<br />
<br />
...and finally inspect the [[WikiPedia:Spectral_density#Electrical_engineering|frequency spectrum]] of our signals using an<br />
[[WikiPedia:Spectrum_analyzer#Swept-tuned|analog spectrum analyzer]], this<br />
[http://www.home.agilent.com/en/pd-3585A%3Aepsg%3Apro-pn-3585A/spectrum-analyzer-high-perf-20hz-40mhz?pm=PL&nid=-536900197.536897319&cc=SE&lc=swe HP3585]<br />
from the same product line as<br />
the signal generator. Like the other equipment here it has<br />
[http://www.hp9845.net/9845/hardware/processors/ a rudimentary and hilariously large microcontroller],<br />
but the signal path<br />
from input to what you see on the screen is completely analog.<br />
<br />
All of this equipment is vintage, but aside from its raw tonnage, the specs are still quite good.<br />
<br />
At the moment, we have our signal generator set to output a nice 1 [[WikiPedia:Hertz#SI_multiples|kHz]]<br />
sine wave at one [[WikiPedia:Volt|Volt]] [[WikiPedia:Amplitude#Root_mean_square_amplitude|RMS]].<br />
We see the sine wave on the oscilloscope, can verify that it is indeed<br />
1 kHz at 1 Volt RMS, which is 2.8 Volts<br />
[[WikiPedia:Amplitude#Peak-to-peak_amplitude|peak-to-peak]],<br />
and that matches the<br />
measurement on the spectrum analyzer as well.<br />
<br />
The analyzer also shows some low-level [[WikiPedia:White_noise|white noise]]<br />
and just a bit of [[WikiPedia:Harmonic_distortion#Harmonic_distortion|harmonic distortion]],<br />
with the highest peak about 70[[WikiPedia:Decibel|dB]] or so below<br />
[[WikiPedia:Fundamental_frequency|the fundamental]].<br />
Now, this doesn't matter at all in our demos, but I<br />
wanted to point it out now just in case you didn't notice it until<br />
later.<br />
<br />
Now, we drop digital sampling in the middle.<br />
<br />
For the conversion, we'll use a boring, consumer-grade, eMagic USB1<br />
audio device. It's also more than ten years old at this point, and it's<br />
getting obsolete.<br />
<br />
A recent converter can easily have an order of magnitude better specs.<br />
[[WikiPedia:Reconstruction_filter#Sampled_data_reconstruction_filters|Flatness]],<br />
[[WikiPedia:Analog-to-digital_converter#Non-linearity|linearity]],<br />
[[WikiPedia:Jitter#Sampling_jitter|jitter]],<br />
[[WikiPedia:Noise_floor|noise behavior]],<br />
[[WikiPedia:Digital-to-analog_converter#DAC_performance|everything]]...<br />
you may not<br />
have noticed. Just because we can measure an improvement doesn't<br />
mean we can hear it, and even these old consumer boxes were already at<br />
the edge of ideal transparency.<br />
<br />
The eMagic connects to my ThinkPad, which displays a digital<br />
waveform and spectrum for comparison, then the ThinkPad<br />
sends the digital signal right back out to the eMagic for<br />
re-conversion to analog and observation on the output scopes.<br />
<br />
Input to output, left to right.<br />
<br style="clear:both;"/><br />
<br />
==Stairsteps==<br />
[[Image:Dsat 006.jpg|360px|right]]<br />
[[Image:Dsat 007.png|360px|right]]<br />
&ldquo;OK, it's go time. We begin by converting an analog signal to digital and<br />
then right back to analog again with no other steps.&rdquo;<br />
<br />
&ldquo;The signal generator is set to produce a 1kHz sine wave just like<br />
before.&rdquo;<br />
<br />
&ldquo;We can see our analog sine wave on our input-side oscilloscope.&rdquo;<br />
<br />
&ldquo;We digitize our signal to<br />
[[Videos/A_Digital_Media_Primer_For_Geeks#Raw_.28digital_audio.29_meat|16 bit PCM at 44.1kHz]],<br />
same as on a CD.&rdquo;<br />
<br />
&ldquo;The spectrum of the digitized signal matches what we saw earlier and what we see now on the analog spectrum analyzer, aside from its <br />
[[WikiPedia:High_impedance|high-impedance input]] being just a smidge noisier.&rdquo;<br />
<br />
&ldquo;For now, the waveform display shows our digitized sine wave as a<br />
stairstep pattern, one step for each sample.&rdquo;<br />
<br />
&ldquo;And when we look at the output signal that's been converted<br />
from digital back to analog, we see...&rdquo;<br />
<br />
&ldquo;It's exactly like the original sine wave. No stairsteps.&rdquo;<br />
<br />
&ldquo;OK, 1 kHz is still a fairly low frequency, maybe the stairsteps are just<br />
hard to see or they're being smoothed away. Fair enough. Let's choose<br />
a higher frequency, something close to [[WikiPedia:Nyquist_frequency|Nyquist]], say 15kHz.&rdquo;<br />
<br />
&ldquo;Now the sine wave is represented by less than three samples per cycle, and... the digital waveform looks pretty awful. Well, looks<br />
can be deceiving. The analog output... is still a perfect sine wave, exactly like the original.&rdquo;<br />
<br />
&ldquo;Let's keep going up.&rdquo;<br />
<br />
&ldquo;16kHz.... 17kHz... 18kHz... 19kHz...&rdquo;<br />
<br />
&ldquo;20kHz. Welcome to the upper limits of human hearing. The output waveform is still perfect. No jagged edges, no dropoff, no stairsteps.&rdquo;<br />
<br />
&ldquo;So where'd the stairsteps go? Don't answer, it's a trick question. They were never there.&rdquo;<br />
<br />
&ldquo;Drawing a digital waveform as a stairstep was wrong to begin with.&rdquo;<br />
<br />
&ldquo;Why? A stairstep is a continuous-time function. It's jagged, and it's piecewise, but it has a defined value at every point in time.&rdquo;<br />
<br />
&ldquo;A sampled signal is entirely different. It's discrete-time; it's only got a value right at each instantaneous sample point and it's<br />
undefined, there is no value at all, everywhere between. A discrete-time signal is properly drawn as a lollipop graph.&rdquo;<br />
<br />
&ldquo;The continuous, analog counterpart of a digital signal passes smoothly through each sample point, and that's just as true for high<br />
frequencies as it is for low.&rdquo;<br />
<br />
&ldquo;Now, the interesting and not at all obvious bit is: [[WikiPedia:Nyquist%E2%80%93Shannon_sampling_theorem|there's only one<br />
bandlimited signal that passes exactly through each sample point]]. It's a unique solution. So if you sample a bandlimited signal and then convert it back, the original input is also the only possible output.&rdquo;<br />
<br />
[[Image:Dsat 008.png|360px|right]]<br />
<br />
&ldquo;And before you say, "oh, I can draw a different signal that passes through those points", well, yes you can, but if it differs even<br />
minutely from the original, it includes frequency content at or beyond Nyquist, breaks the bandlimiting requirement and isn't a valid solution.&rdquo;<br />
<br />
&ldquo;So how did everyone get confused and start thinking of digital signals as stairsteps? I can think of two good reasons.&rdquo;<br />
<br />
&ldquo;First: it's easy enough to convert a sampled signal to a true stairstep. Just<br />
extend each sample value forward until the next sample period. This is<br />
called a [[WikiPedia:Zero-order hold|zero-order hold]], and it's an important part of how some<br />
digital-to-analog converters work, especially the simplest ones.&rdquo;<br />
<br />
&ldquo;So, anyone who looks up [[WikiPedia:Digital-to-analog_converter#Practical_operation|digital-to-analog converter or<br />
digital-to-analog conversion]] is probably going to see a diagram of a<br />
stairstep waveform somewhere, but that's not a finished conversion,<br />
and it's not the signal that comes out.&rdquo;<br />
<br />
&ldquo;Second, and this is probably the more likely reason, engineers who<br />
supposedly know better, like me, draw stairsteps even though they're<br />
technically wrong. It's a sort of like a one-dimensional version of<br />
[[WikiPedia:MacPaint#Development|fat bits in an image editor]].&rdquo;<br />
<br />
&ldquo;Pixels aren't squares either, they're samples of a 2-dimensional<br />
function space and so they're also, conceptually, infinitely small<br />
points. Practically, it's a real pain in the ass to see or manipulate<br />
infinitely small anything, so big squares it is. Digital stairstep<br />
drawings are exactly the same thing.&rdquo;<br />
<br />
&ldquo;It's just a convenient drawing. The stairsteps aren't really there.&rdquo;<br />
<br />
==Bit-depth==<br />
[[Image:Dsat_009.jpg|360px|right]]<br />
[[Image:Dsat_010.jpg|260px|right]]<br />
<br />
When we convert a digital signal back to analog, the result is<br />
''also'' smooth regardless of the [[WikiPedia:Audio_bit_depth|bit depth]]. 24 bits or 16 bits...<br />
or 8 bits... it doesn't matter.<br />
<br />
So does that mean that the digital bit depth makes no difference at<br />
all? Of course not.<br />
<br />
Channel 2 here is the same sine wave input, but we quantize with<br />
[[WikiPedia:Dither|dither]] down to 8 bits.<br />
<br />
On the scope, we still see a nice<br />
smooth sine wave on channel 2. Look very close, and you'll also see a<br />
bit more noise. That's a clue.<br />
<br />
If we look at the spectrum of the signal... aha! Our sine wave is<br />
still there unaffected, but the noise level of the 8-bit signal on<br />
the second channel is much higher!<br />
<br />
And that's the difference the number of bits makes. That's it!<br />
<br />
When we digitize a signal, first we sample it. The<br />
sampling step is perfect; it loses nothing. But then we [[WikiPedia:Quantization_(sound_processing)|quantize]] it,<br />
and [[WikiPedia:Quantization_error|quantization adds noise]].<br />
<br />
The number of bits determines how much noise and so the level of the<br />
noise floor.<br />
<br />
What does this dithered quantization noise sound like? Let's listen<br />
to our 8-bit sine wave.<br />
<br />
That may have been hard to hear anything but the tone. Let's listen<br />
to just the noise after we notch out the sine wave and then bring the<br />
gain up a bit because the noise is quiet.<br />
<br />
Those of you who have used analog recording equipment may have just<br />
thought to yourselves, "My goodness! That sounds like tape hiss!"<br />
Well, it doesn't just sound like tape hiss, it acts like it too, and<br />
if we use a [[WikiPedia:Dither#Different_types|gaussian dither]] then it's<br />
[[WikiPedia:Central_limit_theorem|mathematically equivalent]] in every way. It ''is'' tape hiss.<br />
<br />
Intuitively, that means that we can measure tape hiss and thus the noise floor<br />
of [[WikiPedia:Magnetic_tape_sound_recording|magnetic audio tape]]<br />
in [[WikiPedia:Shannon–Hartley_theorem#Examples|bits instead of decibels]], in order to put things in a<br />
digital perspective. [[WikiPedia:Compact cassettes|Compact cassettes]] (for those of you who are old enough to remember them) could reach as<br />
deep as 9 bits in perfect conditions, though 5 to 6 bits was<br />
more typical, especially if it was a recording made on a<br />
[[WikiPedia:Cassette_deck|tape deck]]. That's right... your mix tapes were only about 6 bits<br />
deep... if you were lucky!<br />
<br />
The very best professional [[WikiPedia:Reel-to-reel_audio_tape_recording|open reel tape]] used in studios could barely<br />
hit... any guesses? 13 bits ''with'' [[WikiPedia:Reel-to-reel_audio_tape_recording#Noise_reduction|advanced noise reduction]]. And<br />
that's why seeing '[[WikiPedia:SPARS_code|D D D]]' on a [[WikiPedia:Compact_disk|Compact Disc]] used to be such a big,<br />
high-end deal.<br />
<br />
==Dither==<br />
[[Image:Dsat_011.png|360px|right]]<br />
<br />
I keep saying that I'm quantizing with [[Wikipedia:dither|dither]], so what is dither<br />
exactly and, more importantly, what does it do?<br />
<br />
The simple way to quantize a signal is to choose the digital<br />
amplitude value closest to the original analog amplitude. [[WikiPedia:Rounding|Obvious]],<br />
right? Unfortunately, the exact noise you get from this simple<br />
quantization scheme depends somewhat on the input signal,<br />
<br />
so we may get noise that's inconsistent, or causes distortion, or is<br />
undesirable in some other way.<br />
<br style="clear:both;"/><br />
<center><div style="background-color:#DDDDFF;border-color:#CCCCDD;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
'''Going deeper…'''<br />
*Cameron Nicklaus Christou's thesis [http://uwspace.uwaterloo.ca/bitstream/10012/3867/1/thesis.pdf Optimal Dither and Noise Shaping in Image Processing] provides an ''excellent'' explanation of dither and noise shaping.<br />
</div></center><br />
<br />
Dither is specially-constructed noise that substitutes for the noise<br />
produced by simple quantization. Dither doesn't [[WikiPedia:Sound_masking|drown out or mask]]<br />
quantization noise, it actually replaces it with noise characteristics<br />
of our choosing that aren't influenced by the input.<br />
<br />
Let's ''watch'' what dither does. The signal generator has too much noise for this test so we'll produce a mathematically perfect sine wave with the ThinkPad and quantize it to 8 bits with dithering.<br />
<br />
We see a nice sine wave on the waveform display and output scope and, once the analog spectrum analyzer catches up...<br />
a clean frequency peak with a uniform noise floor on both spectral displays<br />
just like before. Again, this is with dither.<br />
<br />
Now I turn dithering off.<br />
<br />
The quantization noise, that dither had spread out into a nice, flat noise<br />
floor, piles up into harmonic distortion peaks. The noise floor is<br />
lower, but the level of distortion becomes nonzero, and the distortion<br />
peaks sit higher than the dithering noise did.<br />
<br />
At 8 bits this effect is exaggerated. At 16 bits,<br />
even without dither, harmonic distortion is going to be so low as to<br />
be completely inaudible.<br />
<br />
Still, we can use dither to eliminate it completely if we so choose.<br />
<br />
Turning the dither off again for a moment, you'll notice that the<br />
absolute level of distortion from undithered quantization stays<br />
approximately constant regardless of the input amplitude.<br />
But when the signal level drops below a half a bit, everything<br />
quantizes to zero.<br />
<br />
In a sense, everything quantizing to zero is just 100% distortion!<br />
Dither eliminates this distortion too. We reenable dither<br />
and ... there's our signal back at 1/4 bit, with our nice flat noise floor.<br />
<br />
The noise floor doesn't have to be flat. Dither is noise of our<br />
choosing, so let's choose a noise as [http://www.acoustics.salford.ac.uk/res/cox/sound_quality/?content=subjective inoffensive] and<br />
[[WikiPedia:Absolute_threshold_of_hearing|difficult to notice]]<br />
as possible.<br />
<br />
Our hearing is most sensitive in the midrange from 2kHz to 4kHz,<br />
so that's where background noise is going to be the most obvious.<br />
We can [[WikiPedia:Noise_shaping|shape dithering noise]] away from sensitive frequencies to where<br />
hearing is less sensitive, usually the highest frequencies.<br />
<br />
16-bit dithering noise is normally much too quiet to hear at all, but<br />
let's listen to our noise shaping example, again with the gain<br />
brought way up...<br />
<br />
Lastly, dithered quantization noise ''is'' higher [[WikiPedia:Sound_power|power]] overall<br />
than undithered quantization noise even when it sounds quieter, and<br />
you can see that on a [[WikiPedia:VU_meter|VU meter]] during passages of near-silence. But<br />
dither isn't only an on or off choice. We can reduce the dither's<br />
power to balance less noise against a bit of distortion to minimize<br />
the overall effect.<br />
<br />
We'll also [[WikiPedia:Amplitude_modulation|modulate the input signal]] like this to show how a varying input affects the quantization noise. At<br />
full dithering power, the noise is uniform, constant, and featureless<br />
just like we expect:<br />
<br />
As we reduce the dither's power, the input increasingly<br />
affects the amplitude and the character of the quantization noise.<br />
Shaped dither behaves similarly, but noise shaping lends one more nice<br />
advantage. To make a long story short, it can use a somewhat lower<br />
dither power before the input has as much effect on the output.<br />
<br />
Despite all the time I just spent on dither, we're talking about<br />
differences that start 100 decibels and more below [[WikiPedia:Full_scale|full scale]]. Maybe<br />
if the CD had been<br />
[http://www.research.philips.com/technologies/projects/cd/index.html 14 bits as originally designed],<br />
dither ''might'' be<br />
more important. Maybe. At 16 bits, really, it's mostly a wash. You<br />
can think of dither as an insurance policy that gives several extra<br />
decibels of dynamic range just in case. The simple fact is, though, no<br />
one ever ruined a great recording by not dithering the final master.<br />
<br />
==Bandlimitation and timing==<br />
[[image:Dsat_013.jpg|360px|right]]<br />
<br />
We've been using [[WikiPedia:Sine_wave|sine waves]]. They're the obvious choice when what we<br />
want to see is a system's behavior at a given isolated frequency. Now<br />
let's look at something a bit more complex. What should we expect to<br />
happen when I change the input to a [[WikiPedia:Square_wave|square wave]]...<br />
<br />
The input scope confirms our 1kHz square wave. The output scope shows..<br />
<br />
<br />
Exactly what it should.<br />
...<br />
What is a square wave really? <br />
<br />
<br />
Well, we can say it's a waveform that's some positive value for half a cycle and then transitions instantaneously to a negative value for the other half.<br />
<br />
:<math><br />
\ x(t) = \begin{cases} 1, & |t| < T_1 \\ 0, & T_1 < |t| \leq {1 \over 2}T \end{cases}<br />
</math><br />
<br />
But that doesn't really tell us anything useful about how that input becomes this output.<br />
<br />
Then we remember that any waveform is also [[WikiPedia:Fourier_series|the sum of discrete frequencies]],<br />
and a square wave is particularly simple sum: a fundamental and an<br />
infinite series of [[WikiPedia:Even_and_odd_functions#Harmonics|odd harmonics]]. Sum them all up, you get a<br />
square wave.<br />
<br />
[[Image:dsat_015.jpg|360px|right]]<br />
:<math>\begin{align}<br />
x_{\mathrm{square}}(t) = \frac{4}{\pi}\sin(\omega t) + \frac{4}{3\pi}\sin(3\omega t) + \frac{4}{5\pi}\sin(5\omega t) + \\<br />
\frac{4}{7\pi}\sin(7\omega t) + \frac{4}{9\pi}\sin(9\omega t) + \frac{4}{11\pi}\sin(11\omega t) + \\ <br />
\frac{4}{13\pi}\sin(13\omega t) + \frac{4}{15\pi}\sin(15\omega t) + \frac{4}{17\pi}\sin(17\omega t) + \\<br />
\frac{4}{19\pi}\sin(19\omega t) + \frac{4}{21\pi}\sin(21\omega t) + \frac{4}{23\pi}\sin(23\omega t) + \\<br />
\frac{4}{25\pi}\sin(25\omega t) + \frac{4}{27\pi}\sin(27\omega t) + \frac{4}{29\pi}\sin(29\omega t) + \\<br />
\frac{4}{31\pi}\sin(31\omega t) + \frac{4}{33\pi}\sin(33\omega t) + \cdots <br />
\end{align}</math><br />
<br />
At first glance, that doesn't seem very useful either. You have to sum up an infinite number of harmonics to get the answer. ''Ah'', but we don't have an infinite number of harmonics.<br />
<br />
We're using a quite sharp [[WikiPedia:Low-pass_filter|anti-aliasing filter]] that cuts off right<br />
above 20kHz, so our signal is [[WikiPedia:Bandlimiting|bandlimited]], so only the first ten terms make it through.<br />
<br />
..and that's exactly what we see on the output scope.<br />
<br />
<br style="clear:both;"/><br />
<center><div style="background-color:#DDDDFF;border-color:#CCCCDD;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
'''Going deeper…'''<br />
*In modern web browsers you can program audio synthesizers directly in javascript. Use the two square wave formulas to get a square wave out of [http://js.do/blog/sound-waves-with-javascript/ this page]. (Note: The scope is not very useful.) <br />
</div></center><br />
<br />
The rippling you see around sharp edges in a bandlimited signal is called the [[WikiPedia:/Gibbs_phenomenon|Gibbs effect]]. It happens whenever you slice off part of the frequency domain in the middle of nonzero energy.<br />
<br />
The usual rule of thumb you'll hear is "the sharper the cutoff, the<br />
stronger the rippling", which is approximately true, but we have to be<br />
careful how we think about it.<br />
For example... what would you expect our quite sharp anti-aliasing filter<br />
to do if I run our signal through it a second time?<br />
<br />
Aside from adding a few fractional cycles of delay, the answer is...<br />
nothing at all. The signal is already bandlimited. Bandlimiting it<br />
again doesn't do anything. A second pass can't remove frequencies<br />
that we already removed.<br />
<br />
And that's important. People tend to think of the ripples as<br />
a kind of [[WikiPedia:Sonic_artifact|artifact]] that's added by anti-aliasing and [[WikiPedia:Reconstruction_filter|anti-imaging]]<br />
filters, implying that the ripples get worse each time the signal<br />
passes through. We can see that in this case that didn't happen. So<br />
was it really the filter that added the ripples the first time<br />
through? No, not really. It's a subtle distinction, but Gibbs effect<br />
ripples aren't added by filters, they're just part of what a<br />
bandlimited signal ''is''.<br />
<br />
Even if we synthetically construct what looks like a perfect digital<br />
square wave,<br />
<br />
it's still limited to the channel bandwidth. Remember,<br />
the stairstep representation is misleading.<br />
<br />
What we really have here are instantaneous sample points,<br />
<br />
and only one bandlimited signal fits those points. All we did when we<br />
drew our apparently perfect square wave was line up the sample points<br />
just right so it appeared that there were no ripples if we played<br />
[[WikiPedia:Interpolation|connect-the-dots]].<br />
<br />
But the original bandlimited signal, complete with ripples, was<br />
still there.<br />
<br />
[[image:Dsat_014.gif|360px|right]]<br />
And that leads us to one more important point. You've probably heard<br />
that the timing precision of a digital signal is limited by its sample<br />
rate; put another way,<br />
<br />
that digital signals can't represent anything that falls between the<br />
samples.. implying that [[WikiPedia:Dirac_delta_function|impulses]] or<br />
[[WikiPedia:Synthesizer#ADSR_envelope|fast attacks]] have to align exactly<br />
with a sample, or the timing gets mangled... or they just disappear.<br />
<br />
At this point, we can easily see why that's wrong.<br />
<br />
Again, our input signals are bandlimited. And digital signals are<br />
samples, not stairsteps, not 'connect-the-dots'. We most certainly<br />
can, for example, put the rising edge of our bandlimited square wave<br />
anywhere we want between samples.<br />
<br />
It's represented perfectly and it's reconstructed perfectly.<br />
<br />
==Epilogue==<br />
<br />
[[Image:Moffey.jpg|360px|right]]<br />
<br />
Just like in [[Videos/A_Digital_Media_Primer_For_Geeks|the previous episode]], we've covered a broad range of<br />
topics, and yet barely scratched the surface of each one. If anything, my<br />
sins of omission are greater this time around... but this is a good<br />
stopping point.<br />
<br />
Or maybe, a good starting point. Dig deeper. Experiment. I chose my<br />
demos very carefully to be simple and give clear results. You can<br />
reproduce every one of them on your own if you like. But let's face<br />
it, sometimes we learn the most about a spiffy toy by breaking it open<br />
and studying all the pieces that fall out. And that's OK, we're<br />
engineers. Play with the demo parameters, hack up the code, set up<br />
alternate experiments. The source code for everything, including the<br />
little pushbutton demo application, is up at xiph.org.<br />
<br />
In the course of experimentation, you're likely to run into something<br />
that you didn't expect and can't explain. Don't worry! My earlier<br />
snark aside, Wikipedia is fantastic for exactly this kind of casual<br />
research. And, if you're really serious about understanding signals,<br />
several universities have advanced materials online, such as the<br />
[http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-003-signals-and-systems-spring-2010/index.htm 6.003]<br />
and<br />
[http://ocw.mit.edu/resources/res-6-007-signals-and-systems-spring-2011/ RES.6-007]<br />
Signals and Systems modules at MIT OpenCourseWare. And of<br />
course, there's always the [http://webchat.freenode.net/?channels=xiph community here at Xiph.Org].<br />
<br />
Digging deeper or not, I am out of coffee, so, until next time, happy<br />
hacking!<br />
<br />
==Credits==<br />
[[Image:Dmpfg_019.png|360px|right]]<br />
Written by: Christopher (Monty) Montgomery and the Xiph.Org Community<br />
<br />
Special thanks to:<br />
*Heidi Baumgartner, for the second Tektronix oscilloscope<br />
*Gregory Maxwell and Dr. Timothy Terriberry, for additional technical review<br />
<br />
Intro, title and credits music:<br><br />
"[http://music.lousyrobot.com/track/andy-warhol-is-gone Andy Warhol Is Gone]", by Lousy Robot<br><br />
Used by permission of Lousy Robot.<br><br />
Original source track All Rights Reserved.<br><br />
[http://www.lousyrobot.com www.lousyrobot.com]<br />
<br />
This Video Was Produced Entirely With Free and Open Source Software:<br><br />
<br />
*[http://www.gnu.org/ GNU]<br><br />
*[http://www.linux.org/ Linux]<br><br />
*[http://fedoraproject.org/ Fedora]<br><br />
*[http://cinelerra.org/ Cinelerra]<br><br />
*[http://www.gimp.org/ The Gimp]<br><br />
*[http://audacity.sourceforge.net/ Audacity]<br><br />
*[http://svn.xiph.org/trunk/postfish/README Postfish]<br><br />
*[http://gstreamer.freedesktop.org/ Gstreamer]<br><br />
<br />
All trademarks are the property of their respective owners. <br />
<br />
*''Complete video'' [http://creativecommons.org/licenses/by-sa/3.0/legalcode CC-BY-SA]<br><br />
*''Text transcript and Wiki edition'' [http://creativecommons.org/licenses/by-sa/3.0/legalcode CC-BY-SA]<br><br />
<br />
A Co-Production of Xiph.Org and Red Hat, Inc.<br><br />
(C) 2012-2013, Some Rights Reserved<br><br />
<br />
== Use The Source Luke ==<br />
<br />
As stated in the Epilogue, everything that appears in the video demos is driven by open source software, which means the source is both available for inspection and freely usable by the community. The Thinkpad that appears in the video was running Fedora 17 and Gnome Shell (Gnome 3). The demonstration software does not require Fedora specifically, but it does require Gnu/Linux to run in its current form. In all, the video involved just under 50,000 lines of new and custom-purpose code (including contributions to non-Xiph projects such as Cinelerra and Gromit).<br />
<br />
=== The Spectrum and Waveform Viewer ===<br />
<br />
The realtime software spectrum analyzer application that appears in the video was a preexisting application that was dusted off and updated for use in the video. The waveform viewer (effectively a simple software oscilloscope) was written from scratch making use of some of the internals from the spectrum analyzer application. Both are available from Xiph.Org svn:<br />
<br />
<center><div style="background-color:#DDDDFF;border-color:#CCCCDD;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
*Source for the Spectrum and Waveform applications is found at:<br />
https://svn.xiph.org/trunk/spectrum/<br />
*The source can be checked out of svn using the following command line:<br />
svn co https://svn.xiph.org/trunk/spectrum<br />
*Trac is a convenient way to browse the source without checking out a copy:<br />
https://trac.xiph.org/browser/trunk/spectrum<br />
</div></center><br />
<br />
Spectrum and Waveform both expect an input stream on the command line, either as raw data or as a WAV file.<br />
<br />
=== GTK-Bounce ===<br />
<br />
The touch-controlled application used in the video is named 'gtk-bounce' and was custom-written for the sole purpose of the in-video demonstrations. It is so named because, for the most part, all it does is read the input from an audio device, and then immediately write the same data back out for playback. It also forwards a copy of this data to up to two external monitoring applications, and in several demos, applies simple filters or generates simple waveforms. It includes several demos not included in the video.<br />
<br />
<center><div style="background-color:#DDDDFF;border-color:#CCCCDD;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
*Source for gtk-bounce is found at:<br />
https://svn.xiph.org/trunk/Xiph-episode-II/bounce/<br />
*The source can be checked out of svn using the following command line:<br />
svn co https://svn.xiph.org/trunk/Xiph-episode-II/bounce/<br />
*Trac is a convenient way to browse the source without checking out a copy:<br />
https://trac.xiph.org/browser/Xiph-episode-II/bounce/<br />
</div></center><br />
<br />
==== Starting Gtk-bounce ====<br />
The application is somewhat hardwired for specific demo parameters, but most of the hardwired settings can be found at the top of each source file. As found in SVN, the application expects an ALSA hardware audio device at hw:1, and if none if found, it will wait for one to appear. Once a sound device is successfully initialized, it expects to find and open two pipes named pipe0 and pipe1 for output in the current directory. In the video, the waveform and spectrum applications are started to take input from pipe0 and pipe1 respectively. The output sent to the two pipes is identical, and in most demos matches the output data sent to the hardware device for conversion to analog. The only exception is the tenth demo panel (which does not appear in the video) where gtk-bounce can be set to monitor the hardware inputs instead while the outputs are used to produce test waveforms.<br />
<br />
Assuming gtk-bounce, spectrum and waveform have been checked out and built, the configuration seen in the video can be started using the following commands:<br />
<center><div style="background-color:#DDDDFF;border-color:#CCCCDD;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
* make the pipe fifos for the applications to communicate (only needs to be done once)<br />
mkfifo pipe0 pipe1<br />
* start all three applications<br />
waveform pipe0 & spectrum pipe1 & gtk-bounce &<br />
</div></center><br />
<br />
==== Using Gtk-bounce ====<br />
<br />
Gtk-bounce consists of eleven pushbutton panels (numbered zero through ten) that can be selected by scrolling up and dwon with the arrow buttons on the right side. Each panel is intended for a specific demo or part of a demo.<br />
<br />
<center><div style="background-color:#DDDDFF;border-color:#CCCCDD;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
<br />
[[Image:Dsat-panel0.png|700px|center]]<br />
* '''Panel 0''': This panel presents buttons that allow the sound card to be configured in several sampling rates and bit depths. Samples read from the audio inputs are sent to the output pipes and audio outputs for playback without modification.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel1.png|700px|center]]<br />
* '''Panel 1''': Both channels are forwarded to the outputs, however the user may select the bit depth of each channel independently. When the sound card is running in 16 bit mode and 16-bit depth is selected, the data is untouched. Requantization to a lower bit depth is performed with a flat triangle dither.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel2.png|700px|center]]<br />
* '''Panel 2''': Both channels are re-quantized to the selected bit depth. Requantization to a lower bit depth is performed with a flat triangle dither.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel3.png|700px|center]]<br />
* '''Panel 3''': 'generate sine wave' discards the audio inputs and instead internally generates a sine wave at 32 bit precision, which is then quantized to the selected bit depth, optionally with dither. The resulting signal is then forwarded to the output. <br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel4.png|700px|center]]<br />
* '''Panel 4''': gtk-bounce generates a 16-bit sine wave of the selected amplitude, optionally with dither, and forwards the resulting signal to the outputs. The audio input from the audio device is discarded. Note that the slider sets the peak amplitude, not the peak-to-peak amplitude.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel5.png|700px|center]]<br />
* '''Panel 5''': generates a 16-bit sine wave, optionally quantized using dither. The user may additionally select a flat or a shaped dither. The 'notch and gain' button applies a notch filter to the resulting signal, and boosts the gain of the remaining noise so that it's easily audible. The audio input from the audio device is discarded.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel6.png|700px|center]]<br />
* '''Panel 6''': allows the user to play with the power of the dithering noise applied before quantizating the sine wave. Shaped or flat dither are available. The sine wave may also be modulated with a varying amplitude to highlight correlations between the input and the resulting quantization noise. The 'notch and gain' button applies a notch filter to the resulting signal, and boosts the gain of the remaining noise so that it's easily audible. The audio input from the audio device is discarded.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel7.png|700px|center]]<br />
* '''Panel 7''': applies a sharper antialiasing (lowpass) filter than is likely to be built into the sound-card hardware (as there's generally no reason to use a filter quite this sharp in practice). The very sharp filter allows us to bandpass the demonstration squarewave without any harmonics landing in the transition band. <br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel8.png|700px|center]]<br />
* '''Panel 8''': when selected, generate a synthetic 'squarewave' (this is not quite equivalent to a bandlimited analog squarewave; the harmonic amplitudes are a bit different) that when aligned with the sampling phase just right gives the appearance of having infinite rise and fall time. The slider allows us to shift the waveform sample alignment back and forth by +/- one sample to reveal that the underlying signal is still band-limited.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel9.png|700px|center]]<br />
* '''Panel 9''': <br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel10.png|700px|center]]<br />
* '''Panel 10''': <br />
<div style="clear: both">&nbsp;</div><br />
<br />
</div></center><br />
<br />
=== Cairo Animations ===<br />
<br />
The animations featured throughout the Episode 2 video were rapid-development spaghetti hack-jobs coded by hand in raw Cairo. Each module generated a series of PNG stills that were then stitched into an animation with Cinelerra or mplayer. In the interest of pointing and laughing at what really bad code looks like...<br />
<br />
<center><div style="background-color:#DDDDFF;border-color:#CCCCDD;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
*Source for the Cairo animations is found at:<br />
https://svn.xiph.org/trunk/Xiph-episode-II/cairo/<br />
*The source can be checked out of svn using the following command line:<br />
svn co https://svn.xiph.org/trunk/Xiph-episode-II/cairo/<br />
*Trac is a convenient way to browse the source without checking out a copy:<br />
https://trac.xiph.org/browser/Xiph-episode-II/cairo/<br />
</div></center></div>Gmaxwellhttps://wiki.xiph.org/index.php?title=Videos/Digital_Show_and_Tell&diff=14005Videos/Digital Show and Tell2013-02-26T10:00:40Z<p>Gmaxwell: /* Bandlimitation and timing */ html audio api toy</p>
<hr />
<div><small>''Wiki edition''</small><br />
[[Image:dsat_001.jpg|400px|right]]<br />
<br />
Continuing in the "firehose" tradition of [[Videos/A_Digital_Media_Primer_For_Geeks|Episode 01]], Xiph.Org's second video on digital media explores multiple facets of digital audio signals and how they ''really'' behave in the real world.<br />
<br />
Demonstrations of sampling, quantization, bit-depth, and dither explore digital audio behavior on real audio equipment using both modern digital analysis and vintage analog bench equipment, just in case we can't trust those newfangled digital gizmos. You can download the source code for each demo and try it all for yourself!<br />
<br/><br/><br/><br />
<center><font size="+2">[http://www.xiph.org/video/vid2.shtml Download or Watch online]</font></center><br />
<br style="clear:both;"/><br />
Supported players: [http://www.videolan.org/vlc/ VLC 1.1+], [https://www.mozilla.com/en-US/firefox/ Firefox ], [http://www.chromium.org/Home Chrome ], [http://www.opera.com/ Opera]. Or see [http://www.webmproject.org/users/ other WebM] or [[TheoraSoftwarePlayers|other Theora]] players.<br />
<br />
If you're having trouble with playback in a modern browser or player, please visit our [[Playback_Troubleshooting|playback troubleshooting and discussion]] page.<br />
<br/><br />
<hr/><br />
<br/><br/><br/><br />
[[Image:Xiph_ep02_test.png|400px|right]]<br />
<br />
Hi, I'm Monty Montgomery from [http://www.redhat.com/ Red Hat] and [http://xiph.org/ Xiph.Org].<br />
<br />
A few months ago, I wrote<br />
[http://people.xiph.org/~xiphmont/demo/neil-young.html an article on digital audio and why 24bit/192kHz music downloads don't make sense].<br />
In the article, I<br />
mentioned--almost in passing--that a digital waveform is<br />
[http://people.xiph.org/~xiphmont/demo/neil-young.html#toc_sfam not a stairstep],<br />
and you certainly don't get a stairstep when you<br />
[[WikiPedia:Digital-to-analog_converter|convert from digital back to analog]].<br />
<br />
Of everything in the entire article, '''that''' was the number one thing<br />
people wrote about. In fact, more than half the mail I got was questions and<br />
comments about basic digital signal behavior. Since there's interest, let's<br />
take a little time to play with some ''simple'' digital signals.<br />
<br />
==Veritas ex machina==<br />
[[Image:Dsat_002.jpg|200px|right]]<br />
[[Image:Dsat_003.jpg|200px|right]]<br />
[[Image:Dsat_004.jpg|200px|right]]<br />
[[Image:Dsat_005.jpg|200px|right]]<br />
<br />
Pretend for a moment that we have no idea how digital signals really<br />
behave. In that case it doesn't make sense for us to use digital test<br />
equipment either. Fortunately for this exercise, there's still plenty<br />
of working analog lab equipment out there.<br />
<br />
First up, we need a [[WikiPedia:Function_generator|signal generator]] to provide us with analog input<br />
signals--in this case, an<br />
[http://www.home.agilent.com/en/pd-3325A%3Aepsg%3Apro-pn-3325A/synthesizer-function-generator?pm=PL&nid=-536900197.536896863&cc=SE&lc=swe HP3325]<br />
from 1978. It's still a pretty good<br />
generator, so if you don't mind the size, the weight, the power<br />
consumption, and the noisy fan, you can find them on eBay... occasionally<br />
for only slightly more than you'll pay for shipping.<br />
<br />
Next, we'll observe our analog waveforms on [[WikiPedia:Oscilloscope_types#Cathode-ray_oscilloscope_.28CRO.29|analog oscilloscopes]],<br />
like this Tektronix 2246 from the mid-90s, one of the last and very best analog scopes ever made. Every home lab should have one.<br />
<br />
...and finally inspect the [[WikiPedia:Spectral_density#Electrical_engineering|frequency spectrum]] of our signals using an<br />
[[WikiPedia:Spectrum_analyzer#Swept-tuned|analog spectrum analyzer]], this<br />
[http://www.home.agilent.com/en/pd-3585A%3Aepsg%3Apro-pn-3585A/spectrum-analyzer-high-perf-20hz-40mhz?pm=PL&nid=-536900197.536897319&cc=SE&lc=swe HP3585]<br />
from the same product line as<br />
the signal generator. Like the other equipment here it has<br />
[http://www.hp9845.net/9845/hardware/processors/ a rudimentary and hilariously large microcontroller],<br />
but the signal path<br />
from input to what you see on the screen is completely analog.<br />
<br />
All of this equipment is vintage, but aside from its raw tonnage, the specs are still quite good.<br />
<br />
At the moment, we have our signal generator set to output a nice 1 [[WikiPedia:Hertz#SI_multiples|kHz]]<br />
sine wave at one [[WikiPedia:Volt|Volt]] [[WikiPedia:Amplitude#Root_mean_square_amplitude|RMS]].<br />
We see the sine wave on the oscilloscope, can verify that it is indeed<br />
1 kHz at 1 Volt RMS, which is 2.8 Volts<br />
[[WikiPedia:Amplitude#Peak-to-peak_amplitude|peak-to-peak]],<br />
and that matches the<br />
measurement on the spectrum analyzer as well.<br />
<br />
The analyzer also shows some low-level [[WikiPedia:White_noise|white noise]]<br />
and just a bit of [[WikiPedia:Harmonic_distortion#Harmonic_distortion|harmonic distortion]],<br />
with the highest peak about 70[[WikiPedia:Decibel|dB]] or so below<br />
[[WikiPedia:Fundamental_frequency|the fundamental]].<br />
Now, this doesn't matter at all in our demos, but I<br />
wanted to point it out now just in case you didn't notice it until<br />
later.<br />
<br />
Now, we drop digital sampling in the middle.<br />
<br />
For the conversion, we'll use a boring, consumer-grade, eMagic USB1<br />
audio device. It's also more than ten years old at this point, and it's<br />
getting obsolete.<br />
<br />
A recent converter can easily have an order of magnitude better specs.<br />
[[WikiPedia:Reconstruction_filter#Sampled_data_reconstruction_filters|Flatness]],<br />
[[WikiPedia:Analog-to-digital_converter#Non-linearity|linearity]],<br />
[[WikiPedia:Jitter#Sampling_jitter|jitter]],<br />
[[WikiPedia:Noise_floor|noise behavior]],<br />
[[WikiPedia:Digital-to-analog_converter#DAC_performance|everything]]...<br />
you may not<br />
have noticed. Just because we can measure an improvement doesn't<br />
mean we can hear it, and even these old consumer boxes were already at<br />
the edge of ideal transparency.<br />
<br />
The eMagic connects to my ThinkPad, which displays a digital<br />
waveform and spectrum for comparison, then the ThinkPad<br />
sends the digital signal right back out to the eMagic for<br />
re-conversion to analog and observation on the output scopes.<br />
<br />
Input to output, left to right.<br />
<br style="clear:both;"/><br />
<br />
==Stairsteps==<br />
[[Image:Dsat 006.jpg|360px|right]]<br />
[[Image:Dsat 007.png|360px|right]]<br />
OK, it's go time. We begin by converting an analog signal to digital and<br />
then right back to analog again with no other steps.<br />
<br />
The signal generator is set to produce a 1kHz sine wave just like<br />
before.<br />
<br />
We can see our analog sine wave on our input-side oscilloscope.<br />
<br />
We digitize our signal to<br />
[[Videos/A_Digital_Media_Primer_For_Geeks#Raw_.28digital_audio.29_meat|16 bit PCM at 44.1kHz]],<br />
same as on a CD.<br />
The spectrum of the digitized signal matches what we saw earlier<br />
<br />
and what we see now on the analog spectrum analyzer, aside from its <br />
[[WikiPedia:High_impedance|high-impedance input]] being just a smidge noisier.<br />
<br />
For now, the waveform display shows our digitized sine wave as a<br />
stairstep pattern, one step for each sample.<br />
<br />
And when we look at the output signal that's been converted<br />
from digital back to analog, we see...<br />
<br />
It's exactly like the original sine wave. No stairsteps.<br />
<br />
OK, 1 kHz is still a fairly low frequency, maybe the stairsteps are just<br />
hard to see or they're being smoothed away. Fair enough. Let's choose<br />
a higher frequency, something close to [[WikiPedia:Nyquist_frequency|Nyquist]], say 15kHz.<br />
<br />
Now the sine wave is represented by less than three samples per cycle, and...<br />
<br />
the digital waveform looks pretty awful. Well, looks<br />
can be deceiving. The analog output...<br />
<br />
is still a perfect sine wave, exactly like the original.<br />
<br />
Let's keep going up.<br />
<br />
Let's see if I can do this without blocking any cameras.<br />
<br />
16kHz.... 17kHz... 18kHz... 19kHz... <br />
<br />
20kHz. Welcome to the upper limits of human hearing. The output<br />
waveform is still perfect. No jagged edges, no dropoff, no stairsteps.<br />
<br />
So where'd the stairsteps go? Don't answer, it's a trick question.<br />
They were never there.<br />
<br />
Drawing a digital waveform as a stairstep... was wrong to begin with.<br />
<br />
Why? A stairstep is a continuous-time function. It's jagged, and it's<br />
piecewise, but it has a defined value at every point in time.<br />
<br />
A sampled signal is entirely different. It's discrete-time; it's only<br />
got a value right at each instantaneous sample point and it's<br />
undefined, there is no value at all, everywhere between. A<br />
discrete-time signal is properly drawn as a lollipop graph.<br />
<br />
The continuous, analog counterpart of a digital signal passes<br />
smoothly through each sample point, and that's just as true for high<br />
frequencies as it is for low.<br />
<br />
Now, the interesting and not at all obvious bit is: [[WikiPedia:Nyquist%E2%80%93Shannon_sampling_theorem|there's only one<br />
bandlimited signal that passes exactly through each sample point]]. It's<br />
a unique solution. So if you sample a bandlimited signal and then<br />
convert it back, the original input is also the only possible output.<br />
<br />
[[Image:Dsat 008.png|360px|right]]<br />
<br />
And before you say, "oh, I can draw a different signal that passes<br />
through those points", well, yes you can, but if it differs even<br />
minutely from the original, it includes frequency content at or beyond<br />
Nyquist, breaks the bandlimiting requirement and isn't a valid<br />
solution.<br />
<br />
So how did everyone get confused and start thinking of digital signals<br />
as stairsteps? I can think of two good reasons.<br />
<br />
First: it's easy enough to convert a sampled signal to a true stairstep. Just<br />
extend each sample value forward until the next sample period. This is<br />
called a [[WikiPedia:Zero-order hold|zero-order hold]], and it's an important part of how some<br />
digital-to-analog converters work, especially the simplest ones.<br />
<br />
So, anyone who looks up [[WikiPedia:Digital-to-analog_converter#Practical_operation|digital-to-analog converter or<br />
digital-to-analog conversion]] is probably going to see a diagram of a<br />
stairstep waveform somewhere, but that's not a finished conversion,<br />
and it's not the signal that comes out.<br />
<br />
Second, and this is probably the more likely reason, engineers who<br />
supposedly know better, like me, draw stairsteps even though they're<br />
technically wrong. It's a sort of like a one-dimensional version of<br />
[[WikiPedia:MacPaint#Development|fat bits in an image editor]].<br />
<br />
Pixels aren't squares either, they're samples of a 2-dimensional<br />
function space and so they're also, conceptually, infinitely small<br />
points. Practically, it's a real pain in the ass to see or manipulate<br />
infinitely small anything, so big squares it is. Digital stairstep<br />
drawings are exactly the same thing.<br />
<br />
It's just a convenient drawing. The stairsteps aren't really there.<br />
<br />
==Bit-depth==<br />
[[Image:Dsat_009.jpg|360px|right]]<br />
[[Image:Dsat_010.jpg|260px|right]]<br />
<br />
When we convert a digital signal back to analog, the result is<br />
''also'' smooth regardless of the [[WikiPedia:Audio_bit_depth|bit depth]]. 24 bits or 16 bits...<br />
or 8 bits... it doesn't matter.<br />
<br />
So does that mean that the digital bit depth makes no difference at<br />
all? Of course not.<br />
<br />
Channel 2 here is the same sine wave input, but we quantize with<br />
[[WikiPedia:Dither|dither]] down to 8 bits.<br />
<br />
On the scope, we still see a nice<br />
smooth sine wave on channel 2. Look very close, and you'll also see a<br />
bit more noise. That's a clue.<br />
<br />
If we look at the spectrum of the signal... aha! Our sine wave is<br />
still there unaffected, but the noise level of the 8-bit signal on<br />
the second channel is much higher!<br />
<br />
And that's the difference the number of bits makes. That's it!<br />
<br />
When we digitize a signal, first we sample it. The<br />
sampling step is perfect; it loses nothing. But then we [[WikiPedia:Quantization_(sound_processing)|quantize]] it,<br />
and [[WikiPedia:Quantization_error|quantization adds noise]].<br />
<br />
The number of bits determines how much noise and so the level of the<br />
noise floor.<br />
<br />
What does this dithered quantization noise sound like? Let's listen<br />
to our 8-bit sine wave.<br />
<br />
That may have been hard to hear anything but the tone. Let's listen<br />
to just the noise after we notch out the sine wave and then bring the<br />
gain up a bit because the noise is quiet.<br />
<br />
Those of you who have used analog recording equipment may have just<br />
thought to yourselves, "My goodness! That sounds like tape hiss!"<br />
Well, it doesn't just sound like tape hiss, it acts like it too, and<br />
if we use a [[WikiPedia:Dither#Different_types|gaussian dither]] then it's<br />
[[WikiPedia:Central_limit_theorem|mathematically equivalent]] in every way. It ''is'' tape hiss.<br />
<br />
Intuitively, that means that we can measure tape hiss and thus the noise floor<br />
of [[WikiPedia:Magnetic_tape_sound_recording|magnetic audio tape]]<br />
in [[WikiPedia:Shannon–Hartley_theorem#Examples|bits instead of decibels]], in order to put things in a<br />
digital perspective. [[WikiPedia:Compact cassettes|Compact cassettes]] (for those of you who are old enough to remember them) could reach as<br />
deep as 9 bits in perfect conditions, though 5 to 6 bits was<br />
more typical, especially if it was a recording made on a<br />
[[WikiPedia:Cassette_deck|tape deck]]. That's right... your mix tapes were only about 6 bits<br />
deep... if you were lucky!<br />
<br />
The very best professional [[WikiPedia:Reel-to-reel_audio_tape_recording|open reel tape]] used in studios could barely<br />
hit... any guesses? 13 bits ''with'' [[WikiPedia:Reel-to-reel_audio_tape_recording#Noise_reduction|advanced noise reduction]]. And<br />
that's why seeing '[[WikiPedia:SPARS_code|D D D]]' on a [[WikiPedia:Compact_disk|Compact Disc]] used to be such a big,<br />
high-end deal.<br />
<br />
==Dither==<br />
[[Image:Dsat_011.png|360px|right]]<br />
<br />
I keep saying that I'm quantizing with [[Wikipedia:dither|dither]], so what is dither<br />
exactly and, more importantly, what does it do?<br />
<br />
The simple way to quantize a signal is to choose the digital<br />
amplitude value closest to the original analog amplitude. [[WikiPedia:Rounding|Obvious]],<br />
right? Unfortunately, the exact noise you get from this simple<br />
quantization scheme depends somewhat on the input signal,<br />
<br />
so we may get noise that's inconsistent, or causes distortion, or is<br />
undesirable in some other way.<br />
<br style="clear:both;"/><br />
<center><div style="background-color:#DDDDFF;border-color:#CCCCDD;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
'''Going deeper…'''<br />
*Cameron Nicklaus Christou's thesis [http://uwspace.uwaterloo.ca/bitstream/10012/3867/1/thesis.pdf Optimal Dither and Noise Shaping in Image Processing] provides an ''excellent'' explanation of dither and noise shaping.<br />
</div></center><br />
<br />
Dither is specially-constructed noise that substitutes for the noise<br />
produced by simple quantization. Dither doesn't [[WikiPedia:Sound_masking|drown out or mask]]<br />
quantization noise, it actually replaces it with noise characteristics<br />
of our choosing that aren't influenced by the input.<br />
<br />
Let's ''watch'' what dither does. The signal generator has too much noise for this test so we'll produce a mathematically perfect sine wave with the ThinkPad and quantize it to 8 bits with dithering.<br />
<br />
We see a nice sine wave on the waveform display and output scope and, once the analog spectrum analyzer catches up...<br />
a clean frequency peak with a uniform noise floor on both spectral displays<br />
just like before. Again, this is with dither.<br />
<br />
Now I turn dithering off.<br />
<br />
The quantization noise, that dither had spread out into a nice, flat noise<br />
floor, piles up into harmonic distortion peaks. The noise floor is<br />
lower, but the level of distortion becomes nonzero, and the distortion<br />
peaks sit higher than the dithering noise did.<br />
<br />
At 8 bits this effect is exaggerated. At 16 bits,<br />
even without dither, harmonic distortion is going to be so low as to<br />
be completely inaudible.<br />
<br />
Still, we can use dither to eliminate it completely if we so choose.<br />
<br />
Turning the dither off again for a moment, you'll notice that the<br />
absolute level of distortion from undithered quantization stays<br />
approximately constant regardless of the input amplitude.<br />
But when the signal level drops below a half a bit, everything<br />
quantizes to zero.<br />
<br />
In a sense, everything quantizing to zero is just 100% distortion!<br />
Dither eliminates this distortion too. We reenable dither<br />
and ... there's our signal back at 1/4 bit, with our nice flat noise floor.<br />
<br />
The noise floor doesn't have to be flat. Dither is noise of our<br />
choosing, so let's choose a noise as [http://www.acoustics.salford.ac.uk/res/cox/sound_quality/?content=subjective inoffensive] and<br />
[[WikiPedia:Absolute_threshold_of_hearing|difficult to notice]]<br />
as possible.<br />
<br />
Our hearing is most sensitive in the midrange from 2kHz to 4kHz,<br />
so that's where background noise is going to be the most obvious.<br />
We can [[WikiPedia:Noise_shaping|shape dithering noise]] away from sensitive frequencies to where<br />
hearing is less sensitive, usually the highest frequencies.<br />
<br />
16-bit dithering noise is normally much too quiet to hear at all, but<br />
let's listen to our noise shaping example, again with the gain<br />
brought way up...<br />
<br />
Lastly, dithered quantization noise ''is'' higher [[WikiPedia:Sound_power|power]] overall<br />
than undithered quantization noise even when it sounds quieter, and<br />
you can see that on a [[WikiPedia:VU_meter|VU meter]] during passages of near-silence. But<br />
dither isn't only an on or off choice. We can reduce the dither's<br />
power to balance less noise against a bit of distortion to minimize<br />
the overall effect.<br />
<br />
We'll also [[WikiPedia:Amplitude_modulation|modulate the input signal]] like this to show how a varying input affects the quantization noise. At<br />
full dithering power, the noise is uniform, constant, and featureless<br />
just like we expect:<br />
<br />
As we reduce the dither's power, the input increasingly<br />
affects the amplitude and the character of the quantization noise.<br />
Shaped dither behaves similarly, but noise shaping lends one more nice<br />
advantage. To make a long story short, it can use a somewhat lower<br />
dither power before the input has as much effect on the output.<br />
<br />
Despite all the time I just spent on dither, we're talking about<br />
differences that start 100 decibels and more below [[WikiPedia:Full_scale|full scale]]. Maybe<br />
if the CD had been<br />
[http://www.research.philips.com/technologies/projects/cd/index.html 14 bits as originally designed],<br />
dither ''might'' be<br />
more important. Maybe. At 16 bits, really, it's mostly a wash. You<br />
can think of dither as an insurance policy that gives several extra<br />
decibels of dynamic range just in case. The simple fact is, though, no<br />
one ever ruined a great recording by not dithering the final master.<br />
<br />
==Bandlimitation and timing==<br />
[[image:Dsat_013.jpg|360px|right]]<br />
<br />
We've been using [[WikiPedia:Sine_wave|sine waves]]. They're the obvious choice when what we<br />
want to see is a system's behavior at a given isolated frequency. Now<br />
let's look at something a bit more complex. What should we expect to<br />
happen when I change the input to a [[WikiPedia:Square_wave|square wave]]...<br />
<br />
The input scope confirms our 1kHz square wave. The output scope shows..<br />
<br />
<br />
Exactly what it should.<br />
...<br />
What is a square wave really? <br />
<br />
<br />
Well, we can say it's a waveform that's some positive value for half a cycle and then transitions instantaneously to a negative value for the other half.<br />
<br />
:<math><br />
\ x(t) = \begin{cases} 1, & |t| < T_1 \\ 0, & T_1 < |t| \leq {1 \over 2}T \end{cases}<br />
</math><br />
<br />
But that doesn't really tell us anything useful about how that input becomes this output.<br />
<br />
Then we remember that any waveform is also [[WikiPedia:Fourier_series|the sum of discrete frequencies]],<br />
and a square wave is particularly simple sum: a fundamental and an<br />
infinite series of [[WikiPedia:Even_and_odd_functions#Harmonics|odd harmonics]]. Sum them all up, you get a<br />
square wave.<br />
<br />
[[Image:dsat_015.jpg|360px|right]]<br />
:<math>\begin{align}<br />
x_{\mathrm{square}}(t) = \frac{4}{\pi}\sin(\omega t) + \frac{4}{3\pi}\sin(3\omega t) + \frac{4}{5\pi}\sin(5\omega t) + \\<br />
\frac{4}{7\pi}\sin(7\omega t) + \frac{4}{9\pi}\sin(9\omega t) + \frac{4}{11\pi}\sin(11\omega t) + \\ <br />
\frac{4}{13\pi}\sin(13\omega t) + \frac{4}{15\pi}\sin(15\omega t) + \frac{4}{17\pi}\sin(17\omega t) + \\<br />
\frac{4}{19\pi}\sin(19\omega t) + \frac{4}{21\pi}\sin(21\omega t) + \frac{4}{23\pi}\sin(23\omega t) + \\<br />
\frac{4}{25\pi}\sin(25\omega t) + \frac{4}{27\pi}\sin(27\omega t) + \frac{4}{29\pi}\sin(29\omega t) + \\<br />
\frac{4}{31\pi}\sin(31\omega t) + \frac{4}{33\pi}\sin(33\omega t) + \cdots <br />
\end{align}</math><br />
<br />
At first glance, that doesn't seem very useful either. You have to sum up an infinite number of harmonics to get the answer. ''Ah'', but we don't have an infinite number of harmonics.<br />
<br />
We're using a quite sharp [[WikiPedia:Low-pass_filter|anti-aliasing filter]] that cuts off right<br />
above 20kHz, so our signal is [[WikiPedia:Bandlimiting|bandlimited]], so only the first ten terms make it through.<br />
<br />
..and that's exactly what we see on the output scope.<br />
<br />
<br style="clear:both;"/><br />
<center><div style="background-color:#DDDDFF;border-color:#CCCCDD;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
'''Going deeper…'''<br />
*In modern web browsers you can program audio synthesizers directly in javascript. Use the two square wave formulas to get a square wave out of [http://js.do/blog/sound-waves-with-javascript/ this page]. (Note: The scope is not very useful.) <br />
</div></center><br />
<br />
The rippling you see around sharp edges in a bandlimited signal is called the [[WikiPedia:/Gibbs_phenomenon|Gibbs effect]]. It happens whenever you slice off part of the frequency domain in the middle of nonzero energy.<br />
<br />
The usual rule of thumb you'll hear is "the sharper the cutoff, the<br />
stronger the rippling", which is approximately true, but we have to be<br />
careful how we think about it.<br />
For example... what would you expect our quite sharp anti-aliasing filter<br />
to do if I run our signal through it a second time?<br />
<br />
Aside from adding a few fractional cycles of delay, the answer is...<br />
nothing at all. The signal is already bandlimited. Bandlimiting it<br />
again doesn't do anything. A second pass can't remove frequencies<br />
that we already removed.<br />
<br />
And that's important. People tend to think of the ripples as<br />
a kind of [[WikiPedia:Sonic_artifact|artifact]] that's added by anti-aliasing and [[WikiPedia:Reconstruction_filter|anti-imaging]]<br />
filters, implying that the ripples get worse each time the signal<br />
passes through. We can see that in this case that didn't happen. So<br />
was it really the filter that added the ripples the first time<br />
through? No, not really. It's a subtle distinction, but Gibbs effect<br />
ripples aren't added by filters, they're just part of what a<br />
bandlimited signal ''is''.<br />
<br />
Even if we synthetically construct what looks like a perfect digital<br />
square wave,<br />
<br />
it's still limited to the channel bandwidth. Remember,<br />
the stairstep representation is misleading.<br />
<br />
What we really have here are instantaneous sample points,<br />
<br />
and only one bandlimited signal fits those points. All we did when we<br />
drew our apparently perfect square wave was line up the sample points<br />
just right so it appeared that there were no ripples if we played<br />
[[WikiPedia:Interpolation|connect-the-dots]].<br />
<br />
But the original bandlimited signal, complete with ripples, was<br />
still there.<br />
<br />
[[image:Dsat_014.gif|360px|right]]<br />
And that leads us to one more important point. You've probably heard<br />
that the timing precision of a digital signal is limited by its sample<br />
rate; put another way,<br />
<br />
that digital signals can't represent anything that falls between the<br />
samples.. implying that [[WikiPedia:Dirac_delta_function|impulses]] or<br />
[[WikiPedia:Synthesizer#ADSR_envelope|fast attacks]] have to align exactly<br />
with a sample, or the timing gets mangled... or they just disappear.<br />
<br />
At this point, we can easily see why that's wrong.<br />
<br />
Again, our input signals are bandlimited. And digital signals are<br />
samples, not stairsteps, not 'connect-the-dots'. We most certainly<br />
can, for example, put the rising edge of our bandlimited square wave<br />
anywhere we want between samples.<br />
<br />
It's represented perfectly and it's reconstructed perfectly.<br />
<br />
==Epilogue==<br />
<br />
[[Image:Moffey.jpg|360px|right]]<br />
<br />
Just like in [[Videos/A_Digital_Media_Primer_For_Geeks|the previous episode]], we've covered a broad range of<br />
topics, and yet barely scratched the surface of each one. If anything, my<br />
sins of omission are greater this time around... but this is a good<br />
stopping point.<br />
<br />
Or maybe, a good starting point. Dig deeper. Experiment. I chose my<br />
demos very carefully to be simple and give clear results. You can<br />
reproduce every one of them on your own if you like. But let's face<br />
it, sometimes we learn the most about a spiffy toy by breaking it open<br />
and studying all the pieces that fall out. And that's OK, we're<br />
engineers. Play with the demo parameters, hack up the code, set up<br />
alternate experiments. The source code for everything, including the<br />
little pushbutton demo application, is up at xiph.org.<br />
<br />
In the course of experimentation, you're likely to run into something<br />
that you didn't expect and can't explain. Don't worry! My earlier<br />
snark aside, Wikipedia is fantastic for exactly this kind of casual<br />
research. And, if you're really serious about understanding signals,<br />
several universities have advanced materials online, such as the<br />
[http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-003-signals-and-systems-spring-2010/index.htm 6.003]<br />
and<br />
[http://ocw.mit.edu/resources/res-6-007-signals-and-systems-spring-2011/ RES.6-007]<br />
Signals and Systems modules at MIT OpenCourseWare. And of<br />
course, there's always the [http://webchat.freenode.net/?channels=xiph community here at Xiph.Org].<br />
<br />
Digging deeper or not, I am out of coffee, so, until next time, happy<br />
hacking!<br />
<br />
==Credits==<br />
[[Image:Dmpfg_019.png|360px|right]]<br />
Written by: Christopher (Monty) Montgomery and the Xiph.Org Community<br />
<br />
Special thanks to:<br />
*Heidi Baumgartner, for the second Tektronix oscilloscope<br />
*Gregory Maxwell and Dr. Timothy Terriberry, for additional technical review<br />
<br />
Intro, title and credits music:<br><br />
"[http://music.lousyrobot.com/track/andy-warhol-is-gone Andy Warhol Is Gone]", by Lousy Robot<br><br />
Used by permission of Lousy Robot.<br><br />
Original source track All Rights Reserved.<br><br />
[http://www.lousyrobot.com www.lousyrobot.com]<br />
<br />
This Video Was Produced Entirely With Free and Open Source Software:<br><br />
<br />
*[http://www.gnu.org/ GNU]<br><br />
*[http://www.linux.org/ Linux]<br><br />
*[http://fedoraproject.org/ Fedora]<br><br />
*[http://cinelerra.org/ Cinelerra]<br><br />
*[http://www.gimp.org/ The Gimp]<br><br />
*[http://audacity.sourceforge.net/ Audacity]<br><br />
*[http://svn.xiph.org/trunk/postfish/README Postfish]<br><br />
*[http://gstreamer.freedesktop.org/ Gstreamer]<br><br />
<br />
All trademarks are the property of their respective owners. <br />
<br />
*''Complete video'' [http://creativecommons.org/licenses/by-sa/3.0/legalcode CC-BY-SA]<br><br />
*''Text transcript and Wiki edition'' [http://creativecommons.org/licenses/by-sa/3.0/legalcode CC-BY-SA]<br><br />
<br />
A Co-Production of Xiph.Org and Red Hat, Inc.<br><br />
(C) 2012-2013, Some Rights Reserved<br><br />
<br />
== Use The Source Luke ==<br />
<br />
As stated in the Epilogue, everything that appears in the video demos is driven by open source software, which means the source is both available for inspection and freely usable by the community. The Thinkpad that appears in the video was running Fedora 17 and Gnome Shell (Gnome 3). The demonstration software does not require Fedora specifically, but it does require Gnu/Linux to run in its current form. In all, the video involved just under 50,000 lines of new and custom-purpose code (including contributions to non-Xiph projects such as Cinelerra and Gromit).<br />
<br />
=== The Spectrum and Waveform Viewer ===<br />
<br />
The realtime software spectrum analyzer application that appears in the video was a preexisting application that was dusted off and updated for use in the video. The waveform viewer (effectively a simple software oscilloscope) was written from scratch making use of some of the internals from the spectrum analyzer application. Both are available from Xiph.Org svn:<br />
<br />
<center><div style="background-color:#DDDDFF;border-color:#CCCCDD;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
*Source for the Spectrum and Waveform applications is found at:<br />
https://svn.xiph.org/trunk/spectrum/<br />
*The source can be checked out of svn using the following command line:<br />
svn co https://svn.xiph.org/trunk/spectrum<br />
*Trac is a convenient way to browse the source without checking out a copy:<br />
https://trac.xiph.org/browser/trunk/spectrum<br />
</div></center><br />
<br />
Spectrum and Waveform both expect an input stream on the command line, either as raw data or as a WAV file.<br />
<br />
=== GTK-Bounce ===<br />
<br />
The touch-controlled application used in the video is named 'gtk-bounce' and was custom-written for the sole purpose of the in-video demonstrations. It is so named because, for the most part, all it does is read the input from an audio device, and then immediately write the same data back out for playback. It also forwards a copy of this data to up to two external monitoring applications, and in several demos, applies simple filters or generates simple waveforms. It includes several demos not included in the video.<br />
<br />
<center><div style="background-color:#DDDDFF;border-color:#CCCCDD;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
*Source for gtk-bounce is found at:<br />
https://svn.xiph.org/trunk/Xiph-episode-II/bounce/<br />
*The source can be checked out of svn using the following command line:<br />
svn co https://svn.xiph.org/trunk/Xiph-episode-II/bounce/<br />
*Trac is a convenient way to browse the source without checking out a copy:<br />
https://trac.xiph.org/browser/Xiph-episode-II/bounce/<br />
</div></center><br />
<br />
==== Starting Gtk-bounce ====<br />
The application is somewhat hardwired for specific demo parameters, but most of the hardwired settings can be found at the top of each source file. As found in SVN, the application expects an ALSA hardware audio device at hw:1, and if none if found, it will wait for one to appear. Once a sound device is successfully initialized, it expects to find and open two pipes named pipe0 and pipe1 for output in the current directory. In the video, the waveform and spectrum applications are started to take input from pipe0 and pipe1 respectively. The output sent to the two pipes is identical, and in most demos matches the output data sent to the hardware device for conversion to analog. The only exception is the tenth demo panel (which does not appear in the video) where gtk-bounce can be set to monitor the hardware inputs instead while the outputs are used to produce test waveforms.<br />
<br />
Assuming gtk-bounce, spectrum and waveform have been checked out and built, the configuration seen in the video can be started using the following commands:<br />
<center><div style="background-color:#DDDDFF;border-color:#CCCCDD;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
* make the pipe fifos for the applications to communicate (only needs to be done once)<br />
mkfifo pipe0 pipe1<br />
* start all three applications<br />
waveform pipe0 & spectrum pipe1 & gtk-bounce &<br />
</div></center><br />
<br />
==== Using Gtk-bounce ====<br />
<br />
Gtk-bounce consists of eleven pushbutton panels (numbered zero through ten) that can be selected by scrolling up and dwon with the arrow buttons on the right side. Each panel is intended for a specific demo or part of a demo.<br />
<br />
<center><div style="background-color:#DDDDFF;border-color:#CCCCDD;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
<br />
[[Image:Dsat-panel0.png|700px|center]]<br />
* '''Panel 0''': This panel presents buttons that allow the sound card to be configured in several sampling rates and bit depths. Samples read from the audio inputs are sent to the output pipes and audio outputs for playback without modification.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel1.png|700px|center]]<br />
* '''Panel 1''': Both channels are forwarded to the outputs, however the user may select the bit depth of each channel independently. When the sound card is running in 16 bit mode and 16-bit depth is selected, the data is untouched. Requantization to a lower bit depth is performed with a flat triangle dither.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel2.png|700px|center]]<br />
* '''Panel 2''': Both channels are re-quantized to the selected bit depth. Requantization to a lower bit depth is performed with a flat triangle dither.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel3.png|700px|center]]<br />
* '''Panel 3''': 'generate sine wave' discards the audio inputs and instead internally generates a sine wave at 32 bit precision, which is then quantized to the selected bit depth, optionally with dither. The resulting signal is then forwarded to the output. <br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel4.png|700px|center]]<br />
* '''Panel 4''': gtk-bounce generates a 16-bit sine wave of the selected amplitude, optionally with dither, and forwards the resulting signal to the outputs. The audio input from the audio device is discarded. Note that the slider sets the peak amplitude, not the peak-to-peak amplitude.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel5.png|700px|center]]<br />
* '''Panel 5''': generates a 16-bit sine wave, optionally quantized using dither. The user may additionally select a flat or a shaped dither. The 'notch and gain' button applies a notch filter to the resulting signal, and boosts the gain of the remaining noise so that it's easily audible. The audio input from the audio device is discarded.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel6.png|700px|center]]<br />
* '''Panel 6''': allows the user to play with the power of the dithering noise applied before quantizating the sine wave. Shaped or flat dither are available. The sine wave may also be modulated with a varying amplitude to highlight correlations between the input and the resulting quantization noise. The 'notch and gain' button applies a notch filter to the resulting signal, and boosts the gain of the remaining noise so that it's easily audible. The audio input from the audio device is discarded.<br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel7.png|700px|center]]<br />
* '''Panel 7''': applies a sharper antialiasing (lowpass) filter than is likely to be built into the sound-card hardware (as there's generally no reason to use a filter quite this sharp in practice). The very sharp filter allows us to bandpass the demonstration squarewave without any harmonics landing in the transition band. <br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel8.png|700px|center]]<br />
* '''Panel 8''': <br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel9.png|700px|center]]<br />
* '''Panel 9''': <br />
<div style="clear: both">&nbsp;</div><br />
<br />
[[Image:Dsat-panel10.png|700px|center]]<br />
* '''Panel 10''': <br />
<div style="clear: both">&nbsp;</div><br />
<br />
</div></center><br />
<br />
=== Cairo Animations ===<br />
<br />
The animations featured throughout the Episode 2 video were rapid-development spaghetti hack-jobs coded by hand in raw Cairo. Each module generated a series of PNG stills that were then stitched into an animation with Cinelerra or mplayer. In the interest of pointing and laughing at what really bad code looks like...<br />
<br />
<center><div style="background-color:#DDDDFF;border-color:#CCCCDD;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
*Source for the Cairo animations is found at:<br />
https://svn.xiph.org/trunk/Xiph-episode-II/cairo/<br />
*The source can be checked out of svn using the following command line:<br />
svn co https://svn.xiph.org/trunk/Xiph-episode-II/cairo/<br />
*Trac is a convenient way to browse the source without checking out a copy:<br />
https://trac.xiph.org/browser/Xiph-episode-II/cairo/<br />
</div></center></div>Gmaxwellhttps://wiki.xiph.org/index.php?title=Videos/Digital_Show_and_Tell&diff=13994Videos/Digital Show and Tell2013-02-26T09:30:54Z<p>Gmaxwell: /* Credits */ audio track link.</p>
<hr />
<div><small>''Wiki edition''</small><br />
[[Image:dsat_001.jpg|400px|right]]<br />
<br />
Continuing in the "firehose" tradition of [[Videos/A_Digital_Media_Primer_For_Geeks|Episode 01]], Xiph.Org's second video on digital media explores multiple facets of digital audio signals and how they ''really'' behave in the real world.<br />
<br />
Demonstrations of sampling, quantization, bit-depth, and dither explore digital audio behavior on real audio equipment using both modern digital analysis and vintage analog bench equipment, just in case we can't trust those newfangled digital gizmos. You can download the source code for each demo and try it all for yourself!<br />
<br/><br/><br/><br />
<center><font size="+2">[http://www.xiph.org/video/vid2.shtml Download or Watch online]</font></center><br />
<br style="clear:both;"/><br />
Supported players: [http://www.videolan.org/vlc/ VLC 1.1+], [https://www.mozilla.com/en-US/firefox/ Firefox ], [http://www.chromium.org/Home Chrome ], [http://www.opera.com/ Opera]. Or see [http://www.webmproject.org/users/ other WebM] or [[TheoraSoftwarePlayers|other Theora]] players.<br />
<br />
If you're having trouble with playback in a modern browser or player, please visit our [[Playback_Troubleshooting|playback troubleshooting and discussion]] page.<br />
<br/><br />
<hr/><br />
<br/><br/><br/><br />
[[Image:Xiph_ep02_test.png|400px|right]]<br />
<br />
Hi, I'm Monty Montgomery from [http://www.redhat.com/ Red Hat] and [http://xiph.org/ Xiph.Org].<br />
<br />
A few months ago, I wrote<br />
[http://people.xiph.org/~xiphmont/demo/neil-young.html an article on digital audio and why 24bit/192kHz music downloads don't make sense].<br />
In the article, I<br />
mentioned--almost in passing--that a digital waveform is<br />
[http://people.xiph.org/~xiphmont/demo/neil-young.html#toc_sfam not a stairstep],<br />
and you certainly don't get a stairstep when you<br />
[[WikiPedia:Digital-to-analog_converter|convert from digital back to analog]].<br />
<br />
Of everything in the entire article, '''that''' was the number one thing<br />
people wrote about. In fact, more than half the mail I got was questions and<br />
comments about basic digital signal behavior. Since there's interest, let's<br />
take a little time to play with some ''simple'' digital signals.<br />
<br />
==Veritas ex machina==<br />
[[Image:Dsat_002.jpg|200px|right]]<br />
[[Image:Dsat_003.jpg|200px|right]]<br />
[[Image:Dsat_004.jpg|200px|right]]<br />
[[Image:Dsat_005.jpg|200px|right]]<br />
<br />
Pretend for a moment that we have no idea how digital signals really<br />
behave. In that case it doesn't make sense for us to use digital test<br />
equipment either. Fortunately for this exercise, there's still plenty<br />
of working analog lab equipment out there.<br />
<br />
First up, we need a [[WikiPedia:Function_generator|signal generator]] to provide us with analog input<br />
signals--in this case, an<br />
[http://www.home.agilent.com/en/pd-3325A%3Aepsg%3Apro-pn-3325A/synthesizer-function-generator?pm=PL&nid=-536900197.536896863&cc=SE&lc=swe HP3325]<br />
from 1978. It's still a pretty good<br />
generator, so if you don't mind the size, the weight, the power<br />
consumption, and the noisy fan, you can find them on eBay... occasionally<br />
for only slightly more than you'll pay for shipping.<br />
<br />
Next, we'll observe our analog waveforms on [[WikiPedia:Oscilloscope_types#Cathode-ray_oscilloscope_.28CRO.29|analog oscilloscopes]],<br />
like this Tektronix 2246 from the mid-90s, one of the last and very best analog scopes ever made. Every home lab should have one.<br />
<br />
...and finally inspect the [[WikiPedia:Spectral_density#Electrical_engineering|frequency spectrum]] of our signals using an<br />
[[WikiPedia:Spectrum_analyzer#Swept-tuned|analog spectrum analyzer]], this<br />
[http://www.home.agilent.com/en/pd-3585A%3Aepsg%3Apro-pn-3585A/spectrum-analyzer-high-perf-20hz-40mhz?pm=PL&nid=-536900197.536897319&cc=SE&lc=swe HP3585]<br />
from the same product line as<br />
the signal generator. Like the other equipment here it has<br />
[http://www.hp9845.net/9845/hardware/processors/ a rudimentary and hilariously large microcontroller],<br />
but the signal path<br />
from input to what you see on the screen is completely analog.<br />
<br />
All of this equipment is vintage, but aside from its raw tonnage, the specs are still quite good.<br />
<br />
At the moment, we have our signal generator set to output a nice 1 [[WikiPedia:Hertz#SI_multiples|kHz]]<br />
sine wave at one [[WikiPedia:Volt|Volt]] [[WikiPedia:Amplitude#Root_mean_square_amplitude|RMS]].<br />
We see the sine wave on the oscilloscope, can verify that it is indeed<br />
1 kHz at 1 Volt RMS, which is 2.8 Volts<br />
[[WikiPedia:Amplitude#Peak-to-peak_amplitude|peak-to-peak]],<br />
and that matches the<br />
measurement on the spectrum analyzer as well.<br />
<br />
The analyzer also shows some low-level [[WikiPedia:White_noise|white noise]]<br />
and just a bit of [[WikiPedia:Harmonic_distortion#Harmonic_distortion|harmonic distortion]],<br />
with the highest peak about 70[[WikiPedia:Decibel|dB]] or so below<br />
[[WikiPedia:Fundamental_frequency|the fundamental]].<br />
Now, this doesn't matter at all in our demos, but I<br />
wanted to point it out now just in case you didn't notice it until<br />
later.<br />
<br />
Now, we drop digital sampling in the middle.<br />
<br />
For the conversion, we'll use a boring, consumer-grade, eMagic USB1<br />
audio device. It's also more than ten years old at this point, and it's<br />
getting obsolete.<br />
<br />
A recent converter can easily have an order of magnitude better specs.<br />
[[WikiPedia:Reconstruction_filter#Sampled_data_reconstruction_filters|Flatness]],<br />
[[WikiPedia:Analog-to-digital_converter#Non-linearity|linearity]],<br />
[[WikiPedia:Jitter#Sampling_jitter|jitter]],<br />
[[WikiPedia:Noise_floor|noise behavior]],<br />
[[WikiPedia:Digital-to-analog_converter#DAC_performance|everything]]...<br />
you may not<br />
have noticed. Just because we can measure an improvement doesn't<br />
mean we can hear it, and even these old consumer boxes were already at<br />
the edge of ideal transparency.<br />
<br />
The eMagic connects to my ThinkPad, which displays a digital<br />
waveform and spectrum for comparison, then the ThinkPad<br />
sends the digital signal right back out to the eMagic for<br />
re-conversion to analog and observation on the output scopes.<br />
<br />
Input to output, left to right.<br />
<br style="clear:both;"/><br />
<br />
==Stairsteps==<br />
[[Image:Dsat 006.jpg|360px|right]]<br />
[[Image:Dsat 007.png|360px|right]]<br />
OK, it's go time. We begin by converting an analog signal to digital and<br />
then right back to analog again with no other steps.<br />
<br />
The signal generator is set to produce a 1kHz sine wave just like<br />
before.<br />
<br />
We can see our analog sine wave on our input-side oscilloscope.<br />
<br />
We digitize our signal to<br />
[[Videos/A_Digital_Media_Primer_For_Geeks#Raw_.28digital_audio.29_meat|16 bit PCM at 44.1kHz]],<br />
same as on a CD.<br />
The spectrum of the digitized signal matches what we saw earlier<br />
<br />
and what we see now on the analog spectrum analyzer, aside from its <br />
[[WikiPedia:High_impedance|high-impedance input]] being just a smidge noisier.<br />
<br />
For now, the waveform display shows our digitized sine wave as a<br />
stairstep pattern, one step for each sample.<br />
<br />
And when we look at the output signal that's been converted<br />
from digital back to analog, we see...<br />
<br />
It's exactly like the original sine wave. No stairsteps.<br />
<br />
OK, 1 kHz is still a fairly low frequency, maybe the stairsteps are just<br />
hard to see or they're being smoothed away. Fair enough. Let's choose<br />
a higher frequency, something close to [[WikiPedia:Nyquist_frequency|Nyquist]], say 15kHz.<br />
<br />
Now the sine wave is represented by less than three samples per cycle, and...<br />
<br />
the digital waveform looks pretty awful. Well, looks<br />
can be deceiving. The analog output...<br />
<br />
is still a perfect sine wave, exactly like the original.<br />
<br />
Let's keep going up.<br />
<br />
Let's see if I can do this without blocking any cameras.<br />
<br />
16kHz.... 17kHz... 18kHz... 19kHz... <br />
<br />
20kHz. Welcome to the upper limits of human hearing. The output<br />
waveform is still perfect. No jagged edges, no dropoff, no stairsteps.<br />
<br />
So where'd the stairsteps go? Don't answer, it's a trick question.<br />
They were never there.<br />
<br />
Drawing a digital waveform as a stairstep... was wrong to begin with.<br />
<br />
Why? A stairstep is a continuous-time function. It's jagged, and it's<br />
piecewise, but it has a defined value at every point in time.<br />
<br />
A sampled signal is entirely different. It's discrete-time; it's only<br />
got a value right at each instantaneous sample point and it's<br />
undefined, there is no value at all, everywhere between. A<br />
discrete-time signal is properly drawn as a lollipop graph.<br />
<br />
The continuous, analog counterpart of a digital signal passes<br />
smoothly through each sample point, and that's just as true for high<br />
frequencies as it is for low.<br />
<br />
Now, the interesting and not at all obvious bit is: [[WikiPedia:Nyquist%E2%80%93Shannon_sampling_theorem|there's only one<br />
bandlimited signal that passes exactly through each sample point]]. It's<br />
a unique solution. So if you sample a bandlimited signal and then<br />
convert it back, the original input is also the only possible output.<br />
<br />
[[Image:Dsat 008.png|360px|right]]<br />
<br />
And before you say, "oh, I can draw a different signal that passes<br />
through those points", well, yes you can, but if it differs even<br />
minutely from the original, it includes frequency content at or beyond<br />
Nyquist, breaks the bandlimiting requirement and isn't a valid<br />
solution.<br />
<br />
So how did everyone get confused and start thinking of digital signals<br />
as stairsteps? I can think of two good reasons.<br />
<br />
First: it's easy enough to convert a sampled signal to a true stairstep. Just<br />
extend each sample value forward until the next sample period. This is<br />
called a [[WikiPedia:Zero-order hold|zero-order hold]], and it's an important part of how some<br />
digital-to-analog converters work, especially the simplest ones.<br />
<br />
So, anyone who looks up [[WikiPedia:Digital-to-analog_converter#Practical_operation|digital-to-analog converter or<br />
digital-to-analog conversion]] is probably going to see a diagram of a<br />
stairstep waveform somewhere, but that's not a finished conversion,<br />
and it's not the signal that comes out.<br />
<br />
Second, and this is probably the more likely reason, engineers who<br />
supposedly know better, like me, draw stairsteps even though they're<br />
technically wrong. It's a sort of like a one-dimensional version of<br />
[[WikiPedia:MacPaint#Development|fat bits in an image editor]].<br />
<br />
Pixels aren't squares either, they're samples of a 2-dimensional<br />
function space and so they're also, conceptually, infinitely small<br />
points. Practically, it's a real pain in the ass to see or manipulate<br />
infinitely small anything, so big squares it is. Digital stairstep<br />
drawings are exactly the same thing.<br />
<br />
It's just a convenient drawing. The stairsteps aren't really there.<br />
<br />
==Bit-depth==<br />
[[Image:Dsat_009.jpg|360px|right]]<br />
[[Image:Dsat_010.jpg|260px|right]]<br />
<br />
When we convert a digital signal back to analog, the result is<br />
''also'' smooth regardless of the [[WikiPedia:Audio_bit_depth|bit depth]]. 24 bits or 16 bits...<br />
or 8 bits... it doesn't matter.<br />
<br />
So does that mean that the digital bit depth makes no difference at<br />
all? Of course not.<br />
<br />
Channel 2 here is the same sine wave input, but we quantize with<br />
[[WikiPedia:Dither|dither]] down to 8 bits.<br />
<br />
On the scope, we still see a nice<br />
smooth sine wave on channel 2. Look very close, and you'll also see a<br />
bit more noise. That's a clue.<br />
<br />
If we look at the spectrum of the signal... aha! Our sine wave is<br />
still there unaffected, but the noise level of the 8-bit signal on<br />
the second channel is much higher!<br />
<br />
And that's the difference the number of bits makes. That's it!<br />
<br />
When we digitize a signal, first we sample it. The<br />
sampling step is perfect; it loses nothing. But then we [[WikiPedia:Quantization_(sound_processing)|quantize]] it,<br />
and [[WikiPedia:Quantization_error|quantization adds noise]].<br />
<br />
The number of bits determines how much noise and so the level of the<br />
noise floor.<br />
<br />
What does this dithered quantization noise sound like? Let's listen<br />
to our 8-bit sine wave.<br />
<br />
That may have been hard to hear anything but the tone. Let's listen<br />
to just the noise after we notch out the sine wave and then bring the<br />
gain up a bit because the noise is quiet.<br />
<br />
Those of you who have used analog recording equipment may have just<br />
thought to yourselves, "My goodness! That sounds like tape hiss!"<br />
Well, it doesn't just sound like tape hiss, it acts like it too, and<br />
if we use a [[WikiPedia:Dither#Different_types|gaussian dither]] then it's<br />
[[WikiPedia:Central_limit_theorem|mathematically equivalent]] in every way. It ''is'' tape hiss.<br />
<br />
Intuitively, that means that we can measure tape hiss and thus the noise floor<br />
of [[WikiPedia:Magnetic_tape_sound_recording|magnetic audio tape]]<br />
in [[WikiPedia:Shannon–Hartley_theorem#Examples|bits instead of decibels]], in order to put things in a<br />
digital perspective. [[WikiPedia:Compact cassettes|Compact cassettes]] (for those of you who are old enough to remember them) could reach as<br />
deep as 9 bits in perfect conditions, though 5 to 6 bits was<br />
more typical, especially if it was a recording made on a<br />
[[WikiPedia:Cassette_deck|tape deck]]. That's right... your mix tapes were only about 6 bits<br />
deep... if you were lucky!<br />
<br />
The very best professional [[WikiPedia:Reel-to-reel_audio_tape_recording|open reel tape]] used in studios could barely<br />
hit... any guesses? 13 bits ''with'' [[WikiPedia:Reel-to-reel_audio_tape_recording#Noise_reduction|advanced noise reduction]]. And<br />
that's why seeing '[[WikiPedia:SPARS_code|D D D]]' on a [[WikiPedia:Compact_disk|Compact Disc]] used to be such a big,<br />
high-end deal.<br />
<br />
==Dither==<br />
[[Image:Dsat_011.png|360px|right]]<br />
<br />
I keep saying that I'm quantizing with [[Wikipedia:dither|dither]], so what is dither<br />
exactly and, more importantly, what does it do?<br />
<br />
The simple way to quantize a signal is to choose the digital<br />
amplitude value closest to the original analog amplitude. [[WikiPedia:Rounding|Obvious]],<br />
right? Unfortunately, the exact noise you get from this simple<br />
quantization scheme depends somewhat on the input signal,<br />
<br />
so we may get noise that's inconsistent, or causes distortion, or is<br />
undesirable in some other way.<br />
<br style="clear:both;"/><br />
<center><div style="background-color:#DDDDFF;border-color:#CCCCDD;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
'''Going deeper…'''<br />
*Cameron Nicklaus Christou's thesis [http://uwspace.uwaterloo.ca/bitstream/10012/3867/1/thesis.pdf Optimal Dither and Noise Shaping in Image Processing] provides an ''excellent'' explanation of dither and noise shaping.<br />
</div></center><br />
<br />
Dither is specially-constructed noise that substitutes for the noise<br />
produced by simple quantization. Dither doesn't [[WikiPedia:Sound_masking|drown out or mask]]<br />
quantization noise, it actually replaces it with noise characteristics<br />
of our choosing that aren't influenced by the input.<br />
<br />
Let's ''watch'' what dither does. The signal generator has too much noise for this test so we'll produce a mathematically perfect sine wave with the ThinkPad and quantize it to 8 bits with dithering.<br />
<br />
We see a nice sine wave on the waveform display and output scope and, once the analog spectrum analyzer catches up...<br />
a clean frequency peak with a uniform noise floor on both spectral displays<br />
just like before. Again, this is with dither.<br />
<br />
Now I turn dithering off.<br />
<br />
The quantization noise, that dither had spread out into a nice, flat noise<br />
floor, piles up into harmonic distortion peaks. The noise floor is<br />
lower, but the level of distortion becomes nonzero, and the distortion<br />
peaks sit higher than the dithering noise did.<br />
<br />
At 8 bits this effect is exaggerated. At 16 bits,<br />
even without dither, harmonic distortion is going to be so low as to<br />
be completely inaudible.<br />
<br />
Still, we can use dither to eliminate it completely if we so choose.<br />
<br />
Turning the dither off again for a moment, you'll notice that the<br />
absolute level of distortion from undithered quantization stays<br />
approximately constant regardless of the input amplitude.<br />
But when the signal level drops below a half a bit, everything<br />
quantizes to zero.<br />
<br />
In a sense, everything quantizing to zero is just 100% distortion!<br />
Dither eliminates this distortion too. We reenable dither<br />
and ... there's our signal back at 1/4 bit, with our nice flat noise floor.<br />
<br />
The noise floor doesn't have to be flat. Dither is noise of our<br />
choosing, so let's choose a noise as [http://www.acoustics.salford.ac.uk/res/cox/sound_quality/?content=subjective inoffensive] and<br />
[[WikiPedia:Absolute_threshold_of_hearing|difficult to notice]]<br />
as possible.<br />
<br />
Our hearing is most sensitive in the midrange from 2kHz to 4kHz,<br />
so that's where background noise is going to be the most obvious.<br />
We can [[WikiPedia:Noise_shaping|shape dithering noise]] away from sensitive frequencies to where<br />
hearing is less sensitive, usually the highest frequencies.<br />
<br />
16-bit dithering noise is normally much too quiet to hear at all, but<br />
let's listen to our noise shaping example, again with the gain<br />
brought way up...<br />
<br />
Lastly, dithered quantization noise ''is'' higher [[WikiPedia:Sound_power|power]] overall<br />
than undithered quantization noise even when it sounds quieter, and<br />
you can see that on a [[WikiPedia:VU_meter|VU meter]] during passages of near-silence. But<br />
dither isn't only an on or off choice. We can reduce the dither's<br />
power to balance less noise against a bit of distortion to minimize<br />
the overall effect.<br />
<br />
We'll also [[WikiPedia:Amplitude_modulation|modulate the input signal]] like this to show how a varying input affects the quantization noise. At<br />
full dithering power, the noise is uniform, constant, and featureless<br />
just like we expect:<br />
<br />
As we reduce the dither's power, the input increasingly<br />
affects the amplitude and the character of the quantization noise.<br />
Shaped dither behaves similarly, but noise shaping lends one more nice<br />
advantage. To make a long story short, it can use a somewhat lower<br />
dither power before the input has as much effect on the output.<br />
<br />
Despite all the time I just spent on dither, we're talking about<br />
differences that start 100 decibels and more below [[WikiPedia:Full_scale|full scale]]. Maybe<br />
if the CD had been<br />
[http://www.research.philips.com/technologies/projects/cd/index.html 14 bits as originally designed],<br />
dither ''might'' be<br />
more important. Maybe. At 16 bits, really, it's mostly a wash. You<br />
can think of dither as an insurance policy that gives several extra<br />
decibels of dynamic range just in case. The simple fact is, though, no<br />
one ever ruined a great recording by not dithering the final master.<br />
<br />
==Bandlimitation and timing==<br />
[[image:Dsat_013.jpg|360px|right]]<br />
<br />
We've been using [[WikiPedia:Sine_wave|sine waves]]. They're the obvious choice when what we<br />
want to see is a system's behavior at a given isolated frequency. Now<br />
let's look at something a bit more complex. What should we expect to<br />
happen when I change the input to a [[WikiPedia:Square_wave|square wave]]...<br />
<br />
The input scope confirms our 1kHz square wave. The output scope shows..<br />
<br />
<br />
Exactly what it should.<br />
...<br />
What is a square wave really? <br />
<br />
<br />
Well, we can say it's a waveform that's some positive value for half a cycle and then transitions instantaneously to a negative value for the other half.<br />
<br />
:<math><br />
\ x(t) = \begin{cases} 1, & |t| < T_1 \\ 0, & T_1 < |t| \leq {1 \over 2}T \end{cases}<br />
</math><br />
<br />
But that doesn't really tell us anything useful about how that input becomes this output.<br />
<br />
Then we remember that any waveform is also [[WikiPedia:Fourier_series|the sum of discrete frequencies]],<br />
and a square wave is particularly simple sum: a fundamental and an<br />
infinite series of [[WikiPedia:Even_and_odd_functions#Harmonics|odd harmonics]]. Sum them all up, you get a<br />
square wave.<br />
<br />
[[Image:dsat_015.jpg|360px|right]]<br />
:<math>\begin{align}<br />
x_{\mathrm{square}}(t) = \frac{4}{\pi}\sin(\omega t) + \frac{4}{3\pi}\sin(3\omega t) + \frac{4}{5\pi}\sin(5\omega t) + \\<br />
\frac{4}{7\pi}\sin(7\omega t) + \frac{4}{9\pi}\sin(9\omega t) + \frac{4}{11\pi}\sin(11\omega t) + \\ <br />
\frac{4}{13\pi}\sin(13\omega t) + \frac{4}{15\pi}\sin(15\omega t) + \frac{4}{17\pi}\sin(17\omega t) + \\<br />
\frac{4}{19\pi}\sin(19\omega t) + \frac{4}{21\pi}\sin(21\omega t) + \frac{4}{23\pi}\sin(23\omega t) + \\<br />
\frac{4}{25\pi}\sin(25\omega t) + \frac{4}{27\pi}\sin(27\omega t) + \frac{4}{29\pi}\sin(29\omega t) + \\<br />
\frac{4}{31\pi}\sin(31\omega t) + \frac{4}{33\pi}\sin(33\omega t) + \cdots <br />
\end{align}</math><br />
<br />
At first glance, that doesn't seem very useful either. You have to sum up an infinite number of harmonics to get the answer. ''Ah'', but we don't have an infinite number of harmonics.<br />
<br />
We're using a quite sharp [[WikiPedia:Low-pass_filter|anti-aliasing filter]] that cuts off right<br />
above 20kHz, so our signal is [[WikiPedia:Bandlimiting|bandlimited]], so only the first ten terms make it through.<br />
<br />
..and that's exactly what we see on the output scope.<br />
<br />
The rippling you see around sharp edges in a bandlimited signal is called the [[WikiPedia:/Gibbs_phenomenon|Gibbs effect]]. It happens whenever you slice off part of the frequency domain in the middle of nonzero energy.<br />
<br />
The usual rule of thumb you'll hear is "the sharper the cutoff, the<br />
stronger the rippling", which is approximately true, but we have to be<br />
careful how we think about it.<br />
For example... what would you expect our quite sharp anti-aliasing filter<br />
to do if I run our signal through it a second time?<br />
<br />
Aside from adding a few fractional cycles of delay, the answer is...<br />
nothing at all. The signal is already bandlimited. Bandlimiting it<br />
again doesn't do anything. A second pass can't remove frequencies<br />
that we already removed.<br />
<br />
And that's important. People tend to think of the ripples as<br />
a kind of [[WikiPedia:Sonic_artifact|artifact]] that's added by anti-aliasing and [[WikiPedia:Reconstruction_filter|anti-imaging]]<br />
filters, implying that the ripples get worse each time the signal<br />
passes through. We can see that in this case that didn't happen. So<br />
was it really the filter that added the ripples the first time<br />
through? No, not really. It's a subtle distinction, but Gibbs effect<br />
ripples aren't added by filters, they're just part of what a<br />
bandlimited signal ''is''.<br />
<br />
Even if we synthetically construct what looks like a perfect digital<br />
square wave,<br />
<br />
it's still limited to the channel bandwidth. Remember,<br />
the stairstep representation is misleading.<br />
<br />
What we really have here are instantaneous sample points,<br />
<br />
and only one bandlimited signal fits those points. All we did when we<br />
drew our apparently perfect square wave was line up the sample points<br />
just right so it appeared that there were no ripples if we played<br />
[[WikiPedia:Interpolation|connect-the-dots]].<br />
<br />
But the original bandlimited signal, complete with ripples, was<br />
still there.<br />
<br />
[[image:Dsat_014.gif|360px|right]]<br />
And that leads us to one more important point. You've probably heard<br />
that the timing precision of a digital signal is limited by its sample<br />
rate; put another way,<br />
<br />
that digital signals can't represent anything that falls between the<br />
samples.. implying that [[WikiPedia:Dirac_delta_function|impulses]] or<br />
[[WikiPedia:Synthesizer#ADSR_envelope|fast attacks]] have to align exactly<br />
with a sample, or the timing gets mangled... or they just disappear.<br />
<br />
At this point, we can easily see why that's wrong.<br />
<br />
Again, our input signals are bandlimited. And digital signals are<br />
samples, not stairsteps, not 'connect-the-dots'. We most certainly<br />
can, for example, put the rising edge of our bandlimited square wave<br />
anywhere we want between samples.<br />
<br />
It's represented perfectly and it's reconstructed perfectly.<br />
<br />
==Epilogue==<br />
<br />
[[Image:Moffey.jpg|360px|right]]<br />
<br />
Just like in [[Videos/A_Digital_Media_Primer_For_Geeks|the previous episode]], we've covered a broad range of<br />
topics, and yet barely scratched the surface of each one. If anything, my<br />
sins of omission are greater this time around... but this is a good<br />
stopping point.<br />
<br />
Or maybe, a good starting point. Dig deeper. Experiment. I chose my<br />
demos very carefully to be simple and give clear results. You can<br />
reproduce every one of them on your own if you like. But let's face<br />
it, sometimes we learn the most about a spiffy toy by breaking it open<br />
and studying all the pieces that fall out. And that's OK, we're<br />
engineers. Play with the demo parameters, hack up the code, set up<br />
alternate experiments. The source code for everything, including the<br />
little pushbutton demo application, is up at xiph.org.<br />
<br />
In the course of experimentation, you're likely to run into something<br />
that you didn't expect and can't explain. Don't worry! My earlier<br />
snark aside, Wikipedia is fantastic for exactly this kind of casual<br />
research. And, if you're really serious about understanding signals,<br />
several universities have advanced materials online, such as the<br />
[http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-003-signals-and-systems-spring-2010/index.htm 6.003]<br />
and<br />
[http://ocw.mit.edu/resources/res-6-007-signals-and-systems-spring-2011/ RES.6-007]<br />
Signals and Systems modules at MIT OpenCourseWare. And of<br />
course, there's always the [http://webchat.freenode.net/?channels=xiph community here at Xiph.Org].<br />
<br />
Digging deeper or not, I am out of coffee, so, until next time, happy<br />
hacking!<br />
<br />
==Credits==<br />
[[Image:Dmpfg_019.png|360px|right]]<br />
Written by: Christopher (Monty) Montgomery and the Xiph.Org Community<br />
<br />
Special thanks to:<br />
*Heidi Baumgartner, for the second Tektronix oscilloscope<br />
*Gregory Maxwell and Dr. Timothy Terriberry, for additional technical review<br />
<br />
Intro, title and credits music:<br><br />
"[http://music.lousyrobot.com/track/andy-warhol-is-gone Andy Warhol Is Gone]", by Lousy Robot<br><br />
Used by permission of Lousy Robot.<br><br />
Original source track All Rights Reserved.<br><br />
[http://www.lousyrobot.com www.lousyrobot.com]<br />
<br />
This Video Was Produced Entirely With Free and Open Source Software:<br><br />
<br />
*[http://www.gnu.org/ GNU]<br><br />
*[http://www.linux.org/ Linux]<br><br />
*[http://fedoraproject.org/ Fedora]<br><br />
*[http://cinelerra.org/ Cinelerra]<br><br />
*[http://www.gimp.org/ The Gimp]<br><br />
*[http://audacity.sourceforge.net/ Audacity]<br><br />
*[http://svn.xiph.org/trunk/postfish/README Postfish]<br><br />
*[http://gstreamer.freedesktop.org/ Gstreamer]<br><br />
<br />
All trademarks are the property of their respective owners. <br />
<br />
*''Complete video'' [http://creativecommons.org/licenses/by-sa/3.0/legalcode CC-BY-SA]<br><br />
*''Text transcript and Wiki edition'' [http://creativecommons.org/licenses/by-sa/3.0/legalcode CC-BY-SA]<br><br />
<br />
A Co-Production of Xiph.Org and Red Hat, Inc.<br><br />
(C) 2012-2013, Some Rights Reserved<br><br />
<br />
== Use The Source Luke ==<br />
<br />
As stated in the Epilogue, everything that appears in the video demos is driven by open source software, which means the source is both available for inspection and freely usable by the community. The Thinkpad that appears in the video was running Fedora 17 and Gnome Shell (Gnome 3). The demonstration software does not require Fedora specifically, but it does require Gnu/Linux to run in its current form. In all, the video involved just under 50,000 lines of new and custom-purpose code (including contributions to non-Xiph projects such as Cinelerra and Gromit).<br />
<br />
=== The Spectrum and Waveform Viewer ===<br />
<br />
The realtime software spectrum analyzer application that appears in the video was a preexisting application that was dusted off and updated for use in the video. The waveform viewer (effectively a simple software oscilloscope) was written from scratch making use of some of the internals from the spectrum analyzer application. Both are available from Xiph.Org svn:<br />
<br />
<center><div style="background-color:#DDDDFF;border-color:#CCCCDD;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
*Source for the Spectrum and Waveform applications is found at:<br />
https://svn.xiph.org/trunk/spectrum/<br />
*The source can be checked out of svn using the following command line:<br />
svn co https://svn.xiph.org/trunk/spectrum<br />
*Trac is a convenient way to browse the source without checking out a copy:<br />
https://trac.xiph.org/browser/trunk/spectrum<br />
</div></center><br />
<br />
Spectrum and Waveform both expect an input stream on the command line, either as raw data or as a WAV file.<br />
<br />
=== GTK-Bounce ===<br />
<br />
The touch-controlled application used in the video is named 'gtk-bounce' and was custom-written for the sole purpose of the in-video demonstrations. It is so named because, for the most part, all it does is read the input from an audio device, and then immediately write the same data back out for playback. It also forwards a copy of this data to up to two external monitoring applications, and in several demos, applies simple filters or generates simple waveforms. It includes several demos not included in the video.<br />
<br />
<center><div style="background-color:#DDDDFF;border-color:#CCCCDD;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
*Source for gtk-bounce is found at:<br />
https://svn.xiph.org/trunk/Xiph-episode-II/bounce/<br />
*The source can be checked out of svn using the following command line:<br />
svn co https://svn.xiph.org/trunk/Xiph-episode-II/bounce/<br />
*Trac is a convenient way to browse the source without checking out a copy:<br />
https://trac.xiph.org/browser/Xiph-episode-II/bounce/<br />
</div></center><br />
<br />
The application is somewhat hardwired for specific demo parameters, but most of the hardwired settings can be found at the top of each source file. As found in SVN, the application expects an ALSA hardware audio device at hw:1, and if none if found, it will wait for one to appear. Once a sound device is successfully initialized, it expects to find and open two pipes named pipe0 and pipe1 for output in the current directory. In the video, the waveform and spectrum applications are started to take input from pipe0 and pipe1 respectively. The output sent to the two pipes is identical, and in most demos matches the output data sent to the hardware device for conversion to analog. The only exception is the tenth demo panel (which does not appear in the video) where gtk-bounce can be set to monitor the hardware inputs instead while the outputs are used to produce test waveforms.<br />
<br />
Assuming gtk-bounce, spectrum and waveform have been checked out and built, the configuration seen in the video can be started using the following commands:<br />
<center><div style="background-color:#DDDDFF;border-color:#CCCCDD;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
* make the pipe fifos for the applications to communicate (only needs to be done once)<br />
mkfifo pipe0 pipe1<br />
* start all three applications<br />
waveform pipe0 & spectrum pipe1 & gtk-bounce &<br />
</div></center><br />
<br />
Gtk-bounce consists of eleven pushbutton panels (numbered zero through ten) that can be selected by scrolling up and dwon with the arrow buttons on the right side. Each panel is intended for a specific demo or part of a demo.<br />
<br />
<center><div style="background-color:#DDDDFF;border-color:#CCCCDD;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
<br />
[[Image:Dsat-panel0.png|700px|center]]<br />
* '''Panel 0''': This panel presents buttons that allow the sound card to be configured in several sampling rates and bit depths. Samples read from the audio inputs are sent to the output pipes and audio outputs for playback without modification.<br />
<div style="clear: both"></div><br />
<br />
[[Image:Dsat-panel1.png|700px|center]]<br />
* '''Panel 1''': <br />
<div style="clear: both"></div><br />
<br />
[[Image:Dsat-panel2.png|700px|center]]<br />
* '''Panel 2''': <br />
<div style="clear: both"></div><br />
<br />
[[Image:Dsat-panel3.png|700px|center]]<br />
* '''Panel 3''': <br />
<div style="clear: both"></div><br />
<br />
[[Image:Dsat-panel4.png|700px|center]]<br />
* '''Panel 4''': <br />
<div style="clear: both"></div><br />
<br />
[[Image:Dsat-panel5.png|700px|center]]<br />
* '''Panel 5''': <br />
<div style="clear: both"></div><br />
<br />
[[Image:Dsat-panel6.png|700px|center]]<br />
* '''Panel 6''': <br />
<div style="clear: both"></div><br />
<br />
[[Image:Dsat-panel7.png|700px|center]]<br />
* '''Panel 7''': <br />
<div style="clear: both"></div><br />
<br />
[[Image:Dsat-panel8.png|700px|center]]<br />
* '''Panel 8''': <br />
<div style="clear: both"></div><br />
<br />
[[Image:Dsat-panel9.png|700px|center]]<br />
* '''Panel 9''': <br />
<div style="clear: both"></div><br />
<br />
[[Image:Dsat-panel10.png|700px|center]]<br />
* '''Panel 10''': <br />
<div style="clear: both"></div><br />
<br />
</div></center><br />
<br />
=== Cairo Animations ===<br />
<br />
The animations featured throughout the Episode 2 video were rapid-development spaghetti hack-jobs coded by hand in raw Cairo. Each module generated a series of PNG stills that were then stitched into an animation with Cinelerra or mplayer. In the interest of pointing and laughing at what really bad code looks like...<br />
<br />
<center><div style="background-color:#DDDDFF;border-color:#CCCCDD;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
*Source for the Cairo animations is found at:<br />
https://svn.xiph.org/trunk/Xiph-episode-II/cairo/<br />
*The source can be checked out of svn using the following command line:<br />
svn co https://svn.xiph.org/trunk/Xiph-episode-II/cairo/<br />
*Trac is a convenient way to browse the source without checking out a copy:<br />
https://trac.xiph.org/browser/Xiph-episode-II/cairo/<br />
</div></center></div>Gmaxwellhttps://wiki.xiph.org/index.php?title=Videos/Digital_Show_and_Tell&diff=13993Videos/Digital Show and Tell2013-02-26T09:28:56Z<p>Gmaxwell: /* Dither */ fix wikipedia link to sound_power.</p>
<hr />
<div><small>''Wiki edition''</small><br />
[[Image:dsat_001.jpg|400px|right]]<br />
<br />
Continuing in the "firehose" tradition of [[Videos/A_Digital_Media_Primer_For_Geeks|Episode 01]], Xiph.Org's second video on digital media explores multiple facets of digital audio signals and how they ''really'' behave in the real world.<br />
<br />
Demonstrations of sampling, quantization, bit-depth, and dither explore digital audio behavior on real audio equipment using both modern digital analysis and vintage analog bench equipment, just in case we can't trust those newfangled digital gizmos. You can download the source code for each demo and try it all for yourself!<br />
<br/><br/><br/><br />
<center><font size="+2">[http://www.xiph.org/video/vid2.shtml Download or Watch online]</font></center><br />
<br style="clear:both;"/><br />
Supported players: [http://www.videolan.org/vlc/ VLC 1.1+], [https://www.mozilla.com/en-US/firefox/ Firefox ], [http://www.chromium.org/Home Chrome ], [http://www.opera.com/ Opera]. Or see [http://www.webmproject.org/users/ other WebM] or [[TheoraSoftwarePlayers|other Theora]] players.<br />
<br />
If you're having trouble with playback in a modern browser or player, please visit our [[Playback_Troubleshooting|playback troubleshooting and discussion]] page.<br />
<br/><br />
<hr/><br />
<br/><br/><br/><br />
[[Image:Xiph_ep02_test.png|400px|right]]<br />
<br />
Hi, I'm Monty Montgomery from [http://www.redhat.com/ Red Hat] and [http://xiph.org/ Xiph.Org].<br />
<br />
A few months ago, I wrote<br />
[http://people.xiph.org/~xiphmont/demo/neil-young.html an article on digital audio and why 24bit/192kHz music downloads don't make sense].<br />
In the article, I<br />
mentioned--almost in passing--that a digital waveform is<br />
[http://people.xiph.org/~xiphmont/demo/neil-young.html#toc_sfam not a stairstep],<br />
and you certainly don't get a stairstep when you<br />
[[WikiPedia:Digital-to-analog_converter|convert from digital back to analog]].<br />
<br />
Of everything in the entire article, '''that''' was the number one thing<br />
people wrote about. In fact, more than half the mail I got was questions and<br />
comments about basic digital signal behavior. Since there's interest, let's<br />
take a little time to play with some ''simple'' digital signals.<br />
<br />
==Veritas ex machina==<br />
[[Image:Dsat_002.jpg|200px|right]]<br />
[[Image:Dsat_003.jpg|200px|right]]<br />
[[Image:Dsat_004.jpg|200px|right]]<br />
[[Image:Dsat_005.jpg|200px|right]]<br />
<br />
Pretend for a moment that we have no idea how digital signals really<br />
behave. In that case it doesn't make sense for us to use digital test<br />
equipment either. Fortunately for this exercise, there's still plenty<br />
of working analog lab equipment out there.<br />
<br />
First up, we need a [[WikiPedia:Function_generator|signal generator]] to provide us with analog input<br />
signals--in this case, an<br />
[http://www.home.agilent.com/en/pd-3325A%3Aepsg%3Apro-pn-3325A/synthesizer-function-generator?pm=PL&nid=-536900197.536896863&cc=SE&lc=swe HP3325]<br />
from 1978. It's still a pretty good<br />
generator, so if you don't mind the size, the weight, the power<br />
consumption, and the noisy fan, you can find them on eBay... occasionally<br />
for only slightly more than you'll pay for shipping.<br />
<br />
Next, we'll observe our analog waveforms on [[WikiPedia:Oscilloscope_types#Cathode-ray_oscilloscope_.28CRO.29|analog oscilloscopes]],<br />
like this Tektronix 2246 from the mid-90s, one of the last and very best analog scopes ever made. Every home lab should have one.<br />
<br />
...and finally inspect the [[WikiPedia:Spectral_density#Electrical_engineering|frequency spectrum]] of our signals using an<br />
[[WikiPedia:Spectrum_analyzer#Swept-tuned|analog spectrum analyzer]], this<br />
[http://www.home.agilent.com/en/pd-3585A%3Aepsg%3Apro-pn-3585A/spectrum-analyzer-high-perf-20hz-40mhz?pm=PL&nid=-536900197.536897319&cc=SE&lc=swe HP3585]<br />
from the same product line as<br />
the signal generator. Like the other equipment here it has<br />
[http://www.hp9845.net/9845/hardware/processors/ a rudimentary and hilariously large microcontroller],<br />
but the signal path<br />
from input to what you see on the screen is completely analog.<br />
<br />
All of this equipment is vintage, but aside from its raw tonnage, the specs are still quite good.<br />
<br />
At the moment, we have our signal generator set to output a nice 1 [[WikiPedia:Hertz#SI_multiples|kHz]]<br />
sine wave at one [[WikiPedia:Volt|Volt]] [[WikiPedia:Amplitude#Root_mean_square_amplitude|RMS]].<br />
We see the sine wave on the oscilloscope, can verify that it is indeed<br />
1 kHz at 1 Volt RMS, which is 2.8 Volts<br />
[[WikiPedia:Amplitude#Peak-to-peak_amplitude|peak-to-peak]],<br />
and that matches the<br />
measurement on the spectrum analyzer as well.<br />
<br />
The analyzer also shows some low-level [[WikiPedia:White_noise|white noise]]<br />
and just a bit of [[WikiPedia:Harmonic_distortion#Harmonic_distortion|harmonic distortion]],<br />
with the highest peak about 70[[WikiPedia:Decibel|dB]] or so below<br />
[[WikiPedia:Fundamental_frequency|the fundamental]].<br />
Now, this doesn't matter at all in our demos, but I<br />
wanted to point it out now just in case you didn't notice it until<br />
later.<br />
<br />
Now, we drop digital sampling in the middle.<br />
<br />
For the conversion, we'll use a boring, consumer-grade, eMagic USB1<br />
audio device. It's also more than ten years old at this point, and it's<br />
getting obsolete.<br />
<br />
A recent converter can easily have an order of magnitude better specs.<br />
[[WikiPedia:Reconstruction_filter#Sampled_data_reconstruction_filters|Flatness]],<br />
[[WikiPedia:Analog-to-digital_converter#Non-linearity|linearity]],<br />
[[WikiPedia:Jitter#Sampling_jitter|jitter]],<br />
[[WikiPedia:Noise_floor|noise behavior]],<br />
[[WikiPedia:Digital-to-analog_converter#DAC_performance|everything]]...<br />
you may not<br />
have noticed. Just because we can measure an improvement doesn't<br />
mean we can hear it, and even these old consumer boxes were already at<br />
the edge of ideal transparency.<br />
<br />
The eMagic connects to my ThinkPad, which displays a digital<br />
waveform and spectrum for comparison, then the ThinkPad<br />
sends the digital signal right back out to the eMagic for<br />
re-conversion to analog and observation on the output scopes.<br />
<br />
Input to output, left to right.<br />
<br style="clear:both;"/><br />
<br />
==Stairsteps==<br />
[[Image:Dsat 006.jpg|360px|right]]<br />
[[Image:Dsat 007.png|360px|right]]<br />
OK, it's go time. We begin by converting an analog signal to digital and<br />
then right back to analog again with no other steps.<br />
<br />
The signal generator is set to produce a 1kHz sine wave just like<br />
before.<br />
<br />
We can see our analog sine wave on our input-side oscilloscope.<br />
<br />
We digitize our signal to<br />
[[Videos/A_Digital_Media_Primer_For_Geeks#Raw_.28digital_audio.29_meat|16 bit PCM at 44.1kHz]],<br />
same as on a CD.<br />
The spectrum of the digitized signal matches what we saw earlier<br />
<br />
and what we see now on the analog spectrum analyzer, aside from its <br />
[[WikiPedia:High_impedance|high-impedance input]] being just a smidge noisier.<br />
<br />
For now, the waveform display shows our digitized sine wave as a<br />
stairstep pattern, one step for each sample.<br />
<br />
And when we look at the output signal that's been converted<br />
from digital back to analog, we see...<br />
<br />
It's exactly like the original sine wave. No stairsteps.<br />
<br />
OK, 1 kHz is still a fairly low frequency, maybe the stairsteps are just<br />
hard to see or they're being smoothed away. Fair enough. Let's choose<br />
a higher frequency, something close to [[WikiPedia:Nyquist_frequency|Nyquist]], say 15kHz.<br />
<br />
Now the sine wave is represented by less than three samples per cycle, and...<br />
<br />
the digital waveform looks pretty awful. Well, looks<br />
can be deceiving. The analog output...<br />
<br />
is still a perfect sine wave, exactly like the original.<br />
<br />
Let's keep going up.<br />
<br />
Let's see if I can do this without blocking any cameras.<br />
<br />
16kHz.... 17kHz... 18kHz... 19kHz... <br />
<br />
20kHz. Welcome to the upper limits of human hearing. The output<br />
waveform is still perfect. No jagged edges, no dropoff, no stairsteps.<br />
<br />
So where'd the stairsteps go? Don't answer, it's a trick question.<br />
They were never there.<br />
<br />
Drawing a digital waveform as a stairstep... was wrong to begin with.<br />
<br />
Why? A stairstep is a continuous-time function. It's jagged, and it's<br />
piecewise, but it has a defined value at every point in time.<br />
<br />
A sampled signal is entirely different. It's discrete-time; it's only<br />
got a value right at each instantaneous sample point and it's<br />
undefined, there is no value at all, everywhere between. A<br />
discrete-time signal is properly drawn as a lollipop graph.<br />
<br />
The continuous, analog counterpart of a digital signal passes<br />
smoothly through each sample point, and that's just as true for high<br />
frequencies as it is for low.<br />
<br />
Now, the interesting and not at all obvious bit is: [[WikiPedia:Nyquist%E2%80%93Shannon_sampling_theorem|there's only one<br />
bandlimited signal that passes exactly through each sample point]]. It's<br />
a unique solution. So if you sample a bandlimited signal and then<br />
convert it back, the original input is also the only possible output.<br />
<br />
[[Image:Dsat 008.png|360px|right]]<br />
<br />
And before you say, "oh, I can draw a different signal that passes<br />
through those points", well, yes you can, but if it differs even<br />
minutely from the original, it includes frequency content at or beyond<br />
Nyquist, breaks the bandlimiting requirement and isn't a valid<br />
solution.<br />
<br />
So how did everyone get confused and start thinking of digital signals<br />
as stairsteps? I can think of two good reasons.<br />
<br />
First: it's easy enough to convert a sampled signal to a true stairstep. Just<br />
extend each sample value forward until the next sample period. This is<br />
called a [[WikiPedia:Zero-order hold|zero-order hold]], and it's an important part of how some<br />
digital-to-analog converters work, especially the simplest ones.<br />
<br />
So, anyone who looks up [[WikiPedia:Digital-to-analog_converter#Practical_operation|digital-to-analog converter or<br />
digital-to-analog conversion]] is probably going to see a diagram of a<br />
stairstep waveform somewhere, but that's not a finished conversion,<br />
and it's not the signal that comes out.<br />
<br />
Second, and this is probably the more likely reason, engineers who<br />
supposedly know better, like me, draw stairsteps even though they're<br />
technically wrong. It's a sort of like a one-dimensional version of<br />
[[WikiPedia:MacPaint#Development|fat bits in an image editor]].<br />
<br />
Pixels aren't squares either, they're samples of a 2-dimensional<br />
function space and so they're also, conceptually, infinitely small<br />
points. Practically, it's a real pain in the ass to see or manipulate<br />
infinitely small anything, so big squares it is. Digital stairstep<br />
drawings are exactly the same thing.<br />
<br />
It's just a convenient drawing. The stairsteps aren't really there.<br />
<br />
==Bit-depth==<br />
[[Image:Dsat_009.jpg|360px|right]]<br />
[[Image:Dsat_010.jpg|260px|right]]<br />
<br />
When we convert a digital signal back to analog, the result is<br />
''also'' smooth regardless of the [[WikiPedia:Audio_bit_depth|bit depth]]. 24 bits or 16 bits...<br />
or 8 bits... it doesn't matter.<br />
<br />
So does that mean that the digital bit depth makes no difference at<br />
all? Of course not.<br />
<br />
Channel 2 here is the same sine wave input, but we quantize with<br />
[[WikiPedia:Dither|dither]] down to 8 bits.<br />
<br />
On the scope, we still see a nice<br />
smooth sine wave on channel 2. Look very close, and you'll also see a<br />
bit more noise. That's a clue.<br />
<br />
If we look at the spectrum of the signal... aha! Our sine wave is<br />
still there unaffected, but the noise level of the 8-bit signal on<br />
the second channel is much higher!<br />
<br />
And that's the difference the number of bits makes. That's it!<br />
<br />
When we digitize a signal, first we sample it. The<br />
sampling step is perfect; it loses nothing. But then we [[WikiPedia:Quantization_(sound_processing)|quantize]] it,<br />
and [[WikiPedia:Quantization_error|quantization adds noise]].<br />
<br />
The number of bits determines how much noise and so the level of the<br />
noise floor.<br />
<br />
What does this dithered quantization noise sound like? Let's listen<br />
to our 8-bit sine wave.<br />
<br />
That may have been hard to hear anything but the tone. Let's listen<br />
to just the noise after we notch out the sine wave and then bring the<br />
gain up a bit because the noise is quiet.<br />
<br />
Those of you who have used analog recording equipment may have just<br />
thought to yourselves, "My goodness! That sounds like tape hiss!"<br />
Well, it doesn't just sound like tape hiss, it acts like it too, and<br />
if we use a [[WikiPedia:Dither#Different_types|gaussian dither]] then it's<br />
[[WikiPedia:Central_limit_theorem|mathematically equivalent]] in every way. It ''is'' tape hiss.<br />
<br />
Intuitively, that means that we can measure tape hiss and thus the noise floor<br />
of [[WikiPedia:Magnetic_tape_sound_recording|magnetic audio tape]]<br />
in [[WikiPedia:Shannon–Hartley_theorem#Examples|bits instead of decibels]], in order to put things in a<br />
digital perspective. [[WikiPedia:Compact cassettes|Compact cassettes]] (for those of you who are old enough to remember them) could reach as<br />
deep as 9 bits in perfect conditions, though 5 to 6 bits was<br />
more typical, especially if it was a recording made on a<br />
[[WikiPedia:Cassette_deck|tape deck]]. That's right... your mix tapes were only about 6 bits<br />
deep... if you were lucky!<br />
<br />
The very best professional [[WikiPedia:Reel-to-reel_audio_tape_recording|open reel tape]] used in studios could barely<br />
hit... any guesses? 13 bits ''with'' [[WikiPedia:Reel-to-reel_audio_tape_recording#Noise_reduction|advanced noise reduction]]. And<br />
that's why seeing '[[WikiPedia:SPARS_code|D D D]]' on a [[WikiPedia:Compact_disk|Compact Disc]] used to be such a big,<br />
high-end deal.<br />
<br />
==Dither==<br />
[[Image:Dsat_011.png|360px|right]]<br />
<br />
I keep saying that I'm quantizing with [[Wikipedia:dither|dither]], so what is dither<br />
exactly and, more importantly, what does it do?<br />
<br />
The simple way to quantize a signal is to choose the digital<br />
amplitude value closest to the original analog amplitude. [[WikiPedia:Rounding|Obvious]],<br />
right? Unfortunately, the exact noise you get from this simple<br />
quantization scheme depends somewhat on the input signal,<br />
<br />
so we may get noise that's inconsistent, or causes distortion, or is<br />
undesirable in some other way.<br />
<br style="clear:both;"/><br />
<center><div style="background-color:#DDDDFF;border-color:#CCCCDD;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
'''Going deeper…'''<br />
*Cameron Nicklaus Christou's thesis [http://uwspace.uwaterloo.ca/bitstream/10012/3867/1/thesis.pdf Optimal Dither and Noise Shaping in Image Processing] provides an ''excellent'' explanation of dither and noise shaping.<br />
</div></center><br />
<br />
Dither is specially-constructed noise that substitutes for the noise<br />
produced by simple quantization. Dither doesn't [[WikiPedia:Sound_masking|drown out or mask]]<br />
quantization noise, it actually replaces it with noise characteristics<br />
of our choosing that aren't influenced by the input.<br />
<br />
Let's ''watch'' what dither does. The signal generator has too much noise for this test so we'll produce a mathematically perfect sine wave with the ThinkPad and quantize it to 8 bits with dithering.<br />
<br />
We see a nice sine wave on the waveform display and output scope and, once the analog spectrum analyzer catches up...<br />
a clean frequency peak with a uniform noise floor on both spectral displays<br />
just like before. Again, this is with dither.<br />
<br />
Now I turn dithering off.<br />
<br />
The quantization noise, that dither had spread out into a nice, flat noise<br />
floor, piles up into harmonic distortion peaks. The noise floor is<br />
lower, but the level of distortion becomes nonzero, and the distortion<br />
peaks sit higher than the dithering noise did.<br />
<br />
At 8 bits this effect is exaggerated. At 16 bits,<br />
even without dither, harmonic distortion is going to be so low as to<br />
be completely inaudible.<br />
<br />
Still, we can use dither to eliminate it completely if we so choose.<br />
<br />
Turning the dither off again for a moment, you'll notice that the<br />
absolute level of distortion from undithered quantization stays<br />
approximately constant regardless of the input amplitude.<br />
But when the signal level drops below a half a bit, everything<br />
quantizes to zero.<br />
<br />
In a sense, everything quantizing to zero is just 100% distortion!<br />
Dither eliminates this distortion too. We reenable dither<br />
and ... there's our signal back at 1/4 bit, with our nice flat noise floor.<br />
<br />
The noise floor doesn't have to be flat. Dither is noise of our<br />
choosing, so let's choose a noise as [http://www.acoustics.salford.ac.uk/res/cox/sound_quality/?content=subjective inoffensive] and<br />
[[WikiPedia:Absolute_threshold_of_hearing|difficult to notice]]<br />
as possible.<br />
<br />
Our hearing is most sensitive in the midrange from 2kHz to 4kHz,<br />
so that's where background noise is going to be the most obvious.<br />
We can [[WikiPedia:Noise_shaping|shape dithering noise]] away from sensitive frequencies to where<br />
hearing is less sensitive, usually the highest frequencies.<br />
<br />
16-bit dithering noise is normally much too quiet to hear at all, but<br />
let's listen to our noise shaping example, again with the gain<br />
brought way up...<br />
<br />
Lastly, dithered quantization noise ''is'' higher [[WikiPedia:Sound_power|power]] overall<br />
than undithered quantization noise even when it sounds quieter, and<br />
you can see that on a [[WikiPedia:VU_meter|VU meter]] during passages of near-silence. But<br />
dither isn't only an on or off choice. We can reduce the dither's<br />
power to balance less noise against a bit of distortion to minimize<br />
the overall effect.<br />
<br />
We'll also [[WikiPedia:Amplitude_modulation|modulate the input signal]] like this to show how a varying input affects the quantization noise. At<br />
full dithering power, the noise is uniform, constant, and featureless<br />
just like we expect:<br />
<br />
As we reduce the dither's power, the input increasingly<br />
affects the amplitude and the character of the quantization noise.<br />
Shaped dither behaves similarly, but noise shaping lends one more nice<br />
advantage. To make a long story short, it can use a somewhat lower<br />
dither power before the input has as much effect on the output.<br />
<br />
Despite all the time I just spent on dither, we're talking about<br />
differences that start 100 decibels and more below [[WikiPedia:Full_scale|full scale]]. Maybe<br />
if the CD had been<br />
[http://www.research.philips.com/technologies/projects/cd/index.html 14 bits as originally designed],<br />
dither ''might'' be<br />
more important. Maybe. At 16 bits, really, it's mostly a wash. You<br />
can think of dither as an insurance policy that gives several extra<br />
decibels of dynamic range just in case. The simple fact is, though, no<br />
one ever ruined a great recording by not dithering the final master.<br />
<br />
==Bandlimitation and timing==<br />
[[image:Dsat_013.jpg|360px|right]]<br />
<br />
We've been using [[WikiPedia:Sine_wave|sine waves]]. They're the obvious choice when what we<br />
want to see is a system's behavior at a given isolated frequency. Now<br />
let's look at something a bit more complex. What should we expect to<br />
happen when I change the input to a [[WikiPedia:Square_wave|square wave]]...<br />
<br />
The input scope confirms our 1kHz square wave. The output scope shows..<br />
<br />
<br />
Exactly what it should.<br />
...<br />
What is a square wave really? <br />
<br />
<br />
Well, we can say it's a waveform that's some positive value for half a cycle and then transitions instantaneously to a negative value for the other half.<br />
<br />
:<math><br />
\ x(t) = \begin{cases} 1, & |t| < T_1 \\ 0, & T_1 < |t| \leq {1 \over 2}T \end{cases}<br />
</math><br />
<br />
But that doesn't really tell us anything useful about how that input becomes this output.<br />
<br />
Then we remember that any waveform is also [[WikiPedia:Fourier_series|the sum of discrete frequencies]],<br />
and a square wave is particularly simple sum: a fundamental and an<br />
infinite series of [[WikiPedia:Even_and_odd_functions#Harmonics|odd harmonics]]. Sum them all up, you get a<br />
square wave.<br />
<br />
[[Image:dsat_015.jpg|360px|right]]<br />
:<math>\begin{align}<br />
x_{\mathrm{square}}(t) = \frac{4}{\pi}\sin(\omega t) + \frac{4}{3\pi}\sin(3\omega t) + \frac{4}{5\pi}\sin(5\omega t) + \\<br />
\frac{4}{7\pi}\sin(7\omega t) + \frac{4}{9\pi}\sin(9\omega t) + \frac{4}{11\pi}\sin(11\omega t) + \\ <br />
\frac{4}{13\pi}\sin(13\omega t) + \frac{4}{15\pi}\sin(15\omega t) + \frac{4}{17\pi}\sin(17\omega t) + \\<br />
\frac{4}{19\pi}\sin(19\omega t) + \frac{4}{21\pi}\sin(21\omega t) + \frac{4}{23\pi}\sin(23\omega t) + \\<br />
\frac{4}{25\pi}\sin(25\omega t) + \frac{4}{27\pi}\sin(27\omega t) + \frac{4}{29\pi}\sin(29\omega t) + \\<br />
\frac{4}{31\pi}\sin(31\omega t) + \frac{4}{33\pi}\sin(33\omega t) + \cdots <br />
\end{align}</math><br />
<br />
At first glance, that doesn't seem very useful either. You have to sum up an infinite number of harmonics to get the answer. ''Ah'', but we don't have an infinite number of harmonics.<br />
<br />
We're using a quite sharp [[WikiPedia:Low-pass_filter|anti-aliasing filter]] that cuts off right<br />
above 20kHz, so our signal is [[WikiPedia:Bandlimiting|bandlimited]], so only the first ten terms make it through.<br />
<br />
..and that's exactly what we see on the output scope.<br />
<br />
The rippling you see around sharp edges in a bandlimited signal is called the [[WikiPedia:/Gibbs_phenomenon|Gibbs effect]]. It happens whenever you slice off part of the frequency domain in the middle of nonzero energy.<br />
<br />
The usual rule of thumb you'll hear is "the sharper the cutoff, the<br />
stronger the rippling", which is approximately true, but we have to be<br />
careful how we think about it.<br />
For example... what would you expect our quite sharp anti-aliasing filter<br />
to do if I run our signal through it a second time?<br />
<br />
Aside from adding a few fractional cycles of delay, the answer is...<br />
nothing at all. The signal is already bandlimited. Bandlimiting it<br />
again doesn't do anything. A second pass can't remove frequencies<br />
that we already removed.<br />
<br />
And that's important. People tend to think of the ripples as<br />
a kind of [[WikiPedia:Sonic_artifact|artifact]] that's added by anti-aliasing and [[WikiPedia:Reconstruction_filter|anti-imaging]]<br />
filters, implying that the ripples get worse each time the signal<br />
passes through. We can see that in this case that didn't happen. So<br />
was it really the filter that added the ripples the first time<br />
through? No, not really. It's a subtle distinction, but Gibbs effect<br />
ripples aren't added by filters, they're just part of what a<br />
bandlimited signal ''is''.<br />
<br />
Even if we synthetically construct what looks like a perfect digital<br />
square wave,<br />
<br />
it's still limited to the channel bandwidth. Remember,<br />
the stairstep representation is misleading.<br />
<br />
What we really have here are instantaneous sample points,<br />
<br />
and only one bandlimited signal fits those points. All we did when we<br />
drew our apparently perfect square wave was line up the sample points<br />
just right so it appeared that there were no ripples if we played<br />
[[WikiPedia:Interpolation|connect-the-dots]].<br />
<br />
But the original bandlimited signal, complete with ripples, was<br />
still there.<br />
<br />
[[image:Dsat_014.gif|360px|right]]<br />
And that leads us to one more important point. You've probably heard<br />
that the timing precision of a digital signal is limited by its sample<br />
rate; put another way,<br />
<br />
that digital signals can't represent anything that falls between the<br />
samples.. implying that [[WikiPedia:Dirac_delta_function|impulses]] or<br />
[[WikiPedia:Synthesizer#ADSR_envelope|fast attacks]] have to align exactly<br />
with a sample, or the timing gets mangled... or they just disappear.<br />
<br />
At this point, we can easily see why that's wrong.<br />
<br />
Again, our input signals are bandlimited. And digital signals are<br />
samples, not stairsteps, not 'connect-the-dots'. We most certainly<br />
can, for example, put the rising edge of our bandlimited square wave<br />
anywhere we want between samples.<br />
<br />
It's represented perfectly and it's reconstructed perfectly.<br />
<br />
==Epilogue==<br />
<br />
[[Image:Moffey.jpg|360px|right]]<br />
<br />
Just like in [[Videos/A_Digital_Media_Primer_For_Geeks|the previous episode]], we've covered a broad range of<br />
topics, and yet barely scratched the surface of each one. If anything, my<br />
sins of omission are greater this time around... but this is a good<br />
stopping point.<br />
<br />
Or maybe, a good starting point. Dig deeper. Experiment. I chose my<br />
demos very carefully to be simple and give clear results. You can<br />
reproduce every one of them on your own if you like. But let's face<br />
it, sometimes we learn the most about a spiffy toy by breaking it open<br />
and studying all the pieces that fall out. And that's OK, we're<br />
engineers. Play with the demo parameters, hack up the code, set up<br />
alternate experiments. The source code for everything, including the<br />
little pushbutton demo application, is up at xiph.org.<br />
<br />
In the course of experimentation, you're likely to run into something<br />
that you didn't expect and can't explain. Don't worry! My earlier<br />
snark aside, Wikipedia is fantastic for exactly this kind of casual<br />
research. And, if you're really serious about understanding signals,<br />
several universities have advanced materials online, such as the<br />
[http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-003-signals-and-systems-spring-2010/index.htm 6.003]<br />
and<br />
[http://ocw.mit.edu/resources/res-6-007-signals-and-systems-spring-2011/ RES.6-007]<br />
Signals and Systems modules at MIT OpenCourseWare. And of<br />
course, there's always the [http://webchat.freenode.net/?channels=xiph community here at Xiph.Org].<br />
<br />
Digging deeper or not, I am out of coffee, so, until next time, happy<br />
hacking!<br />
<br />
==Credits==<br />
[[Image:Dmpfg_019.png|360px|right]]<br />
Written by: Christopher (Monty) Montgomery and the Xiph.Org Community<br />
<br />
Special thanks to:<br />
*Heidi Baumgartner, for the second Tektronix oscilloscope<br />
*Gregory Maxwell and Dr. Timothy Terriberry, for additional technical review<br />
<br />
Intro, title and credits music:<br><br />
"Andy Warhol Is Gone", by Lousy Robot<br><br />
Used by permission of Lousy Robot.<br><br />
Original source track All Rights Reserved.<br><br />
[http://www.lousyrobot.com www.lousyrobot.com]<br />
<br />
This Video Was Produced Entirely With Free and Open Source Software:<br><br />
<br />
*[http://www.gnu.org/ GNU]<br><br />
*[http://www.linux.org/ Linux]<br><br />
*[http://fedoraproject.org/ Fedora]<br><br />
*[http://cinelerra.org/ Cinelerra]<br><br />
*[http://www.gimp.org/ The Gimp]<br><br />
*[http://audacity.sourceforge.net/ Audacity]<br><br />
*[http://svn.xiph.org/trunk/postfish/README Postfish]<br><br />
*[http://gstreamer.freedesktop.org/ Gstreamer]<br><br />
<br />
All trademarks are the property of their respective owners. <br />
<br />
*''Complete video'' [http://creativecommons.org/licenses/by-sa/3.0/legalcode CC-BY-SA]<br><br />
*''Text transcript and Wiki edition'' [http://creativecommons.org/licenses/by-sa/3.0/legalcode CC-BY-SA]<br><br />
<br />
A Co-Production of Xiph.Org and Red Hat, Inc.<br><br />
(C) 2012-2013, Some Rights Reserved<br><br />
<br />
== Use The Source Luke ==<br />
<br />
As stated in the Epilogue, everything that appears in the video demos is driven by open source software, which means the source is both available for inspection and freely usable by the community. The Thinkpad that appears in the video was running Fedora 17 and Gnome Shell (Gnome 3). The demonstration software does not require Fedora specifically, but it does require Gnu/Linux to run in its current form. In all, the video involved just under 50,000 lines of new and custom-purpose code (including contributions to non-Xiph projects such as Cinelerra and Gromit).<br />
<br />
=== The Spectrum and Waveform Viewer ===<br />
<br />
The realtime software spectrum analyzer application that appears in the video was a preexisting application that was dusted off and updated for use in the video. The waveform viewer (effectively a simple software oscilloscope) was written from scratch making use of some of the internals from the spectrum analyzer application. Both are available from Xiph.Org svn:<br />
<br />
<center><div style="background-color:#DDDDFF;border-color:#CCCCDD;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
*Source for the Spectrum and Waveform applications is found at:<br />
https://svn.xiph.org/trunk/spectrum/<br />
*The source can be checked out of svn using the following command line:<br />
svn co https://svn.xiph.org/trunk/spectrum<br />
*Trac is a convenient way to browse the source without checking out a copy:<br />
https://trac.xiph.org/browser/trunk/spectrum<br />
</div></center><br />
<br />
Spectrum and Waveform both expect an input stream on the command line, either as raw data or as a WAV file.<br />
<br />
=== GTK-Bounce ===<br />
<br />
The touch-controlled application used in the video is named 'gtk-bounce' and was custom-written for the sole purpose of the in-video demonstrations. It is so named because, for the most part, all it does is read the input from an audio device, and then immediately write the same data back out for playback. It also forwards a copy of this data to up to two external monitoring applications, and in several demos, applies simple filters or generates simple waveforms. It includes several demos not included in the video.<br />
<br />
<center><div style="background-color:#DDDDFF;border-color:#CCCCDD;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
*Source for gtk-bounce is found at:<br />
https://svn.xiph.org/trunk/Xiph-episode-II/bounce/<br />
*The source can be checked out of svn using the following command line:<br />
svn co https://svn.xiph.org/trunk/Xiph-episode-II/bounce/<br />
*Trac is a convenient way to browse the source without checking out a copy:<br />
https://trac.xiph.org/browser/Xiph-episode-II/bounce/<br />
</div></center><br />
<br />
The application is somewhat hardwired for specific demo parameters, but most of the hardwired settings can be found at the top of each source file. As found in SVN, the application expects an ALSA hardware audio device at hw:1, and if none if found, it will wait for one to appear. Once a sound device is successfully initialized, it expects to find and open two pipes named pipe0 and pipe1 for output in the current directory. In the video, the waveform and spectrum applications are started to take input from pipe0 and pipe1 respectively. The output sent to the two pipes is identical, and in most demos matches the output data sent to the hardware device for conversion to analog. The only exception is the tenth demo panel (which does not appear in the video) where gtk-bounce can be set to monitor the hardware inputs instead while the outputs are used to produce test waveforms.<br />
<br />
Assuming gtk-bounce, spectrum and waveform have been checked out and built, the configuration seen in the video can be started using the following commands:<br />
<center><div style="background-color:#DDDDFF;border-color:#CCCCDD;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
* make the pipe fifos for the applications to communicate (only needs to be done once)<br />
mkfifo pipe0 pipe1<br />
* start all three applications<br />
waveform pipe0 & spectrum pipe1 & gtk-bounce &<br />
</div></center><br />
<br />
Gtk-bounce consists of eleven pushbutton panels (numbered zero through ten) that can be selected by scrolling up and dwon with the arrow buttons on the right side. Each panel is intended for a specific demo or part of a demo.<br />
<br />
<center><div style="background-color:#DDDDFF;border-color:#CCCCDD;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
<br />
[[Image:Dsat-panel0.png|700px|center]]<br />
* '''Panel 0''': This panel presents buttons that allow the sound card to be configured in several sampling rates and bit depths. Samples read from the audio inputs are sent to the output pipes and audio outputs for playback without modification.<br />
<div style="clear: both"></div><br />
<br />
[[Image:Dsat-panel1.png|700px|center]]<br />
* '''Panel 1''': <br />
<div style="clear: both"></div><br />
<br />
[[Image:Dsat-panel2.png|700px|center]]<br />
* '''Panel 2''': <br />
<div style="clear: both"></div><br />
<br />
[[Image:Dsat-panel3.png|700px|center]]<br />
* '''Panel 3''': <br />
<div style="clear: both"></div><br />
<br />
[[Image:Dsat-panel4.png|700px|center]]<br />
* '''Panel 4''': <br />
<div style="clear: both"></div><br />
<br />
[[Image:Dsat-panel5.png|700px|center]]<br />
* '''Panel 5''': <br />
<div style="clear: both"></div><br />
<br />
[[Image:Dsat-panel6.png|700px|center]]<br />
* '''Panel 6''': <br />
<div style="clear: both"></div><br />
<br />
[[Image:Dsat-panel7.png|700px|center]]<br />
* '''Panel 7''': <br />
<div style="clear: both"></div><br />
<br />
[[Image:Dsat-panel8.png|700px|center]]<br />
* '''Panel 8''': <br />
<div style="clear: both"></div><br />
<br />
[[Image:Dsat-panel9.png|700px|center]]<br />
* '''Panel 9''': <br />
<div style="clear: both"></div><br />
<br />
[[Image:Dsat-panel10.png|700px|center]]<br />
* '''Panel 10''': <br />
<div style="clear: both"></div><br />
<br />
</div></center><br />
<br />
=== Cairo Animations ===<br />
<br />
The animations featured throughout the Episode 2 video were rapid-development spaghetti hack-jobs coded by hand in raw Cairo. Each module generated a series of PNG stills that were then stitched into an animation with Cinelerra or mplayer. In the interest of pointing and laughing at what really bad code looks like...<br />
<br />
<center><div style="background-color:#DDDDFF;border-color:#CCCCDD;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
*Source for the Cairo animations is found at:<br />
https://svn.xiph.org/trunk/Xiph-episode-II/cairo/<br />
*The source can be checked out of svn using the following command line:<br />
svn co https://svn.xiph.org/trunk/Xiph-episode-II/cairo/<br />
*Trac is a convenient way to browse the source without checking out a copy:<br />
https://trac.xiph.org/browser/Xiph-episode-II/cairo/<br />
</div></center></div>Gmaxwellhttps://wiki.xiph.org/index.php?title=Videos/Digital_Show_and_Tell&diff=13976Videos/Digital Show and Tell2013-02-26T09:07:13Z<p>Gmaxwell: /* Bandlimitation and timing */ move graphics around</p>
<hr />
<div><small>''Wiki edition''</small><br />
[[Image:dsat_001.jpg|400px|right]]<br />
<br />
Continuing in the "firehose" tradition of [[Videos/A_Digital_Media_Primer_For_Geeks|Episode 01]], Xiph.Org's second video on digital media explores multiple facets of digital audio signals and how they ''really'' behave in the real world.<br />
<br />
Demonstrations of sampling, quantization, bit-depth, and dither explore digital audio behavior on real audio equipment using both modern digital analysis and vintage analog bench equipment, just in case we can't trust those newfangled digital gizmos. You can download the source code for each demo and try it all for yourself!<br />
<br/><br/><br/><br />
<center><font size="+2">[http://www.xiph.org/video/vid2.shtml Download or Watch online]</font></center><br />
<br style="clear:both;"/><br />
Supported players: [http://www.videolan.org/vlc/ VLC 1.1+], [https://www.mozilla.com/en-US/firefox/ Firefox ], [http://www.chromium.org/Home Chrome ], [http://www.opera.com/ Opera]. Or see [http://www.webmproject.org/users/ other WebM] or [[TheoraSoftwarePlayers|other Theora]] players.<br />
<br />
If you're having trouble with playback in a modern browser or player, please visit our [[Playback_Troubleshooting|playback troubleshooting and discussion]] page.<br />
<br/><br />
<hr/><br />
<br/><br/><br/><br />
[[Image:Xiph_ep02_test.png|400px|right]]<br />
<br />
Hi, I'm Monty Montgomery from [http://www.redhat.com/ Red Hat] and [http://xiph.org/ Xiph.Org].<br />
<br />
A few months ago, I wrote<br />
[http://people.xiph.org/~xiphmont/demo/neil-young.html an article on digital audio and why 24bit/192kHz music downloads don't make sense].<br />
In the article, I<br />
mentioned--almost in passing--that a digital waveform is<br />
[http://people.xiph.org/~xiphmont/demo/neil-young.html#toc_sfam not a stairstep],<br />
and you certainly don't get a stairstep when you<br />
[[WikiPedia:Digital-to-analog_converter|convert from digital back to analog]].<br />
<br />
Of everything in the entire article, '''that''' was the number one thing<br />
people wrote about. In fact, more than half the mail I got was questions and<br />
comments about basic digital signal behavior. Since there's interest, let's<br />
take a little time to play with some ''simple'' digital signals.<br />
<br />
==Veritas ex machina==<br />
[[Image:Dsat_002.jpg|200px|right]]<br />
[[Image:Dsat_003.jpg|200px|right]]<br />
[[Image:Dsat_004.jpg|200px|right]]<br />
[[Image:Dsat_005.jpg|200px|right]]<br />
<br />
Pretend for a moment that we have no idea how digital signals really<br />
behave. In that case it doesn't make sense for us to use digital test<br />
equipment either. Fortunately for this exercise, there's still plenty<br />
of working analog lab equipment out there.<br />
<br />
First up, we need a [[WikiPedia:Function_generator|signal generator]] to provide us with analog input<br />
signals--in this case, an<br />
[http://www.home.agilent.com/en/pd-3325A%3Aepsg%3Apro-pn-3325A/synthesizer-function-generator?pm=PL&nid=-536900197.536896863&cc=SE&lc=swe HP3325]<br />
from 1978. It's still a pretty good<br />
generator, so if you don't mind the size, the weight, the power<br />
consumption, and the noisy fan, you can find them on eBay... occasionally<br />
for only slightly more than you'll pay for shipping.<br />
<br />
Next, we'll observe our analog waveforms on [[WikiPedia:Oscilloscope_types#Cathode-ray_oscilloscope_.28CRO.29|analog oscilloscopes]],<br />
like this Tektronix 2246 from the mid-90s, one of the last and very best analog scopes ever made. Every home lab should have one.<br />
<br />
...and finally inspect the [[WikiPedia:Spectral_density#Electrical_engineering|frequency spectrum]] of our signals using an<br />
[[WikiPedia:Spectrum_analyzer#Swept-tuned|analog spectrum analyzer]], this<br />
[http://www.home.agilent.com/en/pd-3585A%3Aepsg%3Apro-pn-3585A/spectrum-analyzer-high-perf-20hz-40mhz?pm=PL&nid=-536900197.536897319&cc=SE&lc=swe HP3585]<br />
from the same product line as<br />
the signal generator. Like the other equipment here it has<br />
[http://www.hp9845.net/9845/hardware/processors/ a rudimentary and hilariously large microcontroller],<br />
but the signal path<br />
from input to what you see on the screen is completely analog.<br />
<br />
All of this equipment is vintage, but aside from its raw tonnage, the specs are still quite good.<br />
<br />
At the moment, we have our signal generator set to output a nice 1 [[WikiPedia:Hertz#SI_multiples|kHz]]<br />
sine wave at one [[WikiPedia:Volt|Volt]] [[WikiPedia:Amplitude#Root_mean_square_amplitude|RMS]].<br />
We see the sine wave on the oscilloscope, can verify that it is indeed<br />
1 kHz at 1 Volt RMS, which is 2.8 Volts<br />
[[WikiPedia:Amplitude#Peak-to-peak_amplitude|peak-to-peak]],<br />
and that matches the<br />
measurement on the spectrum analyzer as well.<br />
<br />
The analyzer also shows some low-level [[WikiPedia:White_noise|white noise]]<br />
and just a bit of [[WikiPedia:Harmonic_distortion#Harmonic_distortion|harmonic distortion]],<br />
with the highest peak about 70[[WikiPedia:Decibel|dB]] or so below<br />
[[WikiPedia:Fundamental_frequency|the fundamental]].<br />
Now, this doesn't matter at all in our demos, but I<br />
wanted to point it out now just in case you didn't notice it until<br />
later.<br />
<br />
Now, we drop digital sampling in the middle.<br />
<br />
For the conversion, we'll use a boring, consumer-grade, eMagic USB1<br />
audio device. It's also more than ten years old at this point, and it's<br />
getting obsolete.<br />
<br />
A recent converter can easily have an order of magnitude better specs.<br />
[[WikiPedia:Reconstruction_filter#Sampled_data_reconstruction_filters|Flatness]],<br />
[[WikiPedia:Analog-to-digital_converter#Non-linearity|linearity]],<br />
[[WikiPedia:Jitter#Sampling_jitter|jitter]],<br />
[[WikiPedia:Noise_floor|noise behavior]],<br />
[[WikiPedia:Digital-to-analog_converter#DAC_performance|everything]]...<br />
you may not<br />
have noticed. Just because we can measure an improvement doesn't<br />
mean we can hear it, and even these old consumer boxes were already at<br />
the edge of ideal transparency.<br />
<br />
The eMagic connects to my ThinkPad, which displays a digital<br />
waveform and spectrum for comparison, then the ThinkPad<br />
sends the digital signal right back out to the eMagic for<br />
re-conversion to analog and observation on the output scopes.<br />
<br />
Input to output, left to right.<br />
<br style="clear:both;"/><br />
<br />
==Stairsteps==<br />
[[Image:Dsat 006.jpg|360px|right]]<br />
[[Image:Dsat 007.png|360px|right]]<br />
OK, it's go time. We begin by converting an analog signal to digital and<br />
then right back to analog again with no other steps.<br />
<br />
The signal generator is set to produce a 1kHz sine wave just like<br />
before.<br />
<br />
We can see our analog sine wave on our input-side oscilloscope.<br />
<br />
We digitize our signal to<br />
[[Videos/A_Digital_Media_Primer_For_Geeks#Raw_.28digital_audio.29_meat|16 bit PCM at 44.1kHz]],<br />
same as on a CD.<br />
The spectrum of the digitized signal matches what we saw earlier<br />
<br />
and what we see now on the analog spectrum analyzer, aside from its <br />
[[WikiPedia:High_impedance|high-impedance input]] being just a smidge noisier.<br />
<br />
For now, the waveform display shows our digitized sine wave as a<br />
stairstep pattern, one step for each sample.<br />
<br />
And when we look at the output signal that's been converted<br />
from digital back to analog, we see...<br />
<br />
It's exactly like the original sine wave. No stairsteps.<br />
<br />
OK, 1 kHz is still a fairly low frequency, maybe the stairsteps are just<br />
hard to see or they're being smoothed away. Fair enough. Let's choose<br />
a higher frequency, something close to [[WikiPedia:Nyquist_frequency|Nyquist]], say 15kHz.<br />
<br />
Now the sine wave is represented by less than three samples per cycle, and...<br />
<br />
the digital waveform looks pretty awful. Well, looks<br />
can be deceiving. The analog output...<br />
<br />
is still a perfect sine wave, exactly like the original.<br />
<br />
Let's keep going up.<br />
<br />
Let's see if I can do this without blocking any cameras.<br />
<br />
16kHz.... 17kHz... 18kHz... 19kHz... <br />
<br />
20kHz. Welcome to the upper limits of human hearing. The output<br />
waveform is still perfect. No jagged edges, no dropoff, no stairsteps.<br />
<br />
So where'd the stairsteps go? Don't answer, it's a trick question.<br />
They were never there.<br />
<br />
Drawing a digital waveform as a stairstep... was wrong to begin with.<br />
<br />
Why? A stairstep is a continuous-time function. It's jagged, and it's<br />
piecewise, but it has a defined value at every point in time.<br />
<br />
A sampled signal is entirely different. It's discrete-time; it's only<br />
got a value right at each instantaneous sample point and it's<br />
undefined, there is no value at all, everywhere between. A<br />
discrete-time signal is properly drawn as a lollipop graph.<br />
<br />
The continuous, analog counterpart of a digital signal passes<br />
smoothly through each sample point, and that's just as true for high<br />
frequencies as it is for low.<br />
<br />
Now, the interesting and not at all obvious bit is: [[WikiPedia:Nyquist%E2%80%93Shannon_sampling_theorem|there's only one<br />
bandlimited signal that passes exactly through each sample point]]. It's<br />
a unique solution. So if you sample a bandlimited signal and then<br />
convert it back, the original input is also the only possible output.<br />
<br />
[[Image:Dsat 008.png|360px|right]]<br />
<br />
And before you say, "oh, I can draw a different signal that passes<br />
through those points", well, yes you can, but if it differs even<br />
minutely from the original, it includes frequency content at or beyond<br />
Nyquist, breaks the bandlimiting requirement and isn't a valid<br />
solution.<br />
<br />
So how did everyone get confused and start thinking of digital signals<br />
as stairsteps? I can think of two good reasons.<br />
<br />
First: it's easy enough to convert a sampled signal to a true stairstep. Just<br />
extend each sample value forward until the next sample period. This is<br />
called a [[WikiPedia:Zero-order hold|zero-order hold]], and it's an important part of how some<br />
digital-to-analog converters work, especially the simplest ones.<br />
<br />
So, anyone who looks up [[WikiPedia:Digital-to-analog_converter#Practical_operation|digital-to-analog converter or<br />
digital-to-analog conversion]] is probably going to see a diagram of a<br />
stairstep waveform somewhere, but that's not a finished conversion,<br />
and it's not the signal that comes out.<br />
<br />
Second, and this is probably the more likely reason, engineers who<br />
supposedly know better, like me, draw stairsteps even though they're<br />
technically wrong. It's a sort of like a one-dimensional version of<br />
[[WikiPedia:MacPaint#Development|fat bits in an image editor]].<br />
<br />
Pixels aren't squares either, they're samples of a 2-dimensional<br />
function space and so they're also, conceptually, infinitely small<br />
points. Practically, it's a real pain in the ass to see or manipulate<br />
infinitely small anything, so big squares it is. Digital stairstep<br />
drawings are exactly the same thing.<br />
<br />
It's just a convenient drawing. The stairsteps aren't really there.<br />
<br />
==Bit-depth==<br />
[[Image:Dsat_009.jpg|360px|right]]<br />
[[Image:Dsat_010.jpg|260px|right]]<br />
<br />
When we convert a digital signal back to analog, the result is<br />
''also'' smooth regardless of the [[WikiPedia:Audio_bit_depth|bit depth]]. 24 bits or 16 bits...<br />
or 8 bits... it doesn't matter.<br />
<br />
So does that mean that the digital bit depth makes no difference at<br />
all? Of course not.<br />
<br />
Channel 2 here is the same sine wave input, but we quantize with<br />
[[WikiPedia:Dither|dither]] down to 8 bits.<br />
<br />
On the scope, we still see a nice<br />
smooth sine wave on channel 2. Look very close, and you'll also see a<br />
bit more noise. That's a clue.<br />
<br />
If we look at the spectrum of the signal... aha! Our sine wave is<br />
still there unaffected, but the noise level of the 8-bit signal on<br />
the second channel is much higher!<br />
<br />
And that's the difference the number of bits makes. That's it!<br />
<br />
When we digitize a signal, first we sample it. The<br />
sampling step is perfect; it loses nothing. But then we [[WikiPedia:Quantization_(sound_processing)|quantize]] it,<br />
and [[WikiPedia:Quantization_error|quantization adds noise]].<br />
<br />
The number of bits determines how much noise and so the level of the<br />
noise floor.<br />
<br />
What does this dithered quantization noise sound like? Let's listen<br />
to our 8-bit sine wave.<br />
<br />
That may have been hard to hear anything but the tone. Let's listen<br />
to just the noise after we notch out the sine wave and then bring the<br />
gain up a bit because the noise is quiet.<br />
<br />
Those of you who have used analog recording equipment may have just<br />
thought to yourselves, "My goodness! That sounds like tape hiss!"<br />
Well, it doesn't just sound like tape hiss, it acts like it too, and<br />
if we use a [[WikiPedia:Dither#Different_types|gaussian dither]] then it's<br />
[[WikiPedia:Central_limit_theorem|mathematically equivalent]] in every way. It ''is'' tape hiss.<br />
<br />
Intuitively, that means that we can measure tape hiss and thus the noise floor<br />
of [[WikiPedia:Magnetic_tape_sound_recording|magnetic audio tape]]<br />
in [[WikiPedia:Shannon–Hartley_theorem#Examples|bits instead of decibels]], in order to put things in a<br />
digital perspective. [[WikiPedia:Compact cassettes|Compact cassettes]] (for those of you who are old enough to remember them) could reach as<br />
deep as 9 bits in perfect conditions, though 5 to 6 bits was<br />
more typical, especially if it was a recording made on a<br />
[[WikiPedia:Cassette_deck|tape deck]]. That's right... your mix tapes were only about 6 bits<br />
deep... if you were lucky!<br />
<br />
The very best professional [[WikiPedia:Reel-to-reel_audio_tape_recording|open reel tape]] used in studios could barely<br />
hit... any guesses? 13 bits ''with'' [[WikiPedia:Reel-to-reel_audio_tape_recording#Noise_reduction|advanced noise reduction]]. And<br />
that's why seeing '[[WikiPedia:SPARS_code|D D D]]' on a [[WikiPedia:Compact_disk|Compact Disc]] used to be such a big,<br />
high-end deal.<br />
<br />
==Dither==<br />
[[Image:Dsat_011.png|360px|right]]<br />
<br />
I keep saying that I'm quantizing with [[Wikipedia:dither|dither]], so what is dither<br />
exactly and, more importantly, what does it do?<br />
<br />
The simple way to quantize a signal is to choose the digital<br />
amplitude value closest to the original analog amplitude. [[WikiPedia:Rounding|Obvious]],<br />
right? Unfortunately, the exact noise you get from this simple<br />
quantization scheme depends somewhat on the input signal,<br />
<br />
so we may get noise that's inconsistent, or causes distortion, or is<br />
undesirable in some other way.<br />
<br style="clear:both;"/><br />
<center><div style="background-color:#DDDDFF;border-color:#CCCCDD;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
'''Going deeper…'''<br />
*Cameron Nicklaus Christou's thesis [http://uwspace.uwaterloo.ca/bitstream/10012/3867/1/thesis.pdf Optimal Dither and Noise Shaping in Image Processing] provides an ''excellent'' explanation of dither and noise shaping.<br />
</div></center><br />
<br />
Dither is specially-constructed noise that substitutes for the noise<br />
produced by simple quantization. Dither doesn't [[WikiPedia:Sound_masking|drown out or mask]]<br />
quantization noise, it actually replaces it with noise characteristics<br />
of our choosing that aren't influenced by the input.<br />
<br />
Let's ''watch'' what dither does. The signal generator has too much noise for this test so we'll produce a mathematically perfect sine wave with the ThinkPad and quantize it to 8 bits with dithering.<br />
<br />
We see a nice sine wave on the waveform display and output scope and, once the analog spectrum analyzer catches up...<br />
a clean frequency peak with a uniform noise floor on both spectral displays<br />
just like before. Again, this is with dither.<br />
<br />
Now I turn dithering off.<br />
<br />
The quantization noise, that dither had spread out into a nice, flat noise<br />
floor, piles up into harmonic distortion peaks. The noise floor is<br />
lower, but the level of distortion becomes nonzero, and the distortion<br />
peaks sit higher than the dithering noise did.<br />
<br />
At 8 bits this effect is exaggerated. At 16 bits,<br />
even without dither, harmonic distortion is going to be so low as to<br />
be completely inaudible.<br />
<br />
Still, we can use dither to eliminate it completely if we so choose.<br />
<br />
Turning the dither off again for a moment, you'll notice that the<br />
absolute level of distortion from undithered quantization stays<br />
approximately constant regardless of the input amplitude.<br />
But when the signal level drops below a half a bit, everything<br />
quantizes to zero.<br />
<br />
In a sense, everything quantizing to zero is just 100% distortion!<br />
Dither eliminates this distortion too. We reenable dither<br />
and ... there's our signal back at 1/4 bit, with our nice flat noise floor.<br />
<br />
The noise floor doesn't have to be flat. Dither is noise of our<br />
choosing, so let's choose a noise as [http://www.acoustics.salford.ac.uk/res/cox/sound_quality/?content=subjective inoffensive] and<br />
[[WikiPedia:Absolute_threshold_of_hearing|difficult to notice]]<br />
as possible.<br />
<br />
Our hearing is most sensitive in the midrange from 2kHz to 4kHz,<br />
so that's where background noise is going to be the most obvious.<br />
We can [[WikiPedia:Noise_shaping|shape dithering noise]] away from sensitive frequencies to where<br />
hearing is less sensitive, usually the highest frequencies.<br />
<br />
16-bit dithering noise is normally much too quiet to hear at all, but<br />
let's listen to our noise shaping example, again with the gain<br />
brought way up...<br />
<br />
Lastly, dithered quantization noise ''is'' higher [[WikiPedia:power|Sound_power]] overall<br />
than undithered quantization noise even when it sounds quieter, and<br />
you can see that on a [[WikiPedia:VU_meter|VU meter]] during passages of near-silence. But<br />
dither isn't only an on or off choice. We can reduce the dither's<br />
power to balance less noise against a bit of distortion to minimize<br />
the overall effect.<br />
<br />
We'll also [[WikiPedia:Amplitude_modulation|modulate the input signal]] like this to show how a varying input affects the quantization noise. At<br />
full dithering power, the noise is uniform, constant, and featureless<br />
just like we expect:<br />
<br />
As we reduce the dither's power, the input increasingly<br />
affects the amplitude and the character of the quantization noise.<br />
Shaped dither behaves similarly, but noise shaping lends one more nice<br />
advantage. To make a long story short, it can use a somewhat lower<br />
dither power before the input has as much effect on the output.<br />
<br />
Despite all the time I just spent on dither, we're talking about<br />
differences that start 100 decibels and more below [[WikiPedia:Full_scale|full scale]]. Maybe<br />
if the CD had been<br />
[http://www.research.philips.com/technologies/projects/cd/index.html 14 bits as originally designed],<br />
dither ''might'' be<br />
more important. Maybe. At 16 bits, really, it's mostly a wash. You<br />
can think of dither as an insurance policy that gives several extra<br />
decibels of dynamic range just in case. The simple fact is, though, no<br />
one ever ruined a great recording by not dithering the final master.<br />
<br />
==Bandlimitation and timing==<br />
[[image:Dsat_013.jpg|360px|right]]<br />
<br />
We've been using [[WikiPedia:Sine_wave|sine waves]]. They're the obvious choice when what we<br />
want to see is a system's behavior at a given isolated frequency. Now<br />
let's look at something a bit more complex. What should we expect to<br />
happen when I change the input to a [[WikiPedia:Square_wave|square wave]]...<br />
<br />
The input scope confirms our 1kHz square wave. The output scope shows..<br />
<br />
<br />
Exactly what it should.<br />
...<br />
What is a square wave really? <br />
<br />
<br />
Well, we can say it's a waveform that's some positive value for half a cycle and then transitions instantaneously to a negative value for the other half.<br />
<br />
:<math><br />
\ x(t) = \begin{cases} 1, & |t| < T_1 \\ 0, & T_1 < |t| \leq {1 \over 2}T \end{cases}<br />
</math><br />
<br />
But that doesn't really tell us anything useful about how that input becomes this output.<br />
<br />
Then we remember that any waveform is also [[WikiPedia:Fourier_series|the sum of discrete frequencies]],<br />
and a square wave is particularly simple sum: a fundamental and an<br />
infinite series of [[WikiPedia:Even_and_odd_functions#Harmonics|odd harmonics]]. Sum them all up, you get a<br />
square wave.<br />
<br />
[[Image:dsat_015.jpg|360px|right]]<br />
:<math>\begin{align}<br />
x_{\mathrm{square}}(t) = \frac{4}{\pi}\sin(\omega t) + \frac{4}{3\pi}\sin(3\omega t) + \frac{4}{5\pi}\sin(5\omega t) + \\<br />
\frac{4}{7\pi}\sin(7\omega t) + \frac{4}{9\pi}\sin(9\omega t) + \frac{4}{11\pi}\sin(11\omega t) + \\ <br />
\frac{4}{13\pi}\sin(13\omega t) + \frac{4}{15\pi}\sin(15\omega t) + \frac{4}{17\pi}\sin(17\omega t) + \\<br />
\frac{4}{19\pi}\sin(19\omega t) + \frac{4}{21\pi}\sin(21\omega t) + \frac{4}{23\pi}\sin(23\omega t) + \\<br />
\frac{4}{25\pi}\sin(25\omega t) + \frac{4}{27\pi}\sin(27\omega t) + \frac{4}{29\pi}\sin(29\omega t) + \\<br />
\frac{4}{31\pi}\sin(31\omega t) + \frac{4}{33\pi}\sin(33\omega t) + \cdots <br />
\end{align}</math><br />
<br />
At first glance, that doesn't seem very useful either. You have to sum up an infinite number of harmonics to get the answer. ''Ah'', but we don't have an infinite number of harmonics.<br />
<br />
We're using a quite sharp [[WikiPedia:Low-pass_filter|anti-aliasing filter]] that cuts off right<br />
above 20kHz, so our signal is [[WikiPedia:Bandlimiting|bandlimited]], so only the first ten terms make it through.<br />
<br />
..and that's exactly what we see on the output scope.<br />
<br />
The rippling you see around sharp edges in a bandlimited signal is called the [[WikiPedia:/Gibbs_phenomenon|Gibbs effect]]. It happens whenever you slice off part of the frequency domain in the middle of nonzero energy.<br />
<br />
The usual rule of thumb you'll hear is "the sharper the cutoff, the<br />
stronger the rippling", which is approximately true, but we have to be<br />
careful how we think about it.<br />
For example... what would you expect our quite sharp anti-aliasing filter<br />
to do if I run our signal through it a second time?<br />
<br />
Aside from adding a few fractional cycles of delay, the answer is...<br />
nothing at all. The signal is already bandlimited. Bandlimiting it<br />
again doesn't do anything. A second pass can't remove frequencies<br />
that we already removed.<br />
<br />
And that's important. People tend to think of the ripples as<br />
a kind of [[WikiPedia:Sonic_artifact|artifact]] that's added by anti-aliasing and [[WikiPedia:Reconstruction_filter|anti-imaging]]<br />
filters, implying that the ripples get worse each time the signal<br />
passes through. We can see that in this case that didn't happen. So<br />
was it really the filter that added the ripples the first time<br />
through? No, not really. It's a subtle distinction, but Gibbs effect<br />
ripples aren't added by filters, they're just part of what a<br />
bandlimited signal ''is''.<br />
<br />
Even if we synthetically construct what looks like a perfect digital<br />
square wave,<br />
<br />
it's still limited to the channel bandwidth. Remember,<br />
the stairstep representation is misleading.<br />
<br />
What we really have here are instantaneous sample points,<br />
<br />
and only one bandlimited signal fits those points. All we did when we<br />
drew our apparently perfect square wave was line up the sample points<br />
just right so it appeared that there were no ripples if we played<br />
[[WikiPedia:Interpolation|connect-the-dots]].<br />
<br />
But the original bandlimited signal, complete with ripples, was<br />
still there.<br />
<br />
[[image:Dsat_014.gif|360px|right]]<br />
And that leads us to one more important point. You've probably heard<br />
that the timing precision of a digital signal is limited by its sample<br />
rate; put another way,<br />
<br />
that digital signals can't represent anything that falls between the<br />
samples.. implying that [[WikiPedia:Dirac_delta_function|impulses]] or<br />
[[WikiPedia:Synthesizer#ADSR_envelope|fast attacks]] have to align exactly<br />
with a sample, or the timing gets mangled... or they just disappear.<br />
<br />
At this point, we can easily see why that's wrong.<br />
<br />
Again, our input signals are bandlimited. And digital signals are<br />
samples, not stairsteps, not 'connect-the-dots'. We most certainly<br />
can, for example, put the rising edge of our bandlimited square wave<br />
anywhere we want between samples.<br />
<br />
It's represented perfectly and it's reconstructed perfectly.<br />
<br />
==Epilogue==<br />
<br />
[[Image:Moffey.jpg|360px|right]]<br />
<br />
Just like in [[Videos/A_Digital_Media_Primer_For_Geeks|the previous episode]], we've covered a broad range of<br />
topics, and yet barely scratched the surface of each one. If anything, my<br />
sins of omission are greater this time around... but this is a good<br />
stopping point.<br />
<br />
Or maybe, a good starting point. Dig deeper. Experiment. I chose my<br />
demos very carefully to be simple and give clear results. You can<br />
reproduce every one of them on your own if you like. But let's face<br />
it, sometimes we learn the most about a spiffy toy by breaking it open<br />
and studying all the pieces that fall out. And that's OK, we're<br />
engineers. Play with the demo parameters, hack up the code, set up<br />
alternate experiments. The source code for everything, including the<br />
little pushbutton demo application, is up at xiph.org.<br />
<br />
In the course of experimentation, you're likely to run into something<br />
that you didn't expect and can't explain. Don't worry! My earlier<br />
snark aside, Wikipedia is fantastic for exactly this kind of casual<br />
research. And, if you're really serious about understanding signals,<br />
several universities have advanced materials online, such as the<br />
[http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-003-signals-and-systems-spring-2010/index.htm 6.003]<br />
and<br />
[http://ocw.mit.edu/resources/res-6-007-signals-and-systems-spring-2011/ RES.6-007]<br />
Signals and Systems modules at MIT OpenCourseWare. And of<br />
course, there's always the [http://webchat.freenode.net/?channels=xiph community here at Xiph.Org].<br />
<br />
Digging deeper or not, I am out of coffee, so, until next time, happy<br />
hacking!<br />
<br />
==Credits==<br />
[[Image:Dmpfg_019.png|360px|right]]<br />
Written by: Christopher (Monty) Montgomery and the Xiph.Org Community<br />
<br />
Special thanks to:<br />
*Heidi Baumgartner, for the second Tektronix oscilloscope<br />
*Gregory Maxwell and Dr. Timothy Terriberry, for additional technical review<br />
<br />
Intro, title and credits music:<br><br />
"Andy Warhol Is Gone", by Lousy Robot<br><br />
Used by permission of Lousy Robot.<br><br />
Original source track All Rights Reserved.<br><br />
[http://www.lousyrobot.com www.lousyrobot.com]<br />
<br />
This Video Was Produced Entirely With Free and Open Source Software:<br><br />
<br />
*[http://www.gnu.org/ GNU]<br><br />
*[http://www.linux.org/ Linux]<br><br />
*[http://fedoraproject.org/ Fedora]<br><br />
*[http://cinelerra.org/ Cinelerra]<br><br />
*[http://www.gimp.org/ The Gimp]<br><br />
*[http://audacity.sourceforge.net/ Audacity]<br><br />
*[http://svn.xiph.org/trunk/postfish/README Postfish]<br><br />
*[http://gstreamer.freedesktop.org/ Gstreamer]<br><br />
<br />
All trademarks are the property of their respective owners. <br />
<br />
*''Complete video'' [http://creativecommons.org/licenses/by-sa/3.0/legalcode CC-BY-SA]<br><br />
*''Text transcript and Wiki edition'' [http://creativecommons.org/licenses/by-sa/3.0/legalcode CC-BY-SA]<br><br />
<br />
A Co-Production of Xiph.Org and Red Hat, Inc.<br><br />
(C) 2012-2013, Some Rights Reserved<br><br />
<br />
== Use The Source Luke ==<br />
<br />
As stated in the Epilogue, everything that appears in the video demos is driven by open source software, which means the source is both available for inspection and freely usable by the community. The Thinkpad that appears in the video was running Fedora 17 and Gnome Shell (Gnome 3). The demonstration software does not require Fedora specifically, but it does require Gnu/Linux to run in its current form. In all, the video involved just under 50,000 lines of new and custom-purpose code (including contributions to non-Xiph projects such as Cinelerra and Gromit).<br />
<br />
=== The Spectrum and Waveform Viewer ===<br />
<br />
The realtime software spectrum analyzer application that appears in the video was a preexisting application that was dusted off and updated for use in the video. The waveform viewer (effectively a simple software oscilloscope) was written from scratch making use of some of the internals from the spectrum analyzer application. Both are available from Xiph.Org svn:<br />
<br />
<center><div style="background-color:#DDDDFF;border-color:#CCCCDD;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
*Source for the Spectrum and Waveform applications is found at:<br />
https://svn.xiph.org/trunk/spectrum/<br />
*The source can be checked out of svn using the following command line:<br />
svn co https://svn.xiph.org/trunk/spectrum<br />
*Trac is a convenient way to browse the source without checking out a copy:<br />
https://trac.xiph.org/browser/trunk/spectrum<br />
</div></center><br />
<br />
Spectrum and Waveform both expect an input stream on the command line, either as raw data or as a WAV file.<br />
<br />
=== GTK-Bounce ===<br />
<br />
The touch-controlled application used in the video is named 'gtk-bounce' and was custom-written for the sole purpose of the in-video demonstrations. It is so named because, for the most part, all it does is read the input from an audio device, and then immediately write the same data back out for playback. It also forwards a copy of this data to up to two external monitoring applications, and in several demos, applies simple filters or generates simple waveforms. It includes several demos not included in the video.<br />
<br />
<center><div style="background-color:#DDDDFF;border-color:#CCCCDD;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
*Source for gtk-bounce is found at:<br />
https://svn.xiph.org/trunk/Xiph-episode-II/bounce/<br />
*The source can be checked out of svn using the following command line:<br />
svn co https://svn.xiph.org/trunk/Xiph-episode-II/bounce/<br />
*Trac is a convenient way to browse the source without checking out a copy:<br />
https://trac.xiph.org/browser/Xiph-episode-II/bounce/<br />
</div></center><br />
<br />
The application is somewhat hardwired for specific demo parameters, but most of the hardwired settings can be found at the top of each source file. As found in SVN, the application expects an ALSA hardware audio device at hw:1, and if none if found, it will wait for one to appear. Once a sound device is successfully initialized, it expects to find and open two pipes named pipe0 and pipe1 for output in the current directory. In the video, the waveform and spectrum applications are started to take input from pipe0 and pipe1 respectively. The output sent to the two pipes is identical, and in most demos matches the output data sent to the hardware device for conversion to analog. The only exception is the tenth demo panel (which does not appear in the video) where gtk-bounce can be set to monitor the hardware inputs instead while the outputs are used to produce test waveforms.<br />
<br />
Assuming gtk-bounce, spectrum and waveform have been checked out and built, the configuration seen in the video can be started using the following commands:<br />
<center><div style="background-color:#DDDDFF;border-color:#CCCCDD;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
* make the pipe fifos for the applications to communicate (only needs to be done once)<br />
mkfifo pipe0 pipe1<br />
* start all three applications<br />
waveform pipe0 & spectrum pipe1 & gtk-bounce &<br />
</div></center><br />
<br />
Gtk-bounce consists of eleven pushbutton panels (numbered zero through ten) that can be selected by scrolling up and dwon with the arrow buttons on the right side. Each panel is intended for a specific demo or part of a demo.<br />
<br />
* Panel 0: This panel presents buttons that allow the sound card to be configured in several sampling rates and bit depths. Samples read from the audio inputs are sent to the output pipes and audio outputs for playback without modification.<br />
<br />
* Panel 1: <br />
<br />
* Panel 2: <br />
<br />
* Panel 3: <br />
<br />
* Panel 4: <br />
<br />
* Panel 5: <br />
<br />
* Panel 6: <br />
<br />
* Panel 7: <br />
<br />
* Panel 8: <br />
<br />
* Panel 9: <br />
<br />
* Panel 10:<br />
<br />
=== Cairo Animations ===<br />
<br />
The animations featured throughout the Episode 2 video were rapid-development spaghetti hack-jobs coded by hand in raw Cairo. Each module generated a series of PNG stills that were then stitched into an animation with Cinelerra or mplayer. In the interest of pointing and laughing at what really bad code looks like...<br />
<br />
<center><div style="background-color:#DDDDFF;border-color:#CCCCDD;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
*Source for the Cairo animations is found at:<br />
https://svn.xiph.org/trunk/Xiph-episode-II/cairo/<br />
*The source can be checked out of svn using the following command line:<br />
svn co https://svn.xiph.org/trunk/Xiph-episode-II/cairo/<br />
*Trac is a convenient way to browse the source without checking out a copy:<br />
https://trac.xiph.org/browser/Xiph-episode-II/cairo/<br />
</div></center></div>Gmaxwellhttps://wiki.xiph.org/index.php?title=File:Dsat_015.jpg&diff=13973File:Dsat 015.jpg2013-02-26T09:04:10Z<p>Gmaxwell: </p>
<hr />
<div></div>Gmaxwellhttps://wiki.xiph.org/index.php?title=Videos/Digital_Show_and_Tell&diff=13972Videos/Digital Show and Tell2013-02-26T08:56:01Z<p>Gmaxwell: /* Credits */ hurray. you must never change the programs you use.</p>
<hr />
<div><small>''Wiki edition''</small><br />
[[Image:dsat_001.jpg|400px|right]]<br />
<br />
Continuing in the "firehose" tradition of [[Videos/A_Digital_Media_Primer_For_Geeks|Episode 01]], Xiph.Org's second video on digital media explores multiple facets of digital audio signals and how they ''really'' behave in the real world.<br />
<br />
Demonstrations of sampling, quantization, bit-depth, and dither explore digital audio behavior on real audio equipment using both modern digital analysis and vintage analog bench equipment, just in case we can't trust those newfangled digital gizmos. You can download the source code for each demo and try it all for yourself!<br />
<br/><br/><br/><br />
<center><font size="+2">[http://www.xiph.org/video/vid2.shtml Download or Watch online]</font></center><br />
<br style="clear:both;"/><br />
Supported players: [http://www.videolan.org/vlc/ VLC 1.1+], [https://www.mozilla.com/en-US/firefox/ Firefox ], [http://www.chromium.org/Home Chrome ], [http://www.opera.com/ Opera]. Or see [http://www.webmproject.org/users/ other WebM] or [[TheoraSoftwarePlayers|other Theora]] players.<br />
<br />
If you're having trouble with playback in a modern browser or player, please visit our [[Playback_Troubleshooting|playback troubleshooting and discussion]] page.<br />
<br/><br />
<hr/><br />
<br/><br/><br/><br />
[[Image:Xiph_ep02_test.png|400px|right]]<br />
<br />
Hi, I'm Monty Montgomery from [http://www.redhat.com/ Red Hat] and [http://xiph.org/ Xiph.Org].<br />
<br />
A few months ago, I wrote<br />
[http://people.xiph.org/~xiphmont/demo/neil-young.html an article on digital audio and why 24bit/192kHz music downloads don't make sense].<br />
In the article, I<br />
mentioned--almost in passing--that a digital waveform is<br />
[http://people.xiph.org/~xiphmont/demo/neil-young.html#toc_sfam not a stairstep],<br />
and you certainly don't get a stairstep when you<br />
[[WikiPedia:Digital-to-analog_converter|convert from digital back to analog]].<br />
<br />
Of everything in the entire article, '''that''' was the number one thing<br />
people wrote about. In fact, more than half the mail I got was questions and<br />
comments about basic digital signal behavior. Since there's interest, let's<br />
take a little time to play with some ''simple'' digital signals.<br />
<br />
==Veritas ex machina==<br />
[[Image:Dsat_002.jpg|200px|right]]<br />
[[Image:Dsat_003.jpg|200px|right]]<br />
[[Image:Dsat_004.jpg|200px|right]]<br />
[[Image:Dsat_005.jpg|200px|right]]<br />
<br />
Pretend for a moment that we have no idea how digital signals really<br />
behave. In that case it doesn't make sense for us to use digital test<br />
equipment either. Fortunately for this exercise, there's still plenty<br />
of working analog lab equipment out there.<br />
<br />
First up, we need a [[WikiPedia:Function_generator|signal generator]] to provide us with analog input<br />
signals--in this case, an<br />
[http://www.home.agilent.com/en/pd-3325A%3Aepsg%3Apro-pn-3325A/synthesizer-function-generator?pm=PL&nid=-536900197.536896863&cc=SE&lc=swe HP3325]<br />
from 1978. It's still a pretty good<br />
generator, so if you don't mind the size, the weight, the power<br />
consumption, and the noisy fan, you can find them on eBay... occasionally<br />
for only slightly more than you'll pay for shipping.<br />
<br />
Next, we'll observe our analog waveforms on [[WikiPedia:Oscilloscope_types#Cathode-ray_oscilloscope_.28CRO.29|analog oscilloscopes]],<br />
like this Tektronix 2246 from the mid-90s, one of the last and very best analog scopes ever made. Every home lab should have one.<br />
<br />
...and finally inspect the [[WikiPedia:Spectral_density#Electrical_engineering|frequency spectrum]] of our signals using an<br />
[[WikiPedia:Spectrum_analyzer#Swept-tuned|analog spectrum analyzer]], this<br />
[http://www.home.agilent.com/en/pd-3585A%3Aepsg%3Apro-pn-3585A/spectrum-analyzer-high-perf-20hz-40mhz?pm=PL&nid=-536900197.536897319&cc=SE&lc=swe HP3585]<br />
from the same product line as<br />
the signal generator. Like the other equipment here it has<br />
[http://www.hp9845.net/9845/hardware/processors/ a rudimentary and hilariously large microcontroller],<br />
but the signal path<br />
from input to what you see on the screen is completely analog.<br />
<br />
All of this equipment is vintage, but aside from its raw tonnage, the specs are still quite good.<br />
<br />
At the moment, we have our signal generator set to output a nice 1 [[WikiPedia:Hertz#SI_multiples|kHz]]<br />
sine wave at one [[WikiPedia:Volt|Volt]] [[WikiPedia:Amplitude#Root_mean_square_amplitude|RMS]].<br />
We see the sine wave on the oscilloscope, can verify that it is indeed<br />
1 kHz at 1 Volt RMS, which is 2.8 Volts<br />
[[WikiPedia:Amplitude#Peak-to-peak_amplitude|peak-to-peak]],<br />
and that matches the<br />
measurement on the spectrum analyzer as well.<br />
<br />
The analyzer also shows some low-level [[WikiPedia:White_noise|white noise]]<br />
and just a bit of [[WikiPedia:Harmonic_distortion#Harmonic_distortion|harmonic distortion]],<br />
with the highest peak about 70[[WikiPedia:Decibel|dB]] or so below<br />
[[WikiPedia:Fundamental_frequency|the fundamental]].<br />
Now, this doesn't matter at all in our demos, but I<br />
wanted to point it out now just in case you didn't notice it until<br />
later.<br />
<br />
Now, we drop digital sampling in the middle.<br />
<br />
For the conversion, we'll use a boring, consumer-grade, eMagic USB1<br />
audio device. It's also more than ten years old at this point, and it's<br />
getting obsolete.<br />
<br />
A recent converter can easily have an order of magnitude better specs.<br />
[[WikiPedia:Reconstruction_filter#Sampled_data_reconstruction_filters|Flatness]],<br />
[[WikiPedia:Analog-to-digital_converter#Non-linearity|linearity]],<br />
[[WikiPedia:Jitter#Sampling_jitter|jitter]],<br />
[[WikiPedia:Noise_floor|noise behavior]],<br />
[[WikiPedia:Digital-to-analog_converter#DAC_performance|everything]]...<br />
you may not<br />
have noticed. Just because we can measure an improvement doesn't<br />
mean we can hear it, and even these old consumer boxes were already at<br />
the edge of ideal transparency.<br />
<br />
The eMagic connects to my ThinkPad, which displays a digital<br />
waveform and spectrum for comparison, then the ThinkPad<br />
sends the digital signal right back out to the eMagic for<br />
re-conversion to analog and observation on the output scopes.<br />
<br />
Input to output, left to right.<br />
<br style="clear:both;"/><br />
<br />
==Stairsteps==<br />
[[Image:Dsat 006.jpg|360px|right]]<br />
[[Image:Dsat 007.png|360px|right]]<br />
OK, it's go time. We begin by converting an analog signal to digital and<br />
then right back to analog again with no other steps.<br />
<br />
The signal generator is set to produce a 1kHz sine wave just like<br />
before.<br />
<br />
We can see our analog sine wave on our input-side oscilloscope.<br />
<br />
We digitize our signal to<br />
[[Videos/A_Digital_Media_Primer_For_Geeks#Raw_.28digital_audio.29_meat|16 bit PCM at 44.1kHz]],<br />
same as on a CD.<br />
The spectrum of the digitized signal matches what we saw earlier<br />
<br />
and what we see now on the analog spectrum analyzer, aside from its <br />
[[WikiPedia:High_impedance|high-impedance input]] being just a smidge noisier.<br />
<br />
For now, the waveform display shows our digitized sine wave as a<br />
stairstep pattern, one step for each sample.<br />
<br />
And when we look at the output signal that's been converted<br />
from digital back to analog, we see...<br />
<br />
It's exactly like the original sine wave. No stairsteps.<br />
<br />
OK, 1 kHz is still a fairly low frequency, maybe the stairsteps are just<br />
hard to see or they're being smoothed away. Fair enough. Let's choose<br />
a higher frequency, something close to [[WikiPedia:Nyquist_frequency|Nyquist]], say 15kHz.<br />
<br />
Now the sine wave is represented by less than three samples per cycle, and...<br />
<br />
the digital waveform looks pretty awful. Well, looks<br />
can be deceiving. The analog output...<br />
<br />
is still a perfect sine wave, exactly like the original.<br />
<br />
Let's keep going up.<br />
<br />
Let's see if I can do this without blocking any cameras.<br />
<br />
16kHz.... 17kHz... 18kHz... 19kHz... <br />
<br />
20kHz. Welcome to the upper limits of human hearing. The output<br />
waveform is still perfect. No jagged edges, no dropoff, no stairsteps.<br />
<br />
So where'd the stairsteps go? Don't answer, it's a trick question.<br />
They were never there.<br />
<br />
Drawing a digital waveform as a stairstep... was wrong to begin with.<br />
<br />
Why? A stairstep is a continuous-time function. It's jagged, and it's<br />
piecewise, but it has a defined value at every point in time.<br />
<br />
A sampled signal is entirely different. It's discrete-time; it's only<br />
got a value right at each instantaneous sample point and it's<br />
undefined, there is no value at all, everywhere between. A<br />
discrete-time signal is properly drawn as a lollipop graph.<br />
<br />
The continuous, analog counterpart of a digital signal passes<br />
smoothly through each sample point, and that's just as true for high<br />
frequencies as it is for low.<br />
<br />
Now, the interesting and not at all obvious bit is: [[WikiPedia:Nyquist%E2%80%93Shannon_sampling_theorem|there's only one<br />
bandlimited signal that passes exactly through each sample point]]. It's<br />
a unique solution. So if you sample a bandlimited signal and then<br />
convert it back, the original input is also the only possible output.<br />
<br />
[[Image:Dsat 008.png|360px|right]]<br />
<br />
And before you say, "oh, I can draw a different signal that passes<br />
through those points", well, yes you can, but if it differs even<br />
minutely from the original, it includes frequency content at or beyond<br />
Nyquist, breaks the bandlimiting requirement and isn't a valid<br />
solution.<br />
<br />
So how did everyone get confused and start thinking of digital signals<br />
as stairsteps? I can think of two good reasons.<br />
<br />
First: it's easy enough to convert a sampled signal to a true stairstep. Just<br />
extend each sample value forward until the next sample period. This is<br />
called a [[WikiPedia:Zero-order hold|zero-order hold]], and it's an important part of how some<br />
digital-to-analog converters work, especially the simplest ones.<br />
<br />
So, anyone who looks up [[WikiPedia:Digital-to-analog_converter#Practical_operation|digital-to-analog converter or<br />
digital-to-analog conversion]] is probably going to see a diagram of a<br />
stairstep waveform somewhere, but that's not a finished conversion,<br />
and it's not the signal that comes out.<br />
<br />
Second, and this is probably the more likely reason, engineers who<br />
supposedly know better, like me, draw stairsteps even though they're<br />
technically wrong. It's a sort of like a one-dimensional version of<br />
[[WikiPedia:MacPaint#Development|fat bits in an image editor]].<br />
<br />
Pixels aren't squares either, they're samples of a 2-dimensional<br />
function space and so they're also, conceptually, infinitely small<br />
points. Practically, it's a real pain in the ass to see or manipulate<br />
infinitely small anything, so big squares it is. Digital stairstep<br />
drawings are exactly the same thing.<br />
<br />
It's just a convenient drawing. The stairsteps aren't really there.<br />
<br />
==Bit-depth==<br />
[[Image:Dsat_009.jpg|360px|right]]<br />
[[Image:Dsat_010.jpg|260px|right]]<br />
<br />
When we convert a digital signal back to analog, the result is<br />
''also'' smooth regardless of the [[WikiPedia:Audio_bit_depth|bit depth]]. 24 bits or 16 bits...<br />
or 8 bits... it doesn't matter.<br />
<br />
So does that mean that the digital bit depth makes no difference at<br />
all? Of course not.<br />
<br />
Channel 2 here is the same sine wave input, but we quantize with<br />
[[WikiPedia:Dither|dither]] down to 8 bits.<br />
<br />
On the scope, we still see a nice<br />
smooth sine wave on channel 2. Look very close, and you'll also see a<br />
bit more noise. That's a clue.<br />
<br />
If we look at the spectrum of the signal... aha! Our sine wave is<br />
still there unaffected, but the noise level of the 8-bit signal on<br />
the second channel is much higher!<br />
<br />
And that's the difference the number of bits makes. That's it!<br />
<br />
When we digitize a signal, first we sample it. The<br />
sampling step is perfect; it loses nothing. But then we [[WikiPedia:Quantization_(sound_processing)|quantize]] it,<br />
and [[WikiPedia:Quantization_error|quantization adds noise]].<br />
<br />
The number of bits determines how much noise and so the level of the<br />
noise floor.<br />
<br />
What does this dithered quantization noise sound like? Let's listen<br />
to our 8-bit sine wave.<br />
<br />
That may have been hard to hear anything but the tone. Let's listen<br />
to just the noise after we notch out the sine wave and then bring the<br />
gain up a bit because the noise is quiet.<br />
<br />
Those of you who have used analog recording equipment may have just<br />
thought to yourselves, "My goodness! That sounds like tape hiss!"<br />
Well, it doesn't just sound like tape hiss, it acts like it too, and<br />
if we use a [[WikiPedia:Dither#Different_types|gaussian dither]] then it's<br />
[[WikiPedia:Central_limit_theorem|mathematically equivalent]] in every way. It ''is'' tape hiss.<br />
<br />
Intuitively, that means that we can measure tape hiss and thus the noise floor<br />
of [[WikiPedia:Magnetic_tape_sound_recording|magnetic audio tape]]<br />
in [[WikiPedia:Shannon–Hartley_theorem#Examples|bits instead of decibels]], in order to put things in a<br />
digital perspective. [[WikiPedia:Compact cassettes|Compact cassettes]] (for those of you who are old enough to remember them) could reach as<br />
deep as 9 bits in perfect conditions, though 5 to 6 bits was<br />
more typical, especially if it was a recording made on a<br />
[[WikiPedia:Cassette_deck|tape deck]]. That's right... your mix tapes were only about 6 bits<br />
deep... if you were lucky!<br />
<br />
The very best professional [[WikiPedia:Reel-to-reel_audio_tape_recording|open reel tape]] used in studios could barely<br />
hit... any guesses? 13 bits ''with'' [[WikiPedia:Reel-to-reel_audio_tape_recording#Noise_reduction|advanced noise reduction]]. And<br />
that's why seeing '[[WikiPedia:SPARS_code|D D D]]' on a [[WikiPedia:Compact_disk|Compact Disc]] used to be such a big,<br />
high-end deal.<br />
<br />
==Dither==<br />
[[Image:Dsat_011.png|360px|right]]<br />
<br />
I keep saying that I'm quantizing with [[Wikipedia:dither|dither]], so what is dither<br />
exactly and, more importantly, what does it do?<br />
<br />
The simple way to quantize a signal is to choose the digital<br />
amplitude value closest to the original analog amplitude. [[WikiPedia:Rounding|Obvious]],<br />
right? Unfortunately, the exact noise you get from this simple<br />
quantization scheme depends somewhat on the input signal,<br />
<br />
so we may get noise that's inconsistent, or causes distortion, or is<br />
undesirable in some other way.<br />
<br style="clear:both;"/><br />
<center><div style="background-color:#DDDDFF;border-color:#CCCCDD;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
'''Going deeper…'''<br />
*Cameron Nicklaus Christou's thesis [http://uwspace.uwaterloo.ca/bitstream/10012/3867/1/thesis.pdf Optimal Dither and Noise Shaping in Image Processing] provides an ''excellent'' explanation of dither and noise shaping.<br />
</div></center><br />
<br />
Dither is specially-constructed noise that substitutes for the noise<br />
produced by simple quantization. Dither doesn't [[WikiPedia:Sound_masking|drown out or mask]]<br />
quantization noise, it actually replaces it with noise characteristics<br />
of our choosing that aren't influenced by the input.<br />
<br />
Let's ''watch'' what dither does. The signal generator has too much noise for this test so we'll produce a mathematically perfect sine wave with the ThinkPad and quantize it to 8 bits with dithering.<br />
<br />
We see a nice sine wave on the waveform display and output scope and, once the analog spectrum analyzer catches up...<br />
a clean frequency peak with a uniform noise floor on both spectral displays<br />
just like before. Again, this is with dither.<br />
<br />
Now I turn dithering off.<br />
<br />
The quantization noise, that dither had spread out into a nice, flat noise<br />
floor, piles up into harmonic distortion peaks. The noise floor is<br />
lower, but the level of distortion becomes nonzero, and the distortion<br />
peaks sit higher than the dithering noise did.<br />
<br />
At 8 bits this effect is exaggerated. At 16 bits,<br />
even without dither, harmonic distortion is going to be so low as to<br />
be completely inaudible.<br />
<br />
Still, we can use dither to eliminate it completely if we so choose.<br />
<br />
Turning the dither off again for a moment, you'll notice that the<br />
absolute level of distortion from undithered quantization stays<br />
approximately constant regardless of the input amplitude.<br />
But when the signal level drops below a half a bit, everything<br />
quantizes to zero.<br />
<br />
In a sense, everything quantizing to zero is just 100% distortion!<br />
Dither eliminates this distortion too. We reenable dither<br />
and ... there's our signal back at 1/4 bit, with our nice flat noise floor.<br />
<br />
The noise floor doesn't have to be flat. Dither is noise of our<br />
choosing, so let's choose a noise as [http://www.acoustics.salford.ac.uk/res/cox/sound_quality/?content=subjective inoffensive] and<br />
[[WikiPedia:Absolute_threshold_of_hearing|difficult to notice]]<br />
as possible.<br />
<br />
Our hearing is most sensitive in the midrange from 2kHz to 4kHz,<br />
so that's where background noise is going to be the most obvious.<br />
We can [[WikiPedia:Noise_shaping|shape dithering noise]] away from sensitive frequencies to where<br />
hearing is less sensitive, usually the highest frequencies.<br />
<br />
16-bit dithering noise is normally much too quiet to hear at all, but<br />
let's listen to our noise shaping example, again with the gain<br />
brought way up...<br />
<br />
Lastly, dithered quantization noise ''is'' higher [[WikiPedia:power|Sound_power]] overall<br />
than undithered quantization noise even when it sounds quieter, and<br />
you can see that on a [[WikiPedia:VU_meter|VU meter]] during passages of near-silence. But<br />
dither isn't only an on or off choice. We can reduce the dither's<br />
power to balance less noise against a bit of distortion to minimize<br />
the overall effect.<br />
<br />
We'll also [[WikiPedia:Amplitude_modulation|modulate the input signal]] like this to show how a varying input affects the quantization noise. At<br />
full dithering power, the noise is uniform, constant, and featureless<br />
just like we expect:<br />
<br />
As we reduce the dither's power, the input increasingly<br />
affects the amplitude and the character of the quantization noise.<br />
Shaped dither behaves similarly, but noise shaping lends one more nice<br />
advantage. To make a long story short, it can use a somewhat lower<br />
dither power before the input has as much effect on the output.<br />
<br />
Despite all the time I just spent on dither, we're talking about<br />
differences that start 100 decibels and more below [[WikiPedia:Full_scale|full scale]]. Maybe<br />
if the CD had been<br />
[http://www.research.philips.com/technologies/projects/cd/index.html 14 bits as originally designed],<br />
dither ''might'' be<br />
more important. Maybe. At 16 bits, really, it's mostly a wash. You<br />
can think of dither as an insurance policy that gives several extra<br />
decibels of dynamic range just in case. The simple fact is, though, no<br />
one ever ruined a great recording by not dithering the final master.<br />
<br />
==Bandlimitation and timing==<br />
[[image:Dsat_013.jpg|360px|right]]<br />
[[image:Dsat_014.gif|360px|right]]<br />
<br />
We've been using [[WikiPedia:Sine_wave|sine waves]]. They're the obvious choice when what we<br />
want to see is a system's behavior at a given isolated frequency. Now<br />
let's look at something a bit more complex. What should we expect to<br />
happen when I change the input to a [[WikiPedia:Square_wave|square wave]]...<br />
<br />
The input scope confirms our 1kHz square wave. The output scope shows..<br />
<br />
<br />
Exactly what it should.<br />
...<br />
What is a square wave really? <br />
<br />
<br />
Well, we can say it's a waveform that's some positive value for half a cycle and then transitions instantaneously to a negative value for the other half.<br />
<br />
:<math><br />
\ x(t) = \begin{cases} 1, & |t| < T_1 \\ 0, & T_1 < |t| \leq {1 \over 2}T \end{cases}<br />
</math><br />
<br />
But that doesn't really tell us anything useful about how that input becomes this output.<br />
<br />
Then we remember that any waveform is also [[WikiPedia:Fourier_series|the sum of discrete frequencies]],<br />
and a square wave is particularly simple sum: a fundamental and an<br />
infinite series of [[WikiPedia:Even_and_odd_functions#Harmonics|odd harmonics]]. Sum them all up, you get a<br />
square wave.<br />
<br />
:<math>\begin{align}<br />
x_{\mathrm{square}}(t) = \frac{4}{\pi}\sin(\omega t) + \frac{4}{3\pi}\sin(3\omega t) + \frac{4}{5\pi}\sin(5\omega t) + \\<br />
\frac{4}{7\pi}\sin(7\omega t) + \frac{4}{9\pi}\sin(9\omega t) + \frac{4}{11\pi}\sin(11\omega t) + \\ <br />
\frac{4}{13\pi}\sin(13\omega t) + \frac{4}{15\pi}\sin(15\omega t) + \frac{4}{17\pi}\sin(17\omega t) + \\<br />
\frac{4}{19\pi}\sin(19\omega t) + \frac{4}{21\pi}\sin(21\omega t) + \frac{4}{23\pi}\sin(23\omega t) + \\<br />
\frac{4}{25\pi}\sin(25\omega t) + \frac{4}{27\pi}\sin(27\omega t) + \frac{4}{29\pi}\sin(29\omega t) + \\<br />
\frac{4}{31\pi}\sin(31\omega t) + \frac{4}{33\pi}\sin(33\omega t) + \cdots <br />
\end{align}</math><br />
<br />
At first glance, that doesn't seem very useful either. You have to sum up an infinite number of harmonics to get the answer. ''Ah'', but we don't have an infinite number of harmonics.<br />
<br />
We're using a quite sharp [[WikiPedia:Low-pass_filter|anti-aliasing filter]] that cuts off right<br />
above 20kHz, so our signal is [[WikiPedia:Bandlimiting|bandlimited]], so only the first ten terms make it through.<br />
<br />
..and that's exactly what we see on the output scope.<br />
<br />
The rippling you see around sharp edges in a bandlimited signal is called the [[WikiPedia:/Gibbs_phenomenon|Gibbs effect]]. It happens whenever you slice off part of the frequency domain in the middle of nonzero energy.<br />
<br />
The usual rule of thumb you'll hear is "the sharper the cutoff, the<br />
stronger the rippling", which is approximately true, but we have to be<br />
careful how we think about it.<br />
For example... what would you expect our quite sharp anti-aliasing filter<br />
to do if I run our signal through it a second time?<br />
<br />
Aside from adding a few fractional cycles of delay, the answer is...<br />
nothing at all. The signal is already bandlimited. Bandlimiting it<br />
again doesn't do anything. A second pass can't remove frequencies<br />
that we already removed.<br />
<br />
And that's important. People tend to think of the ripples as<br />
a kind of [[WikiPedia:Sonic_artifact|artifact]] that's added by anti-aliasing and [[WikiPedia:Reconstruction_filter|anti-imaging]]<br />
filters, implying that the ripples get worse each time the signal<br />
passes through. We can see that in this case that didn't happen. So<br />
was it really the filter that added the ripples the first time<br />
through? No, not really. It's a subtle distinction, but Gibbs effect<br />
ripples aren't added by filters, they're just part of what a<br />
bandlimited signal ''is''.<br />
<br />
Even if we synthetically construct what looks like a perfect digital<br />
square wave,<br />
<br />
it's still limited to the channel bandwidth. Remember,<br />
the stairstep representation is misleading.<br />
<br />
What we really have here are instantaneous sample points,<br />
<br />
and only one bandlimited signal fits those points. All we did when we<br />
drew our apparently perfect square wave was line up the sample points<br />
just right so it appeared that there were no ripples if we played<br />
[[WikiPedia:Interpolation|connect-the-dots]].<br />
<br />
But the original bandlimited signal, complete with ripples, was<br />
still there.<br />
<br />
And that leads us to one more important point. You've probably heard<br />
that the timing precision of a digital signal is limited by its sample<br />
rate; put another way,<br />
<br />
that digital signals can't represent anything that falls between the<br />
samples.. implying that [[WikiPedia:Dirac_delta_function|impulses]] or<br />
[[WikiPedia:Synthesizer#ADSR_envelope|fast attacks]] have to align exactly<br />
with a sample, or the timing gets mangled... or they just disappear.<br />
<br />
At this point, we can easily see why that's wrong.<br />
<br />
Again, our input signals are bandlimited. And digital signals are<br />
samples, not stairsteps, not 'connect-the-dots'. We most certainly<br />
can, for example, put the rising edge of our bandlimited square wave<br />
anywhere we want between samples.<br />
<br />
It's represented perfectly and it's reconstructed perfectly.<br />
<br />
==Epilogue==<br />
<br />
[[Image:Moffey.jpg|360px|right]]<br />
<br />
Just like in [[Videos/A_Digital_Media_Primer_For_Geeks|the previous episode]], we've covered a broad range of<br />
topics, and yet barely scratched the surface of each one. If anything, my<br />
sins of omission are greater this time around... but this is a good<br />
stopping point.<br />
<br />
Or maybe, a good starting point. Dig deeper. Experiment. I chose my<br />
demos very carefully to be simple and give clear results. You can<br />
reproduce every one of them on your own if you like. But let's face<br />
it, sometimes we learn the most about a spiffy toy by breaking it open<br />
and studying all the pieces that fall out. And that's OK, we're<br />
engineers. Play with the demo parameters, hack up the code, set up<br />
alternate experiments. The source code for everything, including the<br />
little pushbutton demo application, is up at xiph.org.<br />
<br />
In the course of experimentation, you're likely to run into something<br />
that you didn't expect and can't explain. Don't worry! My earlier<br />
snark aside, Wikipedia is fantastic for exactly this kind of casual<br />
research. And, if you're really serious about understanding signals,<br />
several universities have advanced materials online, such as the<br />
[http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-003-signals-and-systems-spring-2010/index.htm 6.003]<br />
and<br />
[http://ocw.mit.edu/resources/res-6-007-signals-and-systems-spring-2011/ RES.6-007]<br />
Signals and Systems modules at MIT OpenCourseWare. And of<br />
course, there's always the [http://webchat.freenode.net/?channels=xiph community here at Xiph.Org].<br />
<br />
Digging deeper or not, I am out of coffee, so, until next time, happy<br />
hacking!<br />
<br />
==Credits==<br />
[[Image:Dmpfg_019.png|360px|right]]<br />
Written by: Christopher (Monty) Montgomery and the Xiph.Org Community<br />
<br />
Special thanks to:<br />
*Heidi Baumgartner, for the second Tektronix oscilloscope<br />
*Gregory Maxwell and Dr. Timothy Terriberry, for additional technical review<br />
<br />
Intro, title and credits music:<br><br />
"Andy Warhol Is Gone", by Lousy Robot<br><br />
Used by permission of Lousy Robot.<br><br />
Original source track All Rights Reserved.<br><br />
[http://www.lousyrobot.com www.lousyrobot.com]<br />
<br />
This Video Was Produced Entirely With Free and Open Source Software:<br><br />
<br />
*[http://www.gnu.org/ GNU]<br><br />
*[http://www.linux.org/ Linux]<br><br />
*[http://fedoraproject.org/ Fedora]<br><br />
*[http://cinelerra.org/ Cinelerra]<br><br />
*[http://www.gimp.org/ The Gimp]<br><br />
*[http://audacity.sourceforge.net/ Audacity]<br><br />
*[http://svn.xiph.org/trunk/postfish/README Postfish]<br><br />
*[http://gstreamer.freedesktop.org/ Gstreamer]<br><br />
<br />
All trademarks are the property of their respective owners. <br />
<br />
*''Complete video'' [http://creativecommons.org/licenses/by-sa/3.0/legalcode CC-BY-SA]<br><br />
*''Text transcript and Wiki edition'' [http://creativecommons.org/licenses/by-sa/3.0/legalcode CC-BY-SA]<br><br />
<br />
A Co-Production of Xiph.Org and Red Hat, Inc.<br><br />
(C) 2012-2013, Some Rights Reserved<br><br />
<br />
== Use The Source Luke ==<br />
<br />
As stated in the Epilogue, everything that appears in the video demos is driven by open source software, which means the source is both available for inspection and freely usable by the community. The Thinkpad that appears in the video was running Fedora 17 and Gnome Shell (Gnome 3). The demonstration software does not require Fedora specifically, but it does require Gnu/Linux to run in its current form. In all, the video involved just under 50,000 lines of new and custom-purpose code (including contributions to non-Xiph projects such as Cinelerra and Gromit).<br />
<br />
=== The Spectrum and Waveform Viewer ===<br />
<br />
The realtime software spectrum analyzer application that appears in the video was a preexisting application that was dusted off and updated for use in the video. The waveform viewer (effectively a simple software oscilloscope) was written from scratch making use of some of the internals from the spectrum analyzer application. Both are available from Xiph.Org svn:<br />
<br />
<center><div style="background-color:#DDDDFF;border-color:#CCCCDD;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
*Source for the Spectrum and Waveform applications is found at:<br />
https://svn.xiph.org/trunk/spectrum/<br />
*The source can be checked out of svn using the following command line:<br />
svn co https://svn.xiph.org/trunk/spectrum<br />
*Trac is a convenient way to browse the source without checking out a copy:<br />
https://trac.xiph.org/browser/trunk/spectrum<br />
</div></center><br />
<br />
Spectrum and Waveform both expect an input stream on the command line, either as raw data or as a WAV file.<br />
<br />
=== GTK-Bounce ===<br />
<br />
The touch-controlled application used in the video is named 'gtk-bounce' and was custom-written for the sole purpose of the in-video demonstrations. It is so named because, for the most part, all it does is read the input from an audio device, and then immediately write the same data back out for playback. It also forwards a copy of this data to up to two external monitoring applications, and in several demos, applies simple filters or generates simple waveforms. It includes several demos not included in the video.<br />
<br />
<center><div style="background-color:#DDDDFF;border-color:#CCCCDD;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
*Source for gtk-bounce is found at:<br />
https://svn.xiph.org/trunk/Xiph-episode-II/bounce/<br />
*The source can be checked out of svn using the following command line:<br />
svn co https://svn.xiph.org/trunk/Xiph-episode-II/bounce/<br />
*Trac is a convenient way to browse the source without checking out a copy:<br />
https://trac.xiph.org/browser/Xiph-episode-II/bounce/<br />
</div></center><br />
<br />
The application is somewhat hardwired for specific demo purposes, but most of the hardwired settings can be found at the top of each source file. As found in SVN, the application expects an ALSA hardware audio device at hw:1, and if none if found, it will wait for one to appear. Once a sound device is successfully initialized, it expects to find and open two pipes named pipe0 and pipe1 for output in the current directory. In the video, the waveform and spectrum applications are started to take input from pipe0 and pipe1 respectively. The output sent to the two pipes is identical, and in most demos matches the output data sent to the hardware device for conversion to analog. The only exception is the tenth demo panel (which does not appear in the video) where gtk-bounce can be set to monitor the hardware inputs instead while the outputs are used to produce test waveforms.<br />
<br />
Assuming gtk-bounce, spectrum and waveform have been checked out and built, the configuration seen in the video can be started using the following commands:<br />
<center><div style="background-color:#DDDDFF;border-color:#CCCCDD;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
* make the pipe fifos for the applications to communicate (only needs to be done once)<br />
mkfifo pipe0 pipe1<br />
* start all three applications<br />
waveform pipe0 & spectrum pipe1 & gtk-bounce &<br />
</div></center><br />
<br />
Gtk-bounce consists of ten pushbutton panels that can be selected by scrolling up and dwon with the arrow buttons on the right side. Each panel is intended for a specific demo or part of a demo.<br />
<br />
* Panel 1: This panel presents buttons that allow the sound card to be configured in several sampling rates and bit depths. Sampled read from the audio inputs are sent to the output pipes and audio outputs for playback without modification.<br />
<br />
* Panel 2: <br />
<br />
* Panel 3: <br />
* Panel 4: <br />
* Panel 5: <br />
* Panel 6: <br />
* Panel 7: <br />
* Panel 8: <br />
* Panel 9: <br />
* Panel 10:<br />
<br />
=== Cairo Animations ===<br />
<br />
The animations featured throughout the Episode 2 video were rapid-development spaghetti hack-jobs coded by hand in raw Cairo. Each module generated a series of PNG stills that were then stitched into an animation with Cinelerra or mplayer. In the interest of pointing and laughing at what really bad code looks like...<br />
<br />
<center><div style="background-color:#DDDDFF;border-color:#CCCCDD;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
*Source for the Cairo animations is found at:<br />
https://svn.xiph.org/trunk/Xiph-episode-II/cairo/<br />
*The source can be checked out of svn using the following command line:<br />
svn co https://svn.xiph.org/trunk/Xiph-episode-II/cairo/<br />
*Trac is a convenient way to browse the source without checking out a copy:<br />
https://trac.xiph.org/browser/Xiph-episode-II/cairo/<br />
</div></center></div>Gmaxwellhttps://wiki.xiph.org/index.php?title=Videos/Digital_Show_and_Tell&diff=13970Videos/Digital Show and Tell2013-02-26T08:54:44Z<p>Gmaxwell: /* Bandlimitation and timing */ moar terms, prose</p>
<hr />
<div><small>''Wiki edition''</small><br />
[[Image:dsat_001.jpg|400px|right]]<br />
<br />
Continuing in the "firehose" tradition of [[Videos/A_Digital_Media_Primer_For_Geeks|Episode 01]], Xiph.Org's second video on digital media explores multiple facets of digital audio signals and how they ''really'' behave in the real world.<br />
<br />
Demonstrations of sampling, quantization, bit-depth, and dither explore digital audio behavior on real audio equipment using both modern digital analysis and vintage analog bench equipment, just in case we can't trust those newfangled digital gizmos. You can download the source code for each demo and try it all for yourself!<br />
<br/><br/><br/><br />
<center><font size="+2">[http://www.xiph.org/video/vid2.shtml Download or Watch online]</font></center><br />
<br style="clear:both;"/><br />
Supported players: [http://www.videolan.org/vlc/ VLC 1.1+], [https://www.mozilla.com/en-US/firefox/ Firefox ], [http://www.chromium.org/Home Chrome ], [http://www.opera.com/ Opera]. Or see [http://www.webmproject.org/users/ other WebM] or [[TheoraSoftwarePlayers|other Theora]] players.<br />
<br />
If you're having trouble with playback in a modern browser or player, please visit our [[Playback_Troubleshooting|playback troubleshooting and discussion]] page.<br />
<br/><br />
<hr/><br />
<br/><br/><br/><br />
[[Image:Xiph_ep02_test.png|400px|right]]<br />
<br />
Hi, I'm Monty Montgomery from [http://www.redhat.com/ Red Hat] and [http://xiph.org/ Xiph.Org].<br />
<br />
A few months ago, I wrote<br />
[http://people.xiph.org/~xiphmont/demo/neil-young.html an article on digital audio and why 24bit/192kHz music downloads don't make sense].<br />
In the article, I<br />
mentioned--almost in passing--that a digital waveform is<br />
[http://people.xiph.org/~xiphmont/demo/neil-young.html#toc_sfam not a stairstep],<br />
and you certainly don't get a stairstep when you<br />
[[WikiPedia:Digital-to-analog_converter|convert from digital back to analog]].<br />
<br />
Of everything in the entire article, '''that''' was the number one thing<br />
people wrote about. In fact, more than half the mail I got was questions and<br />
comments about basic digital signal behavior. Since there's interest, let's<br />
take a little time to play with some ''simple'' digital signals.<br />
<br />
==Veritas ex machina==<br />
[[Image:Dsat_002.jpg|200px|right]]<br />
[[Image:Dsat_003.jpg|200px|right]]<br />
[[Image:Dsat_004.jpg|200px|right]]<br />
[[Image:Dsat_005.jpg|200px|right]]<br />
<br />
Pretend for a moment that we have no idea how digital signals really<br />
behave. In that case it doesn't make sense for us to use digital test<br />
equipment either. Fortunately for this exercise, there's still plenty<br />
of working analog lab equipment out there.<br />
<br />
First up, we need a [[WikiPedia:Function_generator|signal generator]] to provide us with analog input<br />
signals--in this case, an<br />
[http://www.home.agilent.com/en/pd-3325A%3Aepsg%3Apro-pn-3325A/synthesizer-function-generator?pm=PL&nid=-536900197.536896863&cc=SE&lc=swe HP3325]<br />
from 1978. It's still a pretty good<br />
generator, so if you don't mind the size, the weight, the power<br />
consumption, and the noisy fan, you can find them on eBay... occasionally<br />
for only slightly more than you'll pay for shipping.<br />
<br />
Next, we'll observe our analog waveforms on [[WikiPedia:Oscilloscope_types#Cathode-ray_oscilloscope_.28CRO.29|analog oscilloscopes]],<br />
like this Tektronix 2246 from the mid-90s, one of the last and very best analog scopes ever made. Every home lab should have one.<br />
<br />
...and finally inspect the [[WikiPedia:Spectral_density#Electrical_engineering|frequency spectrum]] of our signals using an<br />
[[WikiPedia:Spectrum_analyzer#Swept-tuned|analog spectrum analyzer]], this<br />
[http://www.home.agilent.com/en/pd-3585A%3Aepsg%3Apro-pn-3585A/spectrum-analyzer-high-perf-20hz-40mhz?pm=PL&nid=-536900197.536897319&cc=SE&lc=swe HP3585]<br />
from the same product line as<br />
the signal generator. Like the other equipment here it has<br />
[http://www.hp9845.net/9845/hardware/processors/ a rudimentary and hilariously large microcontroller],<br />
but the signal path<br />
from input to what you see on the screen is completely analog.<br />
<br />
All of this equipment is vintage, but aside from its raw tonnage, the specs are still quite good.<br />
<br />
At the moment, we have our signal generator set to output a nice 1 [[WikiPedia:Hertz#SI_multiples|kHz]]<br />
sine wave at one [[WikiPedia:Volt|Volt]] [[WikiPedia:Amplitude#Root_mean_square_amplitude|RMS]].<br />
We see the sine wave on the oscilloscope, can verify that it is indeed<br />
1 kHz at 1 Volt RMS, which is 2.8 Volts<br />
[[WikiPedia:Amplitude#Peak-to-peak_amplitude|peak-to-peak]],<br />
and that matches the<br />
measurement on the spectrum analyzer as well.<br />
<br />
The analyzer also shows some low-level [[WikiPedia:White_noise|white noise]]<br />
and just a bit of [[WikiPedia:Harmonic_distortion#Harmonic_distortion|harmonic distortion]],<br />
with the highest peak about 70[[WikiPedia:Decibel|dB]] or so below<br />
[[WikiPedia:Fundamental_frequency|the fundamental]].<br />
Now, this doesn't matter at all in our demos, but I<br />
wanted to point it out now just in case you didn't notice it until<br />
later.<br />
<br />
Now, we drop digital sampling in the middle.<br />
<br />
For the conversion, we'll use a boring, consumer-grade, eMagic USB1<br />
audio device. It's also more than ten years old at this point, and it's<br />
getting obsolete.<br />
<br />
A recent converter can easily have an order of magnitude better specs.<br />
[[WikiPedia:Reconstruction_filter#Sampled_data_reconstruction_filters|Flatness]],<br />
[[WikiPedia:Analog-to-digital_converter#Non-linearity|linearity]],<br />
[[WikiPedia:Jitter#Sampling_jitter|jitter]],<br />
[[WikiPedia:Noise_floor|noise behavior]],<br />
[[WikiPedia:Digital-to-analog_converter#DAC_performance|everything]]...<br />
you may not<br />
have noticed. Just because we can measure an improvement doesn't<br />
mean we can hear it, and even these old consumer boxes were already at<br />
the edge of ideal transparency.<br />
<br />
The eMagic connects to my ThinkPad, which displays a digital<br />
waveform and spectrum for comparison, then the ThinkPad<br />
sends the digital signal right back out to the eMagic for<br />
re-conversion to analog and observation on the output scopes.<br />
<br />
Input to output, left to right.<br />
<br style="clear:both;"/><br />
<br />
==Stairsteps==<br />
[[Image:Dsat 006.jpg|360px|right]]<br />
[[Image:Dsat 007.png|360px|right]]<br />
OK, it's go time. We begin by converting an analog signal to digital and<br />
then right back to analog again with no other steps.<br />
<br />
The signal generator is set to produce a 1kHz sine wave just like<br />
before.<br />
<br />
We can see our analog sine wave on our input-side oscilloscope.<br />
<br />
We digitize our signal to<br />
[[Videos/A_Digital_Media_Primer_For_Geeks#Raw_.28digital_audio.29_meat|16 bit PCM at 44.1kHz]],<br />
same as on a CD.<br />
The spectrum of the digitized signal matches what we saw earlier<br />
<br />
and what we see now on the analog spectrum analyzer, aside from its <br />
[[WikiPedia:High_impedance|high-impedance input]] being just a smidge noisier.<br />
<br />
For now, the waveform display shows our digitized sine wave as a<br />
stairstep pattern, one step for each sample.<br />
<br />
And when we look at the output signal that's been converted<br />
from digital back to analog, we see...<br />
<br />
It's exactly like the original sine wave. No stairsteps.<br />
<br />
OK, 1 kHz is still a fairly low frequency, maybe the stairsteps are just<br />
hard to see or they're being smoothed away. Fair enough. Let's choose<br />
a higher frequency, something close to [[WikiPedia:Nyquist_frequency|Nyquist]], say 15kHz.<br />
<br />
Now the sine wave is represented by less than three samples per cycle, and...<br />
<br />
the digital waveform looks pretty awful. Well, looks<br />
can be deceiving. The analog output...<br />
<br />
is still a perfect sine wave, exactly like the original.<br />
<br />
Let's keep going up.<br />
<br />
Let's see if I can do this without blocking any cameras.<br />
<br />
16kHz.... 17kHz... 18kHz... 19kHz... <br />
<br />
20kHz. Welcome to the upper limits of human hearing. The output<br />
waveform is still perfect. No jagged edges, no dropoff, no stairsteps.<br />
<br />
So where'd the stairsteps go? Don't answer, it's a trick question.<br />
They were never there.<br />
<br />
Drawing a digital waveform as a stairstep... was wrong to begin with.<br />
<br />
Why? A stairstep is a continuous-time function. It's jagged, and it's<br />
piecewise, but it has a defined value at every point in time.<br />
<br />
A sampled signal is entirely different. It's discrete-time; it's only<br />
got a value right at each instantaneous sample point and it's<br />
undefined, there is no value at all, everywhere between. A<br />
discrete-time signal is properly drawn as a lollipop graph.<br />
<br />
The continuous, analog counterpart of a digital signal passes<br />
smoothly through each sample point, and that's just as true for high<br />
frequencies as it is for low.<br />
<br />
Now, the interesting and not at all obvious bit is: [[WikiPedia:Nyquist%E2%80%93Shannon_sampling_theorem|there's only one<br />
bandlimited signal that passes exactly through each sample point]]. It's<br />
a unique solution. So if you sample a bandlimited signal and then<br />
convert it back, the original input is also the only possible output.<br />
<br />
[[Image:Dsat 008.png|360px|right]]<br />
<br />
And before you say, "oh, I can draw a different signal that passes<br />
through those points", well, yes you can, but if it differs even<br />
minutely from the original, it includes frequency content at or beyond<br />
Nyquist, breaks the bandlimiting requirement and isn't a valid<br />
solution.<br />
<br />
So how did everyone get confused and start thinking of digital signals<br />
as stairsteps? I can think of two good reasons.<br />
<br />
First: it's easy enough to convert a sampled signal to a true stairstep. Just<br />
extend each sample value forward until the next sample period. This is<br />
called a [[WikiPedia:Zero-order hold|zero-order hold]], and it's an important part of how some<br />
digital-to-analog converters work, especially the simplest ones.<br />
<br />
So, anyone who looks up [[WikiPedia:Digital-to-analog_converter#Practical_operation|digital-to-analog converter or<br />
digital-to-analog conversion]] is probably going to see a diagram of a<br />
stairstep waveform somewhere, but that's not a finished conversion,<br />
and it's not the signal that comes out.<br />
<br />
Second, and this is probably the more likely reason, engineers who<br />
supposedly know better, like me, draw stairsteps even though they're<br />
technically wrong. It's a sort of like a one-dimensional version of<br />
[[WikiPedia:MacPaint#Development|fat bits in an image editor]].<br />
<br />
Pixels aren't squares either, they're samples of a 2-dimensional<br />
function space and so they're also, conceptually, infinitely small<br />
points. Practically, it's a real pain in the ass to see or manipulate<br />
infinitely small anything, so big squares it is. Digital stairstep<br />
drawings are exactly the same thing.<br />
<br />
It's just a convenient drawing. The stairsteps aren't really there.<br />
<br />
==Bit-depth==<br />
[[Image:Dsat_009.jpg|360px|right]]<br />
[[Image:Dsat_010.jpg|260px|right]]<br />
<br />
When we convert a digital signal back to analog, the result is<br />
''also'' smooth regardless of the [[WikiPedia:Audio_bit_depth|bit depth]]. 24 bits or 16 bits...<br />
or 8 bits... it doesn't matter.<br />
<br />
So does that mean that the digital bit depth makes no difference at<br />
all? Of course not.<br />
<br />
Channel 2 here is the same sine wave input, but we quantize with<br />
[[WikiPedia:Dither|dither]] down to 8 bits.<br />
<br />
On the scope, we still see a nice<br />
smooth sine wave on channel 2. Look very close, and you'll also see a<br />
bit more noise. That's a clue.<br />
<br />
If we look at the spectrum of the signal... aha! Our sine wave is<br />
still there unaffected, but the noise level of the 8-bit signal on<br />
the second channel is much higher!<br />
<br />
And that's the difference the number of bits makes. That's it!<br />
<br />
When we digitize a signal, first we sample it. The<br />
sampling step is perfect; it loses nothing. But then we [[WikiPedia:Quantization_(sound_processing)|quantize]] it,<br />
and [[WikiPedia:Quantization_error|quantization adds noise]].<br />
<br />
The number of bits determines how much noise and so the level of the<br />
noise floor.<br />
<br />
What does this dithered quantization noise sound like? Let's listen<br />
to our 8-bit sine wave.<br />
<br />
That may have been hard to hear anything but the tone. Let's listen<br />
to just the noise after we notch out the sine wave and then bring the<br />
gain up a bit because the noise is quiet.<br />
<br />
Those of you who have used analog recording equipment may have just<br />
thought to yourselves, "My goodness! That sounds like tape hiss!"<br />
Well, it doesn't just sound like tape hiss, it acts like it too, and<br />
if we use a [[WikiPedia:Dither#Different_types|gaussian dither]] then it's<br />
[[WikiPedia:Central_limit_theorem|mathematically equivalent]] in every way. It ''is'' tape hiss.<br />
<br />
Intuitively, that means that we can measure tape hiss and thus the noise floor<br />
of [[WikiPedia:Magnetic_tape_sound_recording|magnetic audio tape]]<br />
in [[WikiPedia:Shannon–Hartley_theorem#Examples|bits instead of decibels]], in order to put things in a<br />
digital perspective. [[WikiPedia:Compact cassettes|Compact cassettes]] (for those of you who are old enough to remember them) could reach as<br />
deep as 9 bits in perfect conditions, though 5 to 6 bits was<br />
more typical, especially if it was a recording made on a<br />
[[WikiPedia:Cassette_deck|tape deck]]. That's right... your mix tapes were only about 6 bits<br />
deep... if you were lucky!<br />
<br />
The very best professional [[WikiPedia:Reel-to-reel_audio_tape_recording|open reel tape]] used in studios could barely<br />
hit... any guesses? 13 bits ''with'' [[WikiPedia:Reel-to-reel_audio_tape_recording#Noise_reduction|advanced noise reduction]]. And<br />
that's why seeing '[[WikiPedia:SPARS_code|D D D]]' on a [[WikiPedia:Compact_disk|Compact Disc]] used to be such a big,<br />
high-end deal.<br />
<br />
==Dither==<br />
[[Image:Dsat_011.png|360px|right]]<br />
<br />
I keep saying that I'm quantizing with [[Wikipedia:dither|dither]], so what is dither<br />
exactly and, more importantly, what does it do?<br />
<br />
The simple way to quantize a signal is to choose the digital<br />
amplitude value closest to the original analog amplitude. [[WikiPedia:Rounding|Obvious]],<br />
right? Unfortunately, the exact noise you get from this simple<br />
quantization scheme depends somewhat on the input signal,<br />
<br />
so we may get noise that's inconsistent, or causes distortion, or is<br />
undesirable in some other way.<br />
<br style="clear:both;"/><br />
<center><div style="background-color:#DDDDFF;border-color:#CCCCDD;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
'''Going deeper…'''<br />
*Cameron Nicklaus Christou's thesis [http://uwspace.uwaterloo.ca/bitstream/10012/3867/1/thesis.pdf Optimal Dither and Noise Shaping in Image Processing] provides an ''excellent'' explanation of dither and noise shaping.<br />
</div></center><br />
<br />
Dither is specially-constructed noise that substitutes for the noise<br />
produced by simple quantization. Dither doesn't [[WikiPedia:Sound_masking|drown out or mask]]<br />
quantization noise, it actually replaces it with noise characteristics<br />
of our choosing that aren't influenced by the input.<br />
<br />
Let's ''watch'' what dither does. The signal generator has too much noise for this test so we'll produce a mathematically perfect sine wave with the ThinkPad and quantize it to 8 bits with dithering.<br />
<br />
We see a nice sine wave on the waveform display and output scope and, once the analog spectrum analyzer catches up...<br />
a clean frequency peak with a uniform noise floor on both spectral displays<br />
just like before. Again, this is with dither.<br />
<br />
Now I turn dithering off.<br />
<br />
The quantization noise, that dither had spread out into a nice, flat noise<br />
floor, piles up into harmonic distortion peaks. The noise floor is<br />
lower, but the level of distortion becomes nonzero, and the distortion<br />
peaks sit higher than the dithering noise did.<br />
<br />
At 8 bits this effect is exaggerated. At 16 bits,<br />
even without dither, harmonic distortion is going to be so low as to<br />
be completely inaudible.<br />
<br />
Still, we can use dither to eliminate it completely if we so choose.<br />
<br />
Turning the dither off again for a moment, you'll notice that the<br />
absolute level of distortion from undithered quantization stays<br />
approximately constant regardless of the input amplitude.<br />
But when the signal level drops below a half a bit, everything<br />
quantizes to zero.<br />
<br />
In a sense, everything quantizing to zero is just 100% distortion!<br />
Dither eliminates this distortion too. We reenable dither<br />
and ... there's our signal back at 1/4 bit, with our nice flat noise floor.<br />
<br />
The noise floor doesn't have to be flat. Dither is noise of our<br />
choosing, so let's choose a noise as [http://www.acoustics.salford.ac.uk/res/cox/sound_quality/?content=subjective inoffensive] and<br />
[[WikiPedia:Absolute_threshold_of_hearing|difficult to notice]]<br />
as possible.<br />
<br />
Our hearing is most sensitive in the midrange from 2kHz to 4kHz,<br />
so that's where background noise is going to be the most obvious.<br />
We can [[WikiPedia:Noise_shaping|shape dithering noise]] away from sensitive frequencies to where<br />
hearing is less sensitive, usually the highest frequencies.<br />
<br />
16-bit dithering noise is normally much too quiet to hear at all, but<br />
let's listen to our noise shaping example, again with the gain<br />
brought way up...<br />
<br />
Lastly, dithered quantization noise ''is'' higher [[WikiPedia:power|Sound_power]] overall<br />
than undithered quantization noise even when it sounds quieter, and<br />
you can see that on a [[WikiPedia:VU_meter|VU meter]] during passages of near-silence. But<br />
dither isn't only an on or off choice. We can reduce the dither's<br />
power to balance less noise against a bit of distortion to minimize<br />
the overall effect.<br />
<br />
We'll also [[WikiPedia:Amplitude_modulation|modulate the input signal]] like this to show how a varying input affects the quantization noise. At<br />
full dithering power, the noise is uniform, constant, and featureless<br />
just like we expect:<br />
<br />
As we reduce the dither's power, the input increasingly<br />
affects the amplitude and the character of the quantization noise.<br />
Shaped dither behaves similarly, but noise shaping lends one more nice<br />
advantage. To make a long story short, it can use a somewhat lower<br />
dither power before the input has as much effect on the output.<br />
<br />
Despite all the time I just spent on dither, we're talking about<br />
differences that start 100 decibels and more below [[WikiPedia:Full_scale|full scale]]. Maybe<br />
if the CD had been<br />
[http://www.research.philips.com/technologies/projects/cd/index.html 14 bits as originally designed],<br />
dither ''might'' be<br />
more important. Maybe. At 16 bits, really, it's mostly a wash. You<br />
can think of dither as an insurance policy that gives several extra<br />
decibels of dynamic range just in case. The simple fact is, though, no<br />
one ever ruined a great recording by not dithering the final master.<br />
<br />
==Bandlimitation and timing==<br />
[[image:Dsat_013.jpg|360px|right]]<br />
[[image:Dsat_014.gif|360px|right]]<br />
<br />
We've been using [[WikiPedia:Sine_wave|sine waves]]. They're the obvious choice when what we<br />
want to see is a system's behavior at a given isolated frequency. Now<br />
let's look at something a bit more complex. What should we expect to<br />
happen when I change the input to a [[WikiPedia:Square_wave|square wave]]...<br />
<br />
The input scope confirms our 1kHz square wave. The output scope shows..<br />
<br />
<br />
Exactly what it should.<br />
...<br />
What is a square wave really? <br />
<br />
<br />
Well, we can say it's a waveform that's some positive value for half a cycle and then transitions instantaneously to a negative value for the other half.<br />
<br />
:<math><br />
\ x(t) = \begin{cases} 1, & |t| < T_1 \\ 0, & T_1 < |t| \leq {1 \over 2}T \end{cases}<br />
</math><br />
<br />
But that doesn't really tell us anything useful about how that input becomes this output.<br />
<br />
Then we remember that any waveform is also [[WikiPedia:Fourier_series|the sum of discrete frequencies]],<br />
and a square wave is particularly simple sum: a fundamental and an<br />
infinite series of [[WikiPedia:Even_and_odd_functions#Harmonics|odd harmonics]]. Sum them all up, you get a<br />
square wave.<br />
<br />
:<math>\begin{align}<br />
x_{\mathrm{square}}(t) = \frac{4}{\pi}\sin(\omega t) + \frac{4}{3\pi}\sin(3\omega t) + \frac{4}{5\pi}\sin(5\omega t) + \\<br />
\frac{4}{7\pi}\sin(7\omega t) + \frac{4}{9\pi}\sin(9\omega t) + \frac{4}{11\pi}\sin(11\omega t) + \\ <br />
\frac{4}{13\pi}\sin(13\omega t) + \frac{4}{15\pi}\sin(15\omega t) + \frac{4}{17\pi}\sin(17\omega t) + \\<br />
\frac{4}{19\pi}\sin(19\omega t) + \frac{4}{21\pi}\sin(21\omega t) + \frac{4}{23\pi}\sin(23\omega t) + \\<br />
\frac{4}{25\pi}\sin(25\omega t) + \frac{4}{27\pi}\sin(27\omega t) + \frac{4}{29\pi}\sin(29\omega t) + \\<br />
\frac{4}{31\pi}\sin(31\omega t) + \frac{4}{33\pi}\sin(33\omega t) + \cdots <br />
\end{align}</math><br />
<br />
At first glance, that doesn't seem very useful either. You have to sum up an infinite number of harmonics to get the answer. ''Ah'', but we don't have an infinite number of harmonics.<br />
<br />
We're using a quite sharp [[WikiPedia:Low-pass_filter|anti-aliasing filter]] that cuts off right<br />
above 20kHz, so our signal is [[WikiPedia:Bandlimiting|bandlimited]], so only the first ten terms make it through.<br />
<br />
..and that's exactly what we see on the output scope.<br />
<br />
The rippling you see around sharp edges in a bandlimited signal is called the [[WikiPedia:/Gibbs_phenomenon|Gibbs effect]]. It happens whenever you slice off part of the frequency domain in the middle of nonzero energy.<br />
<br />
The usual rule of thumb you'll hear is "the sharper the cutoff, the<br />
stronger the rippling", which is approximately true, but we have to be<br />
careful how we think about it.<br />
For example... what would you expect our quite sharp anti-aliasing filter<br />
to do if I run our signal through it a second time?<br />
<br />
Aside from adding a few fractional cycles of delay, the answer is...<br />
nothing at all. The signal is already bandlimited. Bandlimiting it<br />
again doesn't do anything. A second pass can't remove frequencies<br />
that we already removed.<br />
<br />
And that's important. People tend to think of the ripples as<br />
a kind of [[WikiPedia:Sonic_artifact|artifact]] that's added by anti-aliasing and [[WikiPedia:Reconstruction_filter|anti-imaging]]<br />
filters, implying that the ripples get worse each time the signal<br />
passes through. We can see that in this case that didn't happen. So<br />
was it really the filter that added the ripples the first time<br />
through? No, not really. It's a subtle distinction, but Gibbs effect<br />
ripples aren't added by filters, they're just part of what a<br />
bandlimited signal ''is''.<br />
<br />
Even if we synthetically construct what looks like a perfect digital<br />
square wave,<br />
<br />
it's still limited to the channel bandwidth. Remember,<br />
the stairstep representation is misleading.<br />
<br />
What we really have here are instantaneous sample points,<br />
<br />
and only one bandlimited signal fits those points. All we did when we<br />
drew our apparently perfect square wave was line up the sample points<br />
just right so it appeared that there were no ripples if we played<br />
[[WikiPedia:Interpolation|connect-the-dots]].<br />
<br />
But the original bandlimited signal, complete with ripples, was<br />
still there.<br />
<br />
And that leads us to one more important point. You've probably heard<br />
that the timing precision of a digital signal is limited by its sample<br />
rate; put another way,<br />
<br />
that digital signals can't represent anything that falls between the<br />
samples.. implying that [[WikiPedia:Dirac_delta_function|impulses]] or<br />
[[WikiPedia:Synthesizer#ADSR_envelope|fast attacks]] have to align exactly<br />
with a sample, or the timing gets mangled... or they just disappear.<br />
<br />
At this point, we can easily see why that's wrong.<br />
<br />
Again, our input signals are bandlimited. And digital signals are<br />
samples, not stairsteps, not 'connect-the-dots'. We most certainly<br />
can, for example, put the rising edge of our bandlimited square wave<br />
anywhere we want between samples.<br />
<br />
It's represented perfectly and it's reconstructed perfectly.<br />
<br />
==Epilogue==<br />
<br />
[[Image:Moffey.jpg|360px|right]]<br />
<br />
Just like in [[Videos/A_Digital_Media_Primer_For_Geeks|the previous episode]], we've covered a broad range of<br />
topics, and yet barely scratched the surface of each one. If anything, my<br />
sins of omission are greater this time around... but this is a good<br />
stopping point.<br />
<br />
Or maybe, a good starting point. Dig deeper. Experiment. I chose my<br />
demos very carefully to be simple and give clear results. You can<br />
reproduce every one of them on your own if you like. But let's face<br />
it, sometimes we learn the most about a spiffy toy by breaking it open<br />
and studying all the pieces that fall out. And that's OK, we're<br />
engineers. Play with the demo parameters, hack up the code, set up<br />
alternate experiments. The source code for everything, including the<br />
little pushbutton demo application, is up at xiph.org.<br />
<br />
In the course of experimentation, you're likely to run into something<br />
that you didn't expect and can't explain. Don't worry! My earlier<br />
snark aside, Wikipedia is fantastic for exactly this kind of casual<br />
research. And, if you're really serious about understanding signals,<br />
several universities have advanced materials online, such as the<br />
[http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-003-signals-and-systems-spring-2010/index.htm 6.003]<br />
and<br />
[http://ocw.mit.edu/resources/res-6-007-signals-and-systems-spring-2011/ RES.6-007]<br />
Signals and Systems modules at MIT OpenCourseWare. And of<br />
course, there's always the [http://webchat.freenode.net/?channels=xiph community here at Xiph.Org].<br />
<br />
Digging deeper or not, I am out of coffee, so, until next time, happy<br />
hacking!<br />
<br />
==Credits==<br />
<br />
Written by: Christopher (Monty) Montgomery and the Xiph.Org Community<br />
<br />
Special thanks to:<br />
*Heidi Baumgartner, for the second Tektronix oscilloscope<br />
*Gregory Maxwell and Dr. Timothy Terriberry, for additional technical review<br />
<br />
Intro, title and credits music:<br><br />
"Andy Warhol Is Gone", by Lousy Robot<br><br />
Used by permission of Lousy Robot.<br><br />
Original source track All Rights Reserved.<br><br />
[http://www.lousyrobot.com www.lousyrobot.com]<br />
<br />
This Video Was Produced Entirely With Free and Open Source Software:<br><br />
<br />
*[http://www.gnu.org/ GNU]<br><br />
*[http://www.linux.org/ Linux]<br><br />
*[http://fedoraproject.org/ Fedora]<br><br />
*[http://cinelerra.org/ Cinelerra]<br><br />
*[http://www.gimp.org/ The Gimp]<br><br />
*[http://audacity.sourceforge.net/ Audacity]<br><br />
*[http://svn.xiph.org/trunk/postfish/README Postfish]<br><br />
*[http://gstreamer.freedesktop.org/ Gstreamer]<br><br />
<br />
All trademarks are the property of their respective owners. <br />
<br />
*''Complete video'' [http://creativecommons.org/licenses/by-sa/3.0/legalcode CC-BY-SA]<br><br />
*''Text transcript and Wiki edition'' [http://creativecommons.org/licenses/by-sa/3.0/legalcode CC-BY-SA]<br><br />
<br />
A Co-Production of Xiph.Org and Red Hat, Inc.<br><br />
(C) 2012-2013, Some Rights Reserved<br><br />
<br />
== Use The Source Luke ==<br />
<br />
As stated in the Epilogue, everything that appears in the video demos is driven by open source software, which means the source is both available for inspection and freely usable by the community. The Thinkpad that appears in the video was running Fedora 17 and Gnome Shell (Gnome 3). The demonstration software does not require Fedora specifically, but it does require Gnu/Linux to run in its current form. In all, the video involved about 50,000 lines of new and custom-purpose code (including contributions to non-Xiph projects such as Cinelerra and Gromit).<br />
<br />
=== The Spectrum and Waveform Viewer ===<br />
<br />
The realtime software spectrum analyzer application that appears in the video was a preexisting application that was dusted off and updated for use in the video. The waveform viewer (effectively a simple software oscilloscope) was written from scratch making use of some of the internals from the spectrum analyzer application. Both are available from Xiph.Org svn:<br />
<br />
<center><div style="background-color:#DDDDFF;border-color:#CCCCDD;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
*Source for the Spectrum and Waveform applications is found at:<br />
https://svn.xiph.org/trunk/spectrum/<br />
*The source can be checked out of svn using the following command line:<br />
svn co https://svn.xiph.org/trunk/spectrum<br />
*Trac is a convenient way to browse the source without checking out a copy:<br />
https://trac.xiph.org/browser/trunk/spectrum<br />
</div></center><br />
<br />
Spectrum and Waveform both expect an input stream on the command line, either as raw data or as a WAV file.<br />
<br />
=== GTK-Bounce ===<br />
<br />
The touch-controlled application used in the video is named 'gtk-bounce' and was custom-written for the sole purpose of the in-video demonstrations. It is so named because, for the most part, all it does is read the input from an audio device, and then immediately write the same data back out for playback. It also forwards a copy of this data to up to two external monitoring applications, and in several demos, applies simple filters or generates simple waveforms. It includes several demos not included in the video.<br />
<br />
<center><div style="background-color:#DDDDFF;border-color:#CCCCDD;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
*Source for gtk-bounce is found at:<br />
https://svn.xiph.org/trunk/Xiph-episode-II/bounce/<br />
*The source can be checked out of svn using the following command line:<br />
svn co https://svn.xiph.org/trunk/Xiph-episode-II/bounce/<br />
*Trac is a convenient way to browse the source without checking out a copy:<br />
https://trac.xiph.org/browser/Xiph-episode-II/bounce/<br />
</div></center><br />
<br />
The application is somewhat hardwired for specific demo purposes, but most of the hardwired settings can be found at the top of each source file. As found in SVN, the application expects an ALSA hardware audio device at hw:1, and if none if found, it will wait for one to appear. Once a sound device is successfully initialized, it expects to find and open two pipes named pipe0 and pipe1 for output in the current directory. In the video, the waveform and spectrum applications are started to take input from pipe0 and pipe1 respectively. The output sent to the two pipes is identical, and in most demos matches the output data sent to the hardware device for conversion to analog. The only exception is the tenth demo panel (which does not appear in the video) where gtk-bounce can be set to monitor the hardware inputs instead while the outputs are used to produce test waveforms.<br />
<br />
Assuming gtk-bounce, spectrum and waveform have been checked out and built, the configuration seen in the video can be started using the following commands:<br />
<center><div style="background-color:#DDDDFF;border-color:#CCCCDD;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
* make the pipe fifos for the applications to communicate (only needs to be done once)<br />
mkfifo pipe0 pipe1<br />
* start all three applications<br />
waveform pipe0 & spectrum pipe1 & gtk-bounce &<br />
</div></center><br />
<br />
Gtk-bounce consists of ten pushbutton panels that can be selected by scrolling up and dwon with the arrow buttons on the right side. Each panel is intended for a specific demo or part of a demo.<br />
<br />
* Panel 1: This panel presents buttons that allow the sound card to be configured in several sampling rates and bit depths. Sampled read from the audio inputs are sent to the output pipes and audio outputs for playback without modification.<br />
<br />
* Panel 2: <br />
<br />
* Panel 3: <br />
* Panel 4: <br />
* Panel 5: <br />
* Panel 6: <br />
* Panel 7: <br />
* Panel 8: <br />
* Panel 9: <br />
* Panel 10:<br />
<br />
=== Cairo Animations ===<br />
<br />
The animations featured throughout the Episode 2 video were rapid-development spaghetti hack-jobs coded by hand in raw Cairo. Each module generated a series of PNG stills that were then stitched into an animation with Cinelerra or mplayer. In the interest of pointing and laughing at what really bad code looks like...<br />
<br />
<center><div style="background-color:#DDDDFF;border-color:#CCCCDD;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
*Source for the Cairo animations is found at:<br />
https://svn.xiph.org/trunk/Xiph-episode-II/cairo/<br />
*The source can be checked out of svn using the following command line:<br />
svn co https://svn.xiph.org/trunk/Xiph-episode-II/cairo/<br />
*Trac is a convenient way to browse the source without checking out a copy:<br />
https://trac.xiph.org/browser/Xiph-episode-II/cairo/<br />
</div></center></div>Gmaxwellhttps://wiki.xiph.org/index.php?title=Videos/Digital_Show_and_Tell&diff=13964Videos/Digital Show and Tell2013-02-26T08:30:32Z<p>Gmaxwell: /* Bandlimitation and timing */ Squares like LaTeX, more.</p>
<hr />
<div><small>''Wiki edition''</small><br />
[[Image:dsat_001.jpg|400px|right]]<br />
<br />
Continuing in the "firehose" tradition of [[Videos/A_Digital_Media_Primer_For_Geeks|Episode 01]], Xiph.Org's second video on digital media explores multiple facets of digital audio signals and how they ''really'' behave in the real world.<br />
<br />
Demonstrations of sampling, quantization, bit-depth, and dither explore digital audio behavior on real audio equipment using both modern digital analysis and vintage analog bench equipment, just in case we can't trust those newfangled digital gizmos. You can download the source code for each demo and try it all for yourself!<br />
<br/><br/><br/><br />
<center><font size="+2">[http://www.xiph.org/video/vid2.shtml Download or Watch online]</font></center><br />
<br style="clear:both;"/><br />
Supported players: [http://www.videolan.org/vlc/ VLC 1.1+], [https://www.mozilla.com/en-US/firefox/ Firefox ], [http://www.chromium.org/Home Chrome ], [http://www.opera.com/ Opera]. Or see [http://www.webmproject.org/users/ other WebM] or [[TheoraSoftwarePlayers|other Theora]] players.<br />
<br />
If you're having trouble with playback in a modern browser or player, please visit our [[Playback_Troubleshooting|playback troubleshooting and discussion]] page.<br />
<br/><br />
<hr/><br />
<br/><br/><br/><br />
[[Image:Xiph_ep02_test.png|400px|right]]<br />
<br />
Hi, I'm Monty Montgomery from [http://www.redhat.com/ Red Hat] and [http://xiph.org/ Xiph.Org].<br />
<br />
A few months ago, I wrote<br />
[http://people.xiph.org/~xiphmont/demo/neil-young.html an article on digital audio and why 24bit/192kHz music downloads don't make sense].<br />
In the article, I<br />
mentioned--almost in passing--that a digital waveform is<br />
[http://people.xiph.org/~xiphmont/demo/neil-young.html#toc_sfam not a stairstep],<br />
and you certainly don't get a stairstep when you<br />
[[WikiPedia:Digital-to-analog_converter|convert from digital back to analog]].<br />
<br />
Of everything in the entire article, '''that''' was the number one thing<br />
people wrote about. In fact, more than half the mail I got was questions and<br />
comments about basic digital signal behavior. Since there's interest, let's<br />
take a little time to play with some ''simple'' digital signals.<br />
<br />
==Veritas ex machina==<br />
[[Image:Dsat_002.jpg|200px|right]]<br />
[[Image:Dsat_003.jpg|200px|right]]<br />
[[Image:Dsat_004.jpg|200px|right]]<br />
[[Image:Dsat_005.jpg|200px|right]]<br />
<br />
Pretend for a moment that we have no idea how digital signals really<br />
behave. In that case it doesn't make sense for us to use digital test<br />
equipment either. Fortunately for this exercise, there's still plenty<br />
of working analog lab equipment out there.<br />
<br />
First up, we need a [[WikiPedia:Function_generator|signal generator]] to provide us with analog input<br />
signals--in this case, an<br />
[http://www.home.agilent.com/en/pd-3325A%3Aepsg%3Apro-pn-3325A/synthesizer-function-generator?pm=PL&nid=-536900197.536896863&cc=SE&lc=swe HP3325]<br />
from 1978. It's still a pretty good<br />
generator, so if you don't mind the size, the weight, the power<br />
consumption, and the noisy fan, you can find them on eBay... occasionally<br />
for only slightly more than you'll pay for shipping.<br />
<br />
Next, we'll observe our analog waveforms on [[WikiPedia:Oscilloscope_types#Cathode-ray_oscilloscope_.28CRO.29|analog oscilloscopes]],<br />
like this Tektronix 2246 from the mid-90s, one of the last and very best analog scopes ever made. Every home lab should have one.<br />
<br />
...and finally inspect the [[WikiPedia:Spectral_density#Electrical_engineering|frequency spectrum]] of our signals using an<br />
[[WikiPedia:Spectrum_analyzer#Swept-tuned|analog spectrum analyzer]], this<br />
[http://www.home.agilent.com/en/pd-3585A%3Aepsg%3Apro-pn-3585A/spectrum-analyzer-high-perf-20hz-40mhz?pm=PL&nid=-536900197.536897319&cc=SE&lc=swe HP3585]<br />
from the same product line as<br />
the signal generator. Like the other equipment here it has<br />
[http://www.hp9845.net/9845/hardware/processors/ a rudimentary and hilariously large microcontroller],<br />
but the signal path<br />
from input to what you see on the screen is completely analog.<br />
<br />
All of this equipment is vintage, but aside from its raw tonnage, the specs are still quite good.<br />
<br />
At the moment, we have our signal generator set to output a nice 1 [[WikiPedia:Hertz#SI_multiples|kHz]]<br />
sine wave at one [[WikiPedia:Volt|Volt]] [[WikiPedia:Amplitude#Root_mean_square_amplitude|RMS]].<br />
We see the sine wave on the oscilloscope, can verify that it is indeed<br />
1 kHz at 1 Volt RMS, which is 2.8 Volts<br />
[[WikiPedia:Amplitude#Peak-to-peak_amplitude|peak-to-peak]],<br />
and that matches the<br />
measurement on the spectrum analyzer as well.<br />
<br />
The analyzer also shows some low-level [[WikiPedia:White_noise|white noise]]<br />
and just a bit of [[WikiPedia:Harmonic_distortion#Harmonic_distortion|harmonic distortion]],<br />
with the highest peak about 70[[WikiPedia:Decibel|dB]] or so below<br />
[[WikiPedia:Fundamental_frequency|the fundamental]].<br />
Now, this doesn't matter at all in our demos, but I<br />
wanted to point it out now just in case you didn't notice it until<br />
later.<br />
<br />
Now, we drop digital sampling in the middle.<br />
<br />
For the conversion, we'll use a boring, consumer-grade, eMagic USB1<br />
audio device. It's also more than ten years old at this point, and it's<br />
getting obsolete.<br />
<br />
A recent converter can easily have an order of magnitude better specs.<br />
[[WikiPedia:Reconstruction_filter#Sampled_data_reconstruction_filters|Flatness]],<br />
[[WikiPedia:Analog-to-digital_converter#Non-linearity|linearity]],<br />
[[WikiPedia:Jitter#Sampling_jitter|jitter]],<br />
[[WikiPedia:Noise_floor|noise behavior]],<br />
[[WikiPedia:Digital-to-analog_converter#DAC_performance|everything]]...<br />
you may not<br />
have noticed. Just because we can measure an improvement doesn't<br />
mean we can hear it, and even these old consumer boxes were already at<br />
the edge of ideal transparency.<br />
<br />
The eMagic connects to my ThinkPad, which displays a digital<br />
waveform and spectrum for comparison, then the ThinkPad<br />
sends the digital signal right back out to the eMagic for<br />
re-conversion to analog and observation on the output scopes.<br />
<br />
Input to output, left to right.<br />
<br style="clear:both;"/><br />
<br />
==Stairsteps==<br />
[[Image:Dsat 006.jpg|360px|right]]<br />
[[Image:Dsat 007.png|360px|right]]<br />
OK, it's go time. We begin by converting an analog signal to digital and<br />
then right back to analog again with no other steps.<br />
<br />
The signal generator is set to produce a 1kHz sine wave just like<br />
before.<br />
<br />
We can see our analog sine wave on our input-side oscilloscope.<br />
<br />
We digitize our signal to<br />
[[Videos/A_Digital_Media_Primer_For_Geeks#Raw_.28digital_audio.29_meat|16 bit PCM at 44.1kHz]],<br />
same as on a CD.<br />
The spectrum of the digitized signal matches what we saw earlier<br />
<br />
and what we see now on the analog spectrum analyzer, aside from its <br />
[[WikiPedia:High_impedance|high-impedance input]] being just a smidge noisier.<br />
<br />
For now, the waveform display shows our digitized sine wave as a<br />
stairstep pattern, one step for each sample.<br />
<br />
And when we look at the output signal that's been converted<br />
from digital back to analog, we see...<br />
<br />
It's exactly like the original sine wave. No stairsteps.<br />
<br />
OK, 1 kHz is still a fairly low frequency, maybe the stairsteps are just<br />
hard to see or they're being smoothed away. Fair enough. Let's choose<br />
a higher frequency, something close to [[WikiPedia:Nyquist_frequency|Nyquist]], say 15kHz.<br />
<br />
Now the sine wave is represented by less than three samples per cycle, and...<br />
<br />
the digital waveform looks pretty awful. Well, looks<br />
can be deceiving. The analog output...<br />
<br />
is still a perfect sine wave, exactly like the original.<br />
<br />
Let's keep going up.<br />
<br />
Let's see if I can do this without blocking any cameras.<br />
<br />
16kHz.... 17kHz... 18kHz... 19kHz... <br />
<br />
20kHz. Welcome to the upper limits of human hearing. The output<br />
waveform is still perfect. No jagged edges, no dropoff, no stairsteps.<br />
<br />
So where'd the stairsteps go? Don't answer, it's a trick question.<br />
They were never there.<br />
<br />
Drawing a digital waveform as a stairstep... was wrong to begin with.<br />
<br />
Why? A stairstep is a continuous-time function. It's jagged, and it's<br />
piecewise, but it has a defined value at every point in time.<br />
<br />
A sampled signal is entirely different. It's discrete-time; it's only<br />
got a value right at each instantaneous sample point and it's<br />
undefined, there is no value at all, everywhere between. A<br />
discrete-time signal is properly drawn as a lollipop graph.<br />
<br />
The continuous, analog counterpart of a digital signal passes<br />
smoothly through each sample point, and that's just as true for high<br />
frequencies as it is for low.<br />
<br />
Now, the interesting and not at all obvious bit is: [[WikiPedia:Nyquist%E2%80%93Shannon_sampling_theorem|there's only one<br />
bandlimited signal that passes exactly through each sample point]]. It's<br />
a unique solution. So if you sample a bandlimited signal and then<br />
convert it back, the original input is also the only possible output.<br />
<br />
[[Image:Dsat 008.png|360px|right]]<br />
<br />
And before you say, "oh, I can draw a different signal that passes<br />
through those points", well, yes you can, but if it differs even<br />
minutely from the original, it includes frequency content at or beyond<br />
Nyquist, breaks the bandlimiting requirement and isn't a valid<br />
solution.<br />
<br />
So how did everyone get confused and start thinking of digital signals<br />
as stairsteps? I can think of two good reasons.<br />
<br />
First: it's easy enough to convert a sampled signal to a true stairstep. Just<br />
extend each sample value forward until the next sample period. This is<br />
called a [[WikiPedia:Zero-order hold|zero-order hold]], and it's an important part of how some<br />
digital-to-analog converters work, especially the simplest ones.<br />
<br />
So, anyone who looks up [[WikiPedia:Digital-to-analog_converter#Practical_operation|digital-to-analog converter or<br />
digital-to-analog conversion]] is probably going to see a diagram of a<br />
stairstep waveform somewhere, but that's not a finished conversion,<br />
and it's not the signal that comes out.<br />
<br />
Second, and this is probably the more likely reason, engineers who<br />
supposedly know better, like me, draw stairsteps even though they're<br />
technically wrong. It's a sort of like a one-dimensional version of<br />
[[WikiPedia:MacPaint#Development|fat bits in an image editor]].<br />
<br />
Pixels aren't squares either, they're samples of a 2-dimensional<br />
function space and so they're also, conceptually, infinitely small<br />
points. Practically, it's a real pain in the ass to see or manipulate<br />
infinitely small anything, so big squares it is. Digital stairstep<br />
drawings are exactly the same thing.<br />
<br />
It's just a convenient drawing. The stairsteps aren't really there.<br />
<br />
==Bit-depth==<br />
[[Image:Dsat_009.jpg|360px|right]]<br />
[[Image:Dsat_010.jpg|260px|right]]<br />
<br />
When we convert a digital signal back to analog, the result is<br />
''also'' smooth regardless of the [[WikiPedia:Audio_bit_depth|bit depth]]. 24 bits or 16 bits...<br />
or 8 bits... it doesn't matter.<br />
<br />
So does that mean that the digital bit depth makes no difference at<br />
all? Of course not.<br />
<br />
Channel 2 here is the same sine wave input, but we quantize with<br />
[[WikiPedia:Dither|dither]] down to 8 bits.<br />
<br />
On the scope, we still see a nice<br />
smooth sine wave on channel 2. Look very close, and you'll also see a<br />
bit more noise. That's a clue.<br />
<br />
If we look at the spectrum of the signal... aha! Our sine wave is<br />
still there unaffected, but the noise level of the 8-bit signal on<br />
the second channel is much higher!<br />
<br />
And that's the difference the number of bits makes. That's it!<br />
<br />
When we digitize a signal, first we sample it. The<br />
sampling step is perfect; it loses nothing. But then we [[WikiPedia:Quantization_(sound_processing)|quantize]] it,<br />
and [[WikiPedia:Quantization_error|quantization adds noise]].<br />
<br />
The number of bits determines how much noise and so the level of the<br />
noise floor.<br />
<br />
What does this dithered quantization noise sound like? Let's listen<br />
to our 8-bit sine wave.<br />
<br />
That may have been hard to hear anything but the tone. Let's listen<br />
to just the noise after we notch out the sine wave and then bring the<br />
gain up a bit because the noise is quiet.<br />
<br />
Those of you who have used analog recording equipment may have just<br />
thought to yourselves, "My goodness! That sounds like tape hiss!"<br />
Well, it doesn't just sound like tape hiss, it acts like it too, and<br />
if we use a [[WikiPedia:Dither#Different_types|gaussian dither]] then it's<br />
[[WikiPedia:Central_limit_theorem|mathematically equivalent]] in every way. It ''is'' tape hiss.<br />
<br />
Intuitively, that means that we can measure tape hiss and thus the noise floor<br />
of [[WikiPedia:Magnetic_tape_sound_recording|magnetic audio tape]]<br />
in [[WikiPedia:Shannon–Hartley_theorem#Examples|bits instead of decibels]], in order to put things in a<br />
digital perspective. [[WikiPedia:Compact cassettes|Compact cassettes]] (for those of you who are old enough to remember them) could reach as<br />
deep as 9 bits in perfect conditions, though 5 to 6 bits was<br />
more typical, especially if it was a recording made on a<br />
[[WikiPedia:Cassette_deck|tape deck]]. That's right... your mix tapes were only about 6 bits<br />
deep... if you were lucky!<br />
<br />
The very best professional [[WikiPedia:Reel-to-reel_audio_tape_recording|open reel tape]] used in studios could barely<br />
hit... any guesses? 13 bits ''with'' [[WikiPedia:Reel-to-reel_audio_tape_recording#Noise_reduction|advanced noise reduction]]. And<br />
that's why seeing '[[WikiPedia:SPARS_code|D D D]]' on a [[WikiPedia:Compact_disk|Compact Disc]] used to be such a big,<br />
high-end deal.<br />
<br />
==Dither==<br />
[[Image:Dsat_011.png|360px|right]]<br />
<br />
I keep saying that I'm quantizing with [[Wikipedia:dither|dither]], so what is dither<br />
exactly and, more importantly, what does it do?<br />
<br />
The simple way to quantize a signal is to choose the digital<br />
amplitude value closest to the original analog amplitude. [[WikiPedia:Rounding|Obvious]],<br />
right? Unfortunately, the exact noise you get from this simple<br />
quantization scheme depends somewhat on the input signal,<br />
<br />
so we may get noise that's inconsistent, or causes distortion, or is<br />
undesirable in some other way.<br />
<br style="clear:both;"/><br />
<center><div style="background-color:#DDDDFF;border-color:#CCCCDD;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
'''Going deeper…'''<br />
*Cameron Nicklaus Christou's thesis [http://uwspace.uwaterloo.ca/bitstream/10012/3867/1/thesis.pdf Optimal Dither and Noise Shaping in Image Processing] provides an ''excellent'' explanation of dither and noise shaping.<br />
</div></center><br />
<br />
Dither is specially-constructed noise that substitutes for the noise<br />
produced by simple quantization. Dither doesn't [[WikiPedia:Sound_masking|drown out or mask]]<br />
quantization noise, it actually replaces it with noise characteristics<br />
of our choosing that aren't influenced by the input.<br />
<br />
Let's ''watch'' what dither does. The signal generator has too much noise for this test so we'll produce a mathematically perfect sine wave with the ThinkPad and quantize it to 8 bits with dithering.<br />
<br />
We see a nice sine wave on the waveform display and output scope and, once the analog spectrum analyzer catches up...<br />
a clean frequency peak with a uniform noise floor on both spectral displays<br />
just like before. Again, this is with dither.<br />
<br />
Now I turn dithering off.<br />
<br />
The quantization noise, that dither had spread out into a nice, flat noise<br />
floor, piles up into harmonic distortion peaks. The noise floor is<br />
lower, but the level of distortion becomes nonzero, and the distortion<br />
peaks sit higher than the dithering noise did.<br />
<br />
At 8 bits this effect is exaggerated. At 16 bits,<br />
even without dither, harmonic distortion is going to be so low as to<br />
be completely inaudible.<br />
<br />
Still, we can use dither to eliminate it completely if we so choose.<br />
<br />
Turning the dither off again for a moment, you'll notice that the<br />
absolute level of distortion from undithered quantization stays<br />
approximately constant regardless of the input amplitude.<br />
But when the signal level drops below a half a bit, everything<br />
quantizes to zero.<br />
<br />
In a sense, everything quantizing to zero is just 100% distortion!<br />
Dither eliminates this distortion too. We reenable dither<br />
and ... there's our signal back at 1/4 bit, with our nice flat noise floor.<br />
<br />
The noise floor doesn't have to be flat. Dither is noise of our<br />
choosing, so let's choose a noise as [http://www.acoustics.salford.ac.uk/res/cox/sound_quality/?content=subjective inoffensive] and<br />
[[WikiPedia:Absolute_threshold_of_hearing|difficult to notice]]<br />
as possible.<br />
<br />
Our hearing is most sensitive in the midrange from 2kHz to 4kHz,<br />
so that's where background noise is going to be the most obvious.<br />
We can [[WikiPedia:Noise_shaping|shape dithering noise]] away from sensitive frequencies to where<br />
hearing is less sensitive, usually the highest frequencies.<br />
<br />
16-bit dithering noise is normally much too quiet to hear at all, but<br />
let's listen to our noise shaping example, again with the gain<br />
brought way up...<br />
<br />
Lastly, dithered quantization noise ''is'' higher [[WikiPedia:power|Sound_power]] overall<br />
than undithered quantization noise even when it sounds quieter, and<br />
you can see that on a [[WikiPedia:VU_meter|VU meter]] during passages of near-silence. But<br />
dither isn't only an on or off choice. We can reduce the dither's<br />
power to balance less noise against a bit of distortion to minimize<br />
the overall effect.<br />
<br />
We'll also [[WikiPedia:Amplitude_modulation|modulate the input signal]] like this to show how a varying input affects the quantization noise. At<br />
full dithering power, the noise is uniform, constant, and featureless<br />
just like we expect:<br />
<br />
As we reduce the dither's power, the input increasingly<br />
affects the amplitude and the character of the quantization noise.<br />
Shaped dither behaves similarly, but noise shaping lends one more nice<br />
advantage. To make a long story short, it can use a somewhat lower<br />
dither power before the input has as much effect on the output.<br />
<br />
Despite all the time I just spent on dither, we're talking about<br />
differences that start 100 decibels and more below [[WikiPedia:Full_scale|full scale]]. Maybe<br />
if the CD had been<br />
[http://www.research.philips.com/technologies/projects/cd/index.html 14 bits as originally designed],<br />
dither ''might'' be<br />
more important. Maybe. At 16 bits, really, it's mostly a wash. You<br />
can think of dither as an insurance policy that gives several extra<br />
decibels of dynamic range just in case. The simple fact is, though, no<br />
one ever ruined a great recording by not dithering the final master.<br />
<br />
==Bandlimitation and timing==<br />
[[image:Dsat_013.jpg|360px|right]]<br />
[[image:Dsat_014.gif|360px|right]]<br />
<br />
We've been using [[WikiPedia:Sine_wave|sine waves]]. They're the obvious choice when what we<br />
want to see is a system's behavior at a given isolated frequency. Now<br />
let's look at something a bit more complex. What should we expect to<br />
happen when I change the input to a [[WikiPedia:Square_wave|square wave]]...<br />
<br />
The input scope confirms our 1kHz square wave. The output scope shows..<br />
<br />
<br />
Exactly what it should.<br />
...<br />
What is a square wave really? <br />
<br />
<br />
Well, we can say it's a waveform that's some positive value for half a cycle and then transitions instantaneously to a negative value for the other half.<br />
<br />
:<math><br />
\ x(t) = \begin{cases} 1, & |t| < T_1 \\ 0, & T_1 < |t| \leq {1 \over 2}T \end{cases}<br />
</math><br />
<br />
But that doesn't really tell us anything useful about how that input becomes this output.<br />
<br />
Then we remember that any waveform is also [[WikiPedia:Fourier_series|the sum of discrete frequencies]],<br />
and a square wave is particularly simple sum: a fundamental and an<br />
infinite series of [[WikiPedia:Even_and_odd_functions#Harmonics|odd harmonics]]. Sum them all up, you get a<br />
square wave.<br />
<br />
:<math>\begin{align}<br />
x_{\mathrm{square}}(t) & {} = \frac{4}{\pi}\sin(\omega t) + \frac{4}{3\pi}\sin(3\omega t) + \frac{4}{5\pi}\sin(5\omega t) + \frac{4}{7\pi}\sin(7\omega t) + \cdots <br />
\end{align}</math><br />
<br />
At first glance, that doesn't seem very useful either. You have to sum up an infinite number of harmonics to get the answer. ''Ah'', but we don't have an infinite number of harmonics.<br />
<br />
We're using a quite sharp [[WikiPedia:Low-pass_filter|anti-aliasing filter]] that cuts off right<br />
above 20kHz, so our signal is [[WikiPedia:Bandlimiting|bandlimited]], which means we get this:<br />
<br />
..and that's exactly what we see on the output scope.<br />
<br />
The rippling you see around sharp edges in a bandlimited signal is<br />
called the [[WikiPedia:/Gibbs_phenomenon|Gibbs effect]]. It happens whenever you slice off part of the<br />
frequency domain in the middle of nonzero energy.<br />
<br />
The usual rule of thumb you'll hear is "the sharper the cutoff, the<br />
stronger the rippling", which is approximately true, but we have to be<br />
careful how we think about it.<br />
For example... what would you expect our quite sharp anti-aliasing filter<br />
to do if I run our signal through it a second time?<br />
<br />
Aside from adding a few fractional cycles of delay, the answer is...<br />
nothing at all. The signal is already bandlimited. Bandlimiting it<br />
again doesn't do anything. A second pass can't remove frequencies<br />
that we already removed.<br />
<br />
And that's important. People tend to think of the ripples as<br />
a kind of [[WikiPedia:Sonic_artifact|artifact]] that's added by anti-aliasing and [[WikiPedia:Reconstruction_filter|anti-imaging]]<br />
filters, implying that the ripples get worse each time the signal<br />
passes through. We can see that in this case that didn't happen. So<br />
was it really the filter that added the ripples the first time<br />
through? No, not really. It's a subtle distinction, but Gibbs effect<br />
ripples aren't added by filters, they're just part of what a<br />
bandlimited signal ''is''.<br />
<br />
Even if we synthetically construct what looks like a perfect digital<br />
square wave,<br />
<br />
it's still limited to the channel bandwidth. Remember,<br />
the stairstep representation is misleading.<br />
<br />
What we really have here are instantaneous sample points,<br />
<br />
and only one bandlimited signal fits those points. All we did when we<br />
drew our apparently perfect square wave was line up the sample points<br />
just right so it appeared that there were no ripples if we played<br />
[[WikiPedia:Interpolation|connect-the-dots]].<br />
<br />
But the original bandlimited signal, complete with ripples, was<br />
still there.<br />
<br />
And that leads us to one more important point. You've probably heard<br />
that the timing precision of a digital signal is limited by its sample<br />
rate; put another way,<br />
<br />
that digital signals can't represent anything that falls between the<br />
samples.. implying that [[WikiPedia:Dirac_delta_function|impulses]] or<br />
[[WikiPedia:Synthesizer#ADSR_envelope|fast attacks]] have to align exactly<br />
with a sample, or the timing gets mangled... or they just disappear.<br />
<br />
At this point, we can easily see why that's wrong.<br />
<br />
Again, our input signals are bandlimited. And digital signals are<br />
samples, not stairsteps, not 'connect-the-dots'. We most certainly<br />
can, for example, put the rising edge of our bandlimited square wave<br />
anywhere we want between samples.<br />
<br />
It's represented perfectly and it's reconstructed perfectly.<br />
<br />
==Epilogue==<br />
<br />
[[Image:Moffey.jpg|360px|right]]<br />
<br />
Just like in [[Videos/A_Digital_Media_Primer_For_Geeks|the previous episode]], we've covered a broad range of<br />
topics, and yet barely scratched the surface of each one. If anything, my<br />
sins of omission are greater this time around... but this is a good<br />
stopping point.<br />
<br />
Or maybe, a good starting point. Dig deeper. Experiment. I chose my<br />
demos very carefully to be simple and give clear results. You can<br />
reproduce every one of them on your own if you like. But let's face<br />
it, sometimes we learn the most about a spiffy toy by breaking it open<br />
and studying all the pieces that fall out. And that's OK, we're<br />
engineers. Play with the demo parameters, hack up the code, set up<br />
alternate experiments. The source code for everything, including the<br />
little pushbutton demo application, is up at xiph.org.<br />
<br />
In the course of experimentation, you're likely to run into something<br />
that you didn't expect and can't explain. Don't worry! My earlier<br />
snark aside, Wikipedia is fantastic for exactly this kind of casual<br />
research. And, if you're really serious about understanding signals,<br />
several universities have advanced materials online, such as the<br />
[http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-003-signals-and-systems-spring-2010/index.htm 6.003]<br />
and<br />
[http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-007-electromagnetic-energy-from-motors-to-lasers-spring-2011 6.007]<br />
Signals and Systems modules at MIT OpenCourseWare. And of<br />
course, there's always the [http://webchat.freenode.net/?channels=xiph community here at Xiph.Org].<br />
<br />
Digging deeper or not, I am out of coffee, so, until next time, happy<br />
hacking!<br />
<br />
==Credits==<br />
<br />
Written by: Christopher (Monty) Montgomery and the Xiph.Org Community<br />
<br />
Special thanks to:<br />
*Heidi Baumgartner, for the second Tektronix oscilloscope<br />
*Gregory Maxwell and Dr. Timothy Terriberry, for additional technical review<br />
<br />
Intro, title and credits music:<br><br />
"Andy Warhol Is Gone", by Lousy Robot<br><br />
Used by permission of Lousy Robot.<br><br />
Original source track All Rights Reserved.<br><br />
[http://www.lousyrobot.com www.lousyrobot.com]<br />
<br />
This Video Was Produced Entirely With Free and Open Source Software:<br><br />
<br />
*[http://www.gnu.org/ GNU]<br><br />
*[http://www.linux.org/ Linux]<br><br />
*[http://fedoraproject.org/ Fedora]<br><br />
*[http://cinelerra.org/ Cinelerra]<br><br />
*[http://www.gimp.org/ The Gimp]<br><br />
*[http://audacity.sourceforge.net/ Audacity]<br><br />
*[http://svn.xiph.org/trunk/postfish/README Postfish]<br><br />
*[http://gstreamer.freedesktop.org/ Gstreamer]<br><br />
<br />
All trademarks are the property of their respective owners. <br />
<br />
*''Complete video'' [http://creativecommons.org/licenses/by-sa/3.0/legalcode CC-BY-SA]<br><br />
*''Text transcript and Wiki edition'' [http://creativecommons.org/licenses/by-sa/3.0/legalcode CC-BY-SA]<br><br />
<br />
A Co-Production of Xiph.Org and Red Hat, Inc.<br><br />
(C) 2012-2013, Some Rights Reserved<br><br />
<br />
== Use The Source Luke ==<br />
<br />
As stated in the Epilogue, everything that appears in the video demos is driven by open source software, which means the source is both available for inspection and freely usable by the community. The Thinkpad that appears in the video was running Fedora 17 and Gnome Shell (Gnome 3). The demonstration software does not require Fedora specifically, but it does require Gnu/Linux to run in its current form.<br />
<br />
=== The Spectrum and Waveform Viewer ===<br />
<br />
The realtime software spectrum analyzer application that appears in the video was a preexisting application that was dusted off and updated for use in the video. The waveform viewer (effectively a simple software oscilloscope) was written from scratch making use of some of the internals from the spectrum analyzer application. Both are available from Xiph.Org svn:<br />
<br />
<center><div style="background-color:#DDDDFF;border-color:#CCCCDD;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
*Source for the Spectrum and Waveform applications is found at:<br />
https://svn.xiph.org/trunk/spectrum/<br />
*The source can be checked out of svn using the following command line:<br />
svn co https://svn.xiph.org/trunk/spectrum<br />
*Trac is a convenient way to browse the source without checking out a copy:<br />
https://trac.xiph.org/browser/trunk/spectrum<br />
</div></center><br />
<br />
Spectrum and Waveform both expect an input stream on the command line, either as raw data or as a WAV file.<br />
<br />
=== GTK-Bounce ===<br />
<br />
The touch-controlled application used in the video is named 'gtk-bounce' and was custom-written for the sole purpose of the in-video demonstrations. It is so named because, for the most part, all it does is read the input from an audio device, and then immediately write the same data back out for playback. It also forwards a copy of this data to up to two external monitoring applications, and in several demos, applies simple filters or generates simple waveforms. It includes several demos not included in the video.<br />
<br />
<center><div style="background-color:#DDDDFF;border-color:#CCCCDD;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
*Source for gtk-bounce is found at:<br />
https://svn.xiph.org/trunk/Xiph-episode-II/bounce/<br />
*The source can be checked out of svn using the following command line:<br />
svn co https://svn.xiph.org/trunk/Xiph-episode-II/bounce/<br />
*Trac is a convenient way to browse the source without checking out a copy:<br />
https://trac.xiph.org/browser/Xiph-episode-II/bounce/<br />
</div></center><br />
<br />
The application is somewhat hardwired for specific demo purposes, but most of the hardwired settings can be found at the top of each source file. As found in SVN, the application expects an ALSA hardware audio device at hw:1, and if none if found, it will wait for one to appear. Once a sound device is successfully initialized, it expects to find and open two pipes named pipe0 and pipe1 for output in the current directory. In the video, the waveform and spectrum applications are started to take input from pipe0 and pipe1 respectively. The output sent to the two pipes is identical, and in most demos matches the output data sent to the hardware device for conversion to analog. The only exception is the tenth demo panel (which does not appear in the video) where gtk-bounce can be set to monitor the hardware inputs instead while the outputs are used to produce test waveforms.<br />
<br />
<center><div style="background-color:#DDDDFF;border-color:#CCCCDD;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
Assuming gtk-bounce, spectrum and waveform have been checked out and built, the configuration seen in the video can be started using the following commands:<br />
* make the pipe fifos for the applications to communicate (only needs to be done once)<br />
mkfifo pipe0; mkfifo pipe1<br />
* start all three applications<br />
waveform pipe0 & spectrum pipe1 & gtk-bounce &<br />
</div></center></div>Gmaxwellhttps://wiki.xiph.org/index.php?title=Videos/Digital_Show_and_Tell&diff=13958Videos/Digital Show and Tell2013-02-26T08:17:56Z<p>Gmaxwell: /* Epilogue */ Link into IRC</p>
<hr />
<div><small>''Wiki edition''</small><br />
[[Image:dsat_001.jpg|400px|right]]<br />
<br />
Continuing in the "firehose" tradition of [[Videos/A_Digital_Media_Primer_For_Geeks|Episode 01]], Xiph.Org's second video on digital media explores multiple facets of digital audio signals and how they ''really'' behave in the real world.<br />
<br />
Demonstrations of sampling, quantization, bit-depth, and dither explore digital audio behavior on real audio equipment using both modern digital analysis and vintage analog bench equipment, just in case we can't trust those newfangled digital gizmos. You can download the source code for each demo and try it all for yourself!<br />
<br/><br/><br/><br />
<center><font size="+2">[http://www.xiph.org/video/vid2.shtml Download or Watch online]</font></center><br />
<br style="clear:both;"/><br />
Supported players: [http://www.videolan.org/vlc/ VLC 1.1+], [https://www.mozilla.com/en-US/firefox/ Firefox ], [http://www.chromium.org/Home Chrome ], [http://www.opera.com/ Opera]. Or see [http://www.webmproject.org/users/ other WebM] or [[TheoraSoftwarePlayers|other Theora]] players.<br />
<br />
If you're having trouble with playback in a modern browser or player, please visit our [[Playback_Troubleshooting|playback troubleshooting and discussion]] page.<br />
<br/><br />
<hr/><br />
<br/><br/><br/><br />
[[Image:Xiph_ep02_test.png|400px|right]]<br />
<br />
Hi, I'm Monty Montgomery from [http://www.redhat.com/ Red Hat] and [http://xiph.org/ Xiph.Org].<br />
<br />
A few months ago, I wrote<br />
[http://people.xiph.org/~xiphmont/demo/neil-young.html an article on digital audio and why 24bit/192kHz music downloads don't make sense].<br />
In the article, I<br />
mentioned--almost in passing--that a digital waveform is<br />
[http://people.xiph.org/~xiphmont/demo/neil-young.html#toc_sfam not a stairstep],<br />
and you certainly don't get a stairstep when you<br />
[[WikiPedia:Digital-to-analog_converter|convert from digital back to analog]].<br />
<br />
Of everything in the entire article, '''that''' was the number one thing<br />
people wrote about. In fact, more than half the mail I got was questions and<br />
comments about basic digital signal behavior. Since there's interest, let's<br />
take a little time to play with some ''simple'' digital signals.<br />
<br />
==Veritas ex machina==<br />
[[Image:Dsat_002.jpg|200px|right]]<br />
[[Image:Dsat_003.jpg|200px|right]]<br />
[[Image:Dsat_004.jpg|200px|right]]<br />
[[Image:Dsat_005.jpg|200px|right]]<br />
<br />
Pretend for a moment that we have no idea how digital signals really<br />
behave. In that case it doesn't make sense for us to use digital test<br />
equipment either. Fortunately for this exercise, there's still plenty<br />
of working analog lab equipment out there.<br />
<br />
First up, we need a [[WikiPedia:Function_generator|signal generator]] to provide us with analog input<br />
signals--in this case, an<br />
[http://www.home.agilent.com/en/pd-3325A%3Aepsg%3Apro-pn-3325A/synthesizer-function-generator?pm=PL&nid=-536900197.536896863&cc=SE&lc=swe HP3325]<br />
from 1978. It's still a pretty good<br />
generator, so if you don't mind the size, the weight, the power<br />
consumption, and the noisy fan, you can find them on eBay... occasionally<br />
for only slightly more than you'll pay for shipping.<br />
<br />
Next, we'll observe our analog waveforms on [[WikiPedia:Oscilloscope_types#Cathode-ray_oscilloscope_.28CRO.29|analog oscilloscopes]],<br />
like this Tektronix 2246 from the mid-90s, one of the last and very best analog scopes ever made. Every home lab should have one.<br />
<br />
...and finally inspect the [[WikiPedia:Spectral_density#Electrical_engineering|frequency spectrum]] of our signals using an<br />
[[WikiPedia:Spectrum_analyzer#Swept-tuned|analog spectrum analyzer]], this<br />
[http://www.home.agilent.com/en/pd-3585A%3Aepsg%3Apro-pn-3585A/spectrum-analyzer-high-perf-20hz-40mhz?pm=PL&nid=-536900197.536897319&cc=SE&lc=swe HP3585]<br />
from the same product line as<br />
the signal generator. Like the other equipment here it has<br />
[http://www.hp9845.net/9845/hardware/processors/ a rudimentary and hilariously large microcontroller],<br />
but the signal path<br />
from input to what you see on the screen is completely analog.<br />
<br />
All of this equipment is vintage, but aside from its raw tonnage, the specs are still quite good.<br />
<br />
At the moment, we have our signal generator set to output a nice 1 [[WikiPedia:Hertz#SI_multiples|kHz]]<br />
sine wave at one [[WikiPedia:Volt|Volt]] [[WikiPedia:Amplitude#Root_mean_square_amplitude|RMS]].<br />
We see the sine wave on the oscilloscope, can verify that it is indeed<br />
1 kHz at 1 Volt RMS, which is 2.8 Volts<br />
[[WikiPedia:Amplitude#Peak-to-peak_amplitude|peak-to-peak]],<br />
and that matches the<br />
measurement on the spectrum analyzer as well.<br />
<br />
The analyzer also shows some low-level [[WikiPedia:White_noise|white noise]]<br />
and just a bit of [[WikiPedia:Harmonic_distortion#Harmonic_distortion|harmonic distortion]],<br />
with the highest peak about 70[[WikiPedia:Decibel|dB]] or so below<br />
[[WikiPedia:Fundamental_frequency|the fundamental]].<br />
Now, this doesn't matter at all in our demos, but I<br />
wanted to point it out now just in case you didn't notice it until<br />
later.<br />
<br />
Now, we drop digital sampling in the middle.<br />
<br />
For the conversion, we'll use a boring, consumer-grade, eMagic USB1<br />
audio device. It's also more than ten years old at this point, and it's<br />
getting obsolete.<br />
<br />
A recent converter can easily have an order of magnitude better specs.<br />
[[WikiPedia:Reconstruction_filter#Sampled_data_reconstruction_filters|Flatness]],<br />
[[WikiPedia:Analog-to-digital_converter#Non-linearity|linearity]],<br />
[[WikiPedia:Jitter#Sampling_jitter|jitter]],<br />
[[WikiPedia:Noise_floor|noise behavior]],<br />
[[WikiPedia:Digital-to-analog_converter#DAC_performance|everything]]...<br />
you may not<br />
have noticed. Just because we can measure an improvement doesn't<br />
mean we can hear it, and even these old consumer boxes were already at<br />
the edge of ideal transparency.<br />
<br />
The eMagic connects to my ThinkPad, which displays a digital<br />
waveform and spectrum for comparison, then the ThinkPad<br />
sends the digital signal right back out to the eMagic for<br />
re-conversion to analog and observation on the output scopes.<br />
<br />
Input to output, left to right.<br />
<br style="clear:both;"/><br />
<br />
==Stairsteps==<br />
[[Image:Dsat 006.jpg|360px|right]]<br />
[[Image:Dsat 007.png|360px|right]]<br />
OK, it's go time. We begin by converting an analog signal to digital and<br />
then right back to analog again with no other steps.<br />
<br />
The signal generator is set to produce a 1kHz sine wave just like<br />
before.<br />
<br />
We can see our analog sine wave on our input-side oscilloscope.<br />
<br />
We digitize our signal to<br />
[[Videos/A_Digital_Media_Primer_For_Geeks#Raw_.28digital_audio.29_meat|16 bit PCM at 44.1kHz]],<br />
same as on a CD.<br />
The spectrum of the digitized signal matches what we saw earlier<br />
<br />
and what we see now on the analog spectrum analyzer, aside from its <br />
[[WikiPedia:High_impedance|high-impedance input]] being just a smidge noisier.<br />
<br />
For now, the waveform display shows our digitized sine wave as a<br />
stairstep pattern, one step for each sample.<br />
<br />
And when we look at the output signal that's been converted<br />
from digital back to analog, we see...<br />
<br />
It's exactly like the original sine wave. No stairsteps.<br />
<br />
OK, 1 kHz is still a fairly low frequency, maybe the stairsteps are just<br />
hard to see or they're being smoothed away. Fair enough. Let's choose<br />
a higher frequency, something close to [[WikiPedia:Nyquist_frequency|Nyquist]], say 15kHz.<br />
<br />
Now the sine wave is represented by less than three samples per cycle, and...<br />
<br />
the digital waveform looks pretty awful. Well, looks<br />
can be deceiving. The analog output...<br />
<br />
is still a perfect sine wave, exactly like the original.<br />
<br />
Let's keep going up.<br />
<br />
Let's see if I can do this without blocking any cameras.<br />
<br />
16kHz.... 17kHz... 18kHz... 19kHz... <br />
<br />
20kHz. Welcome to the upper limits of human hearing. The output<br />
waveform is still perfect. No jagged edges, no dropoff, no stairsteps.<br />
<br />
So where'd the stairsteps go? Don't answer, it's a trick question.<br />
They were never there.<br />
<br />
Drawing a digital waveform as a stairstep... was wrong to begin with.<br />
<br />
Why? A stairstep is a continuous-time function. It's jagged, and it's<br />
piecewise, but it has a defined value at every point in time.<br />
<br />
A sampled signal is entirely different. It's discrete-time; it's only<br />
got a value right at each instantaneous sample point and it's<br />
undefined, there is no value at all, everywhere between. A<br />
discrete-time signal is properly drawn as a lollipop graph.<br />
<br />
The continuous, analog counterpart of a digital signal passes<br />
smoothly through each sample point, and that's just as true for high<br />
frequencies as it is for low.<br />
<br />
Now, the interesting and not at all obvious bit is: [[WikiPedia:Nyquist%E2%80%93Shannon_sampling_theorem|there's only one<br />
bandlimited signal that passes exactly through each sample point]]. It's<br />
a unique solution. So if you sample a bandlimited signal and then<br />
convert it back, the original input is also the only possible output.<br />
<br />
[[Image:Dsat 008.png|360px|right]]<br />
<br />
And before you say, "oh, I can draw a different signal that passes<br />
through those points", well, yes you can, but if it differs even<br />
minutely from the original, it includes frequency content at or beyond<br />
Nyquist, breaks the bandlimiting requirement and isn't a valid<br />
solution.<br />
<br />
So how did everyone get confused and start thinking of digital signals<br />
as stairsteps? I can think of two good reasons.<br />
<br />
First: it's easy enough to convert a sampled signal to a true stairstep. Just<br />
extend each sample value forward until the next sample period. This is<br />
called a [[WikiPedia:Zero-order hold|zero-order hold]], and it's an important part of how some<br />
digital-to-analog converters work, especially the simplest ones.<br />
<br />
So, anyone who looks up [[WikiPedia:Digital-to-analog_converter#Practical_operation|digital-to-analog converter or<br />
digital-to-analog conversion]] is probably going to see a diagram of a<br />
stairstep waveform somewhere, but that's not a finished conversion,<br />
and it's not the signal that comes out.<br />
<br />
Second, and this is probably the more likely reason, engineers who<br />
supposedly know better, like me, draw stairsteps even though they're<br />
technically wrong. It's a sort of like a one-dimensional version of<br />
[[WikiPedia:MacPaint#Development|fat bits in an image editor]].<br />
<br />
Pixels aren't squares either, they're samples of a 2-dimensional<br />
function space and so they're also, conceptually, infinitely small<br />
points. Practically, it's a real pain in the ass to see or manipulate<br />
infinitely small anything, so big squares it is. Digital stairstep<br />
drawings are exactly the same thing.<br />
<br />
It's just a convenient drawing. The stairsteps aren't really there.<br />
<br />
==Bit-depth==<br />
[[Image:Dsat_009.jpg|360px|right]]<br />
[[Image:Dsat_010.jpg|260px|right]]<br />
<br />
When we convert a digital signal back to analog, the result is<br />
''also'' smooth regardless of the [[WikiPedia:Audio_bit_depth|bit depth]]. 24 bits or 16 bits...<br />
or 8 bits... it doesn't matter.<br />
<br />
So does that mean that the digital bit depth makes no difference at<br />
all? Of course not.<br />
<br />
Channel 2 here is the same sine wave input, but we quantize with<br />
[[WikiPedia:Dither|dither]] down to 8 bits.<br />
<br />
On the scope, we still see a nice<br />
smooth sine wave on channel 2. Look very close, and you'll also see a<br />
bit more noise. That's a clue.<br />
<br />
If we look at the spectrum of the signal... aha! Our sine wave is<br />
still there unaffected, but the noise level of the 8-bit signal on<br />
the second channel is much higher!<br />
<br />
And that's the difference the number of bits makes. That's it!<br />
<br />
When we digitize a signal, first we sample it. The<br />
sampling step is perfect; it loses nothing. But then we [[WikiPedia:Quantization_(sound_processing)|quantize]] it,<br />
and [[WikiPedia:Quantization_error|quantization adds noise]].<br />
<br />
The number of bits determines how much noise and so the level of the<br />
noise floor.<br />
<br />
What does this dithered quantization noise sound like? Let's listen<br />
to our 8-bit sine wave.<br />
<br />
That may have been hard to hear anything but the tone. Let's listen<br />
to just the noise after we notch out the sine wave and then bring the<br />
gain up a bit because the noise is quiet.<br />
<br />
Those of you who have used analog recording equipment may have just<br />
thought to yourselves, "My goodness! That sounds like tape hiss!"<br />
Well, it doesn't just sound like tape hiss, it acts like it too, and<br />
if we use a [[WikiPedia:Dither#Different_types|gaussian dither]] then it's<br />
[[WikiPedia:Central_limit_theorem|mathematically equivalent]] in every way. It ''is'' tape hiss.<br />
<br />
Intuitively, that means that we can measure tape hiss and thus the noise floor<br />
of [[WikiPedia:Magnetic_tape_sound_recording|magnetic audio tape]]<br />
in [[WikiPedia:Shannon–Hartley_theorem#Examples|bits instead of decibels]], in order to put things in a<br />
digital perspective. [[WikiPedia:Compact cassettes|Compact cassettes]] (for those of you who are old enough to remember them) could reach as<br />
deep as 9 bits in perfect conditions, though 5 to 6 bits was<br />
more typical, especially if it was a recording made on a<br />
[[WikiPedia:Cassette_deck|tape deck]]. That's right... your mix tapes were only about 6 bits<br />
deep... if you were lucky!<br />
<br />
The very best professional [[WikiPedia:Reel-to-reel_audio_tape_recording|open reel tape]] used in studios could barely<br />
hit... any guesses? 13 bits ''with'' [[WikiPedia:Reel-to-reel_audio_tape_recording#Noise_reduction|advanced noise reduction]]. And<br />
that's why seeing '[[WikiPedia:SPARS_code|D D D]]' on a [[WikiPedia:Compact_disk|Compact Disc]] used to be such a big,<br />
high-end deal.<br />
<br />
==Dither==<br />
[[Image:Dsat_011.png|360px|right]]<br />
<br />
I keep saying that I'm quantizing with [[Wikipedia:dither|dither]], so what is dither<br />
exactly and, more importantly, what does it do?<br />
<br />
The simple way to quantize a signal is to choose the digital<br />
amplitude value closest to the original analog amplitude. [[WikiPedia:Rounding|Obvious]],<br />
right? Unfortunately, the exact noise you get from this simple<br />
quantization scheme depends somewhat on the input signal,<br />
<br />
so we may get noise that's inconsistent, or causes distortion, or is<br />
undesirable in some other way.<br />
<br style="clear:both;"/><br />
<center><div style="background-color:#DDDDFF;border-color:#CCCCDD;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
'''Going deeper…'''<br />
*Cameron Nicklaus Christou's thesis [http://uwspace.uwaterloo.ca/bitstream/10012/3867/1/thesis.pdf Optimal Dither and Noise Shaping in Image Processing] provides an ''excellent'' explanation of dither and noise shaping.<br />
</div></center><br />
<br />
Dither is specially-constructed noise that substitutes for the noise<br />
produced by simple quantization. Dither doesn't [[WikiPedia:Sound_masking|drown out or mask]]<br />
quantization noise, it actually replaces it with noise characteristics<br />
of our choosing that aren't influenced by the input.<br />
<br />
Let's ''watch'' what dither does. The signal generator has too much noise for this test so we'll produce a mathematically perfect sine wave with the ThinkPad and quantize it to 8 bits with dithering.<br />
<br />
We see a nice sine wave on the waveform display and output scope and, once the analog spectrum analyzer catches up...<br />
a clean frequency peak with a uniform noise floor on both spectral displays<br />
just like before. Again, this is with dither.<br />
<br />
Now I turn dithering off.<br />
<br />
The quantization noise, that dither had spread out into a nice, flat noise<br />
floor, piles up into harmonic distortion peaks. The noise floor is<br />
lower, but the level of distortion becomes nonzero, and the distortion<br />
peaks sit higher than the dithering noise did.<br />
<br />
At 8 bits this effect is exaggerated. At 16 bits,<br />
even without dither, harmonic distortion is going to be so low as to<br />
be completely inaudible.<br />
<br />
Still, we can use dither to eliminate it completely if we so choose.<br />
<br />
Turning the dither off again for a moment, you'll notice that the<br />
absolute level of distortion from undithered quantization stays<br />
approximately constant regardless of the input amplitude.<br />
But when the signal level drops below a half a bit, everything<br />
quantizes to zero.<br />
<br />
In a sense, everything quantizing to zero is just 100% distortion!<br />
Dither eliminates this distortion too. We reenable dither<br />
and ... there's our signal back at 1/4 bit, with our nice flat noise floor.<br />
<br />
The noise floor doesn't have to be flat. Dither is noise of our<br />
choosing, so let's choose a noise as [http://www.acoustics.salford.ac.uk/res/cox/sound_quality/?content=subjective inoffensive] and<br />
[[WikiPedia:Absolute_threshold_of_hearing|difficult to notice]]<br />
as possible.<br />
<br />
Our hearing is most sensitive in the midrange from 2kHz to 4kHz,<br />
so that's where background noise is going to be the most obvious.<br />
We can [[WikiPedia:Noise_shaping|shape dithering noise]] away from sensitive frequencies to where<br />
hearing is less sensitive, usually the highest frequencies.<br />
<br />
16-bit dithering noise is normally much too quiet to hear at all, but<br />
let's listen to our noise shaping example, again with the gain<br />
brought way up...<br />
<br />
Lastly, dithered quantization noise ''is'' higher [[WikiPedia:power|Sound_power]] overall<br />
than undithered quantization noise even when it sounds quieter, and<br />
you can see that on a [[WikiPedia:VU_meter|VU meter]] during passages of near-silence. But<br />
dither isn't only an on or off choice. We can reduce the dither's<br />
power to balance less noise against a bit of distortion to minimize<br />
the overall effect.<br />
<br />
We'll also [[WikiPedia:Amplitude_modulation|modulate the input signal]] like this to show how a varying input affects the quantization noise. At<br />
full dithering power, the noise is uniform, constant, and featureless<br />
just like we expect:<br />
<br />
As we reduce the dither's power, the input increasingly<br />
affects the amplitude and the character of the quantization noise.<br />
Shaped dither behaves similarly, but noise shaping lends one more nice<br />
advantage. To make a long story short, it can use a somewhat lower<br />
dither power before the input has as much effect on the output.<br />
<br />
Despite all the time I just spent on dither, we're talking about<br />
differences that start 100 decibels and more below [[WikiPedia:Full_scale|full scale]]. Maybe<br />
if the CD had been<br />
[http://www.research.philips.com/technologies/projects/cd/index.html 14 bits as originally designed],<br />
dither ''might'' be<br />
more important. Maybe. At 16 bits, really, it's mostly a wash. You<br />
can think of dither as an insurance policy that gives several extra<br />
decibels of dynamic range just in case. The simple fact is, though, no<br />
one ever ruined a great recording by not dithering the final master.<br />
<br />
==Bandlimitation and timing==<br />
[[image:Dsat_013.jpg|360px|right]]<br />
[[image:Dsat_014.gif|360px|right]]<br />
<br />
We've been using [[WikiPedia:Sine_wave|sine waves]]. They're the obvious choice when what we<br />
want to see is a system's behavior at a given isolated frequency. Now<br />
let's look at something a bit more complex. What should we expect to<br />
happen when I change the input to a [[WikiPedia:Square_wave|square wave]]...<br />
<br />
The input scope confirms our 1kHz square wave. The output scope shows..<br />
<br />
<br />
Exactly what it should.<br />
...<br />
What is a square wave really? <br />
<br />
<br />
Well, we can say it's a waveform that's<br />
some positive value for half a cycle and then transitions<br />
instantaneously to a negative value for the other half. But that doesn't<br />
really tell us anything useful about how this input <br />
becomes this output .<br />
<br />
Then we remember that [any waveform is also [[WikiPedia:Fourier_series|the sum of discrete frequencies]],<br />
and a square wave is particularly simple sum: a fundamental and an<br />
infinite series of [[WikiPedia:Even_and_odd_functions#Harmonics|odd harmonics]]. Sum them all up, you get a<br />
square wave.<br />
<br />
At first glance, that doesn't seem very useful either. You have to sum<br />
up an infinite number of harmonics to get the answer. Ah, but we don't<br />
have an infinite number of harmonics.<br />
<br />
We're using a quite sharp [[WikiPedia:Low-pass_filter|anti-aliasing filter]] that cuts off right<br />
above 20kHz, so our signal is [[WikiPedia:Bandlimiting|bandlimited]], which means we get this:<br />
<br />
..and that's exactly what we see on the output scope.<br />
<br />
The rippling you see around sharp edges in a bandlimited signal is<br />
called the [[WikiPedia:/Gibbs_phenomenon|Gibbs effect]]. It happens whenever you slice off part of the<br />
frequency domain in the middle of nonzero energy.<br />
<br />
The usual rule of thumb you'll hear is "the sharper the cutoff, the<br />
stronger the rippling", which is approximately true, but we have to be<br />
careful how we think about it.<br />
For example... what would you expect our quite sharp anti-aliasing filter<br />
to do if I run our signal through it a second time?<br />
<br />
Aside from adding a few fractional cycles of delay, the answer is...<br />
nothing at all. The signal is already bandlimited. Bandlimiting it<br />
again doesn't do anything. A second pass can't remove frequencies<br />
that we already removed.<br />
<br />
And that's important. People tend to think of the ripples as<br />
a kind of [[WikiPedia:Sonic_artifact|artifact]] that's added by anti-aliasing and [[WikiPedia:Reconstruction_filter|anti-imaging]]<br />
filters, implying that the ripples get worse each time the signal<br />
passes through. We can see that in this case that didn't happen. So<br />
was it really the filter that added the ripples the first time<br />
through? No, not really. It's a subtle distinction, but Gibbs effect<br />
ripples aren't added by filters, they're just part of what a<br />
bandlimited signal ''is''.<br />
<br />
Even if we synthetically construct what looks like a perfect digital<br />
square wave,<br />
<br />
it's still limited to the channel bandwidth. Remember,<br />
the stairstep representation is misleading.<br />
<br />
What we really have here are instantaneous sample points,<br />
<br />
and only one bandlimited signal fits those points. All we did when we<br />
drew our apparently perfect square wave was line up the sample points<br />
just right so it appeared that there were no ripples if we played<br />
[[WikiPedia:Interpolation|connect-the-dots]].<br />
<br />
But the original bandlimited signal, complete with ripples, was<br />
still there.<br />
<br />
And that leads us to one more important point. You've probably heard<br />
that the timing precision of a digital signal is limited by its sample<br />
rate; put another way,<br />
<br />
that digital signals can't represent anything that falls between the<br />
samples.. implying that [[WikiPedia:Dirac_delta_function|impulses]] or<br />
[[WikiPedia:Synthesizer#ADSR_envelope|fast attacks]] have to align exactly<br />
with a sample, or the timing gets mangled... or they just disappear.<br />
<br />
At this point, we can easily see why that's wrong.<br />
<br />
Again, our input signals are bandlimited. And digital signals are<br />
samples, not stairsteps, not 'connect-the-dots'. We most certainly<br />
can, for example, put the rising edge of our bandlimited square wave<br />
anywhere we want between samples.<br />
<br />
It's represented perfectly and it's reconstructed perfectly.<br />
<br />
==Epilogue==<br />
<br />
[[Image:Moffey.jpg|360px|right]]<br />
<br />
Just like in [[Videos/A_Digital_Media_Primer_For_Geeks|the previous episode]], we've covered a broad range of<br />
topics, and yet barely scratched the surface of each one. If anything, my<br />
sins of omission are greater this time around... but this is a good<br />
stopping point.<br />
<br />
Or maybe, a good starting point. Dig deeper. Experiment. I chose my<br />
demos very carefully to be simple and give clear results. You can<br />
reproduce every one of them on your own if you like. But let's face<br />
it, sometimes we learn the most about a spiffy toy by breaking it open<br />
and studying all the pieces that fall out. And that's OK, we're<br />
engineers. Play with the demo parameters, hack up the code, set up<br />
alternate experiments. The source code for everything, including the<br />
little pushbutton demo application, is up at xiph.org.<br />
<br />
In the course of experimentation, you're likely to run into something<br />
that you didn't expect and can't explain. Don't worry! My earlier<br />
snark aside, Wikipedia is fantastic for exactly this kind of casual<br />
research. And, if you're really serious about understanding signals,<br />
several universities have advanced materials online, such as the<br />
[http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-003-signals-and-systems-spring-2010/index.htm 6.003]<br />
and<br />
[http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-007-electromagnetic-energy-from-motors-to-lasers-spring-2011 6.007]<br />
Signals and Systems modules at MIT OpenCourseWare. And of<br />
course, there's always the [http://webchat.freenode.net/?channels=xiph community here at Xiph.Org].<br />
<br />
Digging deeper or not, I am out of coffee, so, until next time, happy<br />
hacking!<br />
<br />
== Use The Source Luke ==</div>Gmaxwellhttps://wiki.xiph.org/index.php?title=Videos/Digital_Show_and_Tell&diff=13957Videos/Digital Show and Tell2013-02-26T08:10:40Z<p>Gmaxwell: /* Dither */ deeper box with the dither thesis</p>
<hr />
<div><small>''Wiki edition''</small><br />
[[Image:dsat_001.jpg|400px|right]]<br />
<br />
Continuing in the "firehose" tradition of [[Videos/A_Digital_Media_Primer_For_Geeks|Episode 01]], Xiph.Org's second video on digital media explores multiple facets of digital audio signals and how they ''really'' behave in the real world.<br />
<br />
Demonstrations of sampling, quantization, bit-depth, and dither explore digital audio behavior on real audio equipment using both modern digital analysis and vintage analog bench equipment, just in case we can't trust those newfangled digital gizmos. You can download the source code for each demo and try it all for yourself!<br />
<br/><br/><br/><br />
<center><font size="+2">[http://www.xiph.org/video/vid2.shtml Download or Watch online]</font></center><br />
<br style="clear:both;"/><br />
Supported players: [http://www.videolan.org/vlc/ VLC 1.1+], [https://www.mozilla.com/en-US/firefox/ Firefox ], [http://www.chromium.org/Home Chrome ], [http://www.opera.com/ Opera]. Or see [http://www.webmproject.org/users/ other WebM] or [[TheoraSoftwarePlayers|other Theora]] players.<br />
<br />
If you're having trouble with playback in a modern browser or player, please visit our [[Playback_Troubleshooting|playback troubleshooting and discussion]] page.<br />
<br/><br />
<hr/><br />
<br/><br/><br/><br />
[[Image:Xiph_ep02_test.png|400px|right]]<br />
<br />
Hi, I'm Monty Montgomery from [http://www.redhat.com/ Red Hat] and [http://xiph.org/ Xiph.Org].<br />
<br />
A few months ago, I wrote<br />
[http://people.xiph.org/~xiphmont/demo/neil-young.html an article on digital audio and why 24bit/192kHz music downloads don't make sense].<br />
In the article, I<br />
mentioned--almost in passing--that a digital waveform is<br />
[http://people.xiph.org/~xiphmont/demo/neil-young.html#toc_sfam not a stairstep],<br />
and you certainly don't get a stairstep when you<br />
[[WikiPedia:Digital-to-analog_converter|convert from digital back to analog]].<br />
<br />
Of everything in the entire article, '''that''' was the number one thing<br />
people wrote about. In fact, more than half the mail I got was questions and<br />
comments about basic digital signal behavior. Since there's interest, let's<br />
take a little time to play with some ''simple'' digital signals.<br />
<br />
==Veritas ex machina==<br />
[[Image:Dsat_002.jpg|200px|right]]<br />
[[Image:Dsat_003.jpg|200px|right]]<br />
[[Image:Dsat_004.jpg|200px|right]]<br />
[[Image:Dsat_005.jpg|200px|right]]<br />
<br />
Pretend for a moment that we have no idea how digital signals really<br />
behave. In that case it doesn't make sense for us to use digital test<br />
equipment either. Fortunately for this exercise, there's still plenty<br />
of working analog lab equipment out there.<br />
<br />
First up, we need a [[WikiPedia:Function_generator|signal generator]] to provide us with analog input<br />
signals--in this case, an<br />
[http://www.home.agilent.com/en/pd-3325A%3Aepsg%3Apro-pn-3325A/synthesizer-function-generator?pm=PL&nid=-536900197.536896863&cc=SE&lc=swe HP3325]<br />
from 1978. It's still a pretty good<br />
generator, so if you don't mind the size, the weight, the power<br />
consumption, and the noisy fan, you can find them on eBay... occasionally<br />
for only slightly more than you'll pay for shipping.<br />
<br />
Next, we'll observe our analog waveforms on [[WikiPedia:Oscilloscope_types#Cathode-ray_oscilloscope_.28CRO.29|analog oscilloscopes]],<br />
like this Tektronix 2246 from the mid-90s, one of the last and very best analog scopes ever made. Every home lab should have one.<br />
<br />
...and finally inspect the [[WikiPedia:Spectral_density#Electrical_engineering|frequency spectrum]] of our signals using an<br />
[[WikiPedia:Spectrum_analyzer#Swept-tuned|analog spectrum analyzer]], this<br />
[http://www.home.agilent.com/en/pd-3585A%3Aepsg%3Apro-pn-3585A/spectrum-analyzer-high-perf-20hz-40mhz?pm=PL&nid=-536900197.536897319&cc=SE&lc=swe HP3585]<br />
from the same product line as<br />
the signal generator. Like the other equipment here it has<br />
[http://www.hp9845.net/9845/hardware/processors/ a rudimentary and hilariously large microcontroller],<br />
but the signal path<br />
from input to what you see on the screen is completely analog.<br />
<br />
All of this equipment is vintage, but aside from its raw tonnage, the specs are still quite good.<br />
<br />
At the moment, we have our signal generator set to output a nice 1 [[WikiPedia:Hertz#SI_multiples|kHz]]<br />
sine wave at one [[WikiPedia:Volt|Volt]] [[WikiPedia:Amplitude#Root_mean_square_amplitude|RMS]].<br />
We see the sine wave on the oscilloscope, can verify that it is indeed<br />
1 kHz at 1 Volt RMS, which is 2.8 Volts<br />
[[WikiPedia:Amplitude#Peak-to-peak_amplitude|peak-to-peak]],<br />
and that matches the<br />
measurement on the spectrum analyzer as well.<br />
<br />
The analyzer also shows some low-level [[WikiPedia:White_noise|white noise]]<br />
and just a bit of [[WikiPedia:Harmonic_distortion#Harmonic_distortion|harmonic distortion]],<br />
with the highest peak about 70[[WikiPedia:Decibel|dB]] or so below<br />
[[WikiPedia:Fundamental_frequency|the fundamental]].<br />
Now, this doesn't matter at all in our demos, but I<br />
wanted to point it out now just in case you didn't notice it until<br />
later.<br />
<br />
Now, we drop digital sampling in the middle.<br />
<br />
For the conversion, we'll use a boring, consumer-grade, eMagic USB1<br />
audio device. It's also more than ten years old at this point, and it's<br />
getting obsolete.<br />
<br />
A recent converter can easily have an order of magnitude better specs.<br />
[[WikiPedia:Reconstruction_filter#Sampled_data_reconstruction_filters|Flatness]],<br />
[[WikiPedia:Analog-to-digital_converter#Non-linearity|linearity]],<br />
[[WikiPedia:Jitter#Sampling_jitter|jitter]],<br />
[[WikiPedia:Noise_floor|noise behavior]],<br />
[[WikiPedia:Digital-to-analog_converter#DAC_performance|everything]]...<br />
you may not<br />
have noticed. Just because we can measure an improvement doesn't<br />
mean we can hear it, and even these old consumer boxes were already at<br />
the edge of ideal transparency.<br />
<br />
The eMagic connects to my ThinkPad, which displays a digital<br />
waveform and spectrum for comparison, then the ThinkPad<br />
sends the digital signal right back out to the eMagic for<br />
re-conversion to analog and observation on the output scopes.<br />
<br />
Input to output, left to right.<br />
<br style="clear:both;"/><br />
<br />
==Stairsteps==<br />
[[Image:Dsat 006.jpg|360px|right]]<br />
[[Image:Dsat 007.png|360px|right]]<br />
OK, it's go time. We begin by converting an analog signal to digital and<br />
then right back to analog again with no other steps.<br />
<br />
The signal generator is set to produce a 1kHz sine wave just like<br />
before.<br />
<br />
We can see our analog sine wave on our input-side oscilloscope.<br />
<br />
We digitize our signal to<br />
[[Videos/A_Digital_Media_Primer_For_Geeks#Raw_.28digital_audio.29_meat|16 bit PCM at 44.1kHz]],<br />
same as on a CD.<br />
The spectrum of the digitized signal matches what we saw earlier<br />
<br />
and what we see now on the analog spectrum analyzer, aside from its <br />
[[WikiPedia:High_impedance|high-impedance input]] being just a smidge noisier.<br />
<br />
For now, the waveform display shows our digitized sine wave as a<br />
stairstep pattern, one step for each sample.<br />
<br />
And when we look at the output signal that's been converted<br />
from digital back to analog, we see...<br />
<br />
It's exactly like the original sine wave. No stairsteps.<br />
<br />
OK, 1 kHz is still a fairly low frequency, maybe the stairsteps are just<br />
hard to see or they're being smoothed away. Fair enough. Let's choose<br />
a higher frequency, something close to [[WikiPedia:Nyquist_frequency|Nyquist]], say 15kHz.<br />
<br />
Now the sine wave is represented by less than three samples per cycle, and...<br />
<br />
the digital waveform looks pretty awful. Well, looks<br />
can be deceiving. The analog output...<br />
<br />
is still a perfect sine wave, exactly like the original.<br />
<br />
Let's keep going up.<br />
<br />
Let's see if I can do this without blocking any cameras.<br />
<br />
16kHz.... 17kHz... 18kHz... 19kHz... <br />
<br />
20kHz. Welcome to the upper limits of human hearing. The output<br />
waveform is still perfect. No jagged edges, no dropoff, no stairsteps.<br />
<br />
So where'd the stairsteps go? Don't answer, it's a trick question.<br />
They were never there.<br />
<br />
Drawing a digital waveform as a stairstep... was wrong to begin with.<br />
<br />
Why? A stairstep is a continuous-time function. It's jagged, and it's<br />
piecewise, but it has a defined value at every point in time.<br />
<br />
A sampled signal is entirely different. It's discrete-time; it's only<br />
got a value right at each instantaneous sample point and it's<br />
undefined, there is no value at all, everywhere between. A<br />
discrete-time signal is properly drawn as a lollipop graph.<br />
<br />
The continuous, analog counterpart of a digital signal passes<br />
smoothly through each sample point, and that's just as true for high<br />
frequencies as it is for low.<br />
<br />
Now, the interesting and not at all obvious bit is: [[WikiPedia:Nyquist%E2%80%93Shannon_sampling_theorem|there's only one<br />
bandlimited signal that passes exactly through each sample point]]. It's<br />
a unique solution. So if you sample a bandlimited signal and then<br />
convert it back, the original input is also the only possible output.<br />
<br />
[[Image:Dsat 008.png|360px|right]]<br />
<br />
And before you say, "oh, I can draw a different signal that passes<br />
through those points", well, yes you can, but if it differs even<br />
minutely from the original, it includes frequency content at or beyond<br />
Nyquist, breaks the bandlimiting requirement and isn't a valid<br />
solution.<br />
<br />
So how did everyone get confused and start thinking of digital signals<br />
as stairsteps? I can think of two good reasons.<br />
<br />
First: it's easy enough to convert a sampled signal to a true stairstep. Just<br />
extend each sample value forward until the next sample period. This is<br />
called a [[WikiPedia:Zero-order hold|zero-order hold]], and it's an important part of how some<br />
digital-to-analog converters work, especially the simplest ones.<br />
<br />
So, anyone who looks up [[WikiPedia:Digital-to-analog_converter#Practical_operation|digital-to-analog converter or<br />
digital-to-analog conversion]] is probably going to see a diagram of a<br />
stairstep waveform somewhere, but that's not a finished conversion,<br />
and it's not the signal that comes out.<br />
<br />
Second, and this is probably the more likely reason, engineers who<br />
supposedly know better, like me, draw stairsteps even though they're<br />
technically wrong. It's a sort of like a one-dimensional version of<br />
[[WikiPedia:MacPaint#Development|fat bits in an image editor]].<br />
<br />
Pixels aren't squares either, they're samples of a 2-dimensional<br />
function space and so they're also, conceptually, infinitely small<br />
points. Practically, it's a real pain in the ass to see or manipulate<br />
infinitely small anything, so big squares it is. Digital stairstep<br />
drawings are exactly the same thing.<br />
<br />
It's just a convenient drawing. The stairsteps aren't really there.<br />
<br />
==Bit-depth==<br />
[[Image:Dsat_009.jpg|360px|right]]<br />
[[Image:Dsat_010.jpg|260px|right]]<br />
<br />
When we convert a digital signal back to analog, the result is<br />
''also'' smooth regardless of the [[WikiPedia:Audio_bit_depth|bit depth]]. 24 bits or 16 bits...<br />
or 8 bits... it doesn't matter.<br />
<br />
So does that mean that the digital bit depth makes no difference at<br />
all? Of course not.<br />
<br />
Channel 2 here is the same sine wave input, but we quantize with<br />
[[WikiPedia:Dither|dither]] down to 8 bits.<br />
<br />
On the scope, we still see a nice<br />
smooth sine wave on channel 2. Look very close, and you'll also see a<br />
bit more noise. That's a clue.<br />
<br />
If we look at the spectrum of the signal... aha! Our sine wave is<br />
still there unaffected, but the noise level of the 8-bit signal on<br />
the second channel is much higher!<br />
<br />
And that's the difference the number of bits makes. That's it!<br />
<br />
When we digitize a signal, first we sample it. The<br />
sampling step is perfect; it loses nothing. But then we [[WikiPedia:Quantization_(sound_processing)|quantize]] it,<br />
and [[WikiPedia:Quantization_error|quantization adds noise]].<br />
<br />
The number of bits determines how much noise and so the level of the<br />
noise floor.<br />
<br />
What does this dithered quantization noise sound like? Let's listen<br />
to our 8-bit sine wave.<br />
<br />
That may have been hard to hear anything but the tone. Let's listen<br />
to just the noise after we notch out the sine wave and then bring the<br />
gain up a bit because the noise is quiet.<br />
<br />
Those of you who have used analog recording equipment may have just<br />
thought to yourselves, "My goodness! That sounds like tape hiss!"<br />
Well, it doesn't just sound like tape hiss, it acts like it too, and<br />
if we use a [[WikiPedia:Dither#Different_types|gaussian dither]] then it's<br />
[[WikiPedia:Central_limit_theorem|mathematically equivalent]] in every way. It ''is'' tape hiss.<br />
<br />
Intuitively, that means that we can measure tape hiss and thus the noise floor<br />
of [[WikiPedia:Magnetic_tape_sound_recording|magnetic audio tape]]<br />
in [[WikiPedia:Shannon–Hartley_theorem#Examples|bits instead of decibels]], in order to put things in a<br />
digital perspective. [[WikiPedia:Compact cassettes|Compact cassettes]] (for those of you who are old enough to remember them) could reach as<br />
deep as 9 bits in perfect conditions, though 5 to 6 bits was<br />
more typical, especially if it was a recording made on a<br />
[[WikiPedia:Cassette_deck|tape deck]]. That's right... your mix tapes were only about 6 bits<br />
deep... if you were lucky!<br />
<br />
The very best professional [[WikiPedia:Reel-to-reel_audio_tape_recording|open reel tape]] used in studios could barely<br />
hit... any guesses? 13 bits ''with'' [[WikiPedia:Reel-to-reel_audio_tape_recording#Noise_reduction|advanced noise reduction]]. And<br />
that's why seeing '[[WikiPedia:SPARS_code|D D D]]' on a [[WikiPedia:Compact_disk|Compact Disc]] used to be such a big,<br />
high-end deal.<br />
<br />
==Dither==<br />
[[Image:Dsat_011.png|360px|right]]<br />
<br />
I keep saying that I'm quantizing with [[Wikipedia:dither|dither]], so what is dither<br />
exactly and, more importantly, what does it do?<br />
<br />
The simple way to quantize a signal is to choose the digital<br />
amplitude value closest to the original analog amplitude. [[WikiPedia:Rounding|Obvious]],<br />
right? Unfortunately, the exact noise you get from this simple<br />
quantization scheme depends somewhat on the input signal,<br />
<br />
so we may get noise that's inconsistent, or causes distortion, or is<br />
undesirable in some other way.<br />
<br style="clear:both;"/><br />
<center><div style="background-color:#DDDDFF;border-color:#CCCCDD;border-style:solid;width:80%;padding:0 1em 1em 1em;text-align:left;"><br />
'''Going deeper…'''<br />
*Cameron Nicklaus Christou's thesis [http://uwspace.uwaterloo.ca/bitstream/10012/3867/1/thesis.pdf Optimal Dither and Noise Shaping in Image Processing] provides an ''excellent'' explanation of dither and noise shaping.<br />
</div></center><br />
<br />
Dither is specially-constructed noise that substitutes for the noise<br />
produced by simple quantization. Dither doesn't [[WikiPedia:Sound_masking|drown out or mask]]<br />
quantization noise, it actually replaces it with noise characteristics<br />
of our choosing that aren't influenced by the input.<br />
<br />
Let's ''watch'' what dither does. The signal generator has too much noise for this test so we'll produce a mathematically perfect sine wave with the ThinkPad and quantize it to 8 bits with dithering.<br />
<br />
We see a nice sine wave on the waveform display and output scope and, once the analog spectrum analyzer catches up...<br />
a clean frequency peak with a uniform noise floor on both spectral displays<br />
just like before. Again, this is with dither.<br />
<br />
Now I turn dithering off.<br />
<br />
The quantization noise, that dither had spread out into a nice, flat noise<br />
floor, piles up into harmonic distortion peaks. The noise floor is<br />
lower, but the level of distortion becomes nonzero, and the distortion<br />
peaks sit higher than the dithering noise did.<br />
<br />
At 8 bits this effect is exaggerated. At 16 bits,<br />
even without dither, harmonic distortion is going to be so low as to<br />
be completely inaudible.<br />
<br />
Still, we can use dither to eliminate it completely if we so choose.<br />
<br />
Turning the dither off again for a moment, you'll notice that the<br />
absolute level of distortion from undithered quantization stays<br />
approximately constant regardless of the input amplitude.<br />
But when the signal level drops below a half a bit, everything<br />
quantizes to zero.<br />
<br />
In a sense, everything quantizing to zero is just 100% distortion!<br />
Dither eliminates this distortion too. We reenable dither<br />
and ... there's our signal back at 1/4 bit, with our nice flat noise floor.<br />
<br />
The noise floor doesn't have to be flat. Dither is noise of our<br />
choosing, so let's choose a noise as [http://www.acoustics.salford.ac.uk/res/cox/sound_quality/?content=subjective inoffensive] and<br />
[[WikiPedia:Absolute_threshold_of_hearing|difficult to notice]]<br />
as possible.<br />
<br />
Our hearing is most sensitive in the midrange from 2kHz to 4kHz,<br />
so that's where background noise is going to be the most obvious.<br />
We can [[WikiPedia:Noise_shaping|shape dithering noise]] away from sensitive frequencies to where<br />
hearing is less sensitive, usually the highest frequencies.<br />
<br />
16-bit dithering noise is normally much too quiet to hear at all, but<br />
let's listen to our noise shaping example, again with the gain<br />
brought way up...<br />
<br />
Lastly, dithered quantization noise ''is'' higher [[WikiPedia:power|Sound_power]] overall<br />
than undithered quantization noise even when it sounds quieter, and<br />
you can see that on a [[WikiPedia:VU_meter|VU meter]] during passages of near-silence. But<br />
dither isn't only an on or off choice. We can reduce the dither's<br />
power to balance less noise against a bit of distortion to minimize<br />
the overall effect.<br />
<br />
We'll also [[WikiPedia:Amplitude_modulation|modulate the input signal]] like this to show how a varying input affects the quantization noise. At<br />
full dithering power, the noise is uniform, constant, and featureless<br />
just like we expect:<br />
<br />
As we reduce the dither's power, the input increasingly<br />
affects the amplitude and the character of the quantization noise.<br />
Shaped dither behaves similarly, but noise shaping lends one more nice<br />
advantage. To make a long story short, it can use a somewhat lower<br />
dither power before the input has as much effect on the output.<br />
<br />
Despite all the time I just spent on dither, we're talking about<br />
differences that start 100 decibels and more below [[WikiPedia:Full_scale|full scale]]. Maybe<br />
if the CD had been<br />
[http://www.research.philips.com/technologies/projects/cd/index.html 14 bits as originally designed],<br />
dither ''might'' be<br />
more important. Maybe. At 16 bits, really, it's mostly a wash. You<br />
can think of dither as an insurance policy that gives several extra<br />
decibels of dynamic range just in case. The simple fact is, though, no<br />
one ever ruined a great recording by not dithering the final master.<br />
<br />
==Bandlimitation and timing==<br />
[[image:Dsat_013.jpg|360px|right]]<br />
[[image:Dsat_014.gif|360px|right]]<br />
<br />
We've been using [[WikiPedia:Sine_wave|sine waves]]. They're the obvious choice when what we<br />
want to see is a system's behavior at a given isolated frequency. Now<br />
let's look at something a bit more complex. What should we expect to<br />
happen when I change the input to a [[WikiPedia:Square_wave|square wave]]...<br />
<br />
The input scope confirms our 1kHz square wave. The output scope shows..<br />
<br />
<br />
Exactly what it should.<br />
...<br />
What is a square wave really? <br />
<br />
<br />
Well, we can say it's a waveform that's<br />
some positive value for half a cycle and then transitions<br />
instantaneously to a negative value for the other half. But that doesn't<br />
really tell us anything useful about how this input <br />
becomes this output .<br />
<br />
Then we remember that [any waveform is also [[WikiPedia:Fourier_series|the sum of discrete frequencies]],<br />
and a square wave is particularly simple sum: a fundamental and an<br />
infinite series of [[WikiPedia:Even_and_odd_functions#Harmonics|odd harmonics]]. Sum them all up, you get a<br />
square wave.<br />
<br />
At first glance, that doesn't seem very useful either. You have to sum<br />
up an infinite number of harmonics to get the answer. Ah, but we don't<br />
have an infinite number of harmonics.<br />
<br />
We're using a quite sharp [[WikiPedia:Low-pass_filter|anti-aliasing filter]] that cuts off right<br />
above 20kHz, so our signal is [[WikiPedia:Bandlimiting|bandlimited]], which means we get this:<br />
<br />
..and that's exactly what we see on the output scope.<br />
<br />
The rippling you see around sharp edges in a bandlimited signal is<br />
called the [[WikiPedia:/Gibbs_phenomenon|Gibbs effect]]. It happens whenever you slice off part of the<br />
frequency domain in the middle of nonzero energy.<br />
<br />
The usual rule of thumb you'll hear is "the sharper the cutoff, the<br />
stronger the rippling", which is approximately true, but we have to be<br />
careful how we think about it.<br />
For example... what would you expect our quite sharp anti-aliasing filter<br />
to do if I run our signal through it a second time?<br />
<br />
Aside from adding a few fractional cycles of delay, the answer is...<br />
nothing at all. The signal is already bandlimited. Bandlimiting it<br />
again doesn't do anything. A second pass can't remove frequencies<br />
that we already removed.<br />
<br />
And that's important. People tend to think of the ripples as<br />
a kind of [[WikiPedia:Sonic_artifact|artifact]] that's added by anti-aliasing and [[WikiPedia:Reconstruction_filter|anti-imaging]]<br />
filters, implying that the ripples get worse each time the signal<br />
passes through. We can see that in this case that didn't happen. So<br />
was it really the filter that added the ripples the first time<br />
through? No, not really. It's a subtle distinction, but Gibbs effect<br />
ripples aren't added by filters, they're just part of what a<br />
bandlimited signal ''is''.<br />
<br />
Even if we synthetically construct what looks like a perfect digital<br />
square wave,<br />
<br />
it's still limited to the channel bandwidth. Remember,<br />
the stairstep representation is misleading.<br />
<br />
What we really have here are instantaneous sample points,<br />
<br />
and only one bandlimited signal fits those points. All we did when we<br />
drew our apparently perfect square wave was line up the sample points<br />
just right so it appeared that there were no ripples if we played<br />
[[WikiPedia:Interpolation|connect-the-dots]].<br />
<br />
But the original bandlimited signal, complete with ripples, was<br />
still there.<br />
<br />
And that leads us to one more important point. You've probably heard<br />
that the timing precision of a digital signal is limited by its sample<br />
rate; put another way,<br />
<br />
that digital signals can't represent anything that falls between the<br />
samples.. implying that [[WikiPedia:Dirac_delta_function|impulses]] or<br />
[[WikiPedia:Synthesizer#ADSR_envelope|fast attacks]] have to align exactly<br />
with a sample, or the timing gets mangled... or they just disappear.<br />
<br />
At this point, we can easily see why that's wrong.<br />
<br />
Again, our input signals are bandlimited. And digital signals are<br />
samples, not stairsteps, not 'connect-the-dots'. We most certainly<br />
can, for example, put the rising edge of our bandlimited square wave<br />
anywhere we want between samples.<br />
<br />
It's represented perfectly and it's reconstructed perfectly.<br />
<br />
==Epilogue==<br />
<br />
[[Image:Moffey.jpg|360px|right]]<br />
<br />
Just like in [[Videos/A_Digital_Media_Primer_For_Geeks|the previous episode]], we've covered a broad range of<br />
topics, and yet barely scratched the surface of each one. If anything, my<br />
sins of omission are greater this time around... but this is a good<br />
stopping point.<br />
<br />
Or maybe, a good starting point. Dig deeper. Experiment. I chose my<br />
demos very carefully to be simple and give clear results. You can<br />
reproduce every one of them on your own if you like. But let's face<br />
it, sometimes we learn the most about a spiffy toy by breaking it open<br />
and studying all the pieces that fall out. And that's OK, we're<br />
engineers. Play with the demo parameters, hack up the code, set up<br />
alternate experiments. The source code for everything, including the<br />
little pushbutton demo application, is up at xiph.org.<br />
<br />
In the course of experimentation, you're likely to run into something<br />
that you didn't expect and can't explain. Don't worry! My earlier<br />
snark aside, Wikipedia is fantastic for exactly this kind of casual<br />
research. And, if you're really serious about understanding signals,<br />
several universities have advanced materials online, such as the<br />
[http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-003-signals-and-systems-spring-2010/index.htm 6.003]<br />
and<br />
[http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-007-electromagnetic-energy-from-motors-to-lasers-spring-2011 6.007]<br />
Signals and Systems modules at MIT OpenCourseWare. And of<br />
course, there's always the community here at Xiph.Org.<br />
<br />
Digging deeper or not, I am out of coffee, so, until next time, happy<br />
hacking!<br />
<br />
== Use The Source Luke ==</div>Gmaxwellhttps://wiki.xiph.org/index.php?title=Videos/Digital_Show_and_Tell&diff=13956Videos/Digital Show and Tell2013-02-26T08:03:15Z<p>Gmaxwell: No need to split theora or webm support anymore.</p>
<hr />
<div><small>''Wiki edition''</small><br />
[[Image:dsat_001.jpg|400px|right]]<br />
<br />
Continuing in the "firehose" tradition of [[Videos/A_Digital_Media_Primer_For_Geeks|Episode 01]], Xiph.Org's second video on digital media explores multiple facets of digital audio signals and how they ''really'' behave in the real world.<br />
<br />
Demonstrations of sampling, quantization, bit-depth, and dither explore digital audio behavior on real audio equipment using both modern digital analysis and vintage analog bench equipment, just in case we can't trust those newfangled digital gizmos. You can download the source code for each demo and try it all for yourself!<br />
<br/><br/><br/><br />
<center><font size="+2">[http://www.xiph.org/video/vid2.shtml Download or Watch online]</font></center><br />
<br style="clear:both;"/><br />
Supported players: [http://www.videolan.org/vlc/ VLC 1.1+], [https://www.mozilla.com/en-US/firefox/ Firefox ], [http://www.chromium.org/Home Chrome ], [http://www.opera.com/ Opera]. Or see [http://www.webmproject.org/users/ other WebM] or [[TheoraSoftwarePlayers|other Theora]] players.<br />
<br />
If you're having trouble with playback in a modern browser or player, please visit our [[Playback_Troubleshooting|playback troubleshooting and discussion]] page.<br />
<br/><br />
<hr/><br />
<br/><br/><br/><br />
[[Image:Xiph_ep02_test.png|400px|right]]<br />
<br />
Hi, I'm Monty Montgomery from [http://www.redhat.com/ Red Hat] and [http://xiph.org/ Xiph.Org].<br />
<br />
A few months ago, I wrote<br />
[http://people.xiph.org/~xiphmont/demo/neil-young.html an article on digital audio and why 24bit/192kHz music downloads don't make sense].<br />
In the article, I<br />
mentioned--almost in passing--that a digital waveform is<br />
[http://people.xiph.org/~xiphmont/demo/neil-young.html#toc_sfam not a stairstep],<br />
and you certainly don't get a stairstep when you<br />
[[WikiPedia:Digital-to-analog_converter|convert from digital back to analog]].<br />
<br />
Of everything in the entire article, '''that''' was the number one thing<br />
people wrote about. In fact, more than half the mail I got was questions and<br />
comments about basic digital signal behavior. Since there's interest, let's<br />
take a little time to play with some ''simple'' digital signals.<br />
<br />
==Veritas ex machina==<br />
[[Image:Dsat_002.jpg|200px|right]]<br />
[[Image:Dsat_003.jpg|200px|right]]<br />
[[Image:Dsat_004.jpg|200px|right]]<br />
[[Image:Dsat_005.jpg|200px|right]]<br />
<br />
Pretend for a moment that we have no idea how digital signals really<br />
behave. In that case it doesn't make sense for us to use digital test<br />
equipment either. Fortunately for this exercise, there's still plenty<br />
of working analog lab equipment out there.<br />
<br />
First up, we need a [[WikiPedia:Function_generator|signal generator]] to provide us with analog input<br />
signals--in this case, an<br />
[http://www.home.agilent.com/en/pd-3325A%3Aepsg%3Apro-pn-3325A/synthesizer-function-generator?pm=PL&nid=-536900197.536896863&cc=SE&lc=swe HP3325]<br />
from 1978. It's still a pretty good<br />
generator, so if you don't mind the size, the weight, the power<br />
consumption, and the noisy fan, you can find them on eBay... occasionally<br />
for only slightly more than you'll pay for shipping.<br />
<br />
Next, we'll observe our analog waveforms on [[WikiPedia:Oscilloscope_types#Cathode-ray_oscilloscope_.28CRO.29|analog oscilloscopes]],<br />
like this Tektronix 2246 from the mid-90s, one of the last and very best analog scopes ever made. Every home lab should have one.<br />
<br />
...and finally inspect the [[WikiPedia:Spectral_density#Electrical_engineering|frequency spectrum]] of our signals using an<br />
[[WikiPedia:Spectrum_analyzer#Swept-tuned|analog spectrum analyzer]], this<br />
[http://www.home.agilent.com/en/pd-3585A%3Aepsg%3Apro-pn-3585A/spectrum-analyzer-high-perf-20hz-40mhz?pm=PL&nid=-536900197.536897319&cc=SE&lc=swe HP3585]<br />
from the same product line as<br />
the signal generator. Like the other equipment here it has<br />
[http://www.hp9845.net/9845/hardware/processors/ a rudimentary and hilariously large microcontroller],<br />
but the signal path<br />
from input to what you see on the screen is completely analog.<br />
<br />
All of this equipment is vintage, but aside from its raw tonnage, the specs are still quite good.<br />
<br />
At the moment, we have our signal generator set to output a nice 1 [[WikiPedia:Hertz#SI_multiples|kHz]]<br />
sine wave at one [[WikiPedia:Volt|Volt]] [[WikiPedia:Amplitude#Root_mean_square_amplitude|RMS]].<br />
We see the sine wave on the oscilloscope, can verify that it is indeed<br />
1 kHz at 1 Volt RMS, which is 2.8 Volts<br />
[[WikiPedia:Amplitude#Peak-to-peak_amplitude|peak-to-peak]],<br />
and that matches the<br />
measurement on the spectrum analyzer as well.<br />
<br />
The analyzer also shows some low-level [[WikiPedia:White_noise|white noise]]<br />
and just a bit of [[WikiPedia:Harmonic_distortion#Harmonic_distortion|harmonic distortion]],<br />
with the highest peak about 70[[WikiPedia:Decibel|dB]] or so below<br />
[[WikiPedia:Fundamental_frequency|the fundamental]].<br />
Now, this doesn't matter at all in our demos, but I<br />
wanted to point it out now just in case you didn't notice it until<br />
later.<br />
<br />
Now, we drop digital sampling in the middle.<br />
<br />
For the conversion, we'll use a boring, consumer-grade, eMagic USB1<br />
audio device. It's also more than ten years old at this point, and it's<br />
getting obsolete.<br />
<br />
A recent converter can easily have an order of magnitude better specs.<br />
[[WikiPedia:Reconstruction_filter#Sampled_data_reconstruction_filters|Flatness]],<br />
[[WikiPedia:Analog-to-digital_converter#Non-linearity|linearity]],<br />
[[WikiPedia:Jitter#Sampling_jitter|jitter]],<br />
[[WikiPedia:Noise_floor|noise behavior]],<br />
[[WikiPedia:Digital-to-analog_converter#DAC_performance|everything]]...<br />
you may not<br />
have noticed. Just because we can measure an improvement doesn't<br />
mean we can hear it, and even these old consumer boxes were already at<br />
the edge of ideal transparency.<br />
<br />
The eMagic connects to my ThinkPad, which displays a digital<br />
waveform and spectrum for comparison, then the ThinkPad<br />
sends the digital signal right back out to the eMagic for<br />
re-conversion to analog and observation on the output scopes.<br />
<br />
Input to output, left to right.<br />
<br style="clear:both;"/><br />
<br />
==Stairsteps==<br />
[[Image:Dsat 006.jpg|360px|right]]<br />
[[Image:Dsat 007.png|360px|right]]<br />
OK, it's go time. We begin by converting an analog signal to digital and<br />
then right back to analog again with no other steps.<br />
<br />
The signal generator is set to produce a 1kHz sine wave just like<br />
before.<br />
<br />
We can see our analog sine wave on our input-side oscilloscope.<br />
<br />
We digitize our signal to<br />
[[Videos/A_Digital_Media_Primer_For_Geeks#Raw_.28digital_audio.29_meat|16 bit PCM at 44.1kHz]],<br />
same as on a CD.<br />
The spectrum of the digitized signal matches what we saw earlier<br />
<br />
and what we see now on the analog spectrum analyzer, aside from its <br />
[[WikiPedia:High_impedance|high-impedance input]] being just a smidge noisier.<br />
<br />
For now, the waveform display shows our digitized sine wave as a<br />
stairstep pattern, one step for each sample.<br />
<br />
And when we look at the output signal that's been converted<br />
from digital back to analog, we see...<br />
<br />
It's exactly like the original sine wave. No stairsteps.<br />
<br />
OK, 1 kHz is still a fairly low frequency, maybe the stairsteps are just<br />
hard to see or they're being smoothed away. Fair enough. Let's choose<br />
a higher frequency, something close to [[WikiPedia:Nyquist_frequency|Nyquist]], say 15kHz.<br />
<br />
Now the sine wave is represented by less than three samples per cycle, and...<br />
<br />
the digital waveform looks pretty awful. Well, looks<br />
can be deceiving. The analog output...<br />
<br />
is still a perfect sine wave, exactly like the original.<br />
<br />
Let's keep going up.<br />
<br />
Let's see if I can do this without blocking any cameras.<br />
<br />
16kHz.... 17kHz... 18kHz... 19kHz... <br />
<br />
20kHz. Welcome to the upper limits of human hearing. The output<br />
waveform is still perfect. No jagged edges, no dropoff, no stairsteps.<br />
<br />
So where'd the stairsteps go? Don't answer, it's a trick question.<br />
They were never there.<br />
<br />
Drawing a digital waveform as a stairstep... was wrong to begin with.<br />
<br />
Why? A stairstep is a continuous-time function. It's jagged, and it's<br />
piecewise, but it has a defined value at every point in time.<br />
<br />
A sampled signal is entirely different. It's discrete-time; it's only<br />
got a value right at each instantaneous sample point and it's<br />
undefined, there is no value at all, everywhere between. A<br />
discrete-time signal is properly drawn as a lollipop graph.<br />
<br />
The continuous, analog counterpart of a digital signal passes<br />
smoothly through each sample point, and that's just as true for high<br />
frequencies as it is for low.<br />
<br />
Now, the interesting and not at all obvious bit is: [[WikiPedia:Nyquist%E2%80%93Shannon_sampling_theorem|there's only one<br />
bandlimited signal that passes exactly through each sample point]]. It's<br />
a unique solution. So if you sample a bandlimited signal and then<br />
convert it back, the original input is also the only possible output.<br />
<br />
[[Image:Dsat 008.png|360px|right]]<br />
<br />
And before you say, "oh, I can draw a different signal that passes<br />
through those points", well, yes you can, but if it differs even<br />
minutely from the original, it includes frequency content at or beyond<br />
Nyquist, breaks the bandlimiting requirement and isn't a valid<br />
solution.<br />
<br />
So how did everyone get confused and start thinking of digital signals<br />
as stairsteps? I can think of two good reasons.<br />
<br />
First: it's easy enough to convert a sampled signal to a true stairstep. Just<br />
extend each sample value forward until the next sample period. This is<br />
called a [[WikiPedia:Zero-order hold|zero-order hold]], and it's an important part of how some<br />
digital-to-analog converters work, especially the simplest ones.<br />
<br />
So, anyone who looks up [[WikiPedia:Digital-to-analog_converter#Practical_operation|digital-to-analog converter or<br />
digital-to-analog conversion]] is probably going to see a diagram of a<br />
stairstep waveform somewhere, but that's not a finished conversion,<br />
and it's not the signal that comes out.<br />
<br />
Second, and this is probably the more likely reason, engineers who<br />
supposedly know better, like me, draw stairsteps even though they're<br />
technically wrong. It's a sort of like a one-dimensional version of<br />
[[WikiPedia:MacPaint#Development|fat bits in an image editor]].<br />
<br />
Pixels aren't squares either, they're samples of a 2-dimensional<br />
function space and so they're also, conceptually, infinitely small<br />
points. Practically, it's a real pain in the ass to see or manipulate<br />
infinitely small anything, so big squares it is. Digital stairstep<br />
drawings are exactly the same thing.<br />
<br />
It's just a convenient drawing. The stairsteps aren't really there.<br />
<br />
==Bit-depth==<br />
[[Image:Dsat_009.jpg|360px|right]]<br />
[[Image:Dsat_010.jpg|260px|right]]<br />
<br />
When we convert a digital signal back to analog, the result is<br />
''also'' smooth regardless of the [[WikiPedia:Audio_bit_depth|bit depth]]. 24 bits or 16 bits...<br />
or 8 bits... it doesn't matter.<br />
<br />
So does that mean that the digital bit depth makes no difference at<br />
all? Of course not.<br />
<br />
Channel 2 here is the same sine wave input, but we quantize with<br />
[[WikiPedia:Dither|dither]] down to 8 bits.<br />
<br />
On the scope, we still see a nice<br />
smooth sine wave on channel 2. Look very close, and you'll also see a<br />
bit more noise. That's a clue.<br />
<br />
If we look at the spectrum of the signal... aha! Our sine wave is<br />
still there unaffected, but the noise level of the 8-bit signal on<br />
the second channel is much higher!<br />
<br />
And that's the difference the number of bits makes. That's it!<br />
<br />
When we digitize a signal, first we sample it. The<br />
sampling step is perfect; it loses nothing. But then we [[WikiPedia:Quantization_(sound_processing)|quantize]] it,<br />
and [[WikiPedia:Quantization_error|quantization adds noise]].<br />
<br />
The number of bits determines how much noise and so the level of the<br />
noise floor.<br />
<br />
What does this dithered quantization noise sound like? Let's listen<br />
to our 8-bit sine wave.<br />
<br />
That may have been hard to hear anything but the tone. Let's listen<br />
to just the noise after we notch out the sine wave and then bring the<br />
gain up a bit because the noise is quiet.<br />
<br />
Those of you who have used analog recording equipment may have just<br />
thought to yourselves, "My goodness! That sounds like tape hiss!"<br />
Well, it doesn't just sound like tape hiss, it acts like it too, and<br />
if we use a [[WikiPedia:Dither#Different_types|gaussian dither]] then it's<br />
[[WikiPedia:Central_limit_theorem|mathematically equivalent]] in every way. It ''is'' tape hiss.<br />
<br />
Intuitively, that means that we can measure tape hiss and thus the noise floor<br />
of [[WikiPedia:Magnetic_tape_sound_recording|magnetic audio tape]]<br />
in [[WikiPedia:Shannon–Hartley_theorem#Examples|bits instead of decibels]], in order to put things in a<br />
digital perspective. [[WikiPedia:Compact cassettes|Compact cassettes]] (for those of you who are old enough to remember them) could reach as<br />
deep as 9 bits in perfect conditions, though 5 to 6 bits was<br />
more typical, especially if it was a recording made on a<br />
[[WikiPedia:Cassette_deck|tape deck]]. That's right... your mix tapes were only about 6 bits<br />
deep... if you were lucky!<br />
<br />
The very best professional [[WikiPedia:Reel-to-reel_audio_tape_recording|open reel tape]] used in studios could barely<br />
hit... any guesses? 13 bits ''with'' [[WikiPedia:Reel-to-reel_audio_tape_recording#Noise_reduction|advanced noise reduction]]. And<br />
that's why seeing '[[WikiPedia:SPARS_code|D D D]]' on a [[WikiPedia:Compact_disk|Compact Disc]] used to be such a big,<br />
high-end deal.<br />
<br />
==Dither==<br />
[[Image:Dsat_011.png|360px|right]]<br />
<br />
I keep saying that I'm quantizing with [[Wikipedia:dither|dither]], so what is dither<br />
exactly and, more importantly, what does it do?<br />
<br />
The simple way to quantize a signal is to choose the digital<br />
amplitude value closest to the original analog amplitude. [[WikiPedia:Rounding|Obvious]],<br />
right? Unfortunately, the exact noise you get from this simple<br />
quantization scheme depends somewhat on the input signal,<br />
<br />
so we may get noise that's inconsistent, or causes distortion, or is<br />
undesirable in some other way.<br />
<br />
[show/attribute the dither paper]<br />
Dither is specially-constructed noise that substitutes for the noise<br />
produced by simple quantization. Dither doesn't [[WikiPedia:Sound_masking|drown out or mask]]<br />
quantization noise, it actually replaces it with noise characteristics<br />
of our choosing that aren't influenced by the input.<br />
<br />
Let's ''watch'' what dither does. The signal generator has too much noise for this test so we'll produce a mathematically perfect sine wave with the ThinkPad and quantize it to 8 bits with dithering.<br />
<br />
We see a nice sine wave on the waveform display and output scope and, once the analog spectrum analyzer catches up...<br />
a clean frequency peak with a uniform noise floor on both spectral displays<br />
just like before. Again, this is with dither.<br />
<br />
Now I turn dithering off.<br />
<br />
The quantization noise, that dither had spread out into a nice, flat noise<br />
floor, piles up into harmonic distortion peaks. The noise floor is<br />
lower, but the level of distortion becomes nonzero, and the distortion<br />
peaks sit higher than the dithering noise did.<br />
<br />
At 8 bits this effect is exaggerated. At 16 bits,<br />
even without dither, harmonic distortion is going to be so low as to<br />
be completely inaudible.<br />
<br />
Still, we can use dither to eliminate it completely if we so choose.<br />
<br />
Turning the dither off again for a moment, you'll notice that the<br />
absolute level of distortion from undithered quantization stays<br />
approximately constant regardless of the input amplitude.<br />
But when the signal level drops below a half a bit, everything<br />
quantizes to zero.<br />
<br />
In a sense, everything quantizing to zero is just 100% distortion!<br />
Dither eliminates this distortion too. We reenable dither<br />
and ... there's our signal back at 1/4 bit, with our nice flat noise floor.<br />
<br />
The noise floor doesn't have to be flat. Dither is noise of our<br />
choosing, so let's choose a noise as [http://www.acoustics.salford.ac.uk/res/cox/sound_quality/?content=subjective inoffensive] and<br />
[[WikiPedia:Absolute_threshold_of_hearing|difficult to notice]]<br />
as possible.<br />
<br />
Our hearing is most sensitive in the midrange from 2kHz to 4kHz,<br />
so that's where background noise is going to be the most obvious.<br />
We can [[WikiPedia:Noise_shaping|shape dithering noise]] away from sensitive frequencies to where<br />
hearing is less sensitive, usually the highest frequencies.<br />
<br />
16-bit dithering noise is normally much too quiet to hear at all, but<br />
let's listen to our noise shaping example, again with the gain<br />
brought way up...<br />
<br />
Lastly, dithered quantization noise ''is'' higher [[WikiPedia:power|Sound_power]] overall<br />
than undithered quantization noise even when it sounds quieter, and<br />
you can see that on a [[WikiPedia:VU_meter|VU meter]] during passages of near-silence. But<br />
dither isn't only an on or off choice. We can reduce the dither's<br />
power to balance less noise against a bit of distortion to minimize<br />
the overall effect.<br />
<br />
We'll also [[WikiPedia:Amplitude_modulation|modulate the input signal]] like this to show how a varying input affects the quantization noise. At<br />
full dithering power, the noise is uniform, constant, and featureless<br />
just like we expect:<br />
<br />
As we reduce the dither's power, the input increasingly<br />
affects the amplitude and the character of the quantization noise.<br />
Shaped dither behaves similarly, but noise shaping lends one more nice<br />
advantage. To make a long story short, it can use a somewhat lower<br />
dither power before the input has as much effect on the output.<br />
<br />
Despite all the time I just spent on dither, we're talking about<br />
differences that start 100 decibels and more below [[WikiPedia:Full_scale|full scale]]. Maybe<br />
if the CD had been<br />
[http://www.research.philips.com/technologies/projects/cd/index.html 14 bits as originally designed],<br />
dither ''might'' be<br />
more important. Maybe. At 16 bits, really, it's mostly a wash. You<br />
can think of dither as an insurance policy that gives several extra<br />
decibels of dynamic range just in case. The simple fact is, though, no<br />
one ever ruined a great recording by not dithering the final master.<br />
<br />
==Bandlimitation and timing==<br />
[[image:Dsat_013.jpg|360px|right]]<br />
[[image:Dsat_014.gif|360px|right]]<br />
<br />
We've been using [[WikiPedia:Sine_wave|sine waves]]. They're the obvious choice when what we<br />
want to see is a system's behavior at a given isolated frequency. Now<br />
let's look at something a bit more complex. What should we expect to<br />
happen when I change the input to a [[WikiPedia:Square_wave|square wave]]...<br />
<br />
The input scope confirms our 1kHz square wave. The output scope shows..<br />
<br />
<br />
Exactly what it should.<br />
...<br />
What is a square wave really? <br />
<br />
<br />
Well, we can say it's a waveform that's<br />
some positive value for half a cycle and then transitions<br />
instantaneously to a negative value for the other half. But that doesn't<br />
really tell us anything useful about how this input <br />
becomes this output .<br />
<br />
Then we remember that [any waveform is also [[WikiPedia:Fourier_series|the sum of discrete frequencies]],<br />
and a square wave is particularly simple sum: a fundamental and an<br />
infinite series of [[WikiPedia:Even_and_odd_functions#Harmonics|odd harmonics]]. Sum them all up, you get a<br />
square wave.<br />
<br />
At first glance, that doesn't seem very useful either. You have to sum<br />
up an infinite number of harmonics to get the answer. Ah, but we don't<br />
have an infinite number of harmonics.<br />
<br />
We're using a quite sharp [[WikiPedia:Low-pass_filter|anti-aliasing filter]] that cuts off right<br />
above 20kHz, so our signal is [[WikiPedia:Bandlimiting|bandlimited]], which means we get this:<br />
<br />
..and that's exactly what we see on the output scope.<br />
<br />
The rippling you see around sharp edges in a bandlimited signal is<br />
called the [[WikiPedia:/Gibbs_phenomenon|Gibbs effect]]. It happens whenever you slice off part of the<br />
frequency domain in the middle of nonzero energy.<br />
<br />
The usual rule of thumb you'll hear is "the sharper the cutoff, the<br />
stronger the rippling", which is approximately true, but we have to be<br />
careful how we think about it.<br />
For example... what would you expect our quite sharp anti-aliasing filter<br />
to do if I run our signal through it a second time?<br />
<br />
Aside from adding a few fractional cycles of delay, the answer is...<br />
nothing at all. The signal is already bandlimited. Bandlimiting it<br />
again doesn't do anything. A second pass can't remove frequencies<br />
that we already removed.<br />
<br />
And that's important. People tend to think of the ripples as<br />
a kind of [[WikiPedia:Sonic_artifact|artifact]] that's added by anti-aliasing and [[WikiPedia:Reconstruction_filter|anti-imaging]]<br />
filters, implying that the ripples get worse each time the signal<br />
passes through. We can see that in this case that didn't happen. So<br />
was it really the filter that added the ripples the first time<br />
through? No, not really. It's a subtle distinction, but Gibbs effect<br />
ripples aren't added by filters, they're just part of what a<br />
bandlimited signal ''is''.<br />
<br />
Even if we synthetically construct what looks like a perfect digital<br />
square wave,<br />
<br />
it's still limited to the channel bandwidth. Remember,<br />
the stairstep representation is misleading.<br />
<br />
What we really have here are instantaneous sample points,<br />
<br />
and only one bandlimited signal fits those points. All we did when we<br />
drew our apparently perfect square wave was line up the sample points<br />
just right so it appeared that there were no ripples if we played<br />
[[WikiPedia:Interpolation|connect-the-dots]].<br />
<br />
But the original bandlimited signal, complete with ripples, was<br />
still there.<br />
<br />
And that leads us to one more important point. You've probably heard<br />
that the timing precision of a digital signal is limited by its sample<br />
rate; put another way,<br />
<br />
that digital signals can't represent anything that falls between the<br />
samples.. implying that [[WikiPedia:Dirac_delta_function|impulses]] or<br />
[[WikiPedia:Synthesizer#ADSR_envelope|fast attacks]] have to align exactly<br />
with a sample, or the timing gets mangled... or they just disappear.<br />
<br />
At this point, we can easily see why that's wrong.<br />
<br />
Again, our input signals are bandlimited. And digital signals are<br />
samples, not stairsteps, not 'connect-the-dots'. We most certainly<br />
can, for example, put the rising edge of our bandlimited square wave<br />
anywhere we want between samples.<br />
<br />
It's represented perfectly and it's reconstructed perfectly.<br />
<br />
==Epilogue==<br />
<br />
[[Image:Moffey.jpg|360px|right]]<br />
<br />
Just like in [[Videos/A_Digital_Media_Primer_For_Geeks|the previous episode]], we've covered a broad range of<br />
topics, and yet barely scratched the surface of each one. If anything, my<br />
sins of omission are greater this time around... but this is a good<br />
stopping point.<br />
<br />
Or maybe, a good starting point. Dig deeper. Experiment. I chose my<br />
demos very carefully to be simple and give clear results. You can<br />
reproduce every one of them on your own if you like. But let's face<br />
it, sometimes we learn the most about a spiffy toy by breaking it open<br />
and studying all the pieces that fall out. And that's OK, we're<br />
engineers. Play with the demo parameters, hack up the code, set up<br />
alternate experiments. The source code for everything, including the<br />
little pushbutton demo application, is up at xiph.org.<br />
<br />
In the course of experimentation, you're likely to run into something<br />
that you didn't expect and can't explain. Don't worry! My earlier<br />
snark aside, Wikipedia is fantastic for exactly this kind of casual<br />
research. And, if you're really serious about understanding signals,<br />
several universities have advanced materials online, such as the<br />
[http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-003-signals-and-systems-spring-2010/index.htm 6.003]<br />
and<br />
[http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-007-electromagnetic-energy-from-motors-to-lasers-spring-2011 6.007]<br />
Signals and Systems modules at MIT OpenCourseWare. And of<br />
course, there's always the community here at Xiph.Org.<br />
<br />
Digging deeper or not, I am out of coffee, so, until next time, happy<br />
hacking!<br />
<br />
== Use The Source Luke ==</div>Gmaxwellhttps://wiki.xiph.org/index.php?title=Videos/Digital_Show_and_Tell&diff=13955Videos/Digital Show and Tell2013-02-26T07:57:09Z<p>Gmaxwell: /* Epilogue */ image.</p>
<hr />
<div><small>''Wiki edition''</small><br />
[[Image:dsat_001.jpg|400px|right]]<br />
<br />
Continuing in the "firehose" tradition of [[Videos/A_Digital_Media_Primer_For_Geeks|Episode 01]], Xiph.Org's second video on digital media explores multiple facets of digital audio signals and how they ''really'' behave in the real world.<br />
<br />
Demonstrations of sampling, quantization, bit-depth, and dither explore digital audio behavior on real audio equipment using both modern digital analysis and vintage analog bench equipment, just in case we can't trust those newfangled digital gizmos. You can download the source code for each demo and try it all for yourself!<br />
<br/><br/><br/><br />
<center><font size="+2">[http://www.xiph.org/video/vid2.shtml Download or Watch online]</font></center><br />
<br style="clear:both;"/><br />
Players supporting WEBM: [http://www.videolan.org/vlc/ VLC 1.1+], [https://www.mozilla.com/en-US/firefox/ Firefox ], [http://www.chromium.org/Home Chrome ], [http://www.opera.com/ Opera], [http://www.webmproject.org/users/ more…]<br />
<br />
Players supporting Ogg/Theora: [http://www.videolan.org/vlc/ VLC], [http://www.firefox.com/ Firefox], [http://www.opera.com/ Opera], [[TheoraSoftwarePlayers|more…]]<br />
<br />
If you're having trouble with playback in a modern browser or player, please visit our [[Playback_Troubleshooting|playback troubleshooting and discussion]] page.<br />
<br/><br />
<hr/><br />
<br/><br/><br/><br />
[[Image:Xiph_ep02_test.png|400px|right]]<br />
<br />
Hi, I'm Monty Montgomery from [http://www.redhat.com/ Red Hat] and [http://xiph.org/ Xiph.Org].<br />
<br />
A few months ago, I wrote<br />
[http://people.xiph.org/~xiphmont/demo/neil-young.html an article on digital audio and why 24bit/192kHz music downloads don't make sense].<br />
In the article, I<br />
mentioned--almost in passing--that a digital waveform is<br />
[http://people.xiph.org/~xiphmont/demo/neil-young.html#toc_sfam not a stairstep],<br />
and you certainly don't get a stairstep when you<br />
[[WikiPedia:Digital-to-analog_converter|convert from digital back to analog]].<br />
<br />
Of everything in the entire article, '''that''' was the number one thing<br />
people wrote about. In fact, more than half the mail I got was questions and<br />
comments about basic digital signal behavior. Since there's interest, let's<br />
take a little time to play with some ''simple'' digital signals.<br />
<br />
==Veritas ex machina==<br />
[[Image:Dsat_002.jpg|200px|right]]<br />
[[Image:Dsat_003.jpg|200px|right]]<br />
[[Image:Dsat_004.jpg|200px|right]]<br />
[[Image:Dsat_005.jpg|200px|right]]<br />
<br />
Pretend for a moment that we have no idea how digital signals really<br />
behave. In that case it doesn't make sense for us to use digital test<br />
equipment either. Fortunately for this exercise, there's still plenty<br />
of working analog lab equipment out there.<br />
<br />
First up, we need a [[WikiPedia:Function_generator|signal generator]] to provide us with analog input<br />
signals--in this case, an<br />
[http://www.home.agilent.com/en/pd-3325A%3Aepsg%3Apro-pn-3325A/synthesizer-function-generator?pm=PL&nid=-536900197.536896863&cc=SE&lc=swe HP3325]<br />
from 1978. It's still a pretty good<br />
generator, so if you don't mind the size, the weight, the power<br />
consumption, and the noisy fan, you can find them on eBay... occasionally<br />
for only slightly more than you'll pay for shipping.<br />
<br />
Next, we'll observe our analog waveforms on [[WikiPedia:Oscilloscope_types#Cathode-ray_oscilloscope_.28CRO.29|analog oscilloscopes]],<br />
like this Tektronix 2246 from the mid-90s, one of the last and very best analog scopes ever made. Every home lab should have one.<br />
<br />
...and finally inspect the [[WikiPedia:Spectral_density#Electrical_engineering|frequency spectrum]] of our signals using an<br />
[[WikiPedia:Spectrum_analyzer#Swept-tuned|analog spectrum analyzer]], this<br />
[http://www.home.agilent.com/en/pd-3585A%3Aepsg%3Apro-pn-3585A/spectrum-analyzer-high-perf-20hz-40mhz?pm=PL&nid=-536900197.536897319&cc=SE&lc=swe HP3585]<br />
from the same product line as<br />
the signal generator. Like the other equipment here it has<br />
[http://www.hp9845.net/9845/hardware/processors/ a rudimentary and hilariously large microcontroller],<br />
but the signal path<br />
from input to what you see on the screen is completely analog.<br />
<br />
All of this equipment is vintage, but aside from its raw tonnage, the specs are still quite good.<br />
<br />
At the moment, we have our signal generator set to output a nice 1 [[WikiPedia:Hertz#SI_multiples|kHz]]<br />
sine wave at one [[WikiPedia:Volt|Volt]] [[WikiPedia:Amplitude#Root_mean_square_amplitude|RMS]].<br />
We see the sine wave on the oscilloscope, can verify that it is indeed<br />
1 kHz at 1 Volt RMS, which is 2.8 Volts<br />
[[WikiPedia:Amplitude#Peak-to-peak_amplitude|peak-to-peak]],<br />
and that matches the<br />
measurement on the spectrum analyzer as well.<br />
<br />
The analyzer also shows some low-level [[WikiPedia:White_noise|white noise]]<br />
and just a bit of [[WikiPedia:Harmonic_distortion#Harmonic_distortion|harmonic distortion]],<br />
with the highest peak about 70[[WikiPedia:Decibel|dB]] or so below<br />
[[WikiPedia:Fundamental_frequency|the fundamental]].<br />
Now, this doesn't matter at all in our demos, but I<br />
wanted to point it out now just in case you didn't notice it until<br />
later.<br />
<br />
Now, we drop digital sampling in the middle.<br />
<br />
For the conversion, we'll use a boring, consumer-grade, eMagic USB1<br />
audio device. It's also more than ten years old at this point, and it's<br />
getting obsolete.<br />
<br />
A recent converter can easily have an order of magnitude better specs.<br />
[[WikiPedia:Reconstruction_filter#Sampled_data_reconstruction_filters|Flatness]],<br />
[[WikiPedia:Analog-to-digital_converter#Non-linearity|linearity]],<br />
[[WikiPedia:Jitter#Sampling_jitter|jitter]],<br />
[[WikiPedia:Noise_floor|noise behavior]],<br />
[[WikiPedia:Digital-to-analog_converter#DAC_performance|everything]]...<br />
you may not<br />
have noticed. Just because we can measure an improvement doesn't<br />
mean we can hear it, and even these old consumer boxes were already at<br />
the edge of ideal transparency.<br />
<br />
The eMagic connects to my ThinkPad, which displays a digital<br />
waveform and spectrum for comparison, then the ThinkPad<br />
sends the digital signal right back out to the eMagic for<br />
re-conversion to analog and observation on the output scopes.<br />
<br />
Input to output, left to right.<br />
<br style="clear:both;"/><br />
<br />
==Stairsteps==<br />
[[Image:Dsat 006.jpg|360px|right]]<br />
[[Image:Dsat 007.png|360px|right]]<br />
OK, it's go time. We begin by converting an analog signal to digital and<br />
then right back to analog again with no other steps.<br />
<br />
The signal generator is set to produce a 1kHz sine wave just like<br />
before.<br />
<br />
We can see our analog sine wave on our input-side oscilloscope.<br />
<br />
We digitize our signal to<br />
[[Videos/A_Digital_Media_Primer_For_Geeks#Raw_.28digital_audio.29_meat|16 bit PCM at 44.1kHz]],<br />
same as on a CD.<br />
The spectrum of the digitized signal matches what we saw earlier<br />
<br />
and what we see now on the analog spectrum analyzer, aside from its <br />
[[WikiPedia:High_impedance|high-impedance input]] being just a smidge noisier.<br />
<br />
For now, the waveform display shows our digitized sine wave as a<br />
stairstep pattern, one step for each sample.<br />
<br />
And when we look at the output signal that's been converted<br />
from digital back to analog, we see...<br />
<br />
It's exactly like the original sine wave. No stairsteps.<br />
<br />
OK, 1 kHz is still a fairly low frequency, maybe the stairsteps are just<br />
hard to see or they're being smoothed away. Fair enough. Let's choose<br />
a higher frequency, something close to [[WikiPedia:Nyquist_frequency|Nyquist]], say 15kHz.<br />
<br />
Now the sine wave is represented by less than three samples per cycle, and...<br />
<br />
the digital waveform looks pretty awful. Well, looks<br />
can be deceiving. The analog output...<br />
<br />
is still a perfect sine wave, exactly like the original.<br />
<br />
Let's keep going up.<br />
<br />
Let's see if I can do this without blocking any cameras.<br />
<br />
16kHz.... 17kHz... 18kHz... 19kHz... <br />
<br />
20kHz. Welcome to the upper limits of human hearing. The output<br />
waveform is still perfect. No jagged edges, no dropoff, no stairsteps.<br />
<br />
So where'd the stairsteps go? Don't answer, it's a trick question.<br />
They were never there.<br />
<br />
Drawing a digital waveform as a stairstep... was wrong to begin with.<br />
<br />
Why? A stairstep is a continuous-time function. It's jagged, and it's<br />
piecewise, but it has a defined value at every point in time.<br />
<br />
A sampled signal is entirely different. It's discrete-time; it's only<br />
got a value right at each instantaneous sample point and it's<br />
undefined, there is no value at all, everywhere between. A<br />
discrete-time signal is properly drawn as a lollipop graph.<br />
<br />
The continuous, analog counterpart of a digital signal passes<br />
smoothly through each sample point, and that's just as true for high<br />
frequencies as it is for low.<br />
<br />
Now, the interesting and not at all obvious bit is: [[WikiPedia:Nyquist%E2%80%93Shannon_sampling_theorem|there's only one<br />
bandlimited signal that passes exactly through each sample point]]. It's<br />
a unique solution. So if you sample a bandlimited signal and then<br />
convert it back, the original input is also the only possible output.<br />
<br />
[[Image:Dsat 008.png|360px|right]]<br />
<br />
And before you say, "oh, I can draw a different signal that passes<br />
through those points", well, yes you can, but if it differs even<br />
minutely from the original, it includes frequency content at or beyond<br />
Nyquist, breaks the bandlimiting requirement and isn't a valid<br />
solution.<br />
<br />
So how did everyone get confused and start thinking of digital signals<br />
as stairsteps? I can think of two good reasons.<br />
<br />
First: it's easy enough to convert a sampled signal to a true stairstep. Just<br />
extend each sample value forward until the next sample period. This is<br />
called a [[WikiPedia:Zero-order hold|zero-order hold]], and it's an important part of how some<br />
digital-to-analog converters work, especially the simplest ones.<br />
<br />
So, anyone who looks up [[WikiPedia:Digital-to-analog_converter#Practical_operation|digital-to-analog converter or<br />
digital-to-analog conversion]] is probably going to see a diagram of a<br />
stairstep waveform somewhere, but that's not a finished conversion,<br />
and it's not the signal that comes out.<br />
<br />
Second, and this is probably the more likely reason, engineers who<br />
supposedly know better, like me, draw stairsteps even though they're<br />
technically wrong. It's a sort of like a one-dimensional version of<br />
[[WikiPedia:MacPaint#Development|fat bits in an image editor]].<br />
<br />
Pixels aren't squares either, they're samples of a 2-dimensional<br />
function space and so they're also, conceptually, infinitely small<br />
points. Practically, it's a real pain in the ass to see or manipulate<br />
infinitely small anything, so big squares it is. Digital stairstep<br />
drawings are exactly the same thing.<br />
<br />
It's just a convenient drawing. The stairsteps aren't really there.<br />
<br />
==Bit-depth==<br />
[[Image:Dsat_009.jpg|360px|right]]<br />
[[Image:Dsat_010.jpg|260px|right]]<br />
<br />
When we convert a digital signal back to analog, the result is<br />
''also'' smooth regardless of the [[WikiPedia:Audio_bit_depth|bit depth]]. 24 bits or 16 bits...<br />
or 8 bits... it doesn't matter.<br />
<br />
So does that mean that the digital bit depth makes no difference at<br />
all? Of course not.<br />
<br />
Channel 2 here is the same sine wave input, but we quantize with<br />
[[WikiPedia:Dither|dither]] down to 8 bits.<br />
<br />
On the scope, we still see a nice<br />
smooth sine wave on channel 2. Look very close, and you'll also see a<br />
bit more noise. That's a clue.<br />
<br />
If we look at the spectrum of the signal... aha! Our sine wave is<br />
still there unaffected, but the noise level of the 8-bit signal on<br />
the second channel is much higher!<br />
<br />
And that's the difference the number of bits makes. That's it!<br />
<br />
When we digitize a signal, first we sample it. The<br />
sampling step is perfect; it loses nothing. But then we [[WikiPedia:Quantization_(sound_processing)|quantize]] it,<br />
and [[WikiPedia:Quantization_error|quantization adds noise]].<br />
<br />
The number of bits determines how much noise and so the level of the<br />
noise floor.<br />
<br />
What does this dithered quantization noise sound like? Let's listen<br />
to our 8-bit sine wave.<br />
<br />
That may have been hard to hear anything but the tone. Let's listen<br />
to just the noise after we notch out the sine wave and then bring the<br />
gain up a bit because the noise is quiet.<br />
<br />
Those of you who have used analog recording equipment may have just<br />
thought to yourselves, "My goodness! That sounds like tape hiss!"<br />
Well, it doesn't just sound like tape hiss, it acts like it too, and<br />
if we use a [[WikiPedia:Dither#Different_types|gaussian dither]] then it's<br />
[[WikiPedia:Central_limit_theorem|mathematically equivalent]] in every way. It ''is'' tape hiss.<br />
<br />
Intuitively, that means that we can measure tape hiss and thus the noise floor<br />
of [[WikiPedia:Magnetic_tape_sound_recording|magnetic audio tape]]<br />
in [[WikiPedia:Shannon–Hartley_theorem#Examples|bits instead of decibels]], in order to put things in a<br />
digital perspective. [[WikiPedia:Compact cassettes|Compact cassettes]] (for those of you who are old enough to remember them) could reach as<br />
deep as 9 bits in perfect conditions, though 5 to 6 bits was<br />
more typical, especially if it was a recording made on a<br />
[[WikiPedia:Cassette_deck|tape deck]]. That's right... your mix tapes were only about 6 bits<br />
deep... if you were lucky!<br />
<br />
The very best professional [[WikiPedia:Reel-to-reel_audio_tape_recording|open reel tape]] used in studios could barely<br />
hit... any guesses? 13 bits ''with'' [[WikiPedia:Reel-to-reel_audio_tape_recording#Noise_reduction|advanced noise reduction]]. And<br />
that's why seeing '[[WikiPedia:SPARS_code|D D D]]' on a [[WikiPedia:Compact_disk|Compact Disc]] used to be such a big,<br />
high-end deal.<br />
<br />
==Dither==<br />
[[Image:Dsat_011.png|360px|right]]<br />
<br />
I keep saying that I'm quantizing with [[Wikipedia:dither|dither]], so what is dither<br />
exactly and, more importantly, what does it do?<br />
<br />
The simple way to quantize a signal is to choose the digital<br />
amplitude value closest to the original analog amplitude. [[WikiPedia:Rounding|Obvious]],<br />
right? Unfortunately, the exact noise you get from this simple<br />
quantization scheme depends somewhat on the input signal,<br />
<br />
so we may get noise that's inconsistent, or causes distortion, or is<br />
undesirable in some other way.<br />
<br />
[show/attribute the dither paper]<br />
Dither is specially-constructed noise that substitutes for the noise<br />
produced by simple quantization. Dither doesn't [[WikiPedia:Sound_masking|drown out or mask]]<br />
quantization noise, it actually replaces it with noise characteristics<br />
of our choosing that aren't influenced by the input.<br />
<br />
Let's ''watch'' what dither does. The signal generator has too much noise for this test so we'll produce a mathematically perfect sine wave with the ThinkPad and quantize it to 8 bits with dithering.<br />
<br />
We see a nice sine wave on the waveform display and output scope and, once the analog spectrum analyzer catches up...<br />
a clean frequency peak with a uniform noise floor on both spectral displays<br />
just like before. Again, this is with dither.<br />
<br />
Now I turn dithering off.<br />
<br />
The quantization noise, that dither had spread out into a nice, flat noise<br />
floor, piles up into harmonic distortion peaks. The noise floor is<br />
lower, but the level of distortion becomes nonzero, and the distortion<br />
peaks sit higher than the dithering noise did.<br />
<br />
At 8 bits this effect is exaggerated. At 16 bits,<br />
even without dither, harmonic distortion is going to be so low as to<br />
be completely inaudible.<br />
<br />
Still, we can use dither to eliminate it completely if we so choose.<br />
<br />
Turning the dither off again for a moment, you'll notice that the<br />
absolute level of distortion from undithered quantization stays<br />
approximately constant regardless of the input amplitude.<br />
But when the signal level drops below a half a bit, everything<br />
quantizes to zero.<br />
<br />
In a sense, everything quantizing to zero is just 100% distortion!<br />
Dither eliminates this distortion too. We reenable dither<br />
and ... there's our signal back at 1/4 bit, with our nice flat noise floor.<br />
<br />
The noise floor doesn't have to be flat. Dither is noise of our<br />
choosing, so let's choose a noise as [http://www.acoustics.salford.ac.uk/res/cox/sound_quality/?content=subjective inoffensive] and<br />
[[WikiPedia:Absolute_threshold_of_hearing|difficult to notice]]<br />
as possible.<br />
<br />
Our hearing is most sensitive in the midrange from 2kHz to 4kHz,<br />
so that's where background noise is going to be the most obvious.<br />
We can [[WikiPedia:Noise_shaping|shape dithering noise]] away from sensitive frequencies to where<br />
hearing is less sensitive, usually the highest frequencies.<br />
<br />
16-bit dithering noise is normally much too quiet to hear at all, but<br />
let's listen to our noise shaping example, again with the gain<br />
brought way up...<br />
<br />
Lastly, dithered quantization noise ''is'' higher [[WikiPedia:power|Sound_power]] overall<br />
than undithered quantization noise even when it sounds quieter, and<br />
you can see that on a [[WikiPedia:VU_meter|VU meter]] during passages of near-silence. But<br />
dither isn't only an on or off choice. We can reduce the dither's<br />
power to balance less noise against a bit of distortion to minimize<br />
the overall effect.<br />
<br />
We'll also [[WikiPedia:Amplitude_modulation|modulate the input signal]] like this to show how a varying input affects the quantization noise. At<br />
full dithering power, the noise is uniform, constant, and featureless<br />
just like we expect:<br />
<br />
As we reduce the dither's power, the input increasingly<br />
affects the amplitude and the character of the quantization noise.<br />
Shaped dither behaves similarly, but noise shaping lends one more nice<br />
advantage. To make a long story short, it can use a somewhat lower<br />
dither power before the input has as much effect on the output.<br />
<br />
Despite all the time I just spent on dither, we're talking about<br />
differences that start 100 decibels and more below [[WikiPedia:Full_scale|full scale]]. Maybe<br />
if the CD had been<br />
[http://www.research.philips.com/technologies/projects/cd/index.html 14 bits as originally designed],<br />
dither ''might'' be<br />
more important. Maybe. At 16 bits, really, it's mostly a wash. You<br />
can think of dither as an insurance policy that gives several extra<br />
decibels of dynamic range just in case. The simple fact is, though, no<br />
one ever ruined a great recording by not dithering the final master.<br />
<br />
==Bandlimitation and timing==<br />
[[image:Dsat_013.jpg|360px|right]]<br />
[[image:Dsat_014.gif|360px|right]]<br />
<br />
We've been using [[WikiPedia:Sine_wave|sine waves]]. They're the obvious choice when what we<br />
want to see is a system's behavior at a given isolated frequency. Now<br />
let's look at something a bit more complex. What should we expect to<br />
happen when I change the input to a [[WikiPedia:Square_wave|square wave]]...<br />
<br />
The input scope confirms our 1kHz square wave. The output scope shows..<br />
<br />
<br />
Exactly what it should.<br />
...<br />
What is a square wave really? <br />
<br />
<br />
Well, we can say it's a waveform that's<br />
some positive value for half a cycle and then transitions<br />
instantaneously to a negative value for the other half. But that doesn't<br />
really tell us anything useful about how this input <br />
becomes this output .<br />
<br />
Then we remember that [any waveform is also [[WikiPedia:Fourier_series|the sum of discrete frequencies]],<br />
and a square wave is particularly simple sum: a fundamental and an<br />
infinite series of [[WikiPedia:Even_and_odd_functions#Harmonics|odd harmonics]]. Sum them all up, you get a<br />
square wave.<br />
<br />
At first glance, that doesn't seem very useful either. You have to sum<br />
up an infinite number of harmonics to get the answer. Ah, but we don't<br />
have an infinite number of harmonics.<br />
<br />
We're using a quite sharp [[WikiPedia:Low-pass_filter|anti-aliasing filter]] that cuts off right<br />
above 20kHz, so our signal is [[WikiPedia:Bandlimiting|bandlimited]], which means we get this:<br />
<br />
..and that's exactly what we see on the output scope.<br />
<br />
The rippling you see around sharp edges in a bandlimited signal is<br />
called the [[WikiPedia:/Gibbs_phenomenon|Gibbs effect]]. It happens whenever you slice off part of the<br />
frequency domain in the middle of nonzero energy.<br />
<br />
The usual rule of thumb you'll hear is "the sharper the cutoff, the<br />
stronger the rippling", which is approximately true, but we have to be<br />
careful how we think about it.<br />
For example... what would you expect our quite sharp anti-aliasing filter<br />
to do if I run our signal through it a second time?<br />
<br />
Aside from adding a few fractional cycles of delay, the answer is...<br />
nothing at all. The signal is already bandlimited. Bandlimiting it<br />
again doesn't do anything. A second pass can't remove frequencies<br />
that we already removed.<br />
<br />
And that's important. People tend to think of the ripples as<br />
a kind of [[WikiPedia:Sonic_artifact|artifact]] that's added by anti-aliasing and [[WikiPedia:Reconstruction_filter|anti-imaging]]<br />
filters, implying that the ripples get worse each time the signal<br />
passes through. We can see that in this case that didn't happen. So<br />
was it really the filter that added the ripples the first time<br />
through? No, not really. It's a subtle distinction, but Gibbs effect<br />
ripples aren't added by filters, they're just part of what a<br />
bandlimited signal ''is''.<br />
<br />
Even if we synthetically construct what looks like a perfect digital<br />
square wave,<br />
<br />
it's still limited to the channel bandwidth. Remember,<br />
the stairstep representation is misleading.<br />
<br />
What we really have here are instantaneous sample points,<br />
<br />
and only one bandlimited signal fits those points. All we did when we<br />
drew our apparently perfect square wave was line up the sample points<br />
just right so it appeared that there were no ripples if we played<br />
[[WikiPedia:Interpolation|connect-the-dots]].<br />
<br />
But the original bandlimited signal, complete with ripples, was<br />
still there.<br />
<br />
And that leads us to one more important point. You've probably heard<br />
that the timing precision of a digital signal is limited by its sample<br />
rate; put another way,<br />
<br />
that digital signals can't represent anything that falls between the<br />
samples.. implying that [[WikiPedia:Dirac_delta_function|impulses]] or<br />
[[WikiPedia:Synthesizer#ADSR_envelope|fast attacks]] have to align exactly<br />
with a sample, or the timing gets mangled... or they just disappear.<br />
<br />
At this point, we can easily see why that's wrong.<br />
<br />
Again, our input signals are bandlimited. And digital signals are<br />
samples, not stairsteps, not 'connect-the-dots'. We most certainly<br />
can, for example, put the rising edge of our bandlimited square wave<br />
anywhere we want between samples.<br />
<br />
It's represented perfectly and it's reconstructed perfectly.<br />
<br />
==Epilogue==<br />
<br />
[[Image:Moffey.jpg|360px|right]]<br />
<br />
Just like in [[Videos/A_Digital_Media_Primer_For_Geeks|the previous episode]], we've covered a broad range of<br />
topics, and yet barely scratched the surface of each one. If anything, my<br />
sins of omission are greater this time around... but this is a good<br />
stopping point.<br />
<br />
Or maybe, a good starting point. Dig deeper. Experiment. I chose my<br />
demos very carefully to be simple and give clear results. You can<br />
reproduce every one of them on your own if you like. But let's face<br />
it, sometimes we learn the most about a spiffy toy by breaking it open<br />
and studying all the pieces that fall out. And that's OK, we're<br />
engineers. Play with the demo parameters, hack up the code, set up<br />
alternate experiments. The source code for everything, including the<br />
little pushbutton demo application, is up at xiph.org.<br />
<br />
In the course of experimentation, you're likely to run into something<br />
that you didn't expect and can't explain. Don't worry! My earlier<br />
snark aside, Wikipedia is fantastic for exactly this kind of casual<br />
research. And, if you're really serious about understanding signals,<br />
several universities have advanced materials online, such as the<br />
[http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-003-signals-and-systems-spring-2010/index.htm 6.003]<br />
and<br />
[http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-007-electromagnetic-energy-from-motors-to-lasers-spring-2011 6.007]<br />
Signals and Systems modules at MIT OpenCourseWare. And of<br />
course, there's always the community here at Xiph.Org.<br />
<br />
Digging deeper or not, I am out of coffee, so, until next time, happy<br />
hacking!<br />
<br />
== Use The Source Luke ==</div>Gmaxwellhttps://wiki.xiph.org/index.php?title=File:Moffey.jpg&diff=13954File:Moffey.jpg2013-02-26T07:56:31Z<p>Gmaxwell: Monty has run out of go go juice.</p>
<hr />
<div>Monty has run out of go go juice.</div>Gmaxwell