Skip to content

Commit f6c68d2

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 594085a commit f6c68d2

7 files changed

Lines changed: 232 additions & 0 deletions

content/images/news/serato-control-cd.svg

Lines changed: 2 additions & 0 deletions
Loading

content/images/news/traktor-mk2-signal-with-derivative.svg

Lines changed: 2 additions & 0 deletions
Loading

content/images/news/traktor-mk2-signal-with-readings.svg

Lines changed: 2 additions & 0 deletions
Loading

content/images/news/traktor-mk2-signal-with-timecodes.svg

Lines changed: 2 additions & 0 deletions
Loading

content/images/news/traktor-mk2-signal-with-zero-crossings.svg

Lines changed: 2 additions & 0 deletions
Loading

content/images/news/traktor-mk2-signal.svg

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

0 commit comments

Comments
 (0)