Package net.paulhertz.pixelaudio.example
Class SampleAccurateDemo
java.lang.Object
processing.core.PApplet
net.paulhertz.pixelaudio.example.SampleAccurateDemo
- All Implemented Interfaces:
processing.core.PConstants
public class SampleAccurateDemo
extends processing.core.PApplet
Sample-accurate Sampler/Granular timing demo.
Sample accurate timing in PixelAudio in Sampler and Granular synths.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static final class(package private) static enum -
Field Summary
FieldsModifier and TypeFieldDescription(package private) String(package private) SampleAccurateDemo.BrushKind(package private) static final int(package private) ddf.minim.AudioOutput(package private) boolean(package private) float[](package private) String(package private) static final float(package private) static final int(package private) float(package private) int[](package private) static final String(package private) static final float(package private) static final float(package private) static final int(package private) static final int(package private) static final String(package private) String(package private) static final int(package private) static final int(package private) GranularBrush(package private) GestureGranularConfig.Builder(package private) SampleAccurateDemo.BeatBrushData(package private) PAGranularInstrumentDirector(package private) ADSRParams(package private) float(package private) PAGranularInstrument(package private) final ArrayList<TimedLocation>(package private) SampleAccurateDemo.BrushKind(package private) processing.core.PImage(package private) PixelAudioMapper(package private) ddf.minim.Minim(package private) ddf.minim.MultiChannelBuffer(package private) GestureGranularParams(package private) final ArrayList<TimedLocation>(package private) boolean(package private) static final float(package private) static final float(package private) SamplerBrush(package private) GestureGranularConfig.Builder(package private) SampleAccurateDemo.BeatBrushData(package private) ADSRParams(package private) float(package private) PASamplerInstrumentPool(package private) final ArrayList<TimedLocation>(package private) static final long(package private) boolean(package private) booleanFields inherited from class processing.core.PApplet
args, ARGS_BGCOLOR, ARGS_DISABLE_AWT, ARGS_DISPLAY, ARGS_EDITOR_LOCATION, ARGS_EXTERNAL, ARGS_FULL_SCREEN, ARGS_HIDE_STOP, ARGS_LOCATION, ARGS_PRESENT, ARGS_SKETCH_FOLDER, ARGS_STOP_COLOR, ARGS_UI_SCALE, ARGS_WINDOW_COLOR, DEFAULT_HEIGHT, DEFAULT_WIDTH, disableAWT, displayHeight, displayWidth, dmouseX, dmouseY, emouseX, emouseY, exitCalled, EXTERNAL_MOVE, EXTERNAL_STOP, finished, firstMouse, focused, frameCount, frameRate, frameRateLastNanos, g, height, insideDraw, javaPlatform, javaVersion, javaVersionName, key, keyCode, keyEvent, keyPressed, keyRepeatEnabled, looping, matchPatterns, mouseButton, mouseEvent, mousePressed, mouseX, mouseY, pixelDensity, pixelHeight, pixels, pixelWidth, platform, pmouseX, pmouseY, ratioLeft, ratioScale, ratioTop, recorder, redraw, rheight, rmouseX, rmouseY, rwidth, surface, useNativeSelect, width, windowX, windowYFields inherited from interface processing.core.PConstants
ADD, ALPHA, ALT, AMBIENT, ARC, ARGB, ARROW, BACKSPACE, BASELINE, BEVEL, BEZIER_VERTEX, BLEND, BLUR, BOTTOM, BOX, BREAK, BURN, CENTER, CHATTER, CHORD, CLAMP, CLOSE, CODED, COMPLAINT, CONTROL, CORNER, CORNERS, CROSS, CURVE_VERTEX, CUSTOM, DARKEST, DEG_TO_RAD, DELETE, DIAMETER, DIFFERENCE, DILATE, DIRECTIONAL, DISABLE_ASYNC_SAVEFRAME, DISABLE_BUFFER_READING, DISABLE_DEPTH_MASK, DISABLE_DEPTH_SORT, DISABLE_DEPTH_TEST, DISABLE_KEY_REPEAT, DISABLE_NATIVE_FONTS, DISABLE_OPENGL_ERRORS, DISABLE_OPTIMIZED_STROKE, DISABLE_STROKE_PERSPECTIVE, DISABLE_STROKE_PURE, DISABLE_TEXTURE_MIPMAPS, DODGE, DOWN, DXF, ELLIPSE, ENABLE_ASYNC_SAVEFRAME, ENABLE_BUFFER_READING, ENABLE_DEPTH_MASK, ENABLE_DEPTH_SORT, ENABLE_DEPTH_TEST, ENABLE_KEY_REPEAT, ENABLE_NATIVE_FONTS, ENABLE_OPENGL_ERRORS, ENABLE_OPTIMIZED_STROKE, ENABLE_STROKE_PERSPECTIVE, ENABLE_STROKE_PURE, ENABLE_TEXTURE_MIPMAPS, ENTER, EPSILON, ERODE, ESC, EXCLUSION, FX2D, GIF, GRAY, GROUP, HALF_PI, HAND, HARD_LIGHT, HINT_COUNT, HSB, IMAGE, INVERT, JAVA2D, JPEG, LANDSCAPE, LEFT, LIGHTEST, LINE, LINE_LOOP, LINE_STRIP, LINES, LINUX, MACOS, MACOSX, MAX_FLOAT, MAX_INT, MIN_FLOAT, MIN_INT, MITER, MODEL, MODELVIEW, MOVE, MULTIPLY, NORMAL, OPAQUE, OPEN, OPENGL, ORTHOGRAPHIC, OTHER, OVERLAY, P2D, P3D, PATH, PDF, PERSPECTIVE, PI, PIE, platformNames, POINT, POINTS, POLYGON, PORTRAIT, POSTERIZE, PROBLEM, PROJECT, PROJECTION, QUAD, QUAD_BEZIER_VERTEX, QUAD_STRIP, QUADRATIC_VERTEX, QUADS, QUARTER_PI, RAD_TO_DEG, RADIUS, RECT, REPEAT, REPLACE, RETURN, RGB, RIGHT, ROUND, SCREEN, SHAPE, SHIFT, SOFT_LIGHT, SPAN, SPHERE, SPOT, SQUARE, SUBTRACT, SVG, TAB, TARGA, TAU, TEXT, THIRD_PI, THRESHOLD, TIFF, TOP, TRIANGLE, TRIANGLE_FAN, TRIANGLE_STRIP, TRIANGLES, TWO_PI, UP, VERTEX, WAIT, WHITESPACE, WINDOWS, X, Y, Z -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidadjustAudioGain(float gainDbDelta) voidadjustGranularGain(float gainDbDelta) (package private) voidadjustGranularInterval(float deltaMs) voidadjustInstrumentGain(float gainDbDelta) voidadjustInstrumentGain(SampleAccurateDemo.BrushKind target, float gainDbDelta) voidadjustSamplerGain(float gainDbDelta) (package private) voidadjustSamplerInterval(float deltaMs) void(package private) SampleAccurateDemo.BeatBrushDatacreateBeatBrushData(int count, float intervalMs, boolean granular) (package private) float(package private) SampleAccurateDemo.BrushKindvoiddraw()(package private) voiddrawBeatBrush(AudioBrush brush, int brushColor, boolean highlighted) (package private) void(package private) voiddrawBrushPathOverlay(PACurveMaker curve, GestureGranularConfig.PathMode pathMode, boolean highlighted, int strokeColor) (package private) void(package private) voiddrawTimedLocationFeedback(ArrayList<TimedLocation> events, int eventColor, float maxRadius) (package private) voidenforceAudioSampleRate(ddf.minim.AudioOutput out, float requiredRate) (package private) void(package private) GestureEventParamsvoidfileSelected(File selectedFile) (package private) int[]getColors(int size) (package private) GestureGranularParams(package private) SampleAccurateDemo.BrushKindhitBrush(int x, int y) (package private) void(package private) void(package private) void(package private) float(package private) SampleAccurateDemo.BrushKind(package private) booleanisNearBrush(SampleAccurateDemo.BeatBrushData data, int x, int y) voidvoid(package private) voidloadAudioFile(File audioFile) static voidvoidvoidparseKey(char key, int keyCode) (package private) void(package private) void(package private) voidplayDoubleSamplerBeatBrush(int offsetSamples) (package private) void(package private) void(package private) void(package private) void(package private) void(package private) File(package private) voidrunGranularPointEvent(int x, int y) (package private) voidrunPointEvent(int x, int y) (package private) voidrunSamplerPointEvent(int x, int y) (package private) void(package private) intsampleLenForMillis(float ms) (package private) voidscheduleGranularBrush(GranularBrush brush, GestureSchedule sched, long startSample) (package private) voidscheduleSamplerBrush(SamplerBrush brush, GestureSchedule sched, long startSample) (package private) voidsetBeatRatio(float samplerRatio, float granularRatio) voidsettings()voidsetup()voidshowHelp()voidstop()(package private) voidstoreTimedLocations(ArrayList<TimedLocation> events, GestureSchedule sched, int startTimeMs) (package private) void(package private) voidupdateAudioChain(float[] sig, float sampleRate) (package private) intvisualStartMillis(long startSample, long currentSample, float sampleRate) Methods inherited from class processing.core.PApplet
abs, abs, acos, alpha, ambient, ambient, ambient, ambientLight, ambientLight, append, append, append, append, append, append, applyMatrix, applyMatrix, applyMatrix, applyMatrix, applyMatrix, arc, arc, arraycopy, arraycopy, arraycopy, arrayCopy, arrayCopy, arrayCopy, asin, atan, atan2, attrib, attrib, attrib, attribColor, attribNormal, attribPosition, background, background, background, background, background, background, background, beginCamera, beginContour, beginPGL, beginRaw, beginRaw, beginRecord, beginRecord, beginShape, beginShape, bezier, bezier, bezierDetail, bezierPoint, bezierTangent, bezierVertex, bezierVertex, binary, binary, binary, binary, blend, blend, blendColor, blendMode, blue, box, box, brightness, calcSketchPath, camera, camera, ceil, checkAlpha, checkExtension, choice, choice, circle, clear, clip, color, color, color, color, color, color, color, color, colorMode, colorMode, colorMode, colorMode, concat, concat, concat, concat, concat, concat, concat, constrain, constrain, copy, copy, copy, cos, createFont, createFont, createFont, createGraphics, createGraphics, createGraphics, createImage, createInput, createInput, createInputRaw, createOutput, createOutput, createPath, createPath, createPrimaryGraphics, createReader, createReader, createReader, createShape, createShape, createShape, createWriter, createWriter, createWriter, cursor, cursor, cursor, cursor, curve, curve, curveDetail, curvePoint, curveTangent, curveTightness, curveVertex, curveVertex, dataFile, dataPath, day, debug, degrees, delay, dequeueEvents, desktopFile, desktopPath, die, die, directionalLight, displayDensity, displayDensity, dispose, dist, dist, edge, ellipse, ellipseMode, emissive, emissive, emissive, endCamera, endContour, endPGL, endRaw, endRecord, endShape, endShape, exec, exec, exit, exitActual, exitCalled, exp, expand, expand, expand, expand, expand, expand, expand, expand, expand, expand, expand, expand, expand, expand, expand, expand, expand, expand, fill, fill, fill, fill, fill, fill, filter, filter, filter, floor, flush, focusGained, focusLost, frameMoved, frameRate, frustum, fullScreen, fullScreen, fullScreen, fullScreen, get, get, get, getExtension, getGraphics, getMatrix, getMatrix, getMatrix, getSurface, green, handleDraw, handleKeyEvent, handleMethods, handleMouseEvent, hex, hex, hex, hex, hideMenuBar, hint, hour, hue, image, image, image, imageMode, initSurface, insertFrame, isLooping, join, join, keyPressed, keyReleased, keyTyped, keyTyped, launch, lerp, lerpColor, lerpColor, lightFalloff, lights, lightSpecular, line, line, link, listFiles, listFiles, listPaths, loadBytes, loadBytes, loadBytes, loadFont, loadImage, loadImage, loadJSONArray, loadJSONArray, loadJSONObject, loadJSONObject, loadPixels, loadShader, loadShader, loadShape, loadShape, loadStrings, loadStrings, loadStrings, loadStrings, loadTable, loadTable, loadXML, loadXML, log, loop, mag, mag, main, main, main, makeGraphics, map, mask, match, matchAll, max, max, max, max, max, max, method, millis, min, min, min, min, min, min, minute, modelX, modelY, modelZ, month, mouseClicked, mouseClicked, mouseDragged, mouseDragged, mouseEntered, mouseEntered, mouseExited, mouseExited, mouseMoved, mouseMoved, mousePressed, mouseReleased, mouseReleased, mouseWheel, mouseWheel, nf, nf, nf, nf, nf, nf, nfc, nfc, nfc, nfc, nfp, nfp, nfp, nfp, nfs, nfs, nfs, nfs, noClip, noCursor, noFill, noise, noise, noise, noiseDetail, noiseDetail, noiseSeed, noLights, noLoop, norm, normal, noSmooth, noStroke, noTexture, noTint, orientation, ortho, ortho, ortho, parseBoolean, parseBoolean, parseBoolean, parseBoolean, parseByte, parseByte, parseByte, parseByte, parseByte, parseByte, parseByte, parseByte, parseChar, parseChar, parseChar, parseChar, parseFloat, parseFloat, parseFloat, parseFloat, parseFloat, parseFloat, parseFloat, parseInt, parseInt, parseInt, parseInt, parseInt, parseInt, parseInt, parseInt, parseInt, parseInt, parseInt, parseInt, parseJSONArray, parseJSONObject, parseXML, parseXML, pause, perspective, perspective, pixelDensity, point, point, pointLight, pop, popMatrix, popStyle, postEvent, postWindowMoved, postWindowResized, pow, print, print, print, print, print, print, print, print, print, printArray, printCamera, println, println, println, println, println, println, println, println, println, println, println, printMatrix, printProjection, printStackTrace, push, pushMatrix, pushStyle, quad, quadraticVertex, quadraticVertex, radians, random, random, randomGaussian, randomSeed, rect, rect, rect, rectMode, red, redraw, registerMethod, requestImage, requestImage, resetMatrix, resetShader, resetShader, resume, reverse, reverse, reverse, reverse, reverse, reverse, reverse, rotate, rotate, rotateX, rotateY, rotateZ, round, runSketch, runSketch, runSketch, saturation, save, saveBytes, saveBytes, saveBytes, saveFile, saveFrame, saveFrame, saveJSONArray, saveJSONArray, saveJSONObject, saveJSONObject, savePath, saveStream, saveStream, saveStream, saveStream, saveStream, saveStrings, saveStrings, saveStrings, saveTable, saveTable, saveXML, saveXML, scale, scale, scale, screenX, screenX, screenY, screenY, screenZ, second, selectCallback, selectFolder, selectFolder, selectFolder, selectInput, selectInput, selectInput, selectOutput, selectOutput, selectOutput, set, set, setMatrix, setMatrix, setMatrix, setSize, shader, shader, shape, shape, shape, shapeMode, shearX, shearY, shell, shininess, shorten, shorten, shorten, shorten, shorten, shorten, shorten, showDepthWarning, showDepthWarningXYZ, showMethodWarning, showMissingWarning, showSurface, showVariationWarning, sin, size, size, size, sketchDisplay, sketchFile, sketchFullScreen, sketchHeight, sketchOutputPath, sketchOutputStream, sketchPath, sketchPath, sketchPixelDensity, sketchRenderer, sketchSmooth, sketchWidth, sketchWindowColor, smooth, smooth, sort, sort, sort, sort, sort, sort, sort, sort, sort, sort, specular, specular, specular, sphere, sphereDetail, sphereDetail, splice, splice, splice, splice, splice, splice, splice, splice, splice, splice, splice, splice, splice, split, split, splitTokens, splitTokens, spotLight, sq, sqrt, square, start, startSurface, str, str, str, str, str, str, str, str, str, str, stroke, stroke, stroke, stroke, stroke, stroke, strokeCap, strokeJoin, strokeWeight, style, subset, subset, subset, subset, subset, subset, subset, subset, subset, subset, subset, subset, subset, subset, subset, subset, subset, subset, tan, text, text, text, text, text, text, text, text, text, text, text, textAlign, textAlign, textAscent, textDescent, textFont, textFont, textLeading, textMode, textSize, texture, textureMode, textureWrap, textWidth, textWidth, textWidth, thread, tint, tint, tint, tint, tint, tint, translate, translate, triangle, trim, trim, unbinary, unhex, unregisterMethod, updatePixels, updatePixels, urlDecode, urlEncode, vertex, vertex, vertex, vertex, vertex, windowMove, windowMoved, windowRatio, windowResizable, windowResize, windowResized, windowTitle, year
-
Field Details
-
DISPLAY_W
static final int DISPLAY_W- See Also:
-
DISPLAY_H
static final int DISPLAY_H- See Also:
-
GEN_W
static final int GEN_W- See Also:
-
GEN_H
static final int GEN_H- See Also:
-
REQUIRED_SAMPLE_RATE
static final float REQUIRED_SAMPLE_RATE- See Also:
-
AUDIO_BUFFER_SIZE
static final int AUDIO_BUFFER_SIZE- See Also:
-
SAMPLE_RATE_TOLERANCE
static final float SAMPLE_RATE_TOLERANCE- See Also:
-
BEAT_COUNT
static final int BEAT_COUNT- See Also:
-
DEFAULT_SAMPLER_INTERVAL_MS
static final float DEFAULT_SAMPLER_INTERVAL_MS- See Also:
-
DEFAULT_GRANULAR_INTERVAL_MS
static final float DEFAULT_GRANULAR_INTERVAL_MS- See Also:
-
SCHEDULE_LEAD_SAMPLES
static final long SCHEDULE_LEAD_SAMPLES- See Also:
-
BEAT_BRUSH_SIZE
static final float BEAT_BRUSH_SIZE- See Also:
-
DEFAULT_AUDIO_PATH
- See Also:
-
DIST_AUDIO_PATH
- See Also:
-
minim
ddf.minim.Minim minim -
audioOut
ddf.minim.AudioOutput audioOut -
mapper
PixelAudioMapper mapper -
mapImage
processing.core.PImage mapImage -
colors
int[] colors -
playBuffer
ddf.minim.MultiChannelBuffer playBuffer -
audioSignal
float[] audioSignal -
bufferSampleRate
float bufferSampleRate -
samplerPool
PASamplerInstrumentPool samplerPool -
granularSynth
PAGranularInstrument granularSynth -
granularDirector
PAGranularInstrumentDirector granularDirector -
samplerEnv
ADSRParams samplerEnv -
granularEnv
ADSRParams granularEnv -
samplerBeatConfig
GestureGranularConfig.Builder samplerBeatConfig -
granularBeatConfig
GestureGranularConfig.Builder granularBeatConfig -
pointGranularParams
GestureGranularParams pointGranularParams -
samplerBeatBrush
SamplerBrush samplerBeatBrush -
granularBeatBrush
GranularBrush granularBeatBrush -
samplerBeatData
SampleAccurateDemo.BeatBrushData samplerBeatData -
granularBeatData
SampleAccurateDemo.BeatBrushData granularBeatData -
samplerTimeLocs
-
granularTimeLocs
-
pointTimeLocs
-
audioReady
boolean audioReady -
wrapAround
boolean wrapAround -
pointUsesGranular
boolean pointUsesGranular -
shiftIsDown
boolean shiftIsDown -
activeBrushKind
SampleAccurateDemo.BrushKind activeBrushKind -
hoverBrushKind
SampleAccurateDemo.BrushKind hoverBrushKind -
samplerIntervalMs
float samplerIntervalMs -
granularIntervalMs
float granularIntervalMs -
audioStatus
String audioStatus -
fileStatus
String fileStatus -
actionStatus
String actionStatus
-
-
Constructor Details
-
SampleAccurateDemo
public SampleAccurateDemo()
-
-
Method Details
-
main
-
settings
public void settings()- Overrides:
settingsin classprocessing.core.PApplet
-
setup
public void setup()- Overrides:
setupin classprocessing.core.PApplet
-
initMapping
void initMapping() -
initAudio
void initAudio() -
initSynths
void initSynths() -
preloadDefaultAudio
void preloadDefaultAudio() -
resolveDefaultAudioFile
File resolveDefaultAudioFile() -
draw
public void draw()- Overrides:
drawin classprocessing.core.PApplet
-
drawBeatBrushes
void drawBeatBrushes() -
mousePressed
public void mousePressed()- Overrides:
mousePressedin classprocessing.core.PApplet
-
keyPressed
public void keyPressed()- Overrides:
keyPressedin classprocessing.core.PApplet
-
parseKey
public void parseKey(char key, int keyCode) -
showHelp
public void showHelp() -
keyReleased
public void keyReleased()- Overrides:
keyReleasedin classprocessing.core.PApplet
-
adjustAudioGain
public void adjustAudioGain(float gainDbDelta) -
adjustInstrumentGain
public void adjustInstrumentGain(float gainDbDelta) -
adjustInstrumentGain
-
adjustSamplerGain
public void adjustSamplerGain(float gainDbDelta) -
adjustGranularGain
public void adjustGranularGain(float gainDbDelta) -
chooseAudioFile
public void chooseAudioFile() -
fileSelected
-
loadAudioFile
-
updateAudioChain
void updateAudioChain(float[] sig, float sampleRate) -
renderAudioToImage
void renderAudioToImage() -
getColors
int[] getColors(int size) -
rebuildBeatBrushes
void rebuildBeatBrushes() -
createBeatBrushData
-
playSamplerBeatBrush
void playSamplerBeatBrush() -
playDoubleSamplerBeatBrush
void playDoubleSamplerBeatBrush(int offsetSamples) -
playGranularBeatBrush
void playGranularBeatBrush() -
playBothBeatBrushes
void playBothBeatBrushes() -
scheduleSamplerBrush
-
scheduleGranularBrush
-
eventParamsForSchedule
-
granularParamsFromConfig
-
runPointEvent
void runPointEvent(int x, int y) -
runSamplerPointEvent
void runSamplerPointEvent(int x, int y) -
runGranularPointEvent
void runGranularPointEvent(int x, int y) -
ensureReadyForPlayback
void ensureReadyForPlayback() -
sampleLenForMillis
int sampleLenForMillis(float ms) -
toggleWrapAround
void toggleWrapAround() -
setBeatRatio
void setBeatRatio(float samplerRatio, float granularRatio) -
adjustSamplerInterval
void adjustSamplerInterval(float deltaMs) -
adjustGranularInterval
void adjustGranularInterval(float deltaMs) -
drawBeatBrush
-
drawBrushPathOverlay
void drawBrushPathOverlay(PACurveMaker curve, GestureGranularConfig.PathMode pathMode, boolean highlighted, int strokeColor) -
storeTimedLocations
-
visualStartMillis
int visualStartMillis(long startSample, long currentSample, float sampleRate) -
runTimedLocationFeedback
void runTimedLocationFeedback() -
drawTimedLocationFeedback
-
hitBrush
-
isNearBrush
-
playBrush
-
currentInstrumentKind
SampleAccurateDemo.BrushKind currentInstrumentKind() -
currentInstrumentGainDb
float currentInstrumentGainDb() -
instrumentGainTarget
SampleAccurateDemo.BrushKind instrumentGainTarget() -
instrumentGainDb
-
drawStatus
void drawStatus() -
enforceAudioSampleRate
void enforceAudioSampleRate(ddf.minim.AudioOutput out, float requiredRate) -
stop
public void stop()- Overrides:
stopin classprocessing.core.PApplet
-