From 53c19dda0377e1975c1c2e1036ad3b5e1fc14dd0 Mon Sep 17 00:00:00 2001 From: Luke Murphy Date: Wed, 18 Dec 2019 13:33:56 +0700 Subject: [PATCH] Start to collect parameters and wire up shape generation --- vocoder/static/vocoder.js | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/vocoder/static/vocoder.js b/vocoder/static/vocoder.js index baca1f3..0add511 100644 --- a/vocoder/static/vocoder.js +++ b/vocoder/static/vocoder.js @@ -11,10 +11,7 @@ var serverUrl = 'http://localhost:5000'; var archiveUrl = serverUrl + '/add-to-archive/'; var mic, recorder, soundFile; -var state = 0; - -// 30 seconds (in milliseconds) -var recordingTimeout = 30000; +var recordingTimeout = 30000; // 30 seconds (in milliseconds) function setupRecording(){ mic = new p5.AudioIn(); @@ -76,6 +73,24 @@ function setupRecording(){ playButton.mousePressed(doArchiving); } +function collectSoundParamters(){ + // TODO: collect all the sound parameters + // [x] amplitude + // [x] length of sound + // [ ] pitch + // [ ] nuance + // btw, there is no "nuance" function for p5js. My current guess is to + // perhaps measure it from the "getPeaks". For all wave peaks measured, + // ??? (need to think this through, not really sure ...) + amplitude = soundFile.getPeaks(); + duration = soundFile.duration(); +} + +function generateShape(){ + // TODO: take in sound parameters and generate a shape + ellipse(100, 100, 25, 25); +} + function setup(){ // TODO: Replace this with the leaflet/mappa setup just // using this for now to draw something to experiment on