|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectSimpleSound
Sound
public class Sound
Class that represents a sound. This class is used by the students to extend the capabilities of SimpleSound.
Field Summary |
---|
Fields inherited from class SimpleSound |
---|
MAX_NEG, MAX_POS |
Constructor Summary | |
---|---|
Sound(int numSamples)
Constructor that takes the number of samples that this sound will have Default sampling rate is 22050 samples per second |
|
Sound(Sound copySound)
Constructor that makes a copy of the passed sound |
|
Sound(java.lang.String fileName)
Constructor that takes a file name |
Method Summary | |
---|---|
Sound |
append(Sound appendSound)
Return this sound appended with the input sound |
void |
delete(int start,
int end)
Delete from start to end in this sound |
void |
increaseVolume(double factor)
Increase the volume of a sound |
void |
insertAfter(Sound inSound,
int start)
Insert the input Sound after the specified start Modifies the given sound |
Sound |
mix(Sound mixIn,
double ratio)
Mix the input sound with this sound, with percent ratio of input. |
Sound |
portion(int start,
int end)
Return part of a sound |
Sound |
reverse()
Method to reverse a sound. |
Sound |
scale(double factor)
Scale up or down a sound by the given factor (1.0 returns the same, 2.0 doubles the length, and 0.5 halves the length) |
java.lang.String |
toString()
Method to return the string representation of this sound |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Sound(java.lang.String fileName)
fileName
- the name of the file to read the sound frompublic Sound(int numSamples)
numSamples
- the number of samples desiredpublic Sound(Sound copySound)
copySound
- the sound to copyMethod Detail |
---|
public java.lang.String toString()
toString
in class SimpleSound
public void increaseVolume(double factor)
public Sound reverse()
public Sound append(Sound appendSound)
appendSound
- sound to append to thispublic Sound mix(Sound mixIn, double ratio)
mixIn
- sound to mix inratio
- how much of input mixIn to mix inpublic Sound scale(double factor)
factor
- ratio to increase or decreasepublic void insertAfter(Sound inSound, int start)
inSound
- Sound to insertstart
- index where to start inserting the new soundpublic void delete(int start, int end)
start
- where to start deletionend
- where to stop deletionpublic Sound portion(int start, int end)
start
- where to start returningend
- where to end returning
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |