From the original SynthMaker forum (2004–2014), with its members’ names and dates.
Osseous ·
Hi all,
i was wondering if anyone had ever considered a way to read time-code form vinyl or CD using SM as programs such as traktor and serato etc. do?
The reason i ask is that i saw a Reaktor 5 ensemble which does just that. It was programmed to be able to read the time-code from all of the types of time-coded vinyl which are currently available. The way it worked wasn't great though, and i thought that with the GUI abilities of SM a standalone and/or VST version could be better made in SM.
Assuming that the problems of reading the time-code are overcome, how would SM perform at actually playing back the audio? If i can overcome the time-code reading problems (writing the code to do it that is) i'd like to make an all-in-one piece of software which would have 2 virtual decks, some sort of file browsing capability and an internal DJ-style mixer if the DJ isn't using an external mixer. Maybe add some effects in too.
Any advice or help that people have to offer would be greatly appreciated. Also, as this could be quite far out of my league when it comes to writing code and SM in general, i'd be willing to work with someone else to get this project going.
Yes i asked for this a while back
The SDK from Ms Pinky is available too but it never happened
Maybe in the future who knows
NAS
Osseous ·
If we could have a look at the code in the reaktor 5 ensemble, we might find a way to re-write the code for our own use. no?
Osseous ·
I've been looking at the Reaktor 5 ensemble and reckon that if i was better at the coding and maths of dealing with this sort of thing i could get a working version up and running in SM. The advantage of doing it in reaktor, like the ammobox/hangthedj version (which i posted a link to above) is that you can use the Reaktor 5 Core primitives to do calculations at the sampling rate, unlike in SM. So in SM everything would have to be done in code, and couldn't be done with primitives and i'm not sure i'm up to that.
Also, the Reaktor 5 version only deals with direction and speed (relative position), not with the absolute position of the needle on the vinyl. Getting reliable information on exactly how the absolute position is calculated for all the different types and versions of vinyl time-code out there would probably be next to impossible without buying a piece of time-coded vinyl for each of them and then trying to analyse the audio coming from them so that code can be retro-engineered to make an SM version work or alternatively managing to get the specs for each type/version that is currently available.
I guess another solution would be to create my own time-coded vinyl or use an open source platform such as msPinky but the developer resources which are provided when you buy msPinky are written in C++ and converting that info into something which could be useable in SM might be beyond me again. And that doesn't fit with my idea to provide some software which will work with all types of currently available time-coded vinyl.
Oh well. I guess my idea to provide a cheap/donation-only version of software such as deckadance is doomed to failure before it has even begun.
🙁
Oss
infuzion ·
Osseous wrote: ...you can use the Reaktor 5 Core primitives to do calculations at the sampling rate, unlike in SM. So in SM everything would have to be done in code, and couldn't be done with primitives and i'm not sure i'm up to that.
...the developer resources which are provided when you buy msPinky are written in C++ and converting that info into something which could be useable in SM might be beyond me again. And that doesn't fit with my idea to provide some software which will work with all types of currently available time-coded vinyl.
I don't want to sound rude to you Osseous, but you don't understand SM; all "audio" in SM (Poly/Mono) is at the hosts'/soundcard's samplerate.
C++ to SM Code tutorial:
[old link]
I'm very interested in a timecode-disk VST, & would love to help, but I'm going to wait for 1.1.1+ until SM is both stable for editing & hosts; I'm not going to have my music computer crash on me in front of 1000 people thanks to SM. I would prefer a timecode to ReWire controller... I guess I need to learn C++.
Osseous ·
infuzion wrote: I don't want to sound rude to you Osseous, but you don't understand SM; all "audio" in SM (Poly/Mono) is at the hosts'/soundcard's samplerate.
i know infuzion. the point i was trying to make is that there are a lot of primitives that SM has which would be useful for this type of project but which only work on green data, not mono/poly streams. That sort of stuff would have to be coded and i'm not sure i'd know how to go about writing code for logic gates etc in SM. After reading through my posts again, i realise i didn't word it very well so i can see why you didn't understand what i was saying.
You're right about stability though. Probably much better just using something written in C++ like everything else. It's tried and tested.
🙂
Oss
sambean ·
Getting the speed/direction seems to be the easier part of the problem, getting the position on the other hand...
I had a quick look at a description of the spec here- http://en.wikipedia.org/wiki/Final_Scratch and it doesn't look too bad. Does anyone know if the records are copyright, I take it they are? Hearing a small sample (<1 sec) would help a tonne in working out how it works.. This could make for an interesting project.
Sam
Osseous ·
Yeah, i'd looked at that page too. It basically tells you exactly how it works and while i understand it, i have no idea about how to convert that into a method which will work in SM. Also, apart from msPinky, i can't find any info on any other of the formats so it would be a lot harder to figure it out for them.
infuzion ·
sambean wrote: Does anyone know if the records are copyright, I take it they are?
I assume they are covered by a patent, if I were to make a VST for it I'd just buy one to CYA... wait, I already did! B)
I'm assuming that all time-code vinyl uses a derivative of SMPTE.
Let me know if you want more help.
Nu Audio Science ·
No actually the timecode is different to SMPTE but it is a bear of a subject to get into right now
If you want more info you can check out DJDecks
Its an extrememly cheap DJ software that in my tests and plenty of others too is the most stable and most reactive and supports evrytime code vinyl made to date
Make sure you install some of the skins though because the default isn't very good
NAS
infuzion ·
Nu Audio Science wrote: No actually the timecode is different to SMPTE but it is a bear of a subject to get into right now
Um, SMPTE is a timecode. Do you mean timecode-vinyl is extremely different than SMPTE, somewhat different...? Please explain.
Nu Audio Science ·
A lot of timecode vinyls are extremely different to SMPTE
I can't speak for all of them but the main ones are (Pinky, FS,Serato and so on)
There are plenty of resources online
NAS
mdk ·
where's synthesizer patel? he's your man for timecode questions 🙂
Synthesizer Patel ·
Timecode is trivial to decode. If anyone is still interested in this ping the thread and I'll post details.
As it stands since I'm all bootcamped up I'm going to be taking a stab at this again now that I'm less burnt out on the idea.
infuzion ·
Sounds interesting; I wouldn't mind helping out where I could.
Synthesizer Patel ·
Ok, so here's how timecode works then.
All timecode is basically two sinewaves that are 90 degrees phase shifted, it varies which channel is shifted on which timecode you're using, but basically if it's going backwards when you want it going forwards you just flip it and then it'll work. Thats how you get speed and direction out of timecode. This is the simplest way to accomplish the goal of being able to use a vinyl record to get a digital signal out of it reliably.
If you want absolute position, there are a variety of encoding methods that embed bits of data into the sinewaves by making the peaks higher or lower or skipping them all together, generally this is the 'magic' part of each timecode flavor and in my opinion not really worth figuring out. Absolute position on the record is cool, but if you're using a computer to play audio/synthesis you can just click the waveform with a mouse or rig up a MIDI controller to switch songs or tracks or whatever -- thats what I did with ammobox.
It's difficult to get timecode absolute position unless you have it documented, basically if you know anything about encryption is kind of a one-time-pad, that is to say that while each absolute position requires multiple samples to 'read' (I think 40 or so bits), it's not simply a time-stamp like '0000001,0000002,0000003'. So even though it's basically encrypted, each position is 'padded' from the position to position, so you can simply make a lookup table that says '2209302' is 1:10:23, '30994032' is 1:10:24, '40943093' is 1:10:25, etc. But that ends up being like a 100 meg file.. Unless you know their encoding method and can decode it.
Since it's a plaintext attack, you could likely brute force it (others have as indicated by third party software that can get absolute position out of disparate timecode flavors but again.. I don't care about absolute position and the level of difficulty has kept me from exploring it simply because I'm lazy.
With that being said, how do you decode the timecode to get the speed and direction? Two methods, one is a non-math intensive method that is reasonably reliable but not as 'solid' as the next -- using FFTs. I'll explain the first to give you an idea of how the information gets decoded and then the second to show the more elegant way that I've only half implemented in Reaktor and may or may not even be possible in Synthmaker as is. But. Who knows!
SPEED
Figure 1.
Lets look at a waveform I stole from wikipeadeiddiedieidedia:
If you're an SM user and built a synth you get what this is. Amplitude is loudness, the period is the frequency. The slower the record turns the lower the frequency will be, the faster it turns the faster it'll be. That's all you need to know to get the 'speed'.
Most timecodes are 2khz, although the original Final Scratch timecode was 1.2khz. I hung out with the guy who wrote Ms. Pinky a couple months ago and he told me that 2khz is probably too high as fast backspins on the record will get muddied and you can't really determine if the record is going forward or backwards. Interesting bit of trivia at least.
I've attached a very simple timecode generator that will create a phase shifted waveform that you can change the frequency of and 'flip' the phase shift to fake reversing direction. It should be enough to get people going if they want to try writing a decoder.
DIRECTION
Figure 2.
Extracting direction information is simply about observing the phase shift between the left and right channels. If Blue is the LEFT channel and Red is the RIGHT channel in figure 2, you'll note that the RIGHT channel is slightly ahead of the LEFT channel because of the phase shift.
So all you need to do is when you have a positive-zero crossing in the RIGHT channel, measure the value of the LEFT channel -- if it's going forward it will always be positive.
If you reverse the record play direction, the opposite is true, every time the RIGHT channel has a positive-zero crossing, the LEFT channel will always be negative.
Figure 3.
If you have sample accurate DSP processing, this ends up being pretty reliable, but since you're reading an analog signal and the clock speed of the computer is locked, it will never be a 'solid' lock. That is to say if you somehow had a turntable that turned at exactly 33rpm (which they don't) and were playing 2khz timecode, it'd still have a lot of little fluctuations in the output signal. Factor in dust, bumps, scratches, etc.. this can have wonky effects. In practice ammobox didn't have many problems, but it is without a doubt the most barebones way of decoding timecode. FFT is much more elegant and reliable.
How to calculate speed and direction
Now that we know the frequency the record is playing at by measuring the distance between peaks, and you know the direction by measuring the phase distance between the two channels here's how we make something useful out of it..
Let the type of timecode be 'H', the type being the flavor or brand -- Ms. Pinky, Final Scratch, Traktor Scratch, etc. Final Scratch is 1.2khz, Traktor Scratch is 2.0khz, etc.
Let the detected frequency be 'F'
Let the detected phase be 'P', the two values of P can be -1 (backwards) or 1 (forwards)
Let S be the calculated speed
So the equation is:
(F/H) * P = S
So if you're using Traktor Scratch timecode (2khz), you detect that the frequency is 2.5khz and the phase is positive:
2562.5/2048 * 1 = 1.251
And thats basically it.
The record is spinning 1.251 times faster than 33rpm so if it was a regular record it'd be higher pitched. In the work that I've done, you can just apply S against the playback time of a granular sampler and you can scratch it and it'll sound like scratching.
Using FFTs
We've covered the easy one, this is the harder way of doing it. To be honest I don't command the facts on this method but I know enough that if someone took the information and ran with it it'd be sufficient to make it work.
FFT is short for Fast Fourier Transform, http://en.wikipedia.org/wiki/FFT for those who don't know it allows you to take a group of samples and do analysis on it resulting in an array of values representing the detected frequencies. If you perform an FFT on a group of 256 samples the resulting graph will show the range of frequencies detected in the group of samples.
In the ToneGenV1 OSM I've attached, I've even hooked up an FFT graph, so if you turn the frequency dial on the generator you can see that the dominant frequency detected is pretty close to what the frequency actually is. The lower the number of samples, the less accurate the FFT is.
To compensate for that you can do a couple things, you can do multiple FFTs in tandem with sample offsets, like doing 4 x FFT256's offset by 64 samples and this is where I get a little unsure... There's another method I haven't actually been able to get to work because Reaktor Core kinda sucks for doing complex math with arrays. You can do nearest-neighbor interpolation by finding the dominant frequency in the FFT and getting the bins before and after that bin, you interpolate their values and can get a more granularly accurate detection of frequency. You math guys will know this better than I.
So, if someone can do that in SM, then that's the hard part. FFT will yield phase information if you unpack it, so you just do the same thing that we did with the zero-crossing, compare phases between left and right channels to figure direction out.
So I dunno if any of that is even possible with SM.. So maybe one of you smarties can chirp up and let us know.
Synthesizer Patel ·
Beuller..
Beuller..
infuzion ·
Very interesting... I'll have to play with it later 🙂
philter5 ·
😕 😕 😕 sorry for this dumb question but what about a visual input to detect and match the beat?
there´s a mixing software called virtual dj that has the almost unique option to detect RPM with your webcam.
you have to place the webcam over your turntable and (if the vinyl cover is blank etc...)give the webcam a point that it could focus. it does not matter if you place a vinyl on the turntable or just use your blank deck. Important is that the cam could focus a point so the best way is to use the blank deck and just place a small sticker (that is different coulored from the rest) @ the plate . after short calibration at 33 RPM the software adapts the bpm and from now on you are able to control the mp3 files you are mixing with the movement of the turntable. The timing isn´t really good but it is a cheap solution if you don´t have the money to buy final scratch or Rane. i hope you guys understand me i almost got crazy writing these few words and i don´t know if its clear what i mean 😕
so what i want to know is if this is possible with sm?
the main idea was: i have created a webcam capture module last week.
its a simple module that loads a new picture every second and deletes the last one loaded. now you need a webcam snapshot tool that is able to create pictures at specific motion treshold or at a specific time rate. i used time rate and set the option to take a snapshot every sec. now you see a continiusly updated picture in sm and you can move your hand etc over the webcam to get float values that are detected by color scanners.i will post the osm later. perhaps somebody can need it.
Harvestein ·
Hi,
Sorry to resurrect such an old post, but google popped this up in a search.
I have to thank you for the explanation of how the time coded vinyl works. I could find few resources, if someone could help me find more i would appreciate it.
I was wondering if their is software available or written by someone that reads the live timecoded input, extracts the speed and direction and out puts those values. I am not too hot at programming and id rather skip this part. Or has someone managed to 'rip out' this part of the software from serato/traktor etc (not that i would condone such a thing).
Any advice would be appreciated, i need to be able to use timcoded vinyl for a controller im building. Thankyou.
infuzion ·
Once you understand SMPTE stripped tapes, you'll understand time-code vinyl.
Wrote something here? To have a post removed or your name hidden, write to [email protected].