public class SoundLoop {

    /* This program takes two command line arguments: the name filename.wav of
     * an audio file and an integer n. The program creates and plays
     * a new array that copies the audio samples n times, one after another,
     * then saves this new audio wave into nx-filename.wav
     *
     * Examples:
     * > java-introcs SoundLoop heartbeat.wav 10
     */
    public static void main(String[] args) {
        // Read audio samples and number of repetitions.
        String filename = ______________;
        double[] audio = ______________;
        int repetitions = Integer.parseInt(______________);

        // Array to store new audio.
        double[] repeatedAudio = ______________;

        // Copy the samples in audio into loop.
        for (int repetition = 0; repetition < ______________; repetition++) {
            for (int i = 0; i < ______________; i++) {
                repeatedAudio[______________] = audio[______________];
            }
        }

        // Play new audio.
        StdAudio.play(loop);
        // Save into a new file.
        StdAudio.save(repetitions + "x-" + filename, repeatedAudio);
    }
}
