Skip to content

Instantly share code, notes, and snippets.

View OmerShapira's full-sized avatar
💭
is this the internet

Omer Shapira OmerShapira

💭
is this the internet
View GitHub Profile
@OmerShapira
OmerShapira / PitchWheel.pde
Created November 1, 2012 21:40
PitchWheel
//import ddf.minim.spi.*;
import ddf.minim.signals.*;
import ddf.minim.*;
import ddf.minim.analysis.*;
//import ddf.minim.ugens.*;
//import ddf.minim.effects.*;
//final int[] noteFreqs = {31,33,35,37,39,41,44,46,49,52,55,58,62,65,69,73,78,82,87,93,98,104,110,117,123,131,139,147,156,165,175,185,196,208,220,233,247,262,277,294,311,330,349,370,392,415,440,466,494,523,554,587,622,659,698,740,784,831,880,932,988,1047,1109,1175,1245,1319,1397,1480,1568,1661,1760,1865,1976,2093,2217,2349,2489,2637,2794,2960,3136,3322,3520,3729,3951,4186,4435,4699,4978};
//final String[] noteNames = {"NOTE_B0","NOTE_C1","NOTE_CS1","NOTE_D1","NOTE_DS1","NOTE_E1","NOTE_F1","NOTE_FS1","NOTE_G1","NOTE_GS1","NOTE_A1","NOTE_AS1","NOTE_B1","NOTE_C2","NOTE_CS2","NOTE_D2","NOTE_DS2","NOTE_E2","NOTE_F2","NOTE_FS2","NOTE_G2","NOTE_GS2","NOTE_A2","NOTE_AS2","NOTE_B2","NOTE_C3","NOTE_CS3","NOTE_D3","NOTE_DS3","NOTE_E3","NOTE_F3","NOTE_FS3","NOTE_G3","NOTE_GS3","NOTE_A3","NOTE_AS3","NOTE_B3","NOTE_C4","NOTE_CS4","NOTE_D4","NOTE_DS4","NOTE_E4","NO
@OmerShapira
OmerShapira / gist:4063334
Created November 13, 2012 01:41
Processing Simple Soft Wrap
String wrap(String s, int numChars){
int l = s.length();
if (l <= numChars) {
return s;
} else {
StringBuffer b = new StringBuffer();
char[] charArray = s.toCharArray();
int counter = 0;
for (int i = 0 ; i<l ; i++){
@OmerShapira
OmerShapira / gist:4196862
Created December 3, 2012 18:21
OpenGL Texture Mapping
PImage img;
void setup(){
size(800,600,P3D);
img = loadImage("http://upload.wikimedia.org/wikipedia/commons/4/48/Dirk_Benedict_-_Lucca_Comics_%26_Games_2011.jpg");
}
void draw(){
background(0);
beginShape();
@OmerShapira
OmerShapira / C4DRandomWalk.py
Created December 6, 2012 18:14
Cinema4D Random Walk
import c4d
from c4d import documents
from c4d import Vector
from random import seed
from random import uniform as rand
from math import *
#########################################################################
#Constants
try {
harder();
}
@OmerShapira
OmerShapira / LoadTimer.py
Last active December 16, 2015 08:48
Mini load test
from time import time
t = [time()-time() for x in xrange(1000)]
print(abs(sum(t)/len(t)))
@OmerShapira
OmerShapira / gist:5911950
Last active November 14, 2017 19:05
Lemur: Description

Lemur is a drawing app based on ofxIlda. It's suitable for any vector-drawing machine, but works on laser projectors.

##Structure:

  • Drawables - The program contains Drawables, which are groups of piecewise-polygonal drawings. 'Drawable' is just an interface to ouput ofPolyLines with an input of a time value- but inside, it can be anything. The way we're using them is to generate vector particle systems, and other time-based animations. Right now we have an SVG importer drawable.
  • Time Function: Some effects make more sense with timesteps, sin() functions, etc. In order to simplify development, we built chainable time function units, each manipulating values between 0 and 1.
  • Behavior: a behavior resides inside a drawable, and reacts to a time value. Harmonic motion can be a behavior, but so can "tween", "simplify" and so on.

Goals:

We want to make a GUI-Based app, controlled by duration or other OSC inputs, that allows stacking and node-based connection of elements for live performance.

@OmerShapira
OmerShapira / PWM.py
Last active December 30, 2015 08:09
PWM for Pi
import RPi.GPIO as GPIO
import threading
import time
class PWM(threading.Thread):
"""PWM Control"""
interval = 0.001
global pin_out
global normalized_avg
# Mapping
@OmerShapira
OmerShapira / swizzle.js
Created January 27, 2014 18:12
Javascript swizzle generator for Ryan.js
function generateSwizzles (){
var allSwizzles = [];
var perm = function(list, ret){
if (list.length == 0) {
var swizzleMember = ret.join('') + " : [" + ret.join(',') + ']'
allSwizzles.push(swizzleMember);
return;
}
for (var i = 0; i < list.length; i++) {
@OmerShapira
OmerShapira / Perlin.js
Created February 22, 2014 02:14
Improved noise by Ken Perlin, optimised for JS
// Improved noise
// JS version written by Ken Perlin
// http://mrl.nyu.edu/~perlin
// Modified by Omer Shapira
// http://omershapira.com
var perlin = (function() {
var p = (function() {
// Perlin's artisanal shuffle