Analysing The Serato DJ Timecode Signal - Esgrove
Analysing The Serato DJ Timecode Signal - Esgrove
Analysing The Serato DJ Timecode Signal - Esgrove
Esgrove
Akseli Lukkarila / DJ Esgrove / Ru! Cut
# $ % (
' &
signal
2
http://www.esgrove.fi/analysing-the-serato-dj-timecode-signal/ Página 1 de 22
Analysing the Serato DJ timecode signal – Esgrove 10/21/17 12'26 AM
solutions do much much more than what the name DVS implies, but › Programming
the core function is still the same that it was in 2004 when Serato › Python
Scratch Live was introduced. › Qt
http://www.esgrove.fi/analysing-the-serato-dj-timecode-signal/ Página 2 de 22
Analysing the Serato DJ timecode signal – Esgrove 10/21/17 12'26 AM
“There are two parts to the Serato DJ Control Vinyl: The directional
tone, and the NoiseMap™. Listening to the control vinyl, the
directional tone is the 1 kHz tone. The NoiseMap™ sounds like
random noise over the top of the tone. The directional tone provides
the current speed and direction of the record, while the
NoiseMap™ tells the software precisely where on the record the
needle is currently. “
00:00 00:00
But how does it actually work? Well, let’s fire up Matlab and have a
closer look.
http://www.esgrove.fi/analysing-the-serato-dj-timecode-signal/ Página 3 de 22
Analysing the Serato DJ timecode signal – Esgrove 10/21/17 12'26 AM
http://www.esgrove.fi/analysing-the-serato-dj-timecode-signal/ Página 4 de 22
Analysing the Serato DJ timecode signal – Esgrove 10/21/17 12'26 AM
http://www.esgrove.fi/analysing-the-serato-dj-timecode-signal/ Página 5 de 22
Analysing the Serato DJ timecode signal – Esgrove 10/21/17 12'26 AM
From the frequency spectrum we can confirm that the signal is indeed
exactly 1 kHz, and looking at the waveforms both channels contain
the same sine wave, but the phase of the right channel is 90 degrees
ahead. This is confirmed in the “padded right channel picture”, where
the right channel has been shifted 90 degrees backwards and the
waveforms line up nicely. The distinctly varying amplitudes of the
sine wave suggests the use of Amplitude shift keying -modulation,
which is a digital version of amplitude modulation. From here we can
already deduce two of the three control parameters.
Speed
http://www.esgrove.fi/analysing-the-serato-dj-timecode-signal/ Página 6 de 22
Analysing the Serato DJ timecode signal – Esgrove 10/21/17 12'26 AM
Of course there will be some overhead from all the calculations, but I
think an overall update speed of around a hundred milliseconds
should be enough even for fast scratching, which would allow the
system to detect ten speed changes in a second. Serato probably has
an even better / more optimized detection and calculation method for
this, but these calculations were just to see that it’s feasible. One
possible method would be to just stay in the time domain, and look at
the length of one period, since . Also, most of the DJ hardware
uses an ADC sampling rate of 48 kHz or higher instead of the 44,1 kHz
http://www.esgrove.fi/analysing-the-serato-dj-timecode-signal/ Página 7 de 22
Analysing the Serato DJ timecode signal – Esgrove 10/21/17 12'26 AM
Direction
This one is also very simple. There’s a reason for the 90 degree phase-
shift between the channels: when the signal is played forward, the
right channels sine wave is ahead, and when played backwards, the
left channel is ahead by 90 degrees. This could be detected in many
ways, and ideally it only takes two consecutive samples to determine
the direction, which would be really fast. Assuming that we take a
whole one period of the signal to detect the direction, it would still
only take around one millisecond on normal speed.
Position
Now comes the hard part. This is were the so called NoiseMap comes
in. We need to have some sort of sequence or pattern in the signal that
tells us where we are, i.e. a position marker.
http://www.esgrove.fi/analysing-the-serato-dj-timecode-signal/ Página 8 de 22
Analysing the Serato DJ timecode signal – Esgrove 10/21/17 12'26 AM
http://www.esgrove.fi/analysing-the-serato-dj-timecode-signal/ Página 9 de 22
Analysing the Serato DJ timecode signal – Esgrove 10/21/17 12'26 AM
http://www.esgrove.fi/analysing-the-serato-dj-timecode-signal/ Página 10 de 22
Analysing the Serato DJ timecode signal – Esgrove 10/21/17 12'26 AM
and the B-side is 15 minutes (900 s), so there are 600 000 and 900 000
wave periods per side. There would be
(side B)
position markers for the whole track, which is doable since with 16
bits we can represent
However, in this old interview from 2011, Dylan Wood from Serato
says the following:
DJ TechTools 36
http://www.esgrove.fi/analysing-the-serato-dj-timecode-signal/ Página 11 de 22
Analysing the Serato DJ timecode signal – Esgrove 10/21/17 12'26 AM
Maybe this is just marketing talk, but this answer suggests that instead
of a one dimensional sequence, like we just obtained, the noisemap
seems to be more akin to a 2d pattern, i.e. a picture. Also, what has
been bothering me is that why does the control signal sound so noisy,
when the frequency spectrum shows only a single tone. So let’s look at
the spectrogram of the signal to see what is happening with the
frequency in relation to time.
http://www.esgrove.fi/analysing-the-serato-dj-timecode-signal/ Página 12 de 22
Analysing the Serato DJ timecode signal – Esgrove 10/21/17 12'26 AM
http://www.esgrove.fi/analysing-the-serato-dj-timecode-signal/ Página 13 de 22
Analysing the Serato DJ timecode signal – Esgrove 10/21/17 12'27 AM
http://www.esgrove.fi/analysing-the-serato-dj-timecode-signal/ Página 14 de 22
Analysing the Serato DJ timecode signal – Esgrove 10/21/17 12'27 AM
Matlab
047
048 figure();
049 plot(t, xt); grid on;
050 title({'Serato Control Signal';'stereo'});
051 xlabel('Time (ms)');
052 axis([0 0.1 -1.05 1.05]);
053 set(gca,'XTick',0:0.01:0.1);
054 set(gca,'XTickLabel',{0 10 20 30 40 50 60 70
055 80 90 100});
056 legend('Left', 'Right', 'Location', 'Best');
057 set(gcf, 'PaperUnits','centimeters',
058 'PaperPosition',[0 0 16 9])
059 print(gcf, 'Serato_stereo', '-dpng', '-r300');
060
061 figure();
062 plot(t, xt); grid on;
063 title({'Serato Control Signal';'stereo'});
064 xlabel('Time (ms)');
065 axis([0 0.01 -1.05 1.05]);
066 set(gca,'XTick', 0:0.001:0.01);
067 set(gca,'XTickLabel',{0 1 2 3 4 5 6 7 8 9
068 10});
069 legend('Left', 'Right', 'Location', 'Best');
070 set(gcf, 'PaperUnits','centimeters',
071 'PaperPosition',[0 0 16 9])
072 print(gcf, 'Serato_stereo2', '-dpng', '-
073 r300');
074
075 %% Frequency plots
076
077 % FFT
078 Xf = 2*abs((fft(xleft)/N)); % real part
079 Xf = 20*log(Xf); % dB
080
081 f0 = Fs/N; % frequency resolution (Hz)
082 f1 = 0:f0:(N-1)*f0; % frequency vector
083
084 figure();
085 semilogx(f1, Xf); grid on;
086 title({'Serato Scratch Live Control
087 Signal';'frequency spectrum'});
088 ylabel('Magnitude (dB)');
089 xlabel('Frequency (Hz)');
090 axis([20 20000 -90 3]);
091 set(gca,'XTick',[20 50 100 200 500 1000 2000
092 5000 10000 20000])
093 set(gca,'XTickLabel',{20 50 100 200 500 '1k'
094 '2k' '5k' '10k' '20k'})
095 set(gcf, 'PaperUnits','centimeters',
096 'PaperPosition',[0 0 16 9])
http://www.esgrove.fi/analysing-the-serato-dj-timecode-signal/ Página 16 de 22
Analysing the Serato DJ timecode signal – Esgrove 10/21/17 12'27 AM
http://www.esgrove.fi/analysing-the-serato-dj-timecode-signal/ Página 17 de 22
Analysing the Serato DJ timecode signal – Esgrove 10/21/17 12'27 AM
147
148 % serato
149 figure();
150 spectrogram(xleft(1:441001),1024, 512,
151 [],Fs,'yaxis', 'MinThreshold',-100)
152 title('Serato timecode, 1024 sample window');
153 axis([0 10 0 2]);
154 set(gcf, 'PaperUnits','centimeters',
155 'PaperPosition',[0 0 16 9])
156 print(gcf, 'Serato_spectrogram1', '-dpng', '-
157 r300');
158
159 figure();
160 spectrogram(xleft(1:441001),2^12, 2^11,
161 [],Fs,'yaxis', 'MinThreshold',-100)
162 title('Serato timecode, 4096 sample window');
163 axis([0 2 0 2]);
164 set(gcf, 'PaperUnits','centimeters',
165 'PaperPosition',[0 0 16 9])
166 print(gcf, 'Serato_spectrogram2', '-dpng', '-
167 r300');
168
169 figure();
170 spectrogram(xleft,2^11, 2^10,[],Fs,'yaxis',
171 'MinThreshold',-100)
172 title('Serato timecode, 2048 sample window');
173 axis([0.01 0.2 0 2]);
174 set(gcf, 'PaperUnits','centimeters',
175 'PaperPosition',[0 0 16 9])
176 print(gcf, 'Serato_spectrogram3', '-dpng', '-
177 r300');
178
179 %% Phase shift
180
181 samples90deg = 44100/(4*1000); % samples for
182 1/4 wavelength for 1 kHz sine
183
184 % samples90deg = 11
185
186 % pad right channel 11 samples = 90 deg phase
187 shift backwards
188 % -> waveforms should overlap
189 rightpad = padarray(xright,11,'pre'); % insert
190 11 zeros to beginning
191 padded = rightpad(1:441001);
192
193 figure(5);
194 plot(t, xleft, t, padded); grid on;
195 title({'Serato Scratch Live Control
196 Signal';'padded right channel'});
http://www.esgrove.fi/analysing-the-serato-dj-timecode-signal/ Página 18 de 22
Analysing the Serato DJ timecode signal – Esgrove 10/21/17 12'27 AM
http://www.esgrove.fi/analysing-the-serato-dj-timecode-signal/ Página 19 de 22
Analysing the Serato DJ timecode signal – Esgrove 10/21/17 12'27 AM
end
figure();
s = 1:132000; % sample vector
plot(s, xleft(1:132000)); hold on
plot(s/10, square(1:132000), 'r', 'LineWidth',
0.7); grid on;
title({'Serato Control Signal';'ASK
demodulation'});
xlabel('Bits'); axis([1 2205 -0.05 1.05]);
set(gca,'XTick', 0:44.1:2205);
set(gca,'XTickLabel',[]);
set(gca,'YTick', [0 1]); set(gca,'YTickLabel',
[0 1]);
set(gcf, 'PaperUnits','centimeters',
'PaperPosition',[0 0 16 9])
print(gcf, 'Serato_bitmask', '-dpng', '-
r300');
%% Bit array
x = 0:1:64;
figure();
stem(x, bit_array(1:max(size(x))), 'filled');
grid on;
title({'Serato Control Signal';'bit values'});
xlabel('bit'); axis([0 64 -0.1 1.1]);
set(gca,'XTick', 0:8:64);
set(gca,'YTick', [0 1]); set(gca,'YTickLabel',
[0 1]);
set(gcf, 'PaperUnits','centimeters',
'PaperPosition',[0 0 16 9])
print(gcf, 'Serato_bitvalues', '-dpng', '-
r300');
%% Direction
t = 0:1/60000:0.1;
right = sin(2*pi*1000.*t);
left = sin(2*pi*1000.*t - pi/2);
figure();
plot(t(16:121), left(16:121), 'b'); hold on;
http://www.esgrove.fi/analysing-the-serato-dj-timecode-signal/ Página 20 de 22
Analysing the Serato DJ timecode signal – Esgrove 10/21/17 12'27 AM
Share this:
4
+ Leave a Reply
Enter your comment here...
03.07.2016 at 20:51
Would having the two output signals from the deck/player 180
degrees out of absolute phase (i.e. inverted polarity) cause
Serato to play in reverse? Does its calibration mode and
settings have the ability to compensate for this?
http://www.esgrove.fi/analysing-the-serato-dj-timecode-signal/ Página 21 de 22
Analysing the Serato DJ timecode signal – Esgrove 10/21/17 12'27 AM
http://www.esgrove.fi/analysing-the-serato-dj-timecode-signal/ Página 22 de 22