|
|
@ -86,7 +86,7 @@ function sendToArchive() { |
|
|
|
|
|
|
|
var config = new Headers({ "Content-Type": "multipart/form-data" }); |
|
|
|
|
|
|
|
axios.post(archiveUrl, formData, config).catch(function(error) { |
|
|
|
axios.post(archiveUrl, formData, config).catch(function (error) { |
|
|
|
console.log( |
|
|
|
"Upload failed!", |
|
|
|
"Received the following message:", |
|
|
@ -107,15 +107,15 @@ function gardenShapes() { |
|
|
|
*/ |
|
|
|
axios |
|
|
|
.get(archiveListingUrl) |
|
|
|
.then(function(response) { |
|
|
|
.then(function (response) { |
|
|
|
if (!response.data.length) return; |
|
|
|
let randomIndex = floor(random(0, response.data.length - 1)); |
|
|
|
let url = response.data[randomIndex]; |
|
|
|
axios |
|
|
|
.get(url, { responseType: "blob" }) |
|
|
|
.then(function(response) { |
|
|
|
.then(function (response) { |
|
|
|
let data = new p5.File(response.data); |
|
|
|
let sound = new p5.SoundFile(data, function() { |
|
|
|
let sound = new p5.SoundFile(data, function () { |
|
|
|
let amp = sound.getPeaks(1)[0] * 100; |
|
|
|
let dur = sound.duration(); |
|
|
|
let shape = new GeneratedShape(sound, amp, dur); |
|
|
@ -123,7 +123,7 @@ function gardenShapes() { |
|
|
|
shapes.push(shape); |
|
|
|
}); |
|
|
|
}) |
|
|
|
.catch(function(error) { |
|
|
|
.catch(function (error) { |
|
|
|
console.log( |
|
|
|
"Retrieving single recording from archive failed!", |
|
|
|
"Received the following message:", |
|
|
@ -131,7 +131,7 @@ function gardenShapes() { |
|
|
|
); |
|
|
|
}); |
|
|
|
}) |
|
|
|
.catch(function(error) { |
|
|
|
.catch(function (error) { |
|
|
|
console.log( |
|
|
|
"Retrieving archive listing failed!", |
|
|
|
"Received the following message:", |
|
|
@ -391,7 +391,7 @@ class GeneratedShape { |
|
|
|
color("#CC3D25"), |
|
|
|
color("#A3614E"), |
|
|
|
color("#F0DBA9"), |
|
|
|
color("#7C4531") |
|
|
|
color("#7C4531"), |
|
|
|
]; |
|
|
|
|
|
|
|
let index = floor(random(0, colourChoices.length)); |
|
|
@ -533,7 +533,7 @@ function draw() { |
|
|
|
// build a new copy of the recording to store on the shape object
|
|
|
|
let soundBlob = recording.getBlob(); |
|
|
|
let data = new p5.File(soundBlob); |
|
|
|
let sound = new p5.SoundFile(data, function() { |
|
|
|
let sound = new p5.SoundFile(data, function () { |
|
|
|
let amp = sound.getPeaks(1)[0] * 100; |
|
|
|
let dur = sound.duration(); |
|
|
|
let shape = new GeneratedShape(sound, amp, dur); |
|
|
|