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