# Embedding Mp3 files hosted elsewhere in my p5 sketch

**URL:** https://discourse.processing.org/t/embedding-mp3-files-hosted-elsewhere-in-my-p5-sketch/19567
**Category:** Libraries
**Created:** [April 9, 2020, 7:36am UTC](https://discourse.processing.org/t/embedding-mp3-files-hosted-elsewhere-in-my-p5-sketch/19567 "2020-04-09T07:36:07Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![isasasa](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/isasasa/32/8742_2.png) [@isasasa](https://discourse.processing.org/u/isasasa)
#### Post date: [April 9, 2020, 7:36am UTC](https://discourse.processing.org/t/embedding-mp3-files-hosted-elsewhere-in-my-p5-sketch/19567/1 "2020-04-09T07:36:08Z")

</div>

So basically I am trying to get a project running on Wordpress that had two sound files in it. I’ve loaded the whole project folder into my c-panel and tried using a short code to run the project but the audio didn’t seem to want to talk to the rest of the sketch.

I don’t want to be too lengthy about this, but basically I am asking

When you have something like this ( taken from the p5 example page [https://p5js.org/examples/sound-load-and-play-sound.html](https://p5js.org/examples/sound-load-and-play-sound.html?fbclid=IwAR3zKhu6-Xo-luyRoNqnTGmYZFB2QZTCfuVWbTYOLRx3qaJVrx424pBot8U) ):

function setup() {  
song = loadSound(‘assets/lucky\_dragons\_-\_power\_melody.mp3’);  
createCanvas(720, 200);  
background(255, 0, 0);  
}

Is it crazy to replace the 'assets/lucky\_dragons\_-\_power\_melody.mp3’ with something like ‘[http://mydomainname/public\_html/wp-content/uploads/processing-projects/ForMe.mp3](http://mydomainname/public_html/wp-content/uploads/processing-projects/ForMe.mp3)’]

Or is that just never going to work…?

---

<div class="post-metadata">

### Author: ![endurance21](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/endurance21/32/8149_2.png) [@endurance21](https://discourse.processing.org/u/endurance21)
#### Post date: [April 9, 2020, 2:50pm UTC](https://discourse.processing.org/t/embedding-mp3-files-hosted-elsewhere-in-my-p5-sketch/19567/2 "2020-04-09T14:50:06Z")

</div>

hi! @isasasa  
yes we can replace `(‘assets/lucky_dragons_-_power_melody.mp3’); ` with a proper location of mp3 file ,  
like i have just tested the same with the link  
`https://archive.org/serve/testmp3testfile/mpthreetest.mp3`  
[here is the link of sketch](https://editor.p5js.org/endurance21/sketches/7RQCggBiV)

As you can see , i have used preload function to load sound, it is done in case of large mp3 files must be loaded before they are used ! thus avoiding chances of errors .  
also as i can see  
[http://mydomainname/public\_html/wp-content/uploads/processing-projects/ForMe.mp3](http://mydomainname/public_html/wp-content/uploads/processing-projects/ForMe.mp3)  
is not working properly , so ensure you are using correct adress of mp3 file !!  
and use preload function() too.

hope that will help !  
let us know if the problem still persist !
