How can you make one file, for example: "out.wav", and in it add "1.wav" 10 times, but without delays. That is, to superimpose the sound on another sound even if the previous one has not finished playing. As I've been trying to do for about an hour and a half now, and all I get is playback one by one (i.e.: first the sound plays completely)
Simplest code:
use hound::{WavReader, WavWriter};
fn main() {
let mut reader = WavReader::open("1.wav").unwrap();
let spec = reader.spec();
let mut writer = WavWriter::create("output.wav", spec).unwrap();
for _ in 0..10 {
for sample in reader.samples::<i16>() {
writer.write_sample(sample.unwrap()).unwrap();
}
reader.seek(0).unwrap();
}
}