This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<meta charset="utf-8"> | |
<style> | |
body { | |
padding: 1em; | |
} | |
label, button { | |
margin: 0.5em; | |
} | |
input { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"metadata": { | |
"name": "", | |
"signature": "sha256:cac0968acb6ed81120d6cd83c661c951e8f8930e429d0ee97e66bb68fbd65d99" | |
}, | |
"nbformat": 3, | |
"nbformat_minor": 0, | |
"worksheets": [ | |
{ | |
"cells": [ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"metadata": { | |
"name": "", | |
"signature": "sha256:9b19077405f3d19a20c586240f960df88ffc905854899a3cd49ffb16acc455d5" | |
}, | |
"nbformat": 3, | |
"nbformat_minor": 0, | |
"worksheets": [ | |
{ | |
"cells": [ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var gWave, gFreq, ac, osc, osc1, gainNode, analyser, buffWave, buffFreq; | |
var update = function() { | |
var i, x; | |
gWave.clearRect(0, 0, gWave.canvas.width, gWave.canvas.height); | |
gFreq.clearRect(0, 0, gFreq.canvas.width, gFreq.canvas.height); | |
analyser.getByteTimeDomainData(buffWave); | |
analyser.getByteFrequencyData(buffFreq); | |
for(i = 0; i < buffWave.length; i++) { | |
x = i / (buffWave.length - 1) * gWave.canvas.width; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var ac = new webkitAudioContext(); | |
var cap = {}; | |
navigator.webkitGetUserMedia({audio: true}, function(stream) { | |
cap.mic = ac.createMediaStreamSource(stream); | |
}, null); | |
// 여기까지 일단 실행하고~ 마이크 입력을 허락해 주고. | |
var analyser = ac.createAnalyser(); | |
var buff = new Uint8Array(analyser.frequencyBinCount); | |
var g = document.createElement('canvas').getContext('2d'); | |
g.canvas.width = 512; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var arr = ['a','b','c','d','e']; | |
var objectify = function() { | |
var o = {}; | |
arr.reduce( function (prev, cur, i, array) { | |
(array.length % 2) && array.length - 1 === i ? o[cur] = null : 0; | |
if(i % 2) { | |
return o[prev] = cur; | |
} | |
else { | |
return cur; |