Skip to content

Instantly share code, notes, and snippets.

View grifdail's full-sized avatar

Julien Berthou grifdail

View GitHub Profile
var a = [":bowtie:",":smile:",":laughing:",":blush:",":smiley:",":relaxed:",":smirk:",":heart_eyes:",":kissing_heart:",":kissing_closed_eyes:",":flushed:",":relieved:",":satisfied:",":grin:",":wink:",":stuck_out_tongue_winking_eye:",":stuck_out_tongue_closed_eyes:",":grinning:",":kissing:",":kissing_smiling_eyes:",":stuck_out_tongue:",":sleeping:",":worried:",":frowning:",":anguished:",":open_mouth:",":grimacing:",":confused:",":hushed:",":expressionless:",":unamused:",":sweat_smile:",":sweat:",":disappointed_relieved:",":weary:",":pensive:",":disappointed:",":confounded:",":fearful:",":cold_sweat:",":persevere:",":cry:",":sob:",":joy:",":astonished:",":scream:",":neckbeard:",":tired_face:",":angry:",":rage:",":triumph:",":sleepy:",":yum:",":mask:",":sunglasses:",":dizzy_face:",":imp:",":smiling_imp:",":neutral_face:",":no_mouth:",":innocent:",":alien:",":yellow_heart:",":blue_heart:",":purple_heart:",":heart:",":green_heart:",":broken_heart:",":heartbeat:",":heartpulse:",":two_hearts:",":revolving_hearts:","
{"pistes":[{"type":"sqr","notes":[{"n":0,"o":3,"g":1,"type":0},{"n":0,"o":0,"g":0,"type":0},{"n":0,"o":3,"g":1,"type":0},{"n":0,"o":0,"g":0,"type":0},{"n":0,"o":3,"g":1,"type":0},{"n":0,"o":0,"g":0,"type":0},{"n":0,"o":3,"g":1,"type":0},{"n":0,"o":0,"g":0,"type":0},{"n":9,"o":2,"g":1,"type":0},{"n":0,"o":0,"g":0,"type":0},{"n":9,"o":2,"g":1,"type":0},{"n":0,"o":0,"g":0,"type":0},{"n":9,"o":2,"g":1,"type":0},{"n":0,"o":0,"g":0,"type":0},{"n":9,"o":2,"g":1,"type":0},{"n":9,"o":2,"g":0,"type":0},{"n":0,"o":3,"g":1,"type":0},{"n":0,"o":0,"g":0,"type":0},{"n":0,"o":3,"g":1,"type":0},{"n":0,"o":0,"g":0,"type":0},{"n":0,"o":3,"g":1,"type":0},{"n":0,"o":0,"g":0,"type":0},{"n":0,"o":3,"g":1,"type":0},{"n":0,"o":0,"g":0,"type":0},{"n":9,"o":2,"g":1,"type":0},{"n":0,"o":0,"g":0,"type":0},{"n":9,"o":2,"g":1,"type":0},{"n":0,"o":0,"g":0,"type":0},{"n":9,"o":2,"g":1,"type":0},{"n":0,"o":0,"g":0,"type":0},{"n":9,"o":2,"g":1,"type":0},{"n":9,"o":2,"g":0,"type":0}],"volume":0.1,"harmonic":0},{"type":"arp","notes":[{"n":9,"o":
@grifdail
grifdail / bestSound.js
Created November 4, 2014 17:54
BetterSong.js
/*!
*
* welcome to wavepot
* ------------------
*
* this is a live editor. you create a function named `dsp`
* that accepts the parameter `t`, the coefficient of time,
* which you use to generate a single sample (range -1..1)
*
@grifdail
grifdail / CoolerSound.js
Created November 4, 2014 13:10
CoolerSound
/*!
*
* welcome to wavepot
* ------------------
*
* this is a live editor. you create a function named `dsp`
* that accepts the parameter `t`, the coefficient of time,
* which you use to generate a single sample (range -1..1)
*
@grifdail
grifdail / coolsound.js
Created November 4, 2014 11:34
CouldSound
/*!
*
* welcome to wavepot
* ------------------
*
* this is a live editor. you create a function named `dsp`
* that accepts the parameter `t`, the coefficient of time,
* which you use to generate a single sample (range -1..1)
*
{"pistes":[{"type":"sqr","notes":[{"n":0,"o":4,"g":1,"type":0},{"n":4,"o":4,"g":0,"type":0},{"n":0,"o":4,"g":1,"type":0},{"n":4,"o":4,"g":0,"type":0},{"n":0,"o":4,"g":1,"type":0},{"n":4,"o":4,"g":0,"type":0},{"n":0,"o":4,"g":1,"type":0},{"n":4,"o":4,"g":0,"type":0},{"n":5,"o":4,"g":1,"type":0},{"n":5,"o":4,"g":0,"type":0},{"n":5,"o":4,"g":1,"type":0},{"n":7,"o":4,"g":0,"type":0},{"n":5,"o":4,"g":1,"type":0},{"n":7,"o":4,"g":0,"type":0},{"n":5,"o":4,"g":1,"type":0},{"n":7,"o":4,"g":0,"type":0},{"n":7,"o":4,"g":1,"type":0},{"n":4,"o":4,"g":0,"type":0},{"n":7,"o":4,"g":1,"type":0},{"n":4,"o":4,"g":0,"type":0},{"n":7,"o":4,"g":1,"type":0},{"n":4,"o":4,"g":0,"type":0},{"n":7,"o":4,"g":1,"type":0},{"n":4,"o":4,"g":0,"type":0},{"n":5,"o":4,"g":1,"type":0},{"n":11,"o":4,"g":0,"type":0},{"n":5,"o":4,"g":1,"type":0},{"n":7,"o":4,"g":0,"type":0},{"n":5,"o":4,"g":1,"type":0},{"n":0,"o":5,"g":0,"type":0},{"n":5,"o":4,"g":1,"type":0},{"n":7,"o":4,"g":0,"type":0}],"volume":0.1,"harmonic":0},{"type":"sin","notes":[{"n":0,"o"
@grifdail
grifdail / fixedFramerate.js
Created September 29, 2014 11:27
Framerate fix
function loop(framerate,update,draw) {
//Update and draw are callbacK function
var requestedInterval = 1000/framerate;
var timeSinceLastUpdate = 0;
var lastFrameTimeStamp = 0;
function loopFunction() {
requestAnimationFrame(loopFunction);
var now = Date.now();
@grifdail
grifdail / CoordinateConverter.js
Last active August 29, 2015 14:06
Change coordinate in 2D and 3D
function carToPol(vec) {
var r = Math.sqrt(vec.x * vec.x + vec.y * vec.y);
var a = Math.atan2(vec.y, vec.x);
return {
r:r,
a:a
}
}
function polToCar (coor) {
@grifdail
grifdail / mk.js
Last active August 29, 2015 14:05
Markov music improved
var transpose = 24;
var bpm = 240; // Beats per minute
var spb = 60/bpm; // Second per beat
function note(n, octave){
n += transpose;
return Math.pow(2, (n - 33 + (12 * (octave || 0))) / 12) * 440;
@grifdail
grifdail / gist:e7ec16259514d6aad7ca
Last active August 29, 2015 14:05
MarkovChain music generation for wavepot
var transpose = 24;
var bpm = 240; // Beats per minute
var spb = 60/bpm; // Second per beat
function note(n, octave){
n += transpose;
return Math.pow(2, (n - 33 + (12 * (octave || 0))) / 12) * 440;