From 5fb2fe7990cf22a384e2b681383ba12a2f4bac8e Mon Sep 17 00:00:00 2001 From: litter Date: Tue, 29 Oct 2019 01:21:36 -0400 Subject: [PATCH] Second example with audio playing along-side track. FOUND A BUG!!! The audio file is not resampled by the .rate() method, so image is ORIGINAL RATE / NEW RATE times longer than expected. Ahhhhhh. --- .../OpticalWithPlayback.pde | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 examples/OpticalWithPlayback/OpticalWithPlayback.pde diff --git a/examples/OpticalWithPlayback/OpticalWithPlayback.pde b/examples/OpticalWithPlayback/OpticalWithPlayback.pde new file mode 100644 index 0000000..9ad525c --- /dev/null +++ b/examples/OpticalWithPlayback/OpticalWithPlayback.pde @@ -0,0 +1,25 @@ +import processing.sound.*; +import soundtrack.optical.*; + +SoundtrackOptical soundtrack; +SoundFile playback; //to be used to play audio + +String soundtrackFile = "../../data/barking.wav"; +int dpi = 2400; +float volume = 1.0; +String type = "dual variable area"; +String pitch = "long"; +boolean positive = true; + +void setup() { + size(213, 620); + frameRate(24); + soundtrack = new SoundtrackOptical(this, soundtrackFile, dpi, volume, type, pitch, positive); + playback = new SoundFile(this, soundtrackFile); + + playback.play(); +} + +void draw () { + soundtrack.frame(0, 0); +} \ No newline at end of file