Programming an echo to a sound
An echo occurs when sound waves produced at one place reflect off a hard surface and return back to the original source. The time it takes for the sound to reach the surface and then return is the delay in the echo. Since sound attenuates (diminishes) as it travels, the reflected sound (echo) is quieter than the original.
Write a method:
private Sound echo ( Sound aSound, double delay,
double factor ) {...
which produces a sound with an echo based on the original sound aSound with a delay of delay seconds and an attenuation of factor. The delay can be converted to a number of samples by multiplying by the sampling rate of the sound. The new sound will be longer than the original sound by the number of samples that make up the delay. The first samples in the echo will just be a copy of the samples from the original sound. Once the delay has elapsed, the next set of samples (until the end of the original sound) will be the sum of the samples in the original sound and the samples from the beginning of the original sound at the attenuated amplitude. Finally the last part of the result will simply be the remaining samples of the original sound at the attenuated amplitude.
Write a program that loads a sound, allows the user to play it and then produces a sound with an echo having a delay of 0.5 seconds and an attenuation of 0.25. The new sound should then be presented for the user to play and, when done, the new sound should be saved.
Re: Programming an echo to a sound
This isn't a homework factory. Recommended reading: How to ask questions the smart way
Also, it might be a good idea to reply to the two responses on your earlier thread before we come to the conclusion that you're not really interested.
db
Re: Programming an echo to a sound
Quote:
Originally Posted by
DarrylBurke
This isn't a homework factory. Recommended reading:
How to ask questions the smart way
Also, it might be a good idea to reply to the two responses on your earlier thread before we come to the conclusion that you're not really interested.
db
No, you're right. It isn't a homework factory, however, I am SO stumped and need help... I literally have not a clue.