Having a Bad Time!




The RiscPC could have various types of signal input card fitted. Some of these could be used to ‘grab’ analogue waveforms. The Iyonix is a more modern and faster machine and has its own inbuilt audio interface that offers analogue inputs. By using a suitable application you can tell the computer to grab a series of digital samples. For obvious reasons this is tempting as a method for the user being able to capture copies of their old LP or Cassette recordings. Once this is done you can use !CDBurn or CDVDBurn to create an audio CD. Hence these look like convenient routes for transferring treasured sound recordings onto Audio CD. Alas, there is a serious snag which means your sound recordings will have a bad time...

Although the detailed hardware reasons differ, a significant problem that affected most of the RiscPC cards – and now the Iyonix – is that when you sample an analogue input the samples may not be taken and recorded at the times required. In the case of the Iyonix this problem arises due to the sound chip chosen. This, and the software, nominally offers sampling rates over a wide range from a quite low rate up to 48 ksamples/second (per channel). Unfortunately, because of how it works the sound chip actually always insists on running at 48 ksamples/sec.

Audio CD can only handle one sample rate – 44.1 ksamples/sec. As an example, figure 1 shows what you’d get if you sampled a 2 kHz sinewave at this rate. The line shows the input waveform and the blobs the samples.

Fig1.gif - 16Kb

However if you tell the Iyonix sound chip to sample at 44.1 ksamples/sec you’d actually get something like what I’ve shown in Figure 2.

Fig2.gif - 15Kb

What happens is that the chip insists on sampling with a time of just a 1/48000 th of a second between successive samples. This is OK for a while, but a after a few samples the system realises that it is ‘too soon’ for another sample, so one gets ignored. The result is bursts of samples, taken just a 1/48th of a millisecond apart, but with occasional ‘gaps’ where no sample is recorded. This means that at the end of the total length of time of recording there are only 44100 samples for each period of one second, but the individual samples were not taken at uniform intervals of 1/44100th of a second! The result, when recorded onto an audio CD would be something like what I’ve shown in Figure 3.

Fig3.gif - 16Kb

In Figure 3 the broken line shows the original sinewave, and the blobs show the series of sample values produced by replaying the samples at the regular CD rate. You can see that most of the samples have values which are above or below the intended waveform. When the CD is played you’d get a waveform that smoothly joins up the sample blobs – not the original sinewave! The situation may clearer in Figure 4 where I’ve changed to using a 3 kHz sinewave as an example.

Fig4.gif - 28Kb

The thin line shows the result distorted by the incorrect sampling. The broken line shows the original sinewave. The thicker line shows the difference between what we’d get from the incorrectly recorded CD and the result we wanted. This means the thicker line shows the ‘error’ or distortion pattern. Looking carefully we can see that this has a shape that varies from one cycle of the input sinewave to another. This means it isn’t simply harmonic distortion as it contains components whose frequencies aren’t integer multiples of the input sinewave’s frequency.

The process generates a nasty form of signal distortion, caused by the samples not being taken at the required instants. In the above example with a 3kHz waveform the distortion level is over 20%! This is at least one or two orders of magnitude greater than the levels which would tend to have no audible effect. Note also that the error waveform scales with the signal level, so unlike many ‘natural’ distortion mechanisms the percentage of distortion does not reduce if we have a lower signal amplitude.

Fortunately, the amount of distortion does tend to fall with the input signal frequency. Figure 5 illustrates this by using a 300Hz input sinewave. In this case the distortion level is just under 2·5%. This is still audibly high, but much less objectionable than the 20% result. From these results we can expect that the lower the frequencies in the audio, the lower the distortion. This is usual behaviour for ‘timing related’ problems as with slower changes the precision of timing becomes less important.

Fig5.gif - 17Kb

With the old RiscPC cards problems like this tended to arise due to causes like the sample timing being driven by interrupts or a loop counter that failed to give accurate and regular timing. This could be fixed – in principle at least – by using a card that had its own correctly defined sample timing clock and a buffered interface to ensure no losses in communication. But so far as I know, no-one has a ‘fix’ for the Iyonix chip if you wish to use it directly to make Audio CD rate recordings.

The good news is that you should be able to avoid the problem by using the 48 ksamples/sec rate. But this then means you’d have to process the results to ‘resample’ them to 44.1 ksamples/sec data if you wanted to use the results for an audio CD. That’s a topic for another day, but given the above, be cautious of deciding to use either a RiscPC or an Iyonix to sample any of your old LPs or tapes for transferring to CD. You may regret their poor sense of timing!

Jim Lesurf
970 words
2nd Jun 2007



returnblue.gif - 6Kb