Skip to content

Instantly share code, notes, and snippets.

View 1j01's full-sized avatar

Isaiah Odhner 1j01

View GitHub Profile
@1j01
1j01 / blob_to_buffer.js
Last active August 24, 2018 20:33 — forked from davemackintosh/blob_to_buffer.js
Electron blob to buffer, I made this to use with the nativeImage class.
function blob_to_buffer(blob, callback) {
const file_reader = new FileReader()
file_reader.addEventListener("loadend", event => {
if (file_reader.error) {
callback(file_reader.error)
} else {
callback(null, new Buffer(file_reader.result))
}
}, false)
notes = ['A', 'A#', 'B', 'C', 'C#', 'D', 'D#', 'E', 'F', 'F#', 'G', 'G#']
getFrequency = (noten)->
440 * 2 ** ((noten - 49) / notes.length)
getNoteN = (notestr)->
i = notes.indexOf notestr[0...-1]
octave = parseInt notestr[-1..]
octave -= 1 if i >= notes.indexOf 'C'