Skip to content

Instantly share code, notes, and snippets.

View shimpe's full-sized avatar

shiihs shimpe

View GitHub Profile
@shimpe
shimpe / approach.py
Created September 28, 2018 14:22
approach numbers using limited number of positive exponents
import math
import itertools
from operator import mul
from functools import reduce
def approx(freq, exponents):
resulting_list = []
maxvals = [ list(range(0, math.ceil(math.log(freq, exp)))) for exp in exponents]
print("maxvals = ", maxvals)
cartesian_product = itertools.product(*maxvals)
@shimpe
shimpe / 8bit.sc
Last active March 8, 2019 23:24
8 bit music
(
s.waitForBoot({
Ndef(\bits, {
var t = PulseCount.ar(Impulse.ar(8e3));
var sig = HPF.ar(
(
((t * 15) & (t >> 5)) |
((t * 5) & (t >> [3, 4])) |
((t * 2) & (t >> 9)) |
((t * 8) & (t >> 11)) |
(
// By James McCartney
var w, h = 1080, v = 720, seed, run = true, phase = 0;
var text_radius = 300; // pixels
var text_angle_increment = 7.degrad; // 7 degrees converted to radians
var text_start_angle = 0;
var text_center_x = 0;
var text_center_y = 0;
@shimpe
shimpe / piday.scd
Created March 27, 2020 17:14
code for piday project

( s.waitForBoot({ var deg_to_bass = ( 1: "c3", 2: "d3", 3: "e3", 4: "f3", 5: "g3", 6: "a3", 7: "b3",

@shimpe
shimpe / vexflow in supercollider
Last active April 26, 2020 07:15
testing vexflow in supercollider
(
var webview = WebView().minSize_(300@200);
var browser = View(bounds:900@700).layout_(VLayout(webview));
webview.setHtml(html:"
<div id=\"myscore\"></div>
<script src=\"https://unpkg.com/vexflow/releases/vexflow-min.js\"> </script>
<script>
var vf = new Vex.Flow.Factory({
renderer: {elementId: 'myscore', width: 500, height: 200}
@shimpe
shimpe / abcjs in supercollider
Last active April 26, 2020 07:13
abcjs in supercollider
// note: the trickiest part to getting scores to work is to
// properly escape all the quotes " and backslashes \ while creating the html string
// showing simple fragment
(
var webview = WebView().minSize_(300@600);
var browser = View(bounds:900@700).layout_(VLayout(webview));
webview.setHtml(html:"<html>
<head>
<meta charset='utf-8'>
<meta http-equiv=\"content-type\" content=\"text/html\" />
// continuous
(
~stream = Pwhite(50, 70, 5).asStream;
)
(
~stream.next.debug("next value");
)
(
@shimpe
shimpe / project_coughin_dance.scd
Last active August 16, 2020 11:25
added proper latency compensation

///////////////////////////////////////////////////////////////////////////////////////////////// // // functions: wrap up functionality in a neat name //

( var f = { | a, b | a + b; // last thing in function is what is returned };

import moviepy.editor as mpy
from vectortween.Mapping import Mapping
basename = 'video.mp4'
inputfile = basename + ".mp4"
outputfile = basename + ".new.mp4"
video_file = mpy.VideoFileClip(inputfile)
duration = video_file.duration # duration
video_width, video_height = video_file.size
textclip = mpy.TextClip("www.YouTube.com",fontsize=30,color="red")
@shimpe
shimpe / colored_word.py
Created December 11, 2022 13:24
Make caption with multiple colors in moviepy
# Import everything needed to edit video clips
from moviepy.editor import *
from vectortween.PointAnimation import PointAnimation
fps = 25
duration = 10
W = 2000
H = 500
# Generate a text clip