Skip to content

Instantly share code, notes, and snippets.

View kniknoo's full-sized avatar

Nicholas Rake kniknoo

View GitHub Profile
# frozen_string_literal: true
# TODO: Finish Sprites. beyond basics. Add relevant methods such as calcstringbox for labels "width"
# Base Class, doesn't do much on its own.
class DragonObject
attr_accessor :x, :y, :r, :g, :b, :a, :primitive_marker, :color
def initialize(x:, y:, color:)
@kniknoo
kniknoo / perlin.rb
Last active October 12, 2020 22:57
Version of perlin adapted from wikipedia and used for dragonruby
class PerlinNoise
attr_accessor :noise_map
def initialize(res, pixel, factor: [0.05, 0.05], mode: 'smooth', vectors: 'random')
@noise_map = []
@res = res
@pixel = pixel
@factor = factor
@mode = mode
@vectors = vectors
#buffer 6-3 (robo_blues)
clear
reset
skulpt = "skulpt_synth_midi_1"
drumbrute = "arturia_drumbrute_impact_midi_1"
mono_int = "monologue_midi_2"
r3_int = "r3_midi_2"
#N5EX 5/off
midi_pc 4, port: mono_int, channel: 14 #Monologue 5
#MS50 01
use_bpm 95
with_fx :compressor, slope_above: 0.6, threshold: 0.4, amp: 1.5 do
live_loop :amen_break do
with_fx :bitcrusher, sample_rate: rrand_i(100, 40000), bits: [2, 4, 8, 8, 8, 16, 16, 16, 16, 16, 16, 16, 16].choose do
use_sample_defaults beat_stretch: 8, num_slices: 32, release: 0.5, sustain: 0#, rate: [-1, 1].choose
r = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31]
#sample :loop_amen_full, slice: [0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30].ring.tick
sleep 0.25
(line, 2, 6).choose.times do
#sample :loop_amen_full, slice: r.choose, beat_stretch: rrand(8.05, 8.1) #unless one_in(11)
#Montford
#by KniKnoo
live_loop :bass do
sync :drum if one_in(6)
use_synth :tb303
use_synth_defaults amp: 0.3, res: 0.8, wave: 1, cutoff_attack: 0.03125
nlen = [0.125, 0.25, 0.5].choose
control amp: 0
notes = scale(:f1, :minor_pentatonic).choose
play notes, release: nlen * 1.125, cutoff: rrand(75, 110)
live_loop :kick do
use_sample_defaults amp: 0.7
cue :arpeg
sample :bd_klub
sleep 0.75
sample :bd_klub
sleep 0.25
sample :bd_klub
sleep 1
end
#This is Twinkle Twinkle Little Star
#It has two main parts, the "Twinkle Twinkle" part, and the "Up above the world so high" part.
#Put a block that loops twice around the "Up above the world so high" part
#Copy the remaining section and paste it after the end of the looping section
use_synth :piano
play 55
sleep 0.5
play 55
sleep 0.5
play 62
@kniknoo
kniknoo / MaryHadALittleLamb.rb
Created August 31, 2017 04:11
Mary Had a Little Lamb Homework
#This is the beginning of Mary Had a Little Lamb.
#I'd like for you to try to finish the song
#There are four notes used in this song: :c4, :d4, :e4, and :g4
#The short notes are half notes, represented by sleeping for 0.5 beats
#The long notes at the end of each phrase are whole notes, represented by sleeping for 1 beat
# http://www.true-piano-lessons.com/images/MaryCtab.jpg.jpg
play :e4
sleep 0.5
play :d4
sleep 0.5
use_bpm 70
with_fx :compressor, pre_amp: 1.2, threshold: 0.4, slope_above: 0.75, slope_below: 1, amp: 0.9 do
live_loop :kicks do
sleep 1
loop do
sample :bd_klub
sleep 2.5
sample :bd_klub
sleep 1.5
@kniknoo
kniknoo / commentreview.rb
Last active January 12, 2017 18:32
Review for Rainbow Class
#Comment what each of the sections do
#Don't forget you can press Ctrl - i to see the help for a command you have forgotten
#
use_bpm 55
#
with_fx :flanger do
#
live_loop :kick do