CSE 8A Chapter 10.1-10.2: Lecture 19 Reading Assignment - Composing Sound Through Addition, Blending Sounds
Document Summary
Change sample sound values by adding their waves together for(int i = 0; i < source. getlength(); i++) value = this. getsampleat(i) + source. getsampleat(i); this. setsamplevalueat(i, value); What the code above does is first loop through the all of the sound samples in the source. Then, we add the source"s sou(cid:374)d sa(cid:373)ple value to the sou(cid:374)d caller o(cid:271)je(cid:272)t"s sound sample value. We then set the value that we got from the above addition and set it in the. First, you copy part of the first sound, and copy 50% of each sound. Then, you copy the rest of the second sound public void blendsounds() { First, we create copies of both sounds in this method. Then, we loop through the first 20,000 sound samples in the sound1 (which is a copy of one of the sounds we want to blend) we copy each of the sound values into the sound caller object.