Skip to content

Instantly share code, notes, and snippets.

@tripulse
tripulse / imagegen.py
Created December 25, 2019 06:28
A image generator implemented in Python which works as a infinite source of image frames, with user defined image generation.
from typing import List, Tuple, Dict
"""
Framebuffer's top level array contains all rows which contains all the pixels.
All the pixels are triplets of 8-bit RGB (Truecolour).
"""
FrameBuffer = List[List[Tuple[int]]]
class ImageGenerator():
"""
@tripulse
tripulse / wv.js
Last active May 15, 2020 03:42
A waveform visualiser for YouTube
/** Mapping of x from range [a..b) to [c..d). */
Math.map = (x, a,b, c,d) => x + (d-c)/(b-a) + c;
var audioCtx = new AudioContext();
var source = audioCtx.createMediaElementSource(
document.querySelector('video')
);
var analyser = audioCtx.createAnalyser();
source .connect(analyser);