public class Waveform extends Analyzer

This is a Waveform analyzer. It returns the waveform of an audio stream the moment it is queried with the analyze() method.
Note that by default all sound generators (including microphone capture from AudioIn) have an amplitude of 1, which means that the values of their waveform will be numbers in the range [-0.5, 0.5].

Author:
icalvin102
  • Field Summary

    Fields

  • Constructor Summary

    Constructors

  • Method Summary

    float[]

    analyze()

    Gets the content of the current audiobuffer from the input source, writes it into this Waveform's `data` array, and returns it.

    float[]

    analyze(float[] value)

    Gets the content of the current audiobuffer from the input source.

    void

    Define the audio input for the analyzer.

  • Field Details

    • data

      public float[] data

  • Constructor Details

    • Waveform

      public Waveform(PApplet parent, int nsamples)

      Parameters:
      parent - typically use "this"
      nsamples - number of waveform samples that you want to be able to read at once (a positive integer).
  • Method Details

    • analyze

      public float[] analyze()

      Gets the content of the current audiobuffer from the input source, writes it into this Waveform's `data` array, and returns it.

      Returns:
      the current audiobuffer of the input source. The array has as many elements as this Waveform analyzer's number of samples
    • analyze

      public float[] analyze(float[] value)

      Gets the content of the current audiobuffer from the input source.

      Parameters:
      value - an array with as many elements as this Waveform analyzer's number of samples
      Returns:
      the current audiobuffer of the input source. The array has as many elements as this Waveform analyzer's number of samples
    • input

      Define the audio input for the analyzer.

      Overrides:
      input in class Analyzer
      Parameters:
      input - the input sound source. Can be an oscillator, noise generator, SoundFile or AudioIn.