# Sound in setup doesn't play from openprocessing

**URL:** https://discourse.processing.org/t/sound-in-setup-doesnt-play-from-openprocessing/13185
**Category:** Libraries
**Created:** [August 4, 2019, 2:57pm UTC](https://discourse.processing.org/t/sound-in-setup-doesnt-play-from-openprocessing/13185 "2019-08-04T14:57:00Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![SheCurvesMobius](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/shecurvesmobius/32/7054_2.png) [@SheCurvesMobius](https://discourse.processing.org/u/SheCurvesMobius)
#### Post date: [August 4, 2019, 2:57pm UTC](https://discourse.processing.org/t/sound-in-setup-doesnt-play-from-openprocessing/13185/1 "2019-08-04T14:57:00Z")

</div>

Here’s another interesting finding. Can anyone crack this puzzle? If I place a sound in the setup function it will play when I hit the play button. However, if I navigate to the page through a link on my [openprocessing.org homepage](https://www.openprocessing.org/user/183916#sketches), then the sound won’t play. In that same scenario, if I place the sound in the draw function, though, it does play.

Here’s the code:

```auto
let bell;

function preload() {
	soundFormats('mp3');
	bell = loadSound('doorbell.mp3'); 
}

function setup() {
	createCanvas(windowWidth, windowHeight);
	bell.setVolume(0.5); 
	bell.play();
	clickNotice();	
}

function clickNotice() {
	textSize(12);
	textAlign(CENTER);
	textFont("Helvetica");
	text("If sound doesn't play, click the canvas or hit the refresh button to activate the sketch", width / 2, height / 2);
}

```
