Skip to content

Commit 3315e21

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 4d26c88 commit 3315e21

7 files changed

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

0 commit comments

Comments
 (0)