-
Notifications
You must be signed in to change notification settings - Fork 394
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to use p5 audio library with p5 and canvas-sketch #160
Comments
I can't too, I spend severals hours to fix this, but nothing happen |
Hi! this same question was raised in the creative code course, by bruno
imbrizi. this is the answer:
"it is not possible to save the video with audio using the canvas-sketch
--stream command.
Canvas-sketch is designed to be asynchronous, it waits for each frame to
render completely before moving on to the next. Let's say you are exporting
something complicated and using large dimensions. Even if it runs slowly in
real time, canvas-sketch can still export a video smoothly.
When it comes to audio, it has its own timeline. It's not possible to split
it into audio chunks per frame and then stitch it all together seamlessly.
The best way to export a sketch with video and audio together is to run it
in real time and use screen recording software."
El vie, 29 jul 2022 a las 12:26, Juru ***@***.***>) escribió:
… I can't too, I spend severals hours to fix this, but nothing happen
I subscribe here if someone got the solution !
—
Reply to this email directly, view it on GitHub
<#160 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AVTWEE37UK5S5Z2FNGBJNQ3VWPZ2VANCNFSM53TB3KRA>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
This is somewhat hacky and not an ideal way but it works 🤷 const canvasSketch = require("canvas-sketch");
const p5 = require("p5");
window.p5 = p5;
require("p5/lib/addons/p5.sound");
const sketch = ({ p5 }) => {
const mySynth = new p5.constructor.MonoSynth();
p5.getAudioContext().suspend();
p5.mousePressed = () => {
p5.userStartAudio();
mySynth.play();
};
return ({ context, width, height }) => {
context.fillStyle = `#aaa`;
context.fillRect(0, 0, width, height);
};
};
const settings = {
dimensions: [600, 600],
p5: p5,
};
canvasSketch(sketch, settings); If it throws an error with undefined |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi Matt, I’m currently trying to get realtime audio through p5-sound with canvas-sketch but I can’t seem to make it work. When I call for const mic = new p5.AudioIn();
It says that p5.AudioIn is not a constructor. If I add it through a require with the path, it says that p5 is undefined. I looked on the web and it seem to say that to make it work I have to add the script tag in the html but there is none in canvas-sketch file system. I was wondering if you had any tip. It does the same thing with p5.DOM. Thanks!
The text was updated successfully, but these errors were encountered: