Dynamic pitch shift

Luis via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Feb 25 07:15:20 PST 2016


On Wednesday, 24 February 2016 at 11:17:27 UTC, Tanel Tagaväli 
wrote:
> Sorry for the confusing state of the codebase.
>
> Only the saw wave generator is currently functional, the `saw` 
> and `sine` functions are not used and should be left out of 
> analysis.
>
> Also, audio output is only to ALSA.

Be careful with naive wave generators. You could get very funny 
artefacts from aliasing. You should try one of this 
approximations :

- Correct naive wave generator :
Use furrier composition to build the wave (ie, sum i=1->n 
An*sin(Wn*t + phase)), On this case, should drop of the sumatory 
the sin that generate armonics  >= (Niquist freq)/2

This way, at least should be enough for sound testing, but isn't 
very efficient.

See for example (C++) this Square wave generator against OpenAL 
(It needed some tweaks about just what you asked on the first 
post. The phase wasn't correct, but was enough for me on these 
moment) : 
https://github.com/Zardoz89/trillek-vcomputer-module/blob/78c9dd7bf0ead23cb9a8ccf29fd30c9d0ed7e2e5/tools/src/AlEngine.cpp#L210

- Wavetables
- band-limited resampling algorithm aka BLIP or BLEP algorithms 
(See http://www.cs.cmu.edu/~eli/L/icmc01/hardsync.html and 
http://slack.net/~ant/libs/audio.html#Blip_Buffer )


More information about the Digitalmars-d-learn mailing list