Skip to content

Commit 35b9e5a

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 eec3957 commit 35b9e5a

7 files changed

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

0 commit comments

Comments
 (0)