# "no content type found for .mp3" error

**URL:** <https://discourse.processing.org/t/no-content-type-found-for-mp3-error/35343>\
**Category:** Libraries\
**Created:** [February 20, 2022, 8:13pm UTC](https://discourse.processing.org/t/no-content-type-found-for-mp3-error/35343 "2022-02-20T20:13:36Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![heurihermilab](https://avatars.discourse-cdn.com/v4/letter/h/aeb1de/32.png) [@heurihermilab](https://discourse.processing.org/u/heurihermilab)\
**Post date:** [February 20, 2022, 8:13pm UTC](https://discourse.processing.org/t/no-content-type-found-for-mp3-error/35343/1 "2022-02-20T20:13:37Z")

</div>

Howdy all,

I’m trying to work with the example at [reference | p5.js](https://p5js.org/reference/#/p5.FFT) but

- clicking on the canvas to start/pause the audio inexplicably only works once for each state

- the sketch only executes once, thereafter failing with the error “no content type found for .mp3”

Using version 4 Beta 5 of Processing on M1 Pro 14" MacBook.

Thanks in advance,  
Carl J.

---

<div class="post-metadata">

**Author:** ![heurihermilab](https://avatars.discourse-cdn.com/v4/letter/h/aeb1de/32.png) [@heurihermilab](https://discourse.processing.org/u/heurihermilab)\
**Post date:** [February 20, 2022, 8:20pm UTC](https://discourse.processing.org/t/no-content-type-found-for-mp3-error/35343/2 "2022-02-20T20:20:28Z")

</div>

Here’s all the code (hope this works)…  
Index.html has the proper invocations for SVG and p5.sound.

```auto
let theSound;

function onSoundLoadSuccess(e){
   console.log("load sound success",e);
}
function onSoundLoadError(e){
   console.log("load sound error",e);
}
function onSoundLoadProgress(e){
   console.log("load sound progress",e);
}

function preload() {
  soundFormats('mp3', 'ogg');
  theSound = loadSound('breaths.mp3');
}

function setup() {
  let cnv = createCanvas(displayWidth, displayHeight, SVG);
  cnv.mouseClicked(togglePlay);
  fft = new p5.FFT(0.8, 2048);
  theSound.amp(0.2);
}

function draw() {
  background(20);
  let spectrum = fft.analyze();
  noStroke();
  fill(255, 0, 255);
  for (let i = 0; i< spectrum.length; i++){
    let x = map(i, 0, spectrum.length, 0, width);
    let h = -height + map(spectrum[i], 0, 255, height, 0);
    rect(x, height, width / spectrum.length, h );
  }

  let waveform = fft.waveform();
  noFill();
  beginShape();
  stroke(20);
  for (let i = 0; i < waveform.length; i++){
    let x = map(i, 0, waveform.length, 0, width);
    let y = map( waveform[i], -1, 1, 0, height);
    vertex(x,y);
  }
  endShape();
}

function togglePlay() {
  if (theSound.isPlaying()) {
    theSound.pause();
  } else {
    theSound.loop();
  }
}

```

---

<div class="post-metadata">

**Author:** ![heurihermilab](https://avatars.discourse-cdn.com/v4/letter/h/aeb1de/32.png) [@heurihermilab](https://discourse.processing.org/u/heurihermilab)\
**Post date:** [February 20, 2022, 9:48pm UTC](https://discourse.processing.org/t/no-content-type-found-for-mp3-error/35343/3 "2022-02-20T21:48:02Z")

</div>

—Oh, and Firefox 97.0.1.

---

<div class="post-metadata">

**Author:** ![svan](https://avatars.discourse-cdn.com/v4/letter/s/82dd89/32.png) [@svan](https://discourse.processing.org/u/svan)\
**Post date:** [February 20, 2022, 10:54pm UTC](https://discourse.processing.org/t/no-content-type-found-for-mp3-error/35343/4 "2022-02-20T22:54:00Z")

</div>

You might have better luck in p5.js web editor (Chrome browser). The following changes to your code worked on my system:

```auto
function preload() {
  soundFormats('mp3', 'ogg');
  //theSound = loadSound('breaths.mp3');
  theSound = loadSound('assets/Damscray_DancingTiger.mp3');
}

function setup() {
  let cnv = createCanvas(displayWidth, displayHeight);
  cnv.mouseClicked(togglePlay);
  fft = new p5.FFT(0.8, 2048);
  theSound.amp(0.2);
}

```

Set up a folder called ‘assets’ then drag’ndrop your mp3 file to upload it to the folder. Add the sound script to index.html as the reference states. I dropped ‘SVG’ because I didn’t know what it was.

**output:**

 ![out](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/8/82c42099f71f4bcac70e5fdff14420e20a392b6c.png)

---

<div class="post-metadata">

**Author:** ![heurihermilab](https://avatars.discourse-cdn.com/v4/letter/h/aeb1de/32.png) [@heurihermilab](https://discourse.processing.org/u/heurihermilab)\
**Post date:** [February 21, 2022, 6:34pm UTC](https://discourse.processing.org/t/no-content-type-found-for-mp3-error/35343/5 "2022-02-21T18:34:50Z")

</div>

Thanks for the response!

I’d already tried the web editor but could find no way to upload assets. I don’t run Chrome for privacy reasons.

Unfortunately, I’m trying to bootstrap into an NFT, and the web editor and its assets will not be accessible there.

---

<div class="post-metadata">

**Author:** ![svan](https://avatars.discourse-cdn.com/v4/letter/s/82dd89/32.png) [@svan](https://discourse.processing.org/u/svan)\
**Post date:** [February 21, 2022, 6:49pm UTC](https://discourse.processing.org/t/no-content-type-found-for-mp3-error/35343/6 "2022-02-21T18:49:13Z")

</div>

Click the down arrow beside ‘Sketch Files’ and select ‘Upload file’ from the drop down menu. That will display a dragNdrop window for you to upload your file.

 ![upload](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/c/c0aa82e3e7f72c710ab8f6b008a64beced102d2d.png)

---

<div class="post-metadata">

**Author:** ![svan](https://avatars.discourse-cdn.com/v4/letter/s/82dd89/32.png) [@svan](https://discourse.processing.org/u/svan)\
**Post date:** [February 21, 2022, 7:47pm UTC](https://discourse.processing.org/t/no-content-type-found-for-mp3-error/35343/7 "2022-02-21T19:47:12Z")

</div>

I finally got it to run in Processing IDE using original posted code with these modifications:

```auto
function preload() {
  soundFormats('mp3', 'ogg');
  theSound = loadSound('data/Damscray_DancingTiger.mp3');
}

function setup() {
  let cnv = createCanvas(displayWidth, displayHeight);
  cnv.mouseClicked(togglePlay);
  fft = new p5.FFT(0.8, 2048);
  theSound.amp(0.2);
}

```

1. Create a folder called ‘data’ in your sketch folder and copy/paste your .mp3 file.
2. Make sure ‘p5.sound.js’ is in the libraries folder that is inside of your sketch folder. You may have to copy/paste that also.
3. Make sure index.html script points to the sound file as shown in the reference.
4. Again I had to delete ‘SVG’ because I have no idea what it is.

---

<div class="post-metadata">

**Author:** ![heurihermilab](https://avatars.discourse-cdn.com/v4/letter/h/aeb1de/32.png) [@heurihermilab](https://discourse.processing.org/u/heurihermilab)\
**Post date:** [February 22, 2022, 11:41pm UTC](https://discourse.processing.org/t/no-content-type-found-for-mp3-error/35343/8 "2022-02-22T23:41:26Z")

</div>

Thanks! I appreciate your taking the time to help.

The error, alas, did not go away after reorganizing the sketch directory (and clearing out cruft) but I was able to work around it by switching to Ogg Vorbis.

What’s intriguing is that I swear the same code did work on two occasions with the MP3 file before the error message started appearing instead…

Again, thanks for your efforts, they helped me resolve my situation.

---

<div class="post-metadata">

**Author:** ![heurihermilab](https://avatars.discourse-cdn.com/v4/letter/h/aeb1de/32.png) [@heurihermilab](https://discourse.processing.org/u/heurihermilab)\
**Post date:** [February 24, 2022, 2:37am UTC](https://discourse.processing.org/t/no-content-type-found-for-mp3-error/35343/9 "2022-02-24T02:37:45Z")

</div>

Note: “Upload file” does not appear on this menu in Firefox.

---

<div class="post-metadata">

**Author:** ![svan](https://avatars.discourse-cdn.com/v4/letter/s/82dd89/32.png) [@svan](https://discourse.processing.org/u/svan)\
**Post date:** [February 24, 2022, 3:34am UTC](https://discourse.processing.org/t/no-content-type-found-for-mp3-error/35343/10 "2022-02-24T03:34:35Z")

</div>

I don’t see it in Safari either. Were you able to upload the .mp3 file to the p5.js web editor some other way?

---

<div class="post-metadata">

**Author:** ![heurihermilab](https://avatars.discourse-cdn.com/v4/letter/h/aeb1de/32.png) [@heurihermilab](https://discourse.processing.org/u/heurihermilab)\
**Post date:** [February 24, 2022, 9:24pm UTC](https://discourse.processing.org/t/no-content-type-found-for-mp3-error/35343/11 "2022-02-24T21:24:58Z")

</div>

Nope.

EXTRA\_CHARACTERS\_TO\_ENABLE\_REPLY

---

<div class="post-metadata">

**Author:** ![svan](https://avatars.discourse-cdn.com/v4/letter/s/82dd89/32.png) [@svan](https://discourse.processing.org/u/svan)\
**Post date:** [February 24, 2022, 9:36pm UTC](https://discourse.processing.org/t/no-content-type-found-for-mp3-error/35343/12 "2022-02-24T21:36:00Z")

</div>

Maybe it’s a security feature. [OpenProcessing.org](http://OpenProcessing.org) has a way to upload files (at least it does on my system).
