Tonejs / Tone.js

A Web Audio framework for making interactive music in the browser.
https://tonejs.github.io
MIT License
13.53k stars 985 forks source link

How to reduce pitch shift artifacts #803

Closed acndur1a closed 3 years ago

acndur1a commented 3 years ago

This has been brought up before (2 years ago) in issue #383, was wondering if there is any way to reduce the artifacts? Also, with using Tone.GrainPlayer there isn't any clear example on how to connect these and modify pitch.

Was hoping that there be a workaround for reducing the artifacts while using PitchShift or GrainPlayer, any example code would be helpful.

Audio file is provided as either .wav or .mp3

acndur1a commented 3 years ago

@tambien thanks a lot for labelling this for docs! But apart from the example code, I am wondering if there is any way to reduce noise/artifacts when using Pitch Shift or GrainPlayer?

tambien commented 3 years ago

The parameters you choose really depend on amount of pitch shifting you do and also your source audio (i.e. percussive, drone, noisy). I would say there is no magic values, it's just about finding what sounds right for you given your source. In general the more of the pitch shifting you apply, the greater your artifacts are going to be. In the case of GrainPlayer you can adjust the grainSize and overlap to try to reduce artifacts. PitchShift does not have as many controls, you can adjust the windowSize to something that sounds right to you.

liJie-wk commented 2 years ago

This question was very helpful to me