|
||||||||
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. Copyright Georgia Institute of Technology 2004
Constructor Summary | |
---|---|
Sound(int numSeconds)
Constructor that takes the number of seconds that this sound will have |
|
Sound(Sound copySound)
Constructor that takes a sound to copy |
|
Sound(String fileName)
Constructor that takes a file name |
Method Summary | |
---|---|
void |
add(Sound source)
Method to add the passed sound to this sound |
void |
blendSounds()
Method to overlap or blend two sounds. |
static Sound |
blendSoundsS()
Method to overlap or blend two sounds. |
void |
changeFreq(double factor)
Method to change the frequency of a sound by the passed factor |
void |
changeFreq2(double factor)
Method to change the frequency of a sound by the passed factor |
void |
changeVolume(double factor)
Method to change the volume (amplitude) of the sound by multiplying the current values in the sound by the passed factor. |
Sound |
clip(int start,
int end)
Method to create a new sound by copying just part of the current sound to a new sound |
void |
copySineWave(int freq,
int maxAmplitude)
Method to copy a sine wave with the given frequency and maximum amplitude to the current sound |
Picture |
createPicture()
Method to turn a sound into a picture |
static Sound |
createSineWave(int freq,
int maxAmplitude)
Method to create a one second sine wave sound with the given frequency and maximum amplitude |
static Sound |
createSoundFromTextFile(String fileName)
Method to create a sound from a text file |
static Sound |
createSquareWave(int freq,
int maxAmplitude)
Method to generate a 1 second sound with square waves with the passed frequency and maximum amplitude. |
static Sound |
createTriangleWave(int freq,
int maxAmplitude)
Method to create a one second triangle wave sound with the given frequency and maximum amplitude |
void |
decreaseVolume()
Method to halve the volume (amplitude) of the sound. |
void |
decreaseVolume2()
Method to halve the volume (amplitude) of the sound. |
void |
doNothing()
Method that just shows how to get each sample value and set it again |
void |
doubleFreq()
Method to double the frequency of a sound by taking every second sample. |
void |
echo(int delay)
Method to add an echo to a sound |
Sound |
echo(int delay,
int numEchoes)
Method to create multiple echoes of the current sound |
void |
forceToExtremes()
Method to set all the sample values to the maximum positive value if they were positive (including 0) and the minimum negative value if they were negative. |
void |
halveFreq()
Method to halve the frequency of a sound by taking each sample twice. |
void |
increaseHalfDecreaseHalf()
Method to increase the first half of the sound (double it) and then decrease the second half (half it). |
void |
increaseVolume()
Method to double the volume (amplitude) of the sound |
static void |
main(String[] args)
|
void |
mirrorFrontToBack()
Method to mirror a sound front to back |
void |
normalize()
Method to normalize (make as loud as possible) a sound. |
static Sound |
pickAndPlay()
Method to pick a sound file, create the sound object, play the sound object, and return the sound object |
void |
play5Freq()
Method to play a sound 5 times and each time increase the frequency. |
static Sound |
playNamed(String fileName)
Method to create a sound object from the given file name and play the sound. |
static Sound |
playSpecificSound()
Method to play a specific sound. |
void |
reverse()
Method to reverse the current sound. |
static Sound |
reverseS(String file)
Method to reverse the sound with the passed file name |
void |
splice()
Method to splice two sounds together with some silence between them into the current sound |
void |
splice(Sound source,
int sourceStart,
int sourceStop,
int targetStart)
Method to copy part of the passed sound into this sound at the given start index |
void |
splicePreamble()
Method to splice "We the " then "United" then "people of the United States" into the current sound |
void |
splicePreamble2()
Method to splice the preamble into the current sound so that it says We the United people of the United States |
static Sound |
splicePreambleS()
Method to splice "United" into "We the people of the United States" by adding it after the "the" |
static Sound |
spliceS()
Method to splice two sounds together with some silence between them into the current sound |
String |
toString()
Method to return the string representation of this sound |
void |
writeSamplesAsText(String fileName)
Method to write out the values in the sound to a file as text |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Sound(String fileName)
fileName
- the name of the file to read the sound frompublic Sound(int numSeconds)
numSeconds
- the number of seconds desiredpublic Sound(Sound copySound)
Method Detail |
---|
public String toString()
toString
in class SimpleSound
public static Sound pickAndPlay()
public static Sound playSpecificSound()
public static Sound playNamed(String fileName)
public void doNothing()
public void increaseVolume()
public void decreaseVolume()
public void decreaseVolume2()
public void changeVolume(double factor)
factor
- the factor to multiply bypublic void normalize()
public void forceToExtremes()
public void increaseHalfDecreaseHalf()
public Sound clip(int start, int end)
start
- the index to start the copy at (inclusive)end
- the index to stop the copy at (inclusive)
public static Sound spliceS()
public void splice()
public void splicePreamble()
public static Sound splicePreambleS()
public void splice(Sound source, int sourceStart, int sourceStop, int targetStart)
source
- the source sound to copy fromsourceStart
- the starting index to copy from in the sourcesourceStop
- the ending index (the copy won't include this)targetStart
- the index to start copying intopublic void splicePreamble2()
public static Sound reverseS(String file)
file
- the name of the file
public void reverse()
public void mirrorFrontToBack()
public static Sound blendSoundsS()
public void blendSounds()
public void echo(int delay)
delay
- the number of samples before the echo startspublic Sound echo(int delay, int numEchoes)
delay
- the number of samples before the echo startsnumEchoes
- the number of echoes desired
public void doubleFreq()
public void halveFreq()
public void changeFreq(double factor)
factor
- the amount to increment the source
index by. A number greater than 1 will increase the
frequency and make the sound higher
while a number less than one will decrease the
frequency and make the sound lower.public void changeFreq2(double factor)
factor
- the amount to increment the source
index by. A number greater than 1 will increase the
frequency and make the sound higher
while a number less than one will decrease the frequency
and make the sound lower.public void play5Freq()
public static Sound createSineWave(int freq, int maxAmplitude)
freq
- the desired frequencymaxAmplitude
- the maximum amplitude
public void copySineWave(int freq, int maxAmplitude)
freq
- the desired frequencymaxAmplitude
- the maximum amplitudepublic void add(Sound source)
source
- the sound to combine with this onepublic static Sound createSquareWave(int freq, int maxAmplitude)
freq
- the desired frequencymaxAmplitude
- the maximum amplitude
public static Sound createTriangleWave(int freq, int maxAmplitude)
freq
- the desired frequencymaxAmplitude
- the maximum amplitude
public void writeSamplesAsText(String fileName)
fileName
- the name of the file to write topublic static Sound createSoundFromTextFile(String fileName)
fileName
- the name of the file to read from
public Picture createPicture()
public static void main(String[] args)
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |