Pitch Shifting With Timestreching?
-
Hey!
I’m kind of stuck in determining how to implement some sort of timestreching into my plugin. The timestretching on hise is pretty unreasonable for my use case since I have three samplers and enabling timestreching on all three would be terrible cpu wise. I’m still open to somehow move to a one sampler solution (I chose three since my plugin revolves around the fact that there’s three sound layer (piano, guitar, etc) slots and each of those slots have their own round robins, hence why I went with three samplers), but I was wondering another possibility in that “classic” pitch shifting also changes the time of the sample and using midi note shifts as compensation. The pitch shift in the sampler does a pitch shift without shifting time of sample, but how would I get it so that pitch shifts causing time to shift?
Thanks!
-
The pitch shift in the sampler does a pitch shift without shifting time of sample, but how would I get it so that pitch shifts causing time to shift?
I'm not sure I understand what you're asking. Could you reword the question?
-
@d-healey sorry for the confusion haha, was thinking of the classic/old timestretching/pitchshifting where if you increase pitch, it makes the sample faster and if you decrease pitch, it makes the sample slower. I was thinking to implement this and then a midi shift knob which shifts midi notes such that the pitch would be compensated creating a “timestretch” like feature minus the cpu load. I maybe drastically over complicating things though
-
where if you increase pitch, it makes the sample faster and if you decrease pitch, it makes the sample slower.
That's how pitch shifting has always worked in HISE (up until the new timestretch algorithm was added and gave us a new option).
I was thinking to implement this and then a midi shift knob which shifts midi notes such that the pitch would be compensated creating a “timestretch” like feature minus the cpu load. I maybe drastically over complicating things though
I don't see how that would work. Whenever you change pitch you change time.
-
What you can do is if you have multiple samples, you'll transpose the note so it picks another sample with a different pitch and then pitch it back to the original note. This way you can change the timbre of the sound pretty drastically from soft to harsh.
This can all be done with a single script using
Message.setCoarseDetune()
andMessage.setTransposeAmount()
. -
@d-healey said in Pitch Shifting With Timestreching?:
That's how pitch shifting has always worked in HISE (up until the new timestretch algorithm was added and gave us a new option).
Using the pitch parameter in the sample editor tab in the sampler? When the pitch is increased, the sample still plays at the same speed, even when it was supposed to increase.
@Christoph-Hart said in Pitch Shifting With Timestreching?:
This can all be done with a single script using Message.setCoarseDetune() and Message.setTransposeAmount().
Thanks! This could be useful, but its not what I was really looking for...
I was thinking of pitch shifting that affects tempo. Here's what I was describing in a video I found: video
-
@Casmat said in Pitch Shifting With Timestreching?:
Using the pitch parameter in the sample editor tab in the sampler? When the pitch is increased, the sample still plays at the same speed, even when it was supposed to increase.
If you disable the new time stretching stuff then all the pitch shifting options (stretching samples, adjusting the pitch parameters, using the functions Christoph mentioned, pitch modulators) work by changing the speed of the audio. If they didn't then we wouldn't need the new time stretching algorithm to do it independently.
You probably won't notice it with the pitch parameter of individual samples because the range is small (-100/+100 cents).
With a larger stretch it's clearer
https://filedn.eu/larUQgXOwVjQdvpPaD96lHH/simplescreenrecorder-2023-08-31_10.30.12.mkv
-
@d-healey ahh ok, I understand! However I have samples for mostly every third note, so how would I increase the range of the pitch parameter from the -100-100 cents to something like -12 semitones to 12 semitones?
@d-healey said in Pitch Shifting With Timestreching?:
I don't see how that would work. Whenever you change pitch you change time.
Basically what would happen is that let’s say a person plays C3. Then a handy midi note shift script would take that C3 midi value and instead play C4 (an entirely different sample). Then the C4 would be pitch shifted down to C3, giving the end sound a slowed timestretch effect. The key part is that the midi shift is triggering a different sample that can be lowered by pitch whereas if it was just an one sample instrument, the midi and pitch shifting would cancel out resulting in no timestretch.
-
Basically what would happen is that let’s say a person plays C3. Then a handy midi note shift script would take that C3 midi value and instead play C4 (an entirely different sample). Then the C4 would be pitch shifted down to C3, giving the end sound a slowed timestretch effect. The key part is that the midi shift is triggering a different sample that can be lowered by pitch whereas if it was just an one sample instrument, the midi and pitch shifting would cancel out resulting in no timestretch.
That is exactly what I wrote here:
What you can do is if you have multiple samples, you'll transpose the note so it picks another sample with a different pitch and then pitch it back to the original note. This way you can change the timbre of the sound pretty drastically from soft to harsh.
This can all be done with a single script using Message.setCoarseDetune() and Message.setTransposeAmount().
-
@Christoph-Hart I didn’t realize at the moment haha, sorry for the confusion! :flushed_face: :grinning_face_with_sweat: