createAudio() creates an audio player. This example displays the player’s controls and adjusts its speed. The playback speed is normal when the mouse is on the left edge of the window, and it gets faster as the mouse moves to the right. More information on using media elements such as audio players is on the p5.MediaElement reference page. The audio file is a public domain piano loop by Josef Pres.
Related Examples
![](/_astro/03_Imported_Media-00_Words-thumbnail.B0ocGCfk_Z18RDyX.webp)
No alt text
Words
Load fonts and draw text.
![](/_astro/03_Imported_Media-01_Copy_Image_Data-thumbnail.C_M5-Apf_Z1ShDY6.webp)
No alt text
Copy Image Data
Paint from an image file onto the canvas.
![](/_astro/03_Imported_Media-02_Alpha_Mask-thumbnail.Cu0OO42U_1jXtbX.webp)
No alt text
Alpha Mask
Use one image to cut out a section of another image.
![](/_astro/03_Imported_Media-03_Image_Transparency-thumbnail.Cds7LBFq_Z2i3fPS.webp)
No alt text
Image Transparency
Make an image translucent on the canvas.
![](/_astro/03_Imported_Media-04_Create_Audio-thumbnail.freIsbi7_2nfLeB.webp)
No alt text
Audio Player
Create a player for an audio file.
![](/_astro/03_Imported_Media-05_Video-thumbnail.2aa8-8AD_ZwCeux.webp)
No alt text
Video Player
Create a player for a video file.
![](/_astro/03_Imported_Media-06_Video_Canvas-thumbnail.BlkAL3PB_ZMnFsG.webp)
No alt text
Video on Canvas
Display and stylize a video on the canvas.
![](/_astro/03_Imported_Media-07_Video_Capture-thumbnail.BoO0NmjW_Z2mN7ra.webp)
No alt text
Video Capture
Display a live video feed from a camera.