loadSound getting error: 'AudioContext error at decodeAudioData'

Hi there, I'm getting an error trying to load a soundfile in p5 that I can't seem to find any documentation for. The error I get is "AudioContext error at decodeAudioData for soundtrack.mp3\n The error stack trace includes: \ndecodeAudioData\n at setup (localhost:3000/sketch.js:9:15)". The mp3 file is in the sketch directory, and everything else seems to be in order, can anyone shed any light on this?

var weather;
var ball = {};
var soundFile;

function setup() {
  createCanvas(200, 200);
  loadJSON('http://api.openweathermap.org/data/2.5/weather?q=London,uk&appid=9e063e3eb21fd879e4bf07c87e384bcb', gotData);
  soundFormats('ogg', 'mp3');
  soundFile = loadSound('soundtrack.mp3');

}
function gotData(data) {
  //print(data);
  weather = data;
}

function draw() {
  background(0);
  fill(255);
  if (weather) {
  ellipse(30, 40, (weather.wind.speed *4), (weather.wind.speed *4));
  fill (255, 0, 0);
  text('speed:' + ' ' + weather.wind.speed, 80, 140);
  text('direction:' + ' ' + weather.wind.deg, 80, 160)
  }
}

Answers

  • I am getting the exact same, and my canvas is barebones. Quite literally just the sound file, and playing it at the moment. Could someone chime in if you're getting this too?

Sign In or Register to comment.