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

Wavetable Osc fail

DSP related issues, mathematics, processing and techniques

Re: Wavetable Osc fail

Postby KG_is_back » Sun Dec 28, 2014 9:24 pm

Try to create the naive wavetable oscillator (one that directly interpolates values form the array you normally input to wavetable prim) in code component, input the original wave. If it will give the same result as the stock wavetable osc, even with different interpolations, then that means that the frequency is naturally in the wavetable itself.
KG_is_back
 
Posts: 1196
Joined: Tue Oct 22, 2013 5:43 pm
Location: Slovakia

Re: Wavetable Osc fail

Postby martinvicanek » Sun Dec 28, 2014 9:33 pm

The peaks go to 16 kHz if you double the WT length. So a 8192 samples WT would accomodate all harmonics for an 8 Hz note. Otherwise you simply run out of samples (and into time aliasing).
User avatar
martinvicanek
 
Posts: 1319
Joined: Sat Jun 22, 2013 8:28 pm

Re: Wavetable Osc fail

Postby tester » Sun Dec 28, 2014 9:45 pm

In such uncertain cases I would do following: an audible test of it.

1) Record such wave.
2) Scale it down, so that the frequency of interest is in tonal range (8kHz is a little bit too high).
3) Use spectral (FFT) filter to check surrounding spectras, including the one of interest. You may need to play with gain adjustments.

If you can hear audible gain difference in spectral areas of interest in regards to surroundings, then the problem is real, with one "but". In practical terms, the issue may be not signifficant (peak gain versus gain of the rest of the spectra = masking). That's why I suggest using FFT filter for the test.

One of problems I encoutered in the past is the fact, that FFT may cheat. Not always what you see - is what you hear. I guess it depends on FFT resolution vs spectral density vs windowing.

(btw, the spectral analyzer I used - at 128kpts - did not showed anything where you pointed...)
Need to take a break? I have something right for you.
Feel free to donate. Thank you for your contribution.
tester
 
Posts: 1786
Joined: Wed Jan 18, 2012 10:52 pm
Location: Poland, internet

Re: Wavetable Osc fail

Postby MyCo » Mon Dec 29, 2014 11:46 am

As KG suggested, I tried it with the waveplayer. The result is the same, that means the problem is in the wave itself, not in the code. That's how it looks with the standard waveplayer (linear interpolation):
waveplayer.jpg
waveplayer.jpg (59.38 KiB) Viewed 23206 times


Making the wavetable bigger is not a solution, because it takes more time to generate the wavetable and also increases the size. The problem would still be there but at lower frequencies. I would rather like to know what is causing this, to fix it for any size of wavetable. I assume it's caused by the highest frequency in the wavetable (from the measurements), and that's why zeroing it get's rid of it. But I have to zero more frequencies to get rid of the imaginary parts in the iFFT as well.
Attachments
Just a wavetable (waveplayer).fsm
(140.09 KiB) Downloaded 1157 times
User avatar
MyCo
 
Posts: 718
Joined: Tue Jul 13, 2010 12:33 pm
Location: Germany

Re: Wavetable Osc fail

Postby KG_is_back » Mon Dec 29, 2014 3:18 pm

I've done some research on aliasing and sampling and thought about it a little bit more. In situation you are describing what actually happens, is that you are upsampling the wavetable. Interpolation serves as a lowpass filter to ensure the result will have only frequencies below Nyquist.

Problem is the Nyquist frequency itself - Nyquist frequency cannot be properly recorded and reconstructed, because although you can record/reconstruct the frequency itself, you cannot record/reconstruct its phase and amplitude properly.

This schematic demonstrates this. It contains two sine oscillators (made in code). They both are set to Nyquist frequency and theoretically should output wave with the same amplitude and different phase (depending on respective phase settings). Yet, graph shows exact opposite - They both generate wave with same phase, but the amplitude differs depending on the phase. (Note, that phase is initiated on first sample - to change it you have to refresh the schematic)

I believe this is closely related to what's happening here with the wavetable osc. I have no idea how to solve this problem.
Attachments
Nyquist.fsm
(2.3 KiB) Downloaded 1087 times
KG_is_back
 
Posts: 1196
Joined: Tue Oct 22, 2013 5:43 pm
Location: Slovakia

Re: Wavetable Osc fail

Postby MyCo » Mon Dec 29, 2014 5:48 pm

Maybe there is something wrong with MAnalyzer... SPAN shows a notch instead of a peak. At least that would make more sense.
Attachments
span.jpg
span.jpg (46.95 KiB) Viewed 23193 times
User avatar
MyCo
 
Posts: 718
Joined: Tue Jul 13, 2010 12:33 pm
Location: Germany

Re: Wavetable Osc fail

Postby KG_is_back » Mon Dec 29, 2014 6:22 pm

I also observed notch with frequency analyzers made in FS (with range boosted to 150dB and fairly large windows)
KG_is_back
 
Posts: 1196
Joined: Tue Oct 22, 2013 5:43 pm
Location: Slovakia

Re: Wavetable Osc fail

Postby tester » Mon Dec 29, 2014 9:14 pm

I bet on analyzer. Consider this. With analyzer - you are using certain FFT resolution and logarithmic view (or - FFT steps don't match peak steps). Which means, that at higher frequencies, peaks from saw - accumulate and are calculated as a sum. Because this is nonlinear process, it should produce quasi peaks and holes, and it will look like a pattern. Graphical data also must be calculated "somehow", so there you have another interpolation set.

It's like observing amplitude modulation of a sine. At low resolution, you have one peak, that behaves strange (fluctuates and gets a sort of hole from time to time), and at high resolution - you have 2 (or 3, depending on AM mode you use) distinct peaks.

I played with analyzer I use a little bit, and at least I noticed, there are places where saw peaks merge, as a result - producing a spectrum that has variated amount of visible peaks in certain spectral areas.

So the first method here would be - to use exported audio signal, rescale it down, and using spectral window - play various ranges of the spectra. 40dB of difference is a huge range in audible levels. The audible distortion would be really nasty. :mrgreen:
Need to take a break? I have something right for you.
Feel free to donate. Thank you for your contribution.
tester
 
Posts: 1786
Joined: Wed Jan 18, 2012 10:52 pm
Location: Poland, internet

Previous

Return to DSP

Who is online

Users browsing this forum: No registered users and 38 guests