This reference is for Processing 3.0+. If you have a previous version, use the reference included with your software in the Help menu. If you see any errors or have suggestions, please let us know. If you prefer a more technical reference, visit the Processing Core Javadoc and Libraries Javadoc.



import processing.sound.*;
SoundFile file;

void setup() {
  size(640, 360);
  // Load a soundfile from the /data folder of the sketch and play it back
  file = new SoundFile(this, "sample.mp3");;

void draw() {
Description This is a Soundfile Player which allows to play back and manipulate soundfiles. Supported formats are: WAV, AIF/AIFF, MP3.
frames() Returns the number of frames/samples of the sound file.
sampleRate() Returns the sample rate of the soundfile.
channels() Returns the number of channels in the soundfile.
duration() Returns the duration of the the soundfile.
play() Starts the playback of a soundfile. Only plays the soundfile once.
loop() Starts the playback of a soundfile to loop.
jump() Jump to a specific position in the file while continuing to play.
cue() Cues the playhead to a fixed position in the soundfile. Note that the time parameter supports only integer values.
set() Set multiple parameters at once
pan() Move the sound in a stereo panorama, only supports Mono Files
rate() Change the playback rate of the soundfile.
amp() Changes the amplitude/volume of the player.
add() Offset the output of the player by given value
stop() Stops the player
SoundFile(theParent, path)
Updated on September 13, 2016 05:05:48pm EDT

Creative Commons License