Skip to content

Commit

Permalink
20171225
Browse files Browse the repository at this point in the history
  • Loading branch information
satoshi-kanda committed Dec 29, 2017
1 parent 2c66eb1 commit 861f393
Show file tree
Hide file tree
Showing 10 changed files with 599 additions and 259 deletions.
451 changes: 298 additions & 153 deletions app.js

Large diffs are not rendered by default.

Empty file modified bin/www
100755 → 100644
Empty file.
64 changes: 42 additions & 22 deletions exportFunction.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,33 +19,53 @@ exports.chunkEmit = function chunkEmit(io, audiovisualChunk){
exports.glitchStream = function glitchImage(data){
//console.log(data);
let rtnJson = data;
//let rtnJson = {};
//rtnJson["audio"] = [];
//rtnJson["video"] = "data:image/jpeg;base64,";
//let rtnAudio = {};
let rtnVideo = "data:image/jpeg;base64,";
let baseImgString = data["video"].split("data:image/jpeg;base64,")[1];
//let str = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
let str = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
//console.log("body; " + String(baseString.length));
//console.log(baseString);
//rtnJson["video"] += baseImgString.replace(str[Math.floor(Math.random()*str.length)], str[Math.floor(Math.random()*str.length)]);
rtnVideo += baseImgString.replace(str[Math.floor(Math.random()*str.length)], str[Math.floor(Math.random()*str.length)]);

rtnJson["video"] = rtnVideo.replace(String(Math.floor(Math.random() + 10)), String(Math.floor(Math.random() + 10)));
//data["audio"].forEach((value,index,arr)=>{
/*
for(let key in data["audio"]){
if(data["audio"][key] > 0){
rtnAudio[key] = data["audio"][key];
} else {
//rtnAudio[key] = 0;
rtnAudio[key] = data["audio"][key] * -1;
if("video" in data && ~data.video.indexOf("data:image/jpeg;base64,")){
let rtnVideo = "data:image/jpeg;base64,";
let baseImgString = data["video"].split("data:image/jpeg;base64,")[1];
//let str = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
let str = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
//console.log("body; " + String(baseString.length));
//console.log(baseString);
//rtnJson["video"] += baseImgString.replace(str[Math.floor(Math.random()*str.length)], str[Math.floor(Math.random()*str.length)]);
rtnVideo += baseImgString.replace(str[Math.floor(Math.random()*str.length)], str[Math.floor(Math.random()*str.length)]);

rtnJson["video"] = rtnVideo.replace(String(Math.floor(Math.random() + 10)), String(Math.floor(Math.random() + 10)));
//data["audio"].forEach((value,index,arr)=>{
/*
for(let key in data["audio"]){
if(data["audio"][key] > 0){
rtnAudio[key] = data["audio"][key];
} else {
//rtnAudio[key] = 0;
rtnAudio[key] = data["audio"][key] * -1;
}
}
//});
rtnJson["audio"] = rtnAudio;*/
//console.log(rtnJson);
//console.log(data.audio[String(1)]);
/*
if(data.audio != undefined){
rtnJson.audio = new Float32Array(8192);
//console.log(rtnJson.audio);
//console.log(data.audio.length)
for(let i=0;i<data.audio.length;i++){
//console.log(data.audio[i]);
rtnJson.audio[String(i)] = Math.round(data.audio[String(i)] * 10) /10;
//rtnJson.audio[i] = Math.random() * data.audio[i];
}
}
console.log(rtnJson.audio);*/
rtnJson["glitch"] = true;
} else {
rtnJson.video = data.video
rtnJson["glitch"] = false;
}
//});
rtnJson["audio"] = rtnAudio;*/
//console.log(rtnJson);
rtnJson["glitch"] = true;
return rtnJson;
}

Expand Down
9 changes: 8 additions & 1 deletion lib/status.json
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,9 @@
"PLAYBACK": "0",
"TIMELAPSE": "0"
},
"glitch": false
"glitch": false,
"drone": false,
"droneRoute": {}
},
"clients": {
"dummy": {
Expand All @@ -210,6 +212,11 @@
"DRUM": {"TO": true, "arr": 0, "LATENCY": "0", "RATE":"44100"},
"SILENCE": {"TO": true, "arr": 0, "LATENCY": "0", "RATE":"44100"},
"SECBEFORE": {"TO": true, "arr": 0, "RATE":"44100"}
},
"rhythm":{
"bpm":"60",
"interval":"1000",
"score":"1,1,1,1"
}
}
}
Expand Down
Binary file added public/javascripts/.DS_Store
Binary file not shown.
Empty file modified routes/ctrl.js
100644 → 100755
Empty file.
Empty file modified routes/users.js
100644 → 100755
Empty file.
Loading

0 comments on commit 861f393

Please # to comment.