- Processing
- p5.js
- Processing.py
- Processing for Android
- Processing for Pi

- Processing Foundation

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.

Class | AudioSample
Name | ### pause()
Examples |
    import processing.sound.*;
    AudioSample sample;

    void setup() {
      size(640, 360);
      background(255);

      // Create an array and manually write a single sine wave oscillation into it.
      int resolution = 1000;
      float[] sinewave = new float[resolution];
      for (int i = 0; i < resolution; i++) {
        sinewave[i] = sin(TWO_PI*i/resolution);
      }

      // Create the audiosample based on the data, set framerate to play 200 oscillations/second
      sample = new AudioSample(this, sinewave, 200 * resolution);
      sample.play();
    }

    void draw() {
    }

    void mousePressed() {
      if (sample.isPlaying()) {
        sample.pause();
      } else {
        sample.play();
      }
    }
Description | Stop the playback of the sample, but cue it to the current position. The next call to play() will continue playing where it left off.
Syntax |
    .pause()
Returns | void

Updated on January 9, 2020 00:33:16pm EST