public interface SoundList
Modifier and Type | Method and Description |
---|---|
void |
addEcho(float delay,
float percent)
Add an echo effect to the SoundList.
|
void |
addSample(float sample)
Add a single sample to the end of the SoundList.
|
void |
addSample(float[] sample)
Adds a single sample for each channel to the end of the SoundList.
|
void |
changeSpeed(float percentChange)
Change the speed of the sound.
|
void |
changeVolume(float percentToChange,
boolean allowClipping)
Change the volume of all tracks in the sound list, by multiplying every value by the percent to change.
|
void |
clip(float startTime,
float endTime)
Trim the SoundList, by removing all samples before the startTime, and all samples past the end time.
|
SoundList |
clone()
Returns a clone of this SoundList
|
void |
combine(SoundList clipToCombine,
boolean allowClipping)
Combines this SoundList with a new SoundList, by adding the samples together.
|
void |
fadeIn(float fadeDuration)
Fade in.
|
void |
fadeOut(float fadeDuration,
float startTime)
Fade out.
|
float |
getDuration()
Returns The duration of the sound, in seconds.
|
int |
getNumChannels()
The number of channels in the SoundList
|
int |
getNumSamples()
Returns the number of samples in the MusicList
|
float |
getSampleRate()
Returns the sample rate, in samples per second
|
java.util.Iterator<float[]> |
iterator()
Return an iterator that traverses the entire sample, returning an array floats (one for each channel)
|
java.util.Iterator<java.lang.Float> |
iterator(int channel)
Return an iterator that traverses a single channel of the list
|
void |
makeMono(boolean allowClipping)
Combine all channels into a single channel, by adding together all channels into a single channel.
|
void |
reverse()
Reverse the SoundList.
|
void |
spliceIn(float startSpliceTime,
SoundList clipToSplice)
Splice a new SoundList into this soundList.
|
void |
trimSilence(float maxLevel)
Remove the silence at the front and back of the clip.
|
int getNumChannels()
float getSampleRate()
int getNumSamples()
float getDuration()
void fadeIn(float fadeDuration)
fadeDuration
- The time (in seconds) to fade in.void fadeOut(float fadeDuration, float startTime)
fadeDuration
- The time (in seconds) to fade out.startTime
- The time (in seconds) to start to fade outvoid trimSilence(float maxLevel)
maxLevel
- The level at which the sample is kept.void addEcho(float delay, float percent)
delay
- The time (in seconds) before the echo startspercent
- The percent falloff of the echo (0.5 is 50 percent volume, 0.25 is
25 percent volume, and so on. All samples should be clipped to the range -1 .. 1void reverse()
void changeSpeed(float percentChange)
percentChange
- How much to change the speed. 1.0 is no change, 2.0 doubles the speed (and the pitch), 0.5
cuts the speed in half (and lowers the pitch) The sample rate should remain unchanged! This is probably the hardest
function to implement in the entire project.void addSample(float sample)
sample
- The sample to addvoid addSample(float[] sample)
sample
- Array of samples (one for each channel) to add to the end of the SoundListjava.util.Iterator<float[]> iterator()
void changeVolume(float percentToChange, boolean allowClipping)
percentToChange
- The percent to increase the volume. A value of 1 will leave the clip unchanged, 2.0
will make the volume twice as loud, and 0.5 will make the volume 50% as loud.allowClipping
- If allowClipping is true, then values greater than 1.0 or less than -1.0 after the
volume change are clipped to fit in the range. If allowClipping is false, then if any values are greater than 1.0
or less than -1.0, the entire sample is rescaled to fit in the range.java.util.Iterator<java.lang.Float> iterator(int channel)
channel
- The channel to traversevoid clip(float startTime, float endTime)
startTime
- Time to start (in seconds)endTime
- Time to end clip (as measured from the front of the original clip, in seconds)void spliceIn(float startSpliceTime, SoundList clipToSplice)
startSpliceTime
- Time to start the spliceclipToSplice
- The other SoundClip to splice in.void makeMono(boolean allowClipping)
allowClipping
- If allowClipping is true, then values greater than 1.0 or less than -1.0 after the
addition are clipped to fit in the range. If allowClipping is false, then if any values are greater than 1.0
or less than -1.0, the entire sample is rescaled to fit in the range.void combine(SoundList clipToCombine, boolean allowClipping)
clipToCombine
- The clip to combine with this clipallowClipping
- If allowClipping is true, then values greater than 1.0 or less than -1.0 after the
addition are clipped to fit in the range. If allowClipping is false, then the entire sample is rescaledSoundList clone()