Sound triggered by buttons

Hi there,

Does anyone have an idea of how to trigger sounds with buttons on processing? I have found a tutorial for this for p5.js but can’t make it translate to processing…

Ultimately want to use buttons to trigger video clips but starting with sound first…

Thanks

Website examples section, buttons

Then library sound: website libraries section

Thanks @Chrisir.
I’ve had a look and experiment with buttons and the sound library.
So know how to make a button and play a sound seperately.
But unsure how to combine them…
Unsure which part of the code for playing a sound to put into the button sketch.
Am getting errors every time I try and replace parts.
(I am new to coding so still getting used to things…)
Thanks,
Marianne

Ahh - I’ve got this now!
Trying to now make buttons trigger video clips…

1 Like

a not that easy example

as it combines BUTTON as class in a extra myTools.js file
also contains other things you not need

Hi @kll
Thanks for your reply.
I’ve come across examples similar to this and have wanted to recreate one using a similar code but have had problems with p5js. When trying to load a sound file to the sketch the online editor comes up with the error that it does not accept sound files (e.g. mp3, .wav.) and then the downloadable version is no longer available. How do you get round this?
Thanks,
M

ahm…
p5.js online editor is free web space for learning and sharing

so they had to put in a file size limit, possibly you hit that.


when you look my example, there is a mp3 file i uploaded from PDE examples.
after LOGIN you get the option to
/ file / duplicate /
my sketch…

Perfect, will try this thank you!