Skip to content

Instantly share code, notes, and snippets.

@mgalushka
mgalushka / cosmos.ruby
Last active July 9, 2016 16:20
Cosmos composition
ls =[:E, :E, :D, :D, :A, :A, :F, :F, :G, :G, :B, :B, :C, :C, :A, :A ].ring
phases = [
[1, 0, 0, 0],
[0.8, 1, 0, 0],
[0.8, 0.5, 1, 0],
[0.8, 0.5, 0.8, 1],
[0.8, 0.5, 1, 1.5],
[0.8, 0.7, 1, 1],
[0.8, 1, 0, 0.7], # to do zatuhanie in last
[1, 0, 0, 0.1],
ls =[:E, :D, :C, :D, :E, :F, :E, :D, :C, :D, :E, :F, :G,:D,:G,:D,:G,:F,:E,:D,:C,:C,:C,:C,:C ].ring
counter = 0
live_loop :main_loop do
#use_synth :piano
use_bpm 100
counter = (inc counter)
@mgalushka
mgalushka / intro.ruby
Last active July 10, 2016 19:14
Some intro
phases = [
[ :G2, :G2, :G2, :G2, :G2, :G2, :F1, :F1, :F1, :G1, :G1, :F2].ring,
[ :G3, :G3, :G3, :G3, :G3, :G3, :F2, :F2, :F2, :G2, :G2, :F2].ring
]
takt = 0
counter = 0
phase = 0
live_loop :main_loop do
@mgalushka
mgalushka / servo_motor_rpi.py
Created January 8, 2017 15:27
Controlling servo motor
# installing libraries
# sudo apt-get install -y python-pip
# sudo pip install wiringpi
import time
import wiringpi
wiringpi.wiringPiSetupGpio()
wiringpi.pinMode(18, wiringpi.GPIO.PWM_OUTPUT)
wiringpi.pwmSetMode(wiringpi.GPIO.PWM_MODE_MS)
wiringpi.pwmSetClock(192)
@mgalushka
mgalushka / clock.py
Created March 3, 2019 12:23
Clock (processing)
W = 800
H = 800
class Clock:
def __init__(self, hours, minutes, radius = 2 * W / 3, cx = W / 2, cy = H / 2):
self.hours = hours
self.minutes = minutes
self.radius = radius
self.cx = cx