Class GesturePlayground_back

java.lang.Object
processing.core.PApplet
net.paulhertz.pixelaudio.example.GesturePlayground_back
All Implemented Interfaces:
processing.core.PConstants

public class GesturePlayground_back extends processing.core.PApplet

DONE for granular brushes, construct ADSR, don't read from GUI

GesturePlayground<?b> uses a GUI to provide a tour of the usage and properties of the AudioBrush subclasses GranularBrush and SamplerBrush and the GestureSchedule class. An AudioBrush combines a PACurveMaker and a GestureGranularConfig.Builder. PACurveMaker models gestures, one of the core concepts of PixelAudio. In its simplest encoded form, the PAGesture interface, a gesture consists of an array of points and an array of times. The times array and the points array must be the same size, because the times array records the times when something as-yet-unspecified will happen at the corresponding point in the points array. In my demos for PixelAudio, what happens at a point is typically an audio event and an animation event. The sound happens at the point because points in PixelAudio map onto locations in the sound buffer. Mapping of bitmap locations onto audio buffer indices is another core concept of PixelAudio. Gestures over the 2D space of an image become paths through audio buffers. The audio buffer is traversed either by a granular synthesis engine or by a sampling synthesizer. For the granular synth, a gesture corresponds to a non-linear traversal of an audio buffer, potentially as a continuous sequence of overlapping grains with a single envelope. The sampling synthesizer treats each point as a discrete event with its own envelope. Depending on how gestures and schedules are structured, the two synthesizers can sound very similar, but there are possibilities in each that the other cannot realize. As you might expect, GranularBrush implements granular synth events and SamplerBrush implements sampler synth events. Bother rely on PACUrveMaker which, in addition to capturing the raw gesture of drawing a line, provides methods to reduce points / times and create Bezier paths. PACurveMaker data can also be modified by changing duration, interpolating samples, or non-linear time warping. PAGestureParametric provides a basic structure for implementing these modifications. GesturePlayground uses GestureScheduleBuilder to interpolate and warp time and point lists, with basically the same math.

The parameters for gesture modeling, granular and sampling synthesis, time and sample interpolation, and audio events are modeled in the GUI, which uses GestureGranularConfig.Builder gConfig to track its current state. A GestureGranularConfig instance is associated with each AudioBrush. When you click on an AudioBrush and activate it, its configuration data is loaded to the GUI and you can edit it. It will be saved to the brush when you select another brush or change the edit mode. When a brush is activated with a click, the schedule is built from its PACurveMaker and estureGranularConfig.Builder instance variables:

GestureSchedule schedule = scheduleBuilder.build(gb.curve(), cfg.build(), audioOut.sampleRate());

Part of the calling chain for a GranularBrush:
mouseClicked() calls scheduleGranularBrushClick(gb, x, y);.
In scheduleGranularBrushClick(...) we use gb.snapshot() to build a GestureSchedule Our schedule is loaded outside
a loop by calling audioSched.schedulePoint(startSample, new GranularBrushHappening(x0, y0, gb, schedule, snap)).
We use a loop to schedule animation, dot appearing at the scheduled event points at the right event times.
Each GranularBrushHappening in audioSched will be handled in the AudioListener.processAudioBlock(...) method:
else (h instanceof GranularBrushHappening gbh) {playGranularBrush(gbh.brush, gbh.schedule, gbh.snap, granularMapping);

Part of the calling chain for a SamplerBrush:
mouseClicked() calls scheduleSamplerBrushClick(sb, x, y).
In scheduleSamplerBrushClick() we use sb.snapshot() to build a GestureSchedule and loop through the schedule,
calling audioSched.schedulePoint(startSample + dt, new SamplerPointHappening(x, y, samplePos, len, pan));.
The SamplerPointHappening in audioSched will be handled in the AudioListener.processAudioBlock(...) method:
else if (h instanceof SamplerPointHappening sph) { playSample(sph.samplePos, sph.len, synthGain, samplerEnv, sph.pan); }

  • Field Details

    • pixelaudio

      PixelAudio pixelaudio
    • multigen

      MultiGen multigen
    • genWidth

      int genWidth
    • genHeight

      int genHeight
    • mapper

    • mapSize

      int mapSize
    • baseImage

      processing.core.PImage baseImage
    • mapImage

      processing.core.PImage mapImage
    • chan

    • colors

      int[] colors
    • audioFile

      File audioFile
    • audioFilePath

      String audioFilePath
    • audioFileName

      String audioFileName
    • audioFileTag

      String audioFileTag
    • audioFileLength

      int audioFileLength
    • imageFile

      File imageFile
    • imageFilePath

      String imageFilePath
    • imageFileName

      String imageFileName
    • imageFileTag

      String imageFileTag
    • imageFileWidth

      int imageFileWidth
    • imageFileHeight

      int imageFileHeight
    • isLoadToBoth

      boolean isLoadToBoth
    • daPath

      String daPath
    • daFilename

      String daFilename
    • minim

      ddf.minim.Minim minim
      Minim audio library
    • audioOut

      ddf.minim.AudioOutput audioOut
    • isBufferStale

      boolean isBufferStale
    • sampleRate

      float sampleRate
    • fileSampleRate

      float fileSampleRate
    • audioSignal

      float[] audioSignal
    • playBuffer

      ddf.minim.MultiChannelBuffer playBuffer
    • samplePos

      int samplePos
    • audioLength

      int audioLength
    • samplerEnv

      ADSRParams samplerEnv
    • granularEnv

      ADSRParams granularEnv
    • maxAmplitude

      float maxAmplitude
    • attackTime

      float attackTime
    • decayTime

      float decayTime
    • sustainLevel

      float sustainLevel
    • releaseTime

      float releaseTime
    • pitchScaling

      float pitchScaling
    • defaultPitchScaling

      float defaultPitchScaling
    • lowPitchScaling

      float lowPitchScaling
    • highPitchScaling

      float highPitchScaling
    • envIsGranular

      boolean envIsGranular
    • grainDuration

      int grainDuration
    • noteDuration

      int noteDuration
    • samplelen

      int samplelen
    • synthGain

      float synthGain
    • synthPointGain

      float synthPointGain
    • outputGain

      float outputGain
    • isMuted

      boolean isMuted
    • synth

    • pool

    • sMaxVoices

      int sMaxVoices
    • isUseSynth

      boolean isUseSynth
    • granSignal

      public float[] granSignal
    • gSynth

      public PAGranularInstrument gSynth
    • curveSteps

      public int curveSteps
    • granLength

      public int granLength
    • granHop

      public int granHop
    • gMaxVoices

      public int gMaxVoices
    • currentGranStatus

      String currentGranStatus
    • gDir

    • granularGain

      public float granularGain
    • granularPointGain

      public float granularPointGain
    • useShortGrain

      boolean useShortGrain
    • longSample

      int longSample
    • shortSample

      int shortSample
    • granSamples

      int granSamples
    • hopSamples

      int hopSamples
    • gParamsGesture

      GestureGranularParams gParamsGesture
    • gParamsFixed

      GestureGranularParams gParamsFixed
    • useLongBursts

      boolean useLongBursts
    • maxBurstGrains

      int maxBurstGrains
    • burstGrains

      int burstGrains
    • usePitchedGrains

      boolean usePitchedGrains
    • shift

      int shift
    • totalShift

      int totalShift
    • isAnimating

      boolean isAnimating
    • oldIsAnimating

      boolean oldIsAnimating
    • isTrackMouse

      boolean isTrackMouse
    • animSteps

      int animSteps
    • isRecordingVideo

      boolean isRecordingVideo
    • videoFrameRate

      int videoFrameRate
    • step

      int step
    • videx

      com.hamoid.VideoExport videx
    • curveMaker

      public PACurveMaker curveMaker
    • isDrawMode

      public boolean isDrawMode
    • epsilon

      public float epsilon
    • currentPoint

      public processing.core.PVector currentPoint
    • allPoints

      public ArrayList<processing.core.PVector> allPoints
    • allTimes

      public ArrayList<Integer> allTimes
    • startTime

      public int startTime
    • dragColor

      public int dragColor
    • dragWeight

      public float dragWeight
    • polySteps

      public int polySteps
    • readyBrushColor1

      int readyBrushColor1
    • hoverBrushColor1

      int hoverBrushColor1
    • selectedBrushColor1

      int selectedBrushColor1
    • readyBrushColor2

      int readyBrushColor2
    • hoverBrushColor2

      int hoverBrushColor2
    • selectedBrushColor2

      int selectedBrushColor2
    • dimmedBrushColor

      int dimmedBrushColor
    • circleColor

      int circleColor
    • dimCircleColor

      int dimCircleColor
    • lineColor

      int lineColor
    • dimLineColor

      int dimLineColor
    • animatedCircleColor

      int animatedCircleColor
    • isIgnoreOutsideBounds

      boolean isIgnoreOutsideBounds
    • hoverBrush

      private AudioBrush hoverBrush
      AudioBrush wraps a PACurveMaker (gesture) and a GestureGranularConfig.Builder (granular synthesis parameters)
    • hoverIndex

      private int hoverIndex
    • activeBrush

      private AudioBrush activeBrush
    • granularBrushes

      ArrayList<GranularBrush> granularBrushes
    • activeGranularBrush

      GranularBrush activeGranularBrush
    • activeGranularIndex

      int activeGranularIndex
    • samplerBrushes

      ArrayList<SamplerBrush> samplerBrushes
    • activeSamplerBrush

      SamplerBrush activeSamplerBrush
    • activeSamplerIndex

      int activeSamplerIndex
    • pointTimeLocs

      ArrayList<TimedLocation> pointTimeLocs
    • samplerTimeLocs

      ArrayList<TimedLocation> samplerTimeLocs
    • grainTimeLocs

      ArrayList<TimedLocation> grainTimeLocs
    • pointEventUseSampler

      boolean pointEventUseSampler
    • gConfig

    • defaultGranConfig

      final GestureGranularConfig.Builder defaultGranConfig
    • defaultSampConfig

      final GestureGranularConfig.Builder defaultSampConfig
    • guiSyncing

      boolean guiSyncing
    • baselineCount

      int baselineCount
    • baselineDurationMs

      int baselineDurationMs
    • scheduleBuilder

      GestureScheduleBuilder scheduleBuilder
    • granularMapping

    • mode

    • CURVE_STEPS_HARD_MAX

      static final int CURVE_STEPS_HARD_MAX
      See Also:
    • CURVE_STEPS_SAFE_MAX

      static final int CURVE_STEPS_SAFE_MAX
      See Also:
    • CURVE_STEPS_FLOOR

      static final int CURVE_STEPS_FLOOR
      See Also:
    • doPlayOnDraw

      boolean doPlayOnDraw
    • audioSched

    • audioBlockStartSample

      private final AtomicLong audioBlockStartSample
    • audioNextBlockStartSample

      private final AtomicLong audioNextBlockStartSample
    • dotInbox

    • activeDots

      private final ArrayList<GesturePlayground_back.ActiveDot> activeDots
    • dotLifeMs

      private int dotLifeMs
    • dotDiameter

      private int dotDiameter
    • hopScale

      float hopScale
    • optGrainCount

      int optGrainCount
    • eventStep

      int eventStep
    • isVerbose

      boolean isVerbose
    • isDebugging

      boolean isDebugging
    • controlWindow

      g4p_controls.GWindow controlWindow
    • controlPanel

      g4p_controls.GPanel controlPanel
    • pathSourceLabel

      g4p_controls.GLabel pathSourceLabel
    • pathSourceGroup

      g4p_controls.GToggleGroup pathSourceGroup
    • allOption

      g4p_controls.GOption allOption
    • rdpOption

      g4p_controls.GOption rdpOption
    • curveOption

      g4p_controls.GOption curveOption
    • rdpEpsilonSlider

      g4p_controls.GSlider rdpEpsilonSlider
    • curvePointsSlider

      g4p_controls.GSlider curvePointsSlider
    • hopModeLabel

      g4p_controls.GLabel hopModeLabel
    • hopModeGroup

      g4p_controls.GToggleGroup hopModeGroup
    • gestureOption

      g4p_controls.GOption gestureOption
    • fixedOption

      g4p_controls.GOption fixedOption
    • envelopeLabel

      g4p_controls.GLabel envelopeLabel
    • envelopeMenu

      g4p_controls.GDropList envelopeMenu
    • timingLabel

      g4p_controls.GLabel timingLabel
    • resampleLabel

      g4p_controls.GLabel resampleLabel
    • resampleSlider

      g4p_controls.GSlider resampleSlider
    • resampleField

      g4p_controls.GTextField resampleField
    • durationLabel

      g4p_controls.GLabel durationLabel
    • durationSlider

      g4p_controls.GSlider durationSlider
    • durationField

      g4p_controls.GTextField durationField
    • warpLabel

      g4p_controls.GLabel warpLabel
    • warpSlider

      g4p_controls.GSlider warpSlider
    • epsilonSliderLabel

      g4p_controls.GLabel epsilonSliderLabel
    • curvePointsLabel

      g4p_controls.GLabel curvePointsLabel
    • grainLengthLabel

      g4p_controls.GLabel grainLengthLabel
    • grainLengthSlider

      g4p_controls.GSlider grainLengthSlider
    • hopLengthLabel

      g4p_controls.GLabel hopLengthLabel
    • hopLengthSlider

      g4p_controls.GSlider hopLengthSlider
    • pitchLabel

      g4p_controls.GLabel pitchLabel
    • pitchShiftText

      g4p_controls.GTextField pitchShiftText
    • gainLabel

      g4p_controls.GLabel gainLabel
    • gainSlider

      g4p_controls.GSlider gainSlider
    • grainLengthField

      g4p_controls.GTextField grainLengthField
    • hopLengthField

      g4p_controls.GTextField hopLengthField
    • warpGroup

      g4p_controls.GToggleGroup warpGroup
    • linearWarpOption

      g4p_controls.GOption linearWarpOption
    • expWarpOption

      g4p_controls.GOption expWarpOption
    • squareRootOption

      g4p_controls.GOption squareRootOption
    • customWarpOption

      g4p_controls.GOption customWarpOption
    • arcLengthTimeOption

      g4p_controls.GOption arcLengthTimeOption
    • commentsField

      g4p_controls.GTextArea commentsField
    • adsrItems

      String[] adsrItems
  • Constructor Details

    • GesturePlayground_back

      public GesturePlayground_back()
  • Method Details

    • main

      public static void main(String[] args)
      Parameters:
      args -
    • settings

      public void settings()
      Overrides:
      settings in class processing.core.PApplet
    • setup

      public void setup()
      Overrides:
      setup in class processing.core.PApplet
    • stop

      public void stop()
      turn off audio processing when we exit
      Overrides:
      stop in class processing.core.PApplet
    • getColors

      public int[] getColors(int size)
      Generates an array of rainbow colors using the HSB color space.
      Parameters:
      size - the number of entries in the colors array
      Returns:
      an array of RGB colors ordered by hue
    • initImages

      public void initImages()
      Initializes mapImage with the colors array. mapImage handles the color data for mapper and also serves as our display image.
    • initDrawing

      public void initDrawing()
      Initializes drawing and drawing interaction variables.
    • initConfig

      public void initConfig()
    • initGUI

      public void initGUI()
    • preloadFiles

      public void preloadFiles(String path, String fileName)
    • draw

      public void draw()
      Overrides:
      draw in class processing.core.PApplet
    • handleDrawing

      public void handleDrawing()
      Handles user's drawing actions, draws previously recorded brushstrokes, tracks and generates animation and audio events.
    • findHoverHit

    • updateHover

      void updateHover()
    • writeToScreen

      public void writeToScreen(String msg, int x, int y, int weight, boolean isWhite)
      Displays a line of text to the screen, usually in the draw loop. Handy for debugging. typical call: writeToScreen("When does the mind stop and the world begin?", 64, 1000, 24, true);
      Parameters:
      msg - message to write
      x - x coordinate
      y - y coordinate
      weight - font weight
      isWhite - if true, white text, otherwise, black text
    • mousePressed

      public void mousePressed()
      The built-in mousePressed handler for Processing, but note that it forwards mouse coords to handleMousePressed(). If isDrawMode is true, we start accumulating points to allPoints: initAllPoints() adds the current mouseX and mouseY. After that, the draw loop calls handleDrawing() to add points. Drawing ends on mouseReleased().
      Overrides:
      mousePressed in class processing.core.PApplet
    • mouseDragged

      public void mouseDragged()
      Overrides:
      mouseDragged in class processing.core.PApplet
    • mouseReleased

      public void mouseReleased()
      Overrides:
      mouseReleased in class processing.core.PApplet
    • mouseClicked

      public void mouseClicked()
      Overrides:
      mouseClicked in class processing.core.PApplet
    • keyPressed

      public void keyPressed()
      built-in keyPressed handler, forwards events to parseKey.
      Overrides:
      keyPressed in class processing.core.PApplet
    • parseKey

      public void parseKey(char key, int keyCode)
    • showHelp

      public void showHelp()
      to generate help output, run RegEx search/replace on parseKey case lines with: // case ('.'): // (.+) // println(" * Press $1 to $2.");
    • setAudioGain

      public void setAudioGain(float g)
      Sets audioOut.gain.
      Parameters:
      g - gain value for audioOut, in decibels
    • setMode

      void setMode(GesturePlayground_back.Mode newMode)
    • resetConfigForMode

      void resetConfigForMode()
    • chooseFile

      public void chooseFile()
      Wrapper method for Processing's selectInput command
    • fileSelected

      public void fileSelected(File selectedFile)
      callback method for chooseFile(), handles standard audio and image formats for Processing. If a file has been successfully selected, continues with a call to loadAudioFile() or loadImageFile().
      Parameters:
      selectedFile - the File the user selected
    • loadAudioFile

      public void loadAudioFile(File audFile)
      Attempts to load audio data from a selected file into playBuffer, then calls writeAudioToImage() to transcode audio data and write it to mapImage. Resamples files that are recorded with a different sample rate than the current audio output. If you want to load the image file and audio file separately, comment out writeAudioToImage().
      Parameters:
      audFile - an audio file
    • writeAudioToImage

      public void writeAudioToImage(float[] sig, PixelAudioMapper mapper, processing.core.PImage img, PixelAudioMapper.ChannelNames chan)
      Transcodes audio data in sig[] and writes it to color channel chan of mapImage using the lookup tables in mapper to redirect indexing. Calls mapper.mapSigToImg(), which will throw an IllegalArgumentException if sig.length != img.pixels.length or sig.length != mapper.getSize().
      Parameters:
      sig - an array of float, should be audio data in the range [-1.0, 1.0]
      mapper - a PixelAudioMapper
      img - a PImage
      chan - a color channel
    • commitMapImageToBaseImage

      public void commitMapImageToBaseImage()
    • commitNewBaseImage

      public void commitNewBaseImage(processing.core.PImage img)
    • initAudio

      public void initAudio()
      CALL THIS METHOD IN SETUP() Initializes Minim audio library and audio variables.
    • initTimedEventLists

      public void initTimedEventLists()
      initialize lists of TimedLocation objects, used for animated response to mouse clicks
    • getSamplePos

      public int getSamplePos(int x, int y)
      Calculates the index of the image pixel within the signal path, taking the shifting of pixels and audioSignal into account. See MusicBoxBuffer for use of a windowed buffer in this calculation.
      Parameters:
      x - an x coordinate within mapImage and display bounds
      y - a y coordinate within mapImage and display bounds
      Returns:
      the index of the sample corresponding to (x,y) on the signal path
    • getCoordFromSignalPos

      public processing.core.PVector getCoordFromSignalPos(int pos)
    • runSamplerPointEvent

      void runSamplerPointEvent(int x, int y)
    • runGranularPointEvent

      void runGranularPointEvent(int x, int y)
    • buildPathGranSource

      public PathGranularSource buildPathGranSource(float[] buf, GranularPath camino, GranularSettings settings)
    • playGranularBrush

      void playGranularBrush(GranularBrush gb, GestureSchedule schedule, GestureGranularConfig snap, GestureGranularRenderer.DefaultMapping granularMapping)
    • buildGranSettings

      public GranularSettings buildGranSettings(int len, int hop, GranularSettings.WindowPreset win)
    • playGranular

      public void playGranular(float[] buf, GranularPath camino, GranularSettings settings, boolean isBuildADSR)
    • playGranularGesture

      public void playGranularGesture(float[] buf, GestureSchedule sched, GestureGranularParams params)
    • debugIndexHeadroom

      static void debugIndexHeadroom(float[] buf, int[] startIndices, GestureGranularParams ggp)
    • debugTimesMs

      static void debugTimesMs(GestureSchedule s)
    • calculateEnvelope

      public ADSRParams calculateEnvelope(float gainDb, int totalSamples, float sampleRate)
    • calculateEnvelope

      public ADSRParams calculateEnvelope(float gainDb, float totalMs)
    • playSample

      public int playSample(int samplePos, int samplelen, float amplitude, float pan)
      Plays an audio sample with default envelope and stereo pan.
      Parameters:
      samplePos - position of the sample in the audio buffer
      samplelen - length of the sample (will be adjusted)
      amplitude - amplitude of the sample on playback
      Returns:
      the calculated sample length in samples
    • playSample

      public int playSample(int samplePos, int samplelen, float amplitude, ADSRParams env, float pan)
      Plays an audio sample with a custom envelope and stereo pan.
      Parameters:
      samplePos - position of the sample in the audio buffer
      samplelen - length of the sample (will be adjusted)
      amplitude - amplitude of the sample on playback
      env - an ADSR envelope for the sample
      pan - position of sound in the stereo audio field (-1.0 = left, 0.0 = center, 1.0 = right)
      Returns:
      the calculated sample length in samples
    • playSample

      public int playSample(int samplePos, int samplelen, float amplitude, ADSRParams env, float pitch, float pan)
      Plays an audio sample with with a custom envelope, pitch and stereo pan.
      Parameters:
      samplePos - position of the sample in the audio buffer
      samplelen - length of the sample (will be adjusted)
      amplitude - amplitude of the sample on playback
      env - an ADSR envelope for the sample
      pitch - pitch scaling as deviation from default (1.0), where 0.5 = octave lower, 2.0 = oactave higher
      pan - position of sound in the stereo audio field (-1.0 = left, 0.0 = center, 1.0 = right)
      Returns:
    • calcSampleLen

      public int calcSampleLen(int dur, float mean, float variance)
      Returns:
      a length in samples with some Gaussian variation
    • calcSampleLen

      public int calcSampleLen()
    • ensureSamplerReady

      void ensureSamplerReady()
    • ensureGranularReady

      void ensureGranularReady()
    • buildGranSynth

      public PAGranularInstrument buildGranSynth(ddf.minim.AudioOutput out, ADSRParams env, int numVoices)
    • initGranularParams

      public void initGranularParams()
    • updateAudioChain

      void updateAudioChain(float[] sig)
    • applyColor

      public int[] applyColor(int[] colorSource, int[] graySource, int[] lut)
      Utility method for applying hue and saturation values from a source array of RGB values to the brightness values in a target array of RGB values, using a lookup table to redirect indexing.
      Parameters:
      colorSource - a source array of RGB data from which to obtain hue and saturation values
      graySource - an target array of RGB data from which to obtain brightness values
      lut - a lookup table, must be the same size as colorSource and graySource
      Returns:
      the graySource array of RGB values, with hue and saturation values changed
      Throws:
      IllegalArgumentException - if array arguments are null or if they are not the same length
    • applyColorShifted

      public int[] applyColorShifted(int[] colorSource, int[] graySource, int[] lut, int shift)
    • applyColorMap

      public void applyColorMap()
      applies the Hue and Saturation of pixel values in the colors[] array to mapImage and baseImage
    • initAllPoints

      public void initAllPoints()
      Initializes allPoints and adds the current mouse location to it.
    • handleClickOutsideBrush

      public void handleClickOutsideBrush(int x, int y)
      Respond to mousePressed events, usually by triggering an event
    • isOverAnyBrush

      boolean isOverAnyBrush(int x, int y)
    • addPoint

      public void addPoint(int x, int y)
      While user is dragging the mouse and mode == Mode.DRAW_EDIT_GRANULAR or DRAW_EDIT_SAMPLER, accumulates new points to allPoints and event times to allTimes. Coordinates should be constrained to display window bounds.
    • clipToWidth

      public int clipToWidth(int x)
      Parameters:
      x - a value to constrain to the current window width
      Returns:
      the constrained value
    • clipToHeight

      public int clipToHeight(int y)
      Parameters:
      y - a value to constrain to the current window height
      Returns:
      the constrained value
    • jitterCoord

      public processing.core.PVector jitterCoord(int x, int y, int deviationPx)
    • generateJitterPitch

      float[] generateJitterPitch(int length, float deviationPitch)
    • loadGestureSchedule

      public GestureSchedule loadGestureSchedule(PACurveMaker brush, GestureGranularConfig snap)
    • initCurveMakerAndAddBrush

      public AudioBrush initCurveMakerAndAddBrush()
      Initializes a PACurveMaker instance with allPoints as an argument to the factory method PACurveMaker.buildCurveMaker() and then fills in PACurveMaker instance variables.
    • isBrushInteractable

      boolean isBrushInteractable(AudioBrush b)
    • setActiveBrush

      void setActiveBrush(AudioBrush brush)
    • setActiveBrush

      void setActiveBrush(AudioBrush brush, int idx)
    • recomputeUIBaselinesFromActiveBrush

      void recomputeUIBaselinesFromActiveBrush()
    • drawBrushShapes

      public void drawBrushShapes()
      Iterates over brushShapesList and draws the brushstrokes stored in each PACurveMaker in the list.
    • drawBrushes

      public void drawBrushes(List<? extends AudioBrush> brushes, int readyColor, int hoverColor, int selectedColor)
    • getPathPoints

      ArrayList<processing.core.PVector> getPathPoints(AudioBrush b)
    • getScheduleForBrush

      public GestureSchedule getScheduleForBrush(AudioBrush b)
      Parameters:
      b - an AudioBrushLite instance
      Returns:
      GestureSchedule for the current pathMode of the brush
    • mouseInPoly

      public boolean mouseInPoly(ArrayList<processing.core.PVector> poly)
      Parameters:
      poly - a polygon described by an ArrayList of PVector
      Returns:
      true if the mouse is within the bounds of the polygon, false otherwise
    • pointInPoly

      public boolean pointInPoly(ArrayList<processing.core.PVector> poly, int x, int y)
      Parameters:
      poly - a polygon described by an ArrayList of PVector
      x - x-coordinate
      y - y-coordinate
      Returns:
      true if the mouse is within the bounds of the polygon, false otherwise
    • reset

      public void reset(boolean isClearCurves)
      Reinitializes audio and clears event lists. If isClearCurves is true, clears brushShapesList. TODO clear event lists TODO include granularBrushes
      Parameters:
      isClearCurves -
    • removeActiveBrush

      public void removeActiveBrush()
      Removes the current active PACurveMaker instance, flagged by a highlighted brush stroke, from brushShapesList, if there is one.
    • removeNewestBrush

      public void removeNewestBrush()
      Removes the newest PACurveMaker instance, shown as a brush stroke in the display, from brushShapesList.
    • removeOldestBrush

      public void removeOldestBrush()
      Removes the oldest brush in brushShapesList.
    • scheduleSamplerBrushClick

      void scheduleSamplerBrushClick(SamplerBrush sb, int clickX, int clickY)
    • storeSamplerCurveTL

      public void storeSamplerCurveTL(GestureSchedule sched, int startTime)
    • runSamplerBrushEvents

      public void runSamplerBrushEvents()
    • scheduleGranularBrushClick

      void scheduleGranularBrushClick(GranularBrush gb, int clickX, int clickY)
    • storeGranularCurveTL

      public void storeGranularCurveTL(GestureSchedule sched, int startTime, boolean isGesture)
    • runGrainEvents

      public void runGrainEvents()
      Tracks and runs TimedLocation events in the grainLocsArray list, which is associated with granular synthesis gestures.
    • runPointEvents

      public void runPointEvents()
      Tracks and runs TimedLocation events in the timeLocsArray list, which is associated with mouse clicks that trigger audio a the click point.
    • drawCircle

      public void drawCircle(int x, int y)
      Draws a circle at the location of an audio trigger (mouseDown event).
      Parameters:
      x - x coordinate of circle
      y - y coordinate of circle
    • initListener

      public void initListener()
      Sets up sample-accurate AudioListener called from the Minim audio processing loop. We use the samples() methods in the AudioListener interface to call our processAudioBlock() method. The audio samples don't concern us, just the regular interval over which they are processed: essentially, we have a timer that wakes up at a regular interval.
    • triggerClickHappening

      void triggerClickHappening(GesturePlayground_back.ClickHappening h, int offsetInBlock)
    • oldScheduleGranularBrushClick

      void oldScheduleGranularBrushClick(GranularBrush gb, int x, int y)
    • drawActiveDots

      void drawActiveDots()
    • createGUI

      public void createGUI()
    • createControlWindow

      public void createControlWindow()
    • createControlPanel

      public void createControlPanel()
    • createCommentsField

      public void createCommentsField()
    • createControls

      public void createControls()
    • addControlsToPanel

      public void addControlsToPanel()
    • winDraw

      public void winDraw(processing.core.PApplet appc, g4p_controls.GWinData data)
    • winKey

      public void winKey(processing.core.PApplet appc, g4p_controls.GWinData data, processing.event.KeyEvent evt)
    • controlPanel_hit

      public void controlPanel_hit(g4p_controls.GPanel source, g4p_controls.GEvent event)
    • allOption_clicked

      public void allOption_clicked(g4p_controls.GOption source, g4p_controls.GEvent event)
    • rdpOption_clicked

      public void rdpOption_clicked(g4p_controls.GOption source, g4p_controls.GEvent event)
    • curveOption_clicked

      public void curveOption_clicked(g4p_controls.GOption source, g4p_controls.GEvent event)
    • rdpEpsilonSlider_changed

      public void rdpEpsilonSlider_changed(g4p_controls.GSlider source, g4p_controls.GEvent event)
    • curvePointsSlider_changed

      public void curvePointsSlider_changed(g4p_controls.GSlider source, g4p_controls.GEvent event)
    • gestureOption_clicked

      public void gestureOption_clicked(g4p_controls.GOption source, g4p_controls.GEvent event)
    • fixedOption_clicked

      public void fixedOption_clicked(g4p_controls.GOption source, g4p_controls.GEvent event)
    • resampleSlider_changed

      public void resampleSlider_changed(g4p_controls.GSlider source, g4p_controls.GEvent event)
    • durationSlider_changed

      public void durationSlider_changed(g4p_controls.GSlider source, g4p_controls.GEvent event)
    • grainLengthSlider_changed

      public void grainLengthSlider_changed(g4p_controls.GSlider source, g4p_controls.GEvent event)
    • hopLengthSlider_changed

      public void hopLengthSlider_changed(g4p_controls.GSlider source, g4p_controls.GEvent event)
    • grainLengthField_changed

      public void grainLengthField_changed(g4p_controls.GTextField source, g4p_controls.GEvent event)
    • hopLengthField_changed

      public void hopLengthField_changed(g4p_controls.GTextField source, g4p_controls.GEvent event)
    • pitchShiftText_changed

      public void pitchShiftText_changed(g4p_controls.GTextField source, g4p_controls.GEvent event)
    • gainSlider_changed

      public void gainSlider_changed(g4p_controls.GSlider source, g4p_controls.GEvent event)
    • linearWarpOption_clicked

      public void linearWarpOption_clicked(g4p_controls.GOption source, g4p_controls.GEvent event)
    • expWarpOption_clicked

      public void expWarpOption_clicked(g4p_controls.GOption source, g4p_controls.GEvent event)
    • squareRootOption_clicked

      public void squareRootOption_clicked(g4p_controls.GOption source, g4p_controls.GEvent event)
    • customWarpOption_clicked

      public void customWarpOption_clicked(g4p_controls.GOption source, g4p_controls.GEvent event)
    • warpSlider_changed

      public void warpSlider_changed(g4p_controls.GSlider source, g4p_controls.GEvent event)
    • arcLengthTimeOption_clicked

      public void arcLengthTimeOption_clicked(g4p_controls.GOption source, g4p_controls.GEvent event)
    • envelopeMenu_clicked

      public void envelopeMenu_clicked(g4p_controls.GDropList source, g4p_controls.GEvent event)
    • printGConfigStatus

      public void printGConfigStatus()
    • envPreset

      static ADSRParams envPreset(String name)
    • quantizeToStep

      public static int quantizeToStep(int value, int step)
      Quantize an integer to the nearest multiple of step.
    • syncGuiFromConfig

      void syncGuiFromConfig()
    • clampInt

      static int clampInt(int v, int lo, int hi)
    • setControlsEnabled

      void setControlsEnabled()
    • isEditable

      boolean isEditable()
    • resetToDefaults

      void resetToDefaults()
    • printGOptHints

      void printGOptHints(float alpha)
    • calcGranularOptHints

      public int calcGranularOptHints(String tag, int N, float Tms, int hopSamples, int grainLenSamples, float sr, List<processing.core.PVector> scheduledPoints, float targetSpacingPx, float wt, float ws, StringBuffer sb)
    • fmt

      static String fmt(float v, int decimals)