I used a photosensor to control when the speaker would make a sound. In the first demo, the speaker goes off when any light hits the photosensor. In the second demo, the speaker goes off when 50% of the light hits the photo sensor.