Skip to content

Commit

Permalink
Fix significant audio glitches when voicing/unvoicing.
Browse files Browse the repository at this point in the history
Removed the code that enabled/disabled pitch shifting, as
this resulted in discontinuities.  Instead the pitch shifter is
run with the parameters from the last voiced pitch.
  • Loading branch information
jeremysalwen committed Jan 15, 2022
1 parent b4a5df9 commit 865b7fb
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 7 deletions.
2 changes: 0 additions & 2 deletions pitch_shifter.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@

float* cbo; // circular output buffer
unsigned long cbord; //read index for circular buffer;

int active;
} PitchShifter;


Expand Down
6 changes: 1 addition & 5 deletions talentedhack.c
Original file line number Diff line number Diff line change
Expand Up @@ -320,17 +320,13 @@ static void runTalentedHack(LV2_Handle instance, uint32_t sample_count)
float outpperiod=semitones_to_pperiod(&psTalentedHack->quantizer, outpitch);
// Compute variables for pitch shifter that depend on pitch
ComputePitchShifterVariables(&psTalentedHack->pshifter, pperiod,outpperiod,fs);
psTalentedHack->pshifter.active=1;
} else {
UnVoiceMidi(&psTalentedHack->quantizer,lSampleIndex);
ResetPitchSmoother(&psTalentedHack->psmoother);
psTalentedHack->pshifter.active=0;
}
}
in=ShiftPitch(&psTalentedHack->pshifter,&psTalentedHack->buffer, N);

if(psTalentedHack->pshifter.active) {
in=ShiftPitch(&psTalentedHack->pshifter,&psTalentedHack->buffer, N);
}
unsigned int twoahead = (psTalentedHack->buffer.cbiwr + 2)%N;
if (*psTalentedHack->fcorrector.p_Fcorr>=1) {
in=AddFormants(&psTalentedHack->fcorrector,in,twoahead);
Expand Down

0 comments on commit 865b7fb

Please sign in to comment.