[music-dsp] OSC problem on STM32F4Discovery
rossb-lists at audiomulch.com
Mon Apr 9 10:24:53 EDT 2012
Assuming all variables are integers, if phase doesn't divide TABLESIZE
then you will get a different waveform amplutude for adjacent cycles.
Perhaps that's what you're seeing?
At each cycle start the he value of phase will be different. The pattern
of different waveforms will repeat at the rate of the LCM of phaseInc
Usually you would use a fixed point phase accumulator and phase
increment so you can have subsample accurate increment. That won't
change the fact that frequencies that don't have an integer-sample
period will look different each cycle.
On 9/04/2012 11:28 PM, Julian Schmidt wrote:
> Hello all,
> I'm trying to get an oscillator running on the STM32F4 discovery board.
> I'm sending my audio with 44100Hz via I2S to the onboard codec.
> However I'm experiencing strange problems.
> my code ist quite straight forward:
> phase += phaseInc(440); // calculate the phase increment for 440 hz and
> add it to phase
> if(phase >= TABLESIZE) phase -= TABLESIZE;
> return phase/TABLESIZE;
> this should give me a non bw limited saw from 0 to 1.f
> (I also tried it with an actual wavetable in use. a sine is played fine.
> but as soon as overtones are added i get the fluttering)
> My problem is that i get periodic amplitude modulations on the overtones
> about 2-3 times a second.
> the root frequency amplitude is fixed, but the higher the overtone
> frequency, the more it's amplitude drops every now and then.
> this screenshot illustrates the waveform. the upper waveform has some
> ringing on the discontinuity and the lower has not.
> http://i.imgur.com/JyuEr.png (this image is taken from an inverted saw
> wavetable. but the flutter is the same, no matter if i use a bandlimited
> WT or output the phase counter directly)
> the waveform oscillates between the upper and the lower image.
> the amplitude flutter from the overtones is also frequency dependent.
> at 439 and 441 Hz its not really audible.
> so my tought is that is has to do with the wrap of the phase counter.
> but i can't get my head around whats wrong.
> any ideas where this change in overtone amplitude could come from?
> dupswapdrop -- the music-dsp mailing list and website:
> subscription info, FAQ, source code archive, list archive, book reviews,
> dsp links
More information about the music-dsp