time-nuts@lists.febo.com

Discussion of precise time and frequency measurement

View all threads

shoestring budget & jitter AVR328p

F
folkert
Mon, Oct 16, 2023 11:12 AM

Hello,

As an electronic music-enthousiast I also tinker with sound-chips of
the 8- and 16-bit age. Circuit bending for example. And about that I
have a question.
On my website I published a page describing in a nutshell how tweaking
the clock-frequency of a Philips SAA-1099p soundchip gives interesting
sounds ( https://vanheusden.com/electronics/SAA1099-clock/ ). Here I use
a timer of the Arduino Nano (AVR 328p) as a clock for the SAA1099p
soundchip.
A friend of mine read this and asked me if I have any ideas about the
jitter introduced. Like: if I set the clock to 4MHz, how much jitter
would this give. Now I read somewhere that delays of less than 5ms are
usually not audible but does that also apply to jitter?
First step in the investigation of that is to quantify how much the
jitter introduced is (I guess). I know that when you have a PPS
signal, that you can easily feed that to code that calculates the allan
deviation, but how about clocks in the MHz range? If I divide the clock,
wouldn't that average out any jitter?
My budget is limited and/but I (do) have a hantek DSO-6022BL
oscilloscope, some PicDivs and a 10MHz TCXO.

Regards,

Folkert.

Hello, As an electronic music-enthousiast I also tinker with sound-chips of the 8- and 16-bit age. Circuit bending for example. And about that I have a question. On my website I published a page describing in a nutshell how tweaking the clock-frequency of a Philips SAA-1099p soundchip gives interesting sounds ( https://vanheusden.com/electronics/SAA1099-clock/ ). Here I use a timer of the Arduino Nano (AVR 328p) as a clock for the SAA1099p soundchip. A friend of mine read this and asked me if I have any ideas about the jitter introduced. Like: if I set the clock to 4MHz, how much jitter would this give. Now I read somewhere that delays of less than 5ms are usually not audible but does that also apply to jitter? First step in the investigation of that is to quantify how much the jitter introduced is (I guess). I know that when you have a PPS signal, that you can easily feed that to code that calculates the allan deviation, but how about clocks in the MHz range? If I divide the clock, wouldn't that average out any jitter? My budget is limited and/but I (do) have a hantek DSO-6022BL oscilloscope, some PicDivs and a 10MHz TCXO. Regards, Folkert.
BC
Bob Camp
Wed, Oct 18, 2023 1:14 PM

Hi

A lot depends on how you are dividing the clock signal. The most likely case here is a simple divider that just does integer division ( = the typical timer output on an MCU). You start from a 16 MHz master clock and divide by 4 to get 4 MHz or by 8 to get 2 MHz.

The jitter on the output will be from multiple different sources:

  1. The clock that is driving the MCU. If you are running on the “internal clock” that some MCU’s have, this will be a big deal.

  2. The VCO in any PLL multiplier in your MCU. You might have a 4 MHz external clock that is multiplied to 16 MHz. With a good external clock, this can easily be the dominant source of jitter.

  3. The output circuits on the MCU. Typically this is not a big contributor.

Yes, this list could go on quite a bit further.

Simple answer is that with a proper crystal oscillator into the MCU, your jitter should be << 1 ns.

Jitter is a bit strange. You have the same time jitter regardless of how you divide. Phase noise scales as you multiply or divide. That’s just how the math works out.

Phase noise / phase modulation is a more normal way to look at signal “pollution” in a case like this than jitter. It gets you to numbers that are a bit easier to understand. Saying that a noise contribution is 100 db down puts it on a scale you can understand. ( something like : if your system noise floor is 80 db down …. this doesn’t matter). This is often the better way to dig into a question like this.

Bottom line: No, it’s not a big deal compared to the noise floor’s on the chips you are looking at. That’s true looking at jitter or at phase noise.

Bob

On Oct 16, 2023, at 7:11 AM, folkert via time-nuts time-nuts@lists.febo.com wrote:

Hello,

As an electronic music-enthousiast I also tinker with sound-chips of
the 8- and 16-bit age. Circuit bending for example. And about that I
have a question.
On my website I published a page describing in a nutshell how tweaking
the clock-frequency of a Philips SAA-1099p soundchip gives interesting
sounds ( https://vanheusden.com/electronics/SAA1099-clock/ ). Here I use
a timer of the Arduino Nano (AVR 328p) as a clock for the SAA1099p
soundchip.
A friend of mine read this and asked me if I have any ideas about the
jitter introduced. Like: if I set the clock to 4MHz, how much jitter
would this give. Now I read somewhere that delays of less than 5ms are
usually not audible but does that also apply to jitter?
First step in the investigation of that is to quantify how much the
jitter introduced is (I guess). I know that when you have a PPS
signal, that you can easily feed that to code that calculates the allan
deviation, but how about clocks in the MHz range? If I divide the clock,
wouldn't that average out any jitter?
My budget is limited and/but I (do) have a hantek DSO-6022BL
oscilloscope, some PicDivs and a 10MHz TCXO.

Regards,

Folkert.


time-nuts mailing list -- time-nuts@lists.febo.com
To unsubscribe send an email to time-nuts-leave@lists.febo.com

Hi A lot depends on how you are dividing the clock signal. The most likely case here is a simple divider that just does integer division ( = the typical timer output on an MCU). You start from a 16 MHz master clock and divide by 4 to get 4 MHz or by 8 to get 2 MHz. The jitter on the output will be from multiple different sources: 1) The clock that is driving the MCU. If you are running on the “internal clock” that some MCU’s have, this will be a big deal. 2) The VCO in any PLL multiplier in your MCU. You might have a 4 MHz external clock that is multiplied to 16 MHz. With a good external clock, this can easily be the dominant source of jitter. 3) The output circuits on the MCU. Typically this is not a big contributor. Yes, this list could go on quite a bit further. Simple answer is that with a proper crystal oscillator into the MCU, your jitter should be << 1 ns. Jitter is a bit strange. You have the same time jitter regardless of how you divide. Phase noise scales as you multiply or divide. That’s just how the math works out. Phase noise / phase modulation is a more normal way to look at signal “pollution” in a case like this than jitter. It gets you to numbers that are a bit easier to understand. Saying that a noise contribution is 100 db down puts it on a scale you can understand. ( something like : if your system noise floor is 80 db down …. this doesn’t matter). This is often the better way to dig into a question like this. Bottom line: No, it’s not a big deal compared to the noise floor’s on the chips you are looking at. That’s true looking at jitter or at phase noise. Bob > On Oct 16, 2023, at 7:11 AM, folkert via time-nuts <time-nuts@lists.febo.com> wrote: > > Hello, > > As an electronic music-enthousiast I also tinker with sound-chips of > the 8- and 16-bit age. Circuit bending for example. And about that I > have a question. > On my website I published a page describing in a nutshell how tweaking > the clock-frequency of a Philips SAA-1099p soundchip gives interesting > sounds ( https://vanheusden.com/electronics/SAA1099-clock/ ). Here I use > a timer of the Arduino Nano (AVR 328p) as a clock for the SAA1099p > soundchip. > A friend of mine read this and asked me if I have any ideas about the > jitter introduced. Like: if I set the clock to 4MHz, how much jitter > would this give. Now I read somewhere that delays of less than 5ms are > usually not audible but does that also apply to jitter? > First step in the investigation of that is to quantify how much the > jitter introduced is (I guess). I know that when you have a PPS > signal, that you can easily feed that to code that calculates the allan > deviation, but how about clocks in the MHz range? If I divide the clock, > wouldn't that average out any jitter? > My budget is limited and/but I (do) have a hantek DSO-6022BL > oscilloscope, some PicDivs and a 10MHz TCXO. > > > Regards, > > Folkert. > _______________________________________________ > time-nuts mailing list -- time-nuts@lists.febo.com > To unsubscribe send an email to time-nuts-leave@lists.febo.com
AG
Adrian Godwin
Wed, Oct 18, 2023 1:45 PM

Interesting idea. I would think that the minimal perceptible change (5ms in
your delay example) might map to the time spent at an unexpected frequency
and there would also be a significant parameter in the size of the
frequency error. The measurement of wow and flutter in tape recordings
might provide some benchmarks.

The ideal equipment would be an audio signal generator with the ability to
FM modulate. I have an HP3312A function generator that includes a modulator
source and many others would provide something similar.

It should be possible to construct suitable test sound files and play them
on a computer, but for experimentation it might be better to modify the
frequency in real time. This might be done with an arduino - here's the
basics of a player for .wav files that might be modified for an
adjustable playback rate, or you might just use tone generator code with
continual small variations to the frequency.

https://www.instructables.com/Audio-Player-Using-Arduino-With-Micro-SD-Card/
https://docs.arduino.cc/built-in-examples/digital/toneMelody

On Wed, Oct 18, 2023 at 12:31 PM folkert via time-nuts <
time-nuts@lists.febo.com> wrote:

Hello,

As an electronic music-enthousiast I also tinker with sound-chips of
the 8- and 16-bit age. Circuit bending for example. And about that I
have a question.
On my website I published a page describing in a nutshell how tweaking
the clock-frequency of a Philips SAA-1099p soundchip gives interesting
sounds ( https://vanheusden.com/electronics/SAA1099-clock/ ). Here I use
a timer of the Arduino Nano (AVR 328p) as a clock for the SAA1099p
soundchip.
A friend of mine read this and asked me if I have any ideas about the
jitter introduced. Like: if I set the clock to 4MHz, how much jitter
would this give. Now I read somewhere that delays of less than 5ms are
usually not audible but does that also apply to jitter?
First step in the investigation of that is to quantify how much the
jitter introduced is (I guess). I know that when you have a PPS
signal, that you can easily feed that to code that calculates the allan
deviation, but how about clocks in the MHz range? If I divide the clock,
wouldn't that average out any jitter?
My budget is limited and/but I (do) have a hantek DSO-6022BL
oscilloscope, some PicDivs and a 10MHz TCXO.

Regards,

Folkert.


time-nuts mailing list -- time-nuts@lists.febo.com
To unsubscribe send an email to time-nuts-leave@lists.febo.com

Interesting idea. I would think that the minimal perceptible change (5ms in your delay example) might map to the time spent at an unexpected frequency and there would also be a significant parameter in the size of the frequency error. The measurement of wow and flutter in tape recordings might provide some benchmarks. The ideal equipment would be an audio signal generator with the ability to FM modulate. I have an HP3312A function generator that includes a modulator source and many others would provide something similar. It should be possible to construct suitable test sound files and play them on a computer, but for experimentation it might be better to modify the frequency in real time. This might be done with an arduino - here's the basics of a player for .wav files that might be modified for an adjustable playback rate, or you might just use tone generator code with continual small variations to the frequency. https://www.instructables.com/Audio-Player-Using-Arduino-With-Micro-SD-Card/ https://docs.arduino.cc/built-in-examples/digital/toneMelody On Wed, Oct 18, 2023 at 12:31 PM folkert via time-nuts < time-nuts@lists.febo.com> wrote: > Hello, > > As an electronic music-enthousiast I also tinker with sound-chips of > the 8- and 16-bit age. Circuit bending for example. And about that I > have a question. > On my website I published a page describing in a nutshell how tweaking > the clock-frequency of a Philips SAA-1099p soundchip gives interesting > sounds ( https://vanheusden.com/electronics/SAA1099-clock/ ). Here I use > a timer of the Arduino Nano (AVR 328p) as a clock for the SAA1099p > soundchip. > A friend of mine read this and asked me if I have any ideas about the > jitter introduced. Like: if I set the clock to 4MHz, how much jitter > would this give. Now I read somewhere that delays of less than 5ms are > usually not audible but does that also apply to jitter? > First step in the investigation of that is to quantify how much the > jitter introduced is (I guess). I know that when you have a PPS > signal, that you can easily feed that to code that calculates the allan > deviation, but how about clocks in the MHz range? If I divide the clock, > wouldn't that average out any jitter? > My budget is limited and/but I (do) have a hantek DSO-6022BL > oscilloscope, some PicDivs and a 10MHz TCXO. > > > Regards, > > Folkert. > _______________________________________________ > time-nuts mailing list -- time-nuts@lists.febo.com > To unsubscribe send an email to time-nuts-leave@lists.febo.com >
JL
Jim Lux
Wed, Oct 18, 2023 2:22 PM

I would think that sample timing jitter would look like broadband noise. At least that’s what happens on an ADC - yes, the samples where there’s a large slope (d/dt) the jitter has a larger effect, but I think that “averages out” when looking at many samples. Some individual samples are perturbed more than others.

As for dividing down reducing the jitter, sure - it’s 20 log (N) - just like multiplying up. 

On Mon, 16 Oct 2023 13:11:54 +0200, folkert via time-nuts time-nuts@lists.febo.com wrote:

Hello,

As an electronic music-enthousiast I also tinker with sound-chips of
the 8- and 16-bit age. Circuit bending for example. And about that I
have a question.
On my website I published a page describing in a nutshell how tweaking
the clock-frequency of a Philips SAA-1099p soundchip gives interesting
sounds ( https://vanheusden.com/electronics/SAA1099-clock/ ). Here I use
a timer of the Arduino Nano (AVR 328p) as a clock for the SAA1099p
soundchip.
A friend of mine read this and asked me if I have any ideas about the
jitter introduced. Like: if I set the clock to 4MHz, how much jitter
would this give. Now I read somewhere that delays of less than 5ms are
usually not audible but does that also apply to jitter?
First step in the investigation of that is to quantify how much the
jitter introduced is (I guess). I know that when you have a PPS
signal, that you can easily feed that to code that calculates the allan
deviation, but how about clocks in the MHz range? If I divide the clock,
wouldn't that average out any jitter?
My budget is limited and/but I (do) have a hantek DSO-6022BL
oscilloscope, some PicDivs and a 10MHz TCXO.

Regards,

Folkert.


time-nuts mailing list -- time-nuts@lists.febo.com
To unsubscribe send an email to time-nuts-leave@lists.febo.com
 

I would think that sample timing jitter would look like broadband noise. At least that’s what happens on an ADC - yes, the samples where there’s a large slope (d/dt) the jitter has a larger effect, but I think that “averages out” when looking at many samples. Some individual samples are perturbed more than others. As for dividing down reducing the jitter, sure - it’s 20 log (N) - just like multiplying up.  On Mon, 16 Oct 2023 13:11:54 +0200, folkert via time-nuts <time-nuts@lists.febo.com> wrote: Hello, As an electronic music-enthousiast I also tinker with sound-chips of the 8- and 16-bit age. Circuit bending for example. And about that I have a question. On my website I published a page describing in a nutshell how tweaking the clock-frequency of a Philips SAA-1099p soundchip gives interesting sounds ( https://vanheusden.com/electronics/SAA1099-clock/ ). Here I use a timer of the Arduino Nano (AVR 328p) as a clock for the SAA1099p soundchip. A friend of mine read this and asked me if I have any ideas about the jitter introduced. Like: if I set the clock to 4MHz, how much jitter would this give. Now I read somewhere that delays of less than 5ms are usually not audible but does that also apply to jitter? First step in the investigation of that is to quantify how much the jitter introduced is (I guess). I know that when you have a PPS signal, that you can easily feed that to code that calculates the allan deviation, but how about clocks in the MHz range? If I divide the clock, wouldn't that average out any jitter? My budget is limited and/but I (do) have a hantek DSO-6022BL oscilloscope, some PicDivs and a 10MHz TCXO. Regards, Folkert. _______________________________________________ time-nuts mailing list -- time-nuts@lists.febo.com To unsubscribe send an email to time-nuts-leave@lists.febo.com  
C
chris@chriscaudle.org
Wed, Oct 18, 2023 4:46 PM

On Oct 16 2023, at 6:11 am, folkert via time-nuts
time-nuts@lists.febo.com wrote:

Now I read somewhere that delays of less than 5ms are
usually not audible but does that also apply to jitter?

That needs context, blanket statements like "x is not audible" need to
describe the situation, e.g. starting playing 5ms later (e.g. you
pushed the play button on a file player) 5ms later than you did
yesterday is obviously not audible, but delaying a signal by 5ms and
adding to the original will cause severe comb filtering, and delaying
only one side of a stereo signal by 5ms will cause a very noticeable
shift in the stereo image.

So when you want to talk similarly about clock jitter, you have to
define how the clock is being used, and what device is using the clock.

In general discussing jitter of a clock used for sample conversion is
better discussed in the frequency domain as phase noise, and then you
additionally need to know the sensitivity of the converter to phase
noise on the clock.

First step in the investigation of that is to quantify how much the
jitter introduced is (I guess).

The usual process would be to measure the phase noise of the clock, and
then while having the converter convert a digitally generated single
frequency test signal (assuming the conversion is from digital to
analog) clocked by a high quality clock generator, measure the output
signal with known levels of phase noise at various frequencies added to
the clock while measuring the output signal to see when measurable
sidebands are generated for each frequency and amplitude of added phase
noise.  You can then compare the measured sensitivity of the device to
clock phase noise to the measured phase noise of your generated clock
and determine whether it is likely to be a problem for your use.

For high quality conversion the phase noise of the clock can be a
concern, but using 8 bit devices relaxes your constraints considerably.
One thing which may be a concern even at the higher noise floors of an
8-bit device is repetitive division errors which could show up as a
distinct tone in the conversion.  For most converter designs phase
noise on the sample clock become phase or frequency modulation of the
output signal, and since that is typically independent of the source
signal it becomes an aharmonic interfering signal that is signal level
dependent.  Having no harmonic relation to the source signal
potentially makes it much more noticeable.

-- Chris Caudle

On Oct 16 2023, at 6:11 am, folkert via time-nuts
time-nuts@lists.febo.com wrote:

Hello,

As an electronic music-enthousiast I also tinker with sound-chips of
the 8- and 16-bit age. Circuit bending for example. And about that I
have a question.
On my website I published a page describing in a nutshell how tweaking
the clock-frequency of a Philips SAA-1099p soundchip gives interesting
sounds ( https://vanheusden.com/electronics/SAA1099-clock/ ). Here I use
a timer of the Arduino Nano (AVR 328p) as a clock for the SAA1099p
soundchip.
A friend of mine read this and asked me if I have any ideas about the
jitter introduced. Like: if I set the clock to 4MHz, how much jitter
would this give. Now I read somewhere that delays of less than 5ms are
usually not audible but does that also apply to jitter?
First step in the investigation of that is to quantify how much the
jitter introduced is (I guess). I know that when you have a PPS
signal, that you can easily feed that to code that calculates the allan
deviation, but how about clocks in the MHz range? If I divide the clock,
wouldn't that average out any jitter?
My budget is limited and/but I (do) have a hantek DSO-6022BL
oscilloscope, some PicDivs and a 10MHz TCXO.

Regards,

Folkert.


time-nuts mailing list -- time-nuts@lists.febo.com
To unsubscribe send an email to time-nuts-leave@lists.febo.com

On Oct 16 2023, at 6:11 am, folkert via time-nuts <time-nuts@lists.febo.com> wrote: Now I read somewhere that delays of less than 5ms are usually not audible but does that also apply to jitter? That needs context, blanket statements like "x is not audible" need to describe the situation, e.g. starting playing 5ms later (e.g. you pushed the play button on a file player) 5ms later than you did yesterday is obviously not audible, but delaying a signal by 5ms and adding to the original will cause severe comb filtering, and delaying only one side of a stereo signal by 5ms will cause a very noticeable shift in the stereo image. So when you want to talk similarly about clock jitter, you have to define how the clock is being used, and what device is using the clock. In general discussing jitter of a clock used for sample conversion is better discussed in the frequency domain as phase noise, and then you additionally need to know the sensitivity of the converter to phase noise on the clock. First step in the investigation of that is to quantify how much the jitter introduced is (I guess). The usual process would be to measure the phase noise of the clock, and then while having the converter convert a digitally generated single frequency test signal (assuming the conversion is from digital to analog) clocked by a high quality clock generator, measure the output signal with known levels of phase noise at various frequencies added to the clock while measuring the output signal to see when measurable sidebands are generated for each frequency and amplitude of added phase noise. You can then compare the measured sensitivity of the device to clock phase noise to the measured phase noise of your generated clock and determine whether it is likely to be a problem for your use. For high quality conversion the phase noise of the clock can be a concern, but using 8 bit devices relaxes your constraints considerably. One thing which may be a concern even at the higher noise floors of an 8-bit device is repetitive division errors which could show up as a distinct tone in the conversion. For most converter designs phase noise on the sample clock become phase or frequency modulation of the output signal, and since that is typically independent of the source signal it becomes an aharmonic interfering signal that is signal level dependent. Having no harmonic relation to the source signal potentially makes it much more noticeable. -- Chris Caudle On Oct 16 2023, at 6:11 am, folkert via time-nuts <time-nuts@lists.febo.com> wrote: Hello, As an electronic music-enthousiast I also tinker with sound-chips of the 8- and 16-bit age. Circuit bending for example. And about that I have a question. On my website I published a page describing in a nutshell how tweaking the clock-frequency of a Philips SAA-1099p soundchip gives interesting sounds ( https://vanheusden.com/electronics/SAA1099-clock/ ). Here I use a timer of the Arduino Nano (AVR 328p) as a clock for the SAA1099p soundchip. A friend of mine read this and asked me if I have any ideas about the jitter introduced. Like: if I set the clock to 4MHz, how much jitter would this give. Now I read somewhere that delays of less than 5ms are usually not audible but does that also apply to jitter? First step in the investigation of that is to quantify how much the jitter introduced is (I guess). I know that when you have a PPS signal, that you can easily feed that to code that calculates the allan deviation, but how about clocks in the MHz range? If I divide the clock, wouldn't that average out any jitter? My budget is limited and/but I (do) have a hantek DSO-6022BL oscilloscope, some PicDivs and a 10MHz TCXO. Regards, Folkert. _______________________________________________ time-nuts mailing list -- time-nuts@lists.febo.com To unsubscribe send an email to time-nuts-leave@lists.febo.com
AR
Andrew Rodland
Tue, Oct 31, 2023 4:15 PM

Phase noise causes spectral broadening and spurs — if you were to have your
synthesizer produce a 500Hz sine wave from a 4MHz clock, but the 4MHz clock
has ticks that aren't all 250ns long, then instead of getting a pure tone
on the output you would get something that "spreads out" to the frequencies
on either side of 500Hz, possibly with some sharp peaks some distance away.

But this doesn't really matter for what you're doing.

The way you're programming the timer on the 328 is just an integer divider
coming straight down from the CPU's clock. Every n clock cycles, the output
is told to flip-flop. If you had fractional division (intentionally
alternating between timer periods to get a more accurate long-term
frequency) that would cause spurs. If you were dividing down some faster
clock but then sampling it at the 328's clock rate, that would cause
issues. But what you're doing is basically too simple to go wrong, and the
only noise on the output frequency should be what comes from the input.

That input, on an Arduino Nano, is an Abracon crystal oscillator, which is
nothing special by time-nuts standards, but probably as good or better than
the clock sources in any of the devices where the SAA1099 originally lived.

Probably your biggest contributor will be ADC noise. Try this if you can:
program the SAA to output the cleanest tone you can, and then very very
slowly adjust the pot near the bottom of its range to the point where it
jumps between two discrete frequencies. If you get things just right, you
might get a sort of raspy two-tone output. That would be because successive
analogRead()s are producing different values, causing your timer tick
interval to rapidly and randomly alternate between 1 and 2 clocks. That's
artificially induced jitter. Of course you can also do it at the point
between 2 and 3, between 3 and 4, etc., but that lowest one should be the
most notable.

Andrew

On Wed, Oct 18, 2023 at 6:11 AM folkert via time-nuts <
time-nuts@lists.febo.com> wrote:

Hello,

As an electronic music-enthousiast I also tinker with sound-chips of
the 8- and 16-bit age. Circuit bending for example. And about that I
have a question.
On my website I published a page describing in a nutshell how tweaking
the clock-frequency of a Philips SAA-1099p soundchip gives interesting
sounds ( https://vanheusden.com/electronics/SAA1099-clock/ ). Here I use
a timer of the Arduino Nano (AVR 328p) as a clock for the SAA1099p
soundchip.
A friend of mine read this and asked me if I have any ideas about the
jitter introduced. Like: if I set the clock to 4MHz, how much jitter
would this give. Now I read somewhere that delays of less than 5ms are
usually not audible but does that also apply to jitter?
First step in the investigation of that is to quantify how much the
jitter introduced is (I guess). I know that when you have a PPS
signal, that you can easily feed that to code that calculates the allan
deviation, but how about clocks in the MHz range? If I divide the clock,
wouldn't that average out any jitter?
My budget is limited and/but I (do) have a hantek DSO-6022BL
oscilloscope, some PicDivs and a 10MHz TCXO.

Regards,

Folkert.


time-nuts mailing list -- time-nuts@lists.febo.com
To unsubscribe send an email to time-nuts-leave@lists.febo.com

Phase noise causes spectral broadening and spurs — if you were to have your synthesizer produce a 500Hz sine wave from a 4MHz clock, but the 4MHz clock has ticks that aren't all 250ns long, then instead of getting a pure tone on the output you would get something that "spreads out" to the frequencies on either side of 500Hz, possibly with some sharp peaks some distance away. But this doesn't really matter for what you're doing. The way you're programming the timer on the 328 is just an integer divider coming straight down from the CPU's clock. Every n clock cycles, the output is told to flip-flop. If you had fractional division (intentionally alternating between timer periods to get a more accurate long-term frequency) that would cause spurs. If you were dividing down some *faster* clock but then *sampling* it at the 328's clock rate, that would cause issues. But what you're doing is basically too simple to go wrong, and the only noise on the output frequency should be what comes from the input. That input, on an Arduino Nano, is an Abracon crystal oscillator, which is nothing special by time-nuts standards, but probably as good or better than the clock sources in any of the devices where the SAA1099 originally lived. Probably your biggest contributor will be ADC noise. Try this if you can: program the SAA to output the cleanest tone you can, and then very very slowly adjust the pot near the bottom of its range to the point where it jumps between two discrete frequencies. If you get things just right, you might get a sort of raspy two-tone output. That would be because successive analogRead()s are producing different values, causing your timer tick interval to rapidly and randomly alternate between 1 and 2 clocks. That's artificially induced jitter. Of course you can also do it at the point between 2 and 3, between 3 and 4, etc., but that lowest one should be the most notable. Andrew On Wed, Oct 18, 2023 at 6:11 AM folkert via time-nuts < time-nuts@lists.febo.com> wrote: > Hello, > > As an electronic music-enthousiast I also tinker with sound-chips of > the 8- and 16-bit age. Circuit bending for example. And about that I > have a question. > On my website I published a page describing in a nutshell how tweaking > the clock-frequency of a Philips SAA-1099p soundchip gives interesting > sounds ( https://vanheusden.com/electronics/SAA1099-clock/ ). Here I use > a timer of the Arduino Nano (AVR 328p) as a clock for the SAA1099p > soundchip. > A friend of mine read this and asked me if I have any ideas about the > jitter introduced. Like: if I set the clock to 4MHz, how much jitter > would this give. Now I read somewhere that delays of less than 5ms are > usually not audible but does that also apply to jitter? > First step in the investigation of that is to quantify how much the > jitter introduced is (I guess). I know that when you have a PPS > signal, that you can easily feed that to code that calculates the allan > deviation, but how about clocks in the MHz range? If I divide the clock, > wouldn't that average out any jitter? > My budget is limited and/but I (do) have a hantek DSO-6022BL > oscilloscope, some PicDivs and a 10MHz TCXO. > > > Regards, > > Folkert. > _______________________________________________ > time-nuts mailing list -- time-nuts@lists.febo.com > To unsubscribe send an email to time-nuts-leave@lists.febo.com >