Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
MediaElement connect example added.
  • Loading branch information
deveshidwivedi authored Jan 19, 2024
commit e10b406a09a6b4c9cd36278af9c83016849cb74e
33 changes: 33 additions & 0 deletions src/dom/dom.js
Original file line number Diff line number Diff line change
Expand Up @@ -4555,6 +4555,39 @@ class MediaElement extends p5.Element {
* @method connect
* @param {AudioNode|Object} audioNode AudioNode from the Web Audio API,
* or an object from the p5.sound library
* @example
* <div>
* <code>
* let myAudio;
* let reverb;
*
* function preload() {
* myAudio = loadSound('assets/beat.mp3');
* }
* function setup() {
* createCanvas(150, 150);
* textAlign(CENTER);
*
* // Create a reverb effect
* reverb = new p5.Reverb();
*
* // Connect the audio element to the reverb effect
* myAudio.connect(reverb);
*
* // Connect the reverb effect to the main output
* reverb.connect();
*
* myAudio.play();
* }
*
* function draw() {
* background(111, 143, 175);
* }
* </code>
* </div>
*
* @alt
* Reverb-enhanced audio beat displayed on a blue canvas.
*/
connect(obj) {
let audioContext, mainOutput;
Expand Down