This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
"Lava New Version" by MelisaHot on Shadertoy | |
https://www.shadertoy.com/view/ssKBzm | |
""" | |
import taichi as ti | |
ti.init(arch=ti.vulkan) | |
@ti.func |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from sardine_core.run import * | |
import os | |
import signalflow as sf | |
graph = sf.AudioGraph() | |
audio_path = "/signalflow/examples/audio/stereo-count.wav" | |
buf = sf.Buffer(audio_path) | |
player = sf.BufferPlayer(buf, loop=True) | |
player.play() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
from tolvera import Tolvera, run | |
from tolvera.osc.update import Updater | |
from tolvera.utils import map_range | |
from signalflow import * | |
class Sine(Patch): | |
def __init__(self, freq=880, gain=1.0, pan=0.0): | |
super().__init__() | |
freq = self.add_input("freq", freq) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
import argparse | |
def load_json(name): | |
with open(name) as f: | |
data = json.load(f) | |
return data | |
def make_tidal_map(cc_dict, prefix): | |
tidal_map = [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import taichi as ti | |
import cv2 as cv | |
cap = cv.VideoCapture(0) | |
if not cap.isOpened(): | |
print("Cannot open camera") | |
exit() | |
ti.init(arch=ti.vulkan) | |
x,y = 1920,1080 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from iipyper import Audio, run | |
import sounddevice as sd | |
import taichi as ti | |
from math import pi | |
import sys | |
@ti.kernel | |
def generate_data(outdata: ti.ext_arr(), | |
frames: ti.i32, | |
start_idx: ti.template(), | |
fs: ti.f32): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
Original: http://www.dgp.toronto.edu/~mac/e-stuff/point_in_polygon.py | |
''' | |
@ti.func | |
def polygon(self, x: ti.template(), y: ti.template(), rgba: vec4): | |
x_min, x_max = x.min(), x.max() | |
y_min, y_max = y.min(), y.max() | |
l = len(x) | |
for i, j in ti.ndrange(x_max-x_min, y_max-y_min): | |
p = [x_min+i, y_min+j] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import taichi as ti | |
ti.init() | |
n = 16 | |
x = ti.field(ti.i32) | |
dyn = ti.root.dynamic(ti.i, n).place(x) | |
@ti.kernel | |
def add_data(): | |
for i in range(10): | |
x.append(i) | |
print(x.length(), x[i]) # will print i |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import taichi as ti | |
ti.init(arch=ti.cuda) # not supported on vulkan | |
@ti.dataclass | |
class Particle: | |
position: ti.math.vec2 | |
velocity: ti.math.vec2 | |
@ti.data_oriented |
NewerOlder