Tone Generator Inaccuracies?
Forum rules
If you require help using Audacity, please post on the forum board relevant to your operating system:
Windows
Mac OS X
GNU/Linux and Unix-like
If you require help using Audacity, please post on the forum board relevant to your operating system:
Windows
Mac OS X
GNU/Linux and Unix-like
-
sonusmagus
- Posts: 12
- Joined: Thu Jun 16, 2016 8:59 pm
- Operating System: macOS 10.15 Catalina or later
Tone Generator Inaccuracies?
I need to create very accurate tones @ 96K
I tried to create a 830.61Hz sine wave @ 96K
To get a perfect loop I should be able to multiply 830.61 X 9600 = 7973856 (or 83.061 seconds)
Then simply set start of loop at zero and end of loop at 7973856 and it SHOULD be 100% accurate
When I generate the tone and look at what has been calculated, something is wrong
This has always worked for me with Sound Forge
Any ideas on this?
Thanks
TINLEY
I tried to create a 830.61Hz sine wave @ 96K
To get a perfect loop I should be able to multiply 830.61 X 9600 = 7973856 (or 83.061 seconds)
Then simply set start of loop at zero and end of loop at 7973856 and it SHOULD be 100% accurate
When I generate the tone and look at what has been calculated, something is wrong
This has always worked for me with Sound Forge
Any ideas on this?
Thanks
TINLEY
Re: Tone Generator Inaccuracies?
A frequency of 830.61 Hz has a period of 1/830.61 seconds.
At 96000 Hz sample rate, to convert seconds to samples, multiply seconds by 96000.
So a single cycle at 830.61 Hz would be 96000/830.61 = 115.57770795 sample periods.
68991 cycles of 830.61 Hz at 96000 Hz sample rate would be:
1 cycle period = 96000/830.61 samples
68991 cycles = (68991 * 96000)/ 830.61 = 7973821.64914942
So 7973822 samples will be very nearly perfect.
At 96000 Hz sample rate, to convert seconds to samples, multiply seconds by 96000.
So a single cycle at 830.61 Hz would be 96000/830.61 = 115.57770795 sample periods.
68991 cycles of 830.61 Hz at 96000 Hz sample rate would be:
1 cycle period = 96000/830.61 samples
68991 cycles = (68991 * 96000)/ 830.61 = 7973821.64914942
So 7973822 samples will be very nearly perfect.
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)
-
sonusmagus
- Posts: 12
- Joined: Thu Jun 16, 2016 8:59 pm
- Operating System: macOS 10.15 Catalina or later
Re: Tone Generator Inaccuracies?
I had the first calculation, thanks
But where does 68991 come from?
What would make it perfect?
Can I do this:
83061 cycles of 830.61 Hz at 96000 Hz sample rate would be:
1 cycle period = 96000/830.61 samples
83061 cycles = (83061 * 96000)/ 830.61 = 9600000
So 96000.00 samples will be perfect
I was trying to account for the two decimal places and over complicating it
Now makes perfect sense to me
Thanks
TINLEY
But where does 68991 come from?
What would make it perfect?
Can I do this:
83061 cycles of 830.61 Hz at 96000 Hz sample rate would be:
1 cycle period = 96000/830.61 samples
83061 cycles = (83061 * 96000)/ 830.61 = 9600000
So 96000.00 samples will be perfect
I was trying to account for the two decimal places and over complicating it
Now makes perfect sense to me
Thanks
TINLEY
Re: Tone Generator Inaccuracies?
I looked for the closest number of complete cycles to your figure of 7973856 samples.sonusmagus wrote:But where does 68991 come from?
To do that:
We know that 1 cycle is: "(sample rate)/frequency" samples.
How many cycles in 7973856 samples = (number of samples)/(samples per cycle)
Which gives us:
7973856/(96000/830.61)
= 68991.29721 cycles
Rounding to the closest number of cycles = 68991 cycles.
Any whole number of samples that is an exact multiple of 96000/830.61sonusmagus wrote:What would make it perfect?
Try 100 seconds
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)
Re: Tone Generator Inaccuracies?
or 3,200,000 samples (33.333 seconds)steve wrote:Any whole number of samples that is an exact multiple of 96000/830.61
Try 100 seconds
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)
-
Robert J. H.
- Posts: 3633
- Joined: Thu May 31, 2012 8:33 am
- Operating System: Windows 10
Re: Tone Generator Inaccuracies?
that's a pretty nasty frequency, isn't it?steve wrote:or 3,200,000 samples (33.333 seconds)steve wrote:Any whole number of samples that is an exact multiple of 96000/830.61
Try 100 seconds
The exact value (to 50 places) would be:
830.60939515989027704488357786743025088666010693809 Hz
The question is now how much accuracy one wants.
Steve's 33.3... seconds are perfect for 830.61 Hz
For 830.609 Hz it would be:
1,000 s / GCD(96,000,000 , 830,609) = 1,000 / 1 = 1,000 seconds
and for 830.6094 Hz:
10,000 s / GCD(960,000,000 , 8,306,094) = 10,000 / 6 = 1,666.667 seconds
That's the problem with such irrational, transcendental numbers...
Robert
Re: Tone Generator Inaccuracies?
Is that for G#5/Ab5 at A440?Robert J. H. wrote:The exact value (to 50 places) would be:
830.60939515989027704488357786743025088666010693809 Hz
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)
-
Robert J. H.
- Posts: 3633
- Joined: Thu May 31, 2012 8:33 am
- Operating System: Windows 10
Re: Tone Generator Inaccuracies?
Exactly, for equal temperament to be precise.steve wrote:Is that for G#5/Ab5 at A440?Robert J. H. wrote:The exact value (to 50 places) would be:
830.60939515989027704488357786743025088666010693809 Hz
-
Robert J. H.
- Posts: 3633
- Joined: Thu May 31, 2012 8:33 am
- Operating System: Windows 10
Re: Tone Generator Inaccuracies?
Here's the Octave formula for the frequency value:
>> vpa(sym(440)*2**(11/sym(12)))
It works only with the Symbolic package installed.
>> vpa(sym(440)*2**(11/sym(12)))
It works only with the Symbolic package installed.
-
Gale Andrews
- Quality Assurance
- Posts: 41761
- Joined: Fri Jul 27, 2007 12:02 am
- Operating System: Windows 10
Re: Tone Generator Inaccuracies?
I guess this is of most interest in the "Audio Processing" board so I moved it there.
Gale
Gale
________________________________________FOR INSTANT HELP: (Click on Link below)
* * * * * Tips * * * * * Tutorials * * * * * Quick Start Guide * * * * * Audacity Manual
* * * * * Tips * * * * * Tutorials * * * * * Quick Start Guide * * * * * Audacity Manual