Dynamic pitch shift

Nicholas Wilson via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Feb 24 04:59:22 PST 2016


On Wednesday, 24 February 2016 at 10:33:56 UTC, Tanel Tagaväli 
wrote:
> Hello!
>
> I've been making some progress on the native D audio front:
> https://github.com/clinei/daud/tree/28ac042a16ae6785605a9a501b5f867c8f962055
>
> It's a continuous waveform generator, currently outputting a 
> saw wave that changes pitch every 1K frames.
>
> I have a slight problem, however.
> Due to the frequency changing in the middle of a wave, I have 
> to patch the new waveform together with the last, which I've 
> done with `countUntil` at daud/gen.d:211 (I don't need to call 
> popFrontN because the range is a reference type).
>
> However, when calling `RepeatingGenerator.frequency`, the value 
> of `_repeat.front` is not the value of the last frame.
> app.d:61 is a temporary hack.
>
>
> How could I get the value currently passed through `cont` from 
> `_repeat`?

So the buffer holds one period of the waveform?
I'm assuming that you are nowhere near the Niquist limit.
What is your harmonic distortion rate like?
If it's just for audio how much additional distortion would you 
gain from just resetting the wave from the beginning?

Also your static if (false) for debugging ... debug(statement) is 
a thing for a reason :)

Nic


More information about the Digitalmars-d-learn mailing list