JS HOME Index
JS AVR Index
Timing of software sequencers against hardware sequencers
Some days ago, I got my STK500 AVR Starter kit. Of course, the first thing I wanted to program was a midi application.
As PASCAL is my favorite language, I decided to use the AVR-Pascal-compiler (demo version) of
. I really like this AVR programing environment, creating fast and short code. Of course I know that GNU C or Assembler would be better...
So I wrote a little
, which just transforms the incoming midi time clock signal into short 1 msec pulses, of course also with Start/stop and continue signals.
In addition to that, the other I/O outputs of an Atmel AVR 90S2313 chip were used to generate clock/N pulses, which means : N= 2, 3, 5, 7, 9 and 11. Of course, in normal musical applications you will only use 3 and sometimes 2. But sometimes, other division factors may be useful for strange rythmic patterns.
In Steinberg Cubase Score (running under Windows 95), midi time clock is generated with 24 messages per quarter (ppq), or 96 messages per full note. So, you will get 96 pulses per note with the programmed AVR-chip. To prove the ability of my little AVR software, I used a laptop with cubase score, generating midi time clock with 220 bpm (beats (or quarter notes) per minute). This would lead to 5280 pulses per minute or 88 pulses per second, i.e. one pulse each 11,36 millisecond. Theoretically.
The AVR chip worked, sending 1 msecond pulses for clock, start, stop and continue corresponding to the activities of the sequencer program. But the generated time clock pulses intervals were far away from beeing constantly 11,36 milliseconds. Looking on the oscilloscope, I saw a wild jitter around 11 msec without any rule.
I thought to myself : 'this has to be measured', so I recorded the outcoming midi time clock pulse with a harddisc recorder (44,1 KHz, 8Bit, Mono). The result was a (more or less) 88 Hz short square pulse wave, sounding VERY dirty.
programm, I calculated the time intervals between the succeeding notes and found the following distribution :
bar graph of the cumulative distribution of suceeding time intervals in milliseconds from one midi time clock pulse to the next using cubase score
You can see, that there is a high dispersion of time intervals between succeeding midi sync events. This is far away what I would have expected. Cubasis Score is an old software, running on a laptop with 100 MHz, which is of course not state of the art. SO I thought, using new software (Cubasis AVR Version 3, running under Windows 2000) on a faster computer (800 MHz, 512 Mbyte RAM) would solve that problem. No, not at all. The same dispersion, even more grave.
bar graph of the cumulative distribution of suceeding time intervals in milliseconds from one midi time clock pulse to the next using cubasis VST 3
This was the time, I thought, there is a problem with my setup, some systematic error. Perhaps a software problem, or a problem with my harddisc recorder. So I tried the same with a hardware sequencer, in this case a Rave-O-Lution 309 from Quasimidi. Setting : 220 bpm, midi time clock (24 ppq) : on the osciloscope I saw a stable pulse pattern as it should be :
bar graph of the cumulative distribution of suceeding time intervals in milliseconds from one midi time clock pulse to the next using a hardware sequencer (Quasimidi Rave-O-Lution 309)
So, my decision is clear : electronic music with stable timing : NEVER use software sequencers, at least with Cubasxxxx sequencers running under Windows XX.
My next AVR project will perhaps be a simple hardware sequencer....