Class PitchShifter
java.lang.Object
de.pottgames.tuningfork.SoundEffectData
de.pottgames.tuningfork.PitchShifter
The pitch shifter applies time-invariant pitch shifting to the input signal, over a one octave range and controllable at a semi-tone and cent resolution.
-
Field Summary
FieldsModifier and TypeFieldDescriptionintRange: -12 - 12, Default: 12
This sets the number of semitones by which the pitch is shifted.intRange: -50 - 50, Default: 0
This sets the number of cents between Semitones a pitch is shifted. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidapply(int effectId) static PitchShifterchipmunk()correctPitch(float pitch) SetscoarseTuneandfineTuneto values that try to correct a pitch applied to aSoundSource, so that the sound appears to be played back at a pitch of 1.static PitchShifterdemon()booleaninthashCode()static PitchShiftermaxPitch()static PitchShifterminPitch()toString()
-
Field Details
-
coarseTune
public int coarseTuneRange: -12 - 12, Default: 12
This sets the number of semitones by which the pitch is shifted. There are 12 semitones per octave. Negative values create a downwards shift in pitch, positive values pitch the sound upwards. -
fineTune
public int fineTuneRange: -50 - 50, Default: 0
This sets the number of cents between Semitones a pitch is shifted. A Cent is 1/100th of a Semitone. Negative values create a downwards shift in pitch, positive values pitch the sound upwards.
-
-
Constructor Details
-
PitchShifter
public PitchShifter()
-
-
Method Details
-
chipmunk
-
demon
-
maxPitch
-
minPitch
-
correctPitch
SetscoarseTuneandfineTuneto values that try to correct a pitch applied to aSoundSource, so that the sound appears to be played back at a pitch of 1. This way, it is possible to change the playback speed of a sound without changing its pitch.
Note: In order to only hear the pitch corrected sound, the direct sound path must be muted with the help ofSoundSource.setFilter(float, float)set to [0,0].- Parameters:
pitch- - pitch correction only works for 0.5 <= pitch <= 2- Returns:
- the PitchShifter for chaining
-
apply
protected void apply(int effectId) - Specified by:
applyin classSoundEffectData
-
hashCode
-
equals
-
toString
-