Skip to content

Commit f8dd35e

Browse files
committed
Add a Traktor MK2 blog post
This blog post explains the current state of implementation for the Traktor MK2 decoder.
1 parent 633eaaa commit f8dd35e

7 files changed

Lines changed: 164 additions & 0 deletions
617 KB
Loading
620 KB
Loading
604 KB
Loading
631 KB
Loading
504 KB
Loading
485 KB
Loading
Lines changed: 164 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,164 @@
1+
title: "How Does Timecode Vinyl Actually Work? (Pt. 3)"
2+
authors: Jan Claußen
3+
tags: traktor, timecode, dvs, vinyl control
4+
date: 2025-07-25 14:43:00
5+
6+
Since its release in 2011, the **Traktor Control Vinyl MK2** has sparked curiosity among digital DJs and audio developers alike. Its timecode format stands apart from Serato’s, which we explored in the previous posts. With the MK2 system, Native Instruments introduced a more advanced timecode that boosts resolution and accuracy by applying cryptographic methods for both decoding and error correction.
7+
8+
In this post, we’ll break down how it actually works.
9+
10+
---
11+
12+
## Table of Contents
13+
14+
1. [Recap: How Serato Timecode Works](#recap)
15+
2. [The Traktor MK2 Signal](#traktor-mk2-timecode)
16+
3. [Pitch Detection](#pitch-detection)
17+
4. [Demodulation Techniques](#demodulation)
18+
5. [The Code](#the-code)
19+
6. [What’s Next](#whats-next)
20+
21+
---
22+
23+
## Recap: How Serato Timecode Works <a name="recap"></a>
24+
25+
Serato’s timecode is built around a [Linear Feedback Shift Register](https://en.wikipedia.org/wiki/Linear-feedback_shift_register), modulated onto a 1 kHz carrier using [amplitude modulation (AM)](https://en.wikipedia.org/wiki/Amplitude_modulation)—a legacy method from radio transmission.
26+
27+
The demodulation process is relatively simple: when one stereo channel crosses the x-axis, the other hits a peak. If that peak exceeds a certain threshold, the system reads it as a 1; if not, it’s a 0.
28+
29+
![Serato Timecode Signal]({static}/images/news/serato-control-cd.png)
30+
31+
We covered this in more detail in [DVS Internals Pt. 1]({filename}/news/2021-11-21-dvs-internals-pt1.md) and [Pt. 2]({filename}/news/2021-12-22-dvs-internals-pt2.md).
32+
33+
---
34+
35+
## The Traktor MK2 Signal <a name="traktor-mk2-timecode"></a>
36+
37+
Below is a generated signal that resembles what you’ll find on the Traktor MK2 Control CD.
38+
39+
The carrier wave operates at **2500 Hz**, a significant increase from Serato’s 1000 Hz.
40+
41+
> **Advantage 1:** The higher carrier frequency allows for ~2.5× greater resolution.
42+
43+
![Offset-modulated Signal]({static}/images/news/offset-modulated-signal.png)
44+
45+
Upon inspection, this waveform clearly doesn’t use amplitude modulation—the amplitude remains constant. Instead, it appears to be **offset-modulated**, where the signal is shifted vertically from the x-axis. This is a non-standard technique not commonly used in typical modulation schemes.
46+
47+
On the original vinyl version (not shown here due to copyright), the offset can be so large that the signal floats entirely above the x-axis for multiple cycles—making zero-crossing detection impossible.
48+
49+
Even when that doesn’t happen, the offset causes the time difference $d_t$ between zero-crossings to become irregular, introducing audible pitch flutter.
50+
51+
To decode the signal, we must solve:
52+
53+
1. How to filter the signal to enable pitch detection
54+
2. How to demodulate this non-standard modulation
55+
3. What exactly is encoded in this bitstream?
56+
57+
---
58+
59+
## Pitch Detection <a name="pitch-detection"></a>
60+
61+
> **Note:** If you're unfamiliar with pitch detection in DVS systems, revisit [DVS Internals Pt. 1]({filename}/news/2021-11-21-dvs-internals-pt1.md).
62+
63+
Our goal is to produce a signal that oscillates evenly around the x-axis. This filtered waveform can then be processed using standard pitch detection algorithms.
64+
65+
A simple derivative operation achieves this:
66+
67+
$$y[n] = x[n] - x[n-1]$$
68+
69+
When applied to the offset-modulated signal, we get:
70+
71+
![Offset-modulated signal with derivative]({static}/images/news/offset-modulated-signal-with-derivative.png)
72+
73+
The resulting waveform oscillates cleanly around zero, which is ideal for analysis. It also makes it easier to pinpoint the half-cycle peaks needed for bit detection.
74+
75+
You may notice that the derivative’s zero-crossings don’t align perfectly with the original peaks. That’s due to a delay introduced by the filter. Smoothing the signal first, then compensating for the delay (e.g., by selecting <br>$x[n-3]$), yields better results.
76+
77+
For greater accuracy, one could analyze the phase response $\phi(\omega)$, which shows how delay varies with input frequency—but for most use cases, a fixed delay works well enough.
78+
79+
---
80+
81+
## Demodulation Techniques <a name="demodulation"></a>
82+
83+
To extract bits from the signal, we detect the zero-crossings and sample the amplitude of the sinusoid at those moments.
84+
85+
![Offset-modulated signal with zero-crossings]({static}/images/news/offset-modulated-signal-with-zero-crossings.png)
86+
87+
The filtered signal can cross the x-axis in two directions—positive to negative or vice versa. Based on the direction, we determine which half-cycle contains the encoded bit.
88+
89+
![Offset-modulated signal with readings]({static}/images/news/offset-modulated-signal-with-readings.png)
90+
91+
Demodulation is then as simple as applying a threshold: amplitudes above it are **1**, and below it are **0**.
92+
93+
![Offset-modulated signal with timecodes]({static}/images/news/offset-modulated-signal-with-timecodes.png)
94+
95+
On actual vinyl, the physical behavior of the needle causes the offset to decay over time. This decay complicates bit extraction.
96+
97+
To compensate, we analyze the **slope** between subsequent readings:
98+
99+
$$slope[n] = reading[n] - reading[n-1]$$
100+
101+
This method helps isolate the encoded signal from the floating zero line caused by mechanical drift.
102+
103+
---
104+
105+
## The Code <a name="the-code"></a>
106+
107+
> **Note:** A deeper explanation of LFSRs can be found in [DVS Internals Pt. 2]({filename}/news/2021-12-22-dvs-internals-pt2.md)
108+
109+
Interestingly, the Traktor MK2 system also uses a Linear Feedback Shift Register (LFSR)—but with very different parameters. While Serato’s LFSR has a 20-bit length, Traktor’s appears to use a **110-bit** register.
110+
111+
The number of unique states an LFSR can generate is:
112+
113+
$$n_{max} = 2^m -1$$
114+
115+
Hence for the Serato timecode
116+
117+
$$n_{serato} = 2^{20} -1 = 1\,048\,575$$
118+
119+
and for the Traktor MK2 timecode
120+
121+
$$n_{mk2} = 2^{110} -1 = 1.298 \cdot 10^{33} = 1\,298\,074\,214\,633\,706\,907\,132\,624\,082\,305\,023$$
122+
123+
That’s an astronomically high number—far beyond what’s required for this application.
124+
125+
But how many states are actually needed?
126+
127+
With a 2500 Hz carrier, you get 2500 bits per second. For 12 minutes of timecode:
128+
129+
$$12 \,min \cdot 60 \,s = 720 \,s$$
130+
$$720 \,s \cdot 2500 \,states/s = 1\,800\,000 \,states$$
131+
132+
This already exceeds the maximum state range of Serato’s 20-bit LFSR.
133+
134+
> **Advantage 2:** The MK2 timecode supports ~1.8× more states than Serato’s system.
135+
136+
However, a downside appears: each 110-bit state must be stored in 128 bits (4 × 32-bit integers).
137+
138+
So for 12 minutes:
139+
140+
$$1\,800\,000 \,states \cdot 128 \,bit = 230\,400\,000 \,bit = 28\,800\,000 \,byte = 27.46 \,MB$$
141+
142+
And for a 25-minute CD:
143+
144+
$$4\,500\,000 \,states \cdot 128 \,bit = 576\,000\,000 \,bit = 72\,000\,000 \,byte = 68.66 \,MB$$
145+
146+
> **Disadvantage 1:** The memory footprint is large—even a single side of timecode can exceed 27 MB.
147+
148+
This makes storing a full lookup table impractical in production software.
149+
150+
Nonetheless, this technique works and it represents the current state of
151+
implementation of the xwax library used that is used for vinyl control in Mixxx.
152+
153+
---
154+
155+
## What’s Next <a name="whats-next"></a>
156+
157+
Fortunately, there are mathematical methods to reduce the memory requirements.
158+
This requires diving deeper into the crypthographic theory. First tests show
159+
that this can possibly be achieved by decimating the bitstream over a 110-bit
160+
window. This collapses the sequence into a 22-bit alternating
161+
[Gold code](https://en.wikipedia.org/wiki/Gold_code). The implementation of
162+
this technique is far more complex and not complex yet.
163+
164+
We’ll explore those strategies in the next part of this series.

0 commit comments

Comments
 (0)