-b- for work with p5.js it is recommended to use a ( test ) account at https://editor.p5js.org/
also very good for reporting problems / asking questions here at the forum
because in seconds we see code, have needed files at hand, see the result
and can play with it…
after all running you can do download & upload to your server…
-c- also you need to report what OS and browser you use to test it.
like with win 10 / Firefox many things not run, Google Chrome better.
The online editor is so much easier than managing multiple library files etc…Thanks,
What’s weird is that my sketch works great in the online editor but I still get the autoplay error error in my console when I run it from my own server.
p5.sound.min.js:26 Error: getUserMedia is not implemented in this browser
at Object.navigator.mediaDevices.getUserMedia.navigator.mediaDevices.getUserMedia (p5.dom.min.js:3)
at t.AudioIn.start (p5.sound.min.js:26)
at setup (sketch.js:22)
at p5.<anonymous> (p5.js:55224)
at p5._runIfPreloadsAreDone (p5.js:55173)
at p5.<anonymous> (p5.js:55159)
at new p5 (p5.js:55438)
at _globalInit (p5.js:54830)
so your latest ?change? gives same ERROR here
you see that too on OSX?
var mic, soundFile;
var amplitude;
var mapMax = 1.0;
function preload() {
// load the sound, but don't play it yet
//soundFile = loadSound('test.mp3')
}
function setup() {
c = createCanvas(windowWidth, windowHeight);
background(0);
fill(255);
noStroke();
mic = new p5.AudioIn();
mic.start();
// soundFile.play();
amplitude = new p5.Amplitude();
amplitude.setInput(mic);
// amplitude.smooth(0.8); // <-- try this!
}
function draw() {
background(0);
var level = amplitude.getLevel();
text('Amplitude: ' + level, 20, 20);
text('mapMax: ' + mapMax, 20, 40);
// map ellipse height
var ellipseHeight = map(level, 0, mapMax, height, 0);
ellipse(width/2, ellipseHeight, 100, 100);
}
Use of the orientation sensor is deprecated. p5.js:55419:23
Use of the motion sensor is deprecated. p5.js:55419:23
win 10 chrome NOT OK
p5.sound.min.js:24 The AudioContext was not allowed to start. It must be resumed (or created) after a user gesture on the page. https://goo.gl/7K7WLu
t.Context @ p5.sound.min.js:24
p5.sound.min.js:24 The AudioContext was not allowed to start. It must be resumed (or created) after a user gesture on the page. https://goo.gl/7K7WLu
(anonymous) @ p5.sound.min.js:24
but both ask correctly for usage of mic.
now need to work on the chrome info you got already from GoToLoop
and try like
function touchStarted() {
if (getAudioContext().state !== 'running') {
getAudioContext().resume();
}
}