Support

If you have a problem or need to report a bug please email : support@dsprobotics.com

There are 3 sections to this support area:

DOWNLOADS: access to product manuals, support files and drivers

HELP & INFORMATION: tutorials and example files for learning or finding pre-made modules for your projects

USER FORUMS: meet with other users and exchange ideas, you can also get help and assistance here

NEW REGISTRATIONS - please contact us if you wish to register on the forum

Users are reminded of the forum rules they sign up to which prohibits any activity that violates any laws including posting material covered by copyright

The better Multi-Osc

Post any examples or modules that you want to share here

Phase Drift Fixes

Postby martinvicanek » Tue Jun 30, 2015 10:26 pm

Updated harmonic oscillators with phase drift fixed:
viewtopic.php?f=3&t=2871&p=15437#p15437

Updated classical waveforms oscillators with phase drift fixed:
viewtopic.php?f=3&t=2871&p=15534#p15534
User avatar
martinvicanek
 
Posts: 1322
Joined: Sat Jun 22, 2013 8:28 pm

Re: The better Multi-Osc

Postby KG_is_back » Wed Jul 01, 2015 11:32 am

Very nice! Cool how you take advantage of the integer overflow. At first I thought it would reduce the frequency precision, but then I've done the math. The frequency coefficient gets rounded (looses last few decimal digits) if you set the cutoff at (1/256)*nyquist ( =81Hz @44kHz samplerate). For the original floating point the rounding depends on the phase of the oscillator - when the phase gets over 0.5 (oscillator is half cycle through) the oscillator starts to loose precision at any samplerate above 0.5*Nyquist. Smaller the phase, smaller the loss. However, that means the rounding errors are inconsistent and the actual frequency of the oscillator (vs. the one you feed in) is less predictable.

With fixed point arithmetic you can be sure that there are 2**31 possible frequencies ( 2**32 if we count negative too).
If you use freq > 2^-7 then you can be sure the oscillator will not drift ever. For freq < 2^-7 it is not as hard to figure out the real frequency of the osc - for every negative power of two below -7 you loose one binary digit.
KG_is_back
 
Posts: 1196
Joined: Tue Oct 22, 2013 5:43 pm
Location: Slovakia

Re: The better Multi-Osc

Postby tulamide » Wed Jul 01, 2015 4:12 pm

@Martin and @KG:

Just so that you know. If you could listen to a discussion between Stephen Hawking and Albert Einstein - that's how I feel right now :oops:

And a question: Should I implement the new sine osc in the multi-osc, or is it a special case?
"There lies the dog buried" (German saying translated literally)
tulamide
 
Posts: 2692
Joined: Sat Jun 21, 2014 2:48 pm
Location: Germany

Re: The better Multi-Osc

Postby martinvicanek » Wed Jul 01, 2015 11:03 pm

@KG, I am not at all worried about low frequencies losing a bit or two - that's still very accurate even for the LFO range. No, the point is that in the new design, the internal oscillator state is incremented in steps given by the frequency and nothing else. The phase is added when all is done - there is no influence of the phase on the internal state, no rounding errors there. Hence if you take two instances of the oscillator and drive them with the same frequency, they will maintain a constant phase relationship forever. (well at least until the Andromeda galaxy collides with our Milky Way, or until our sun becomes a red giant and swallows the earth - whatever comes first haha). :lol:
@tulamide, yes, please replace the oscillators with the updated versions whenever you get round to it.
User avatar
martinvicanek
 
Posts: 1322
Joined: Sat Jun 22, 2013 8:28 pm

Re: The better Multi-Osc

Postby KG_is_back » Thu Jul 02, 2015 12:26 am

martinvicanek wrote:I am not at all worried about low frequencies losing a bit or two - that's still very accurate even for the LFO range.


Actually it can be an issue in some applications. Like if you need Oscillator to run continuously over long periods of time ( ~days). Like keeping track if AC distribution net is not drifting or something. Saw this in a documentary - if electricity demand drops/rises suddenly the frequency of AC drops/rises too by minuscule amounts - the electricity companies have to monitor that very carefully and adjust power plants energy output accordingly. This becomes even bigger issue with wind-farms, which are completely irradic.

martinvicanek wrote:(well at least until the Andromeda galaxy collides with our Milky Way, or until our sun becomes a red giant and swallows the earth - whatever comes first haha


Andromeda galaxy hits us (Milkyway) in about 3.75 billion years, while sun becomes red giant in cca.4-5billion years. However, as sun get brighter and brighter earth might get inhabitable in under 2 billion Y. The real threat are the solar storms. I think in 19th century one hit us and it basically took out most of telegraph net. Solar storms regularly take down satellites and a big one could potentially fry all electronics on earth including power grid (and most definitely on the orbit). The worst part about it is, well... ever heard of butterfly effect? because that's basically how solar storms form. We can have like 8minute warning ahead if we are lucky - good luck throwing your computer and TV into nearest Faraday cage in that time :lol:
KG_is_back
 
Posts: 1196
Joined: Tue Oct 22, 2013 5:43 pm
Location: Slovakia

Re: The better Multi-Osc

Postby tulamide » Mon Jul 13, 2015 5:06 pm

martinvicanek wrote:@tulamide, yes, please replace the oscillators with the updated versions whenever you get round to it.

Done! Also made a second module, so one can use either bandlimited or naive versions (where applicable, I think it is not needed for sine and noise correct? If not, what would the naive version of the sine be?)
"There lies the dog buried" (German saying translated literally)
tulamide
 
Posts: 2692
Joined: Sat Jun 21, 2014 2:48 pm
Location: Germany

Re: The better Multi-Osc

Postby martinvicanek » Mon Jul 13, 2015 9:09 pm

Correct, and thanks! A sine is bandlimited by definition, there is no "naive" sine. In a way, white noise is the complete opposite: it has full bandwith, and the more it aliases, the better. :mrgreen:
User avatar
martinvicanek
 
Posts: 1322
Joined: Sat Jun 22, 2013 8:28 pm

Re: The better Multi-Osc

Postby KG_is_back » Mon Jul 13, 2015 10:03 pm

martinvicanek wrote: In a way, white noise is the complete opposite: it has full bandwith, and the more it aliases, the better.


well, that is more of a philosophical question. White noise is defined as "noise with equal energy in every frequency band of the same width". In mathematical world it would have overall infinite energy (because continuous bandwidth extends to infinity). That implies, if you would sample such noise into sampled-signal, the aliases would add-up to infinity or you'd filter them out and the magnitude frequency response would no longer be truly flat (if you'd use brickwall-lowpass at nyquist the response would be flat in DC-Nyquist range and zero above, which is also the case of this "white noise" generator).
There is no "white noise" in real world either, since (as far as we can tell) real world can't "interpret" infinite frequency (Planc length is most likely the maximum possible wavelength in the universe, higher frequency waves would most likely collapse into black holes or something).
KG_is_back
 
Posts: 1196
Joined: Tue Oct 22, 2013 5:43 pm
Location: Slovakia

Re: The better Multi-Osc

Postby Perfect Human Interface » Tue Jul 14, 2015 10:41 pm

KG_is_back wrote:There is no "white noise" in real world either, since (as far as we can tell) real world can't "interpret" infinite frequency


Indeed, it's purely a mathematical concept. Interesting how the universe seems to both support and yet limit infinities.

Although remarkable how similar rain or river rapids can sound to noise, audibly speaking. :)
Perfect Human Interface
 
Posts: 643
Joined: Sun Mar 10, 2013 7:32 pm

Re: The better Multi-Osc

Postby KG_is_back » Wed Jul 15, 2015 1:56 am

Perfect Human Interface wrote:lthough remarkable how similar rain or river rapids can sound to noise, audibly speaking.


Yeah, it's simply a limitation of human perception. In both situations the water drops are created by very complicated process and one they hit the surface, they create "randomly" spaced short bursts of sound. Our brain is incapable of recognising the pattern thus considering it random "noise".

Sound is a very good example where model of reality that our brain uses does not correspond with reality. In reality sound is wave, which can equivalently be described as time-varying air pressure or as sum of (co)sine-waves with different frequencies. However, our auditory system does not detect it in that way. Our ears consist of cca.7000 sensory cells (per ear), where each one detects narrow part of the spectrum and transmits "envelope" of that spectrum into the brain. In our brain we "see" (hear) what you can see on a FFT analyser - a frequency graph that changes over time.
Our brain observes time and frequency ( > 20Hz) as two unrelated phenomena, while in reality they are just two ways to describe the same thing. This leads to some weird perception illusions when signal shifts from "time domain" (perceived as value changing in time) into "frequency domain" (perceived as periodic event with frequency).
Good example of this is binaural beat. If you send a two sine-waves each into one ear, with slightly different frequency, your brain can't make sense of that. If the frequency difference is big enough you will hear two "frequencies" one in each ear. But once you choose the differece to be smaller ( <50Hz) you will hear <50Hz "frequency" inside your head (your brain assumes is a single sine wave driven by some weird LFO with <50Hz frequency). It get's even weirder - you can hear this beating downto cca.5Hz ( =you perceive sub-sonic event as a sonic one), where you have a mixed impression of "frequency" (sound with 5Hz) and "beating" (the original sine wave driven by 5Hz LFO).

Similarly, our brains have similar misconception about waves and moving objects. Waves on water seem to "travel" while the water is only slightly moving in circles. This effect of something both "moving" and "not moving" seems slightly paradoxic and confusing. It is even worse with quantum-mechanics which is completely out of human intuition and comprehension.
KG_is_back
 
Posts: 1196
Joined: Tue Oct 22, 2013 5:43 pm
Location: Slovakia

PreviousNext

Return to User Examples

Who is online

Users browsing this forum: No registered users and 15 guests