Skip to content

Instantly share code, notes, and snippets.

#--
# This file is part of Sonic Pi: http://sonic-pi.net
# Full project source: https://github.com/samaaron/sonic-pi
# License: https://github.com/samaaron/sonic-pi/blob/master/LICENSE.md
#
# Copyright 2013, 2014, 2015, 2016 by Sam Aaron (http://sam.aaron.name).
# All rights reserved.
#
# Permission is granted for use, copying, modification, and
# distribution of modified versions of this work as long as this
# rd.rb
# https://vimeo.com/223727860
load "~/petal/petal.rb"
cps(0.55)
d1 ":bd_klub(11,16,3)", amp: 3, rate: 1
d2 ":bd_haus(6,16,3)", amp: 4, rate: 1
d3 "hh(13,16,5)", n: 0, amp: 4, rate: 'rand -1 1', pan: 'rand -1 1'
# bc.rb
# https://soundcloud.com/kn1kn1/bcrb
use_bpm 95
in_thread do
loop do
sync :ddd
sample :bd_klub, rate: 1 - 0.25, amp: 5
sleep 0.5
クリエイティブコーディングスクール札幌2017参加希望の皆様
講師の金井と申します。ワークショップへのご参加ありがとうございます。
ワークショップで使用するソフトウェアに関するご案内です。
参加者の皆様には、恐縮ですが以下のセッティングを事前に行って頂き、講義に臨んでいただければ幸いです。
- Sonic Pi
公式ページ http://sonic-pi.net/ より、v2.11.1をダウンロードしてインストールをお願い致します。
(近日中にv3.0.0がリリースされますが、今回はv2.11.1を使用します)
# Petal bangs osc message at the start of every cycle. #Sonic Pi 2.11.1
load "~/petal/petal.rb"
d1 "bd"
client = SonicPi::OSC::UDPClient.new("127.0.0.1", 7770, use_encoder_cache: true)
i = 0
live_loop :bang do
sync :d0
@kn1kn1
kn1kn1 / receiver.rb
Last active August 31, 2017 13:00
SP3 remote OSC sync experiment
use_real_time
sync "/osc/h"
sleep 0.5
live_loop :receiver do
sync "/osc/h"
sample :bd_haus
sleep 0.1
end
require "~/github/petal/petal"
use_fx_with_petal false
spc = get_seconds_per_cycle
s = spc / 2.0
use_random_seed 10
live_loop :od1 do
sn = ["less","cp","ades3","d","sid","sd","rs"].choose
live_loop :l1 do
loop_chop(:loop_mehackit2, 4, 5, 1.0, 1.5, true)
end
def loop_chop(loop_name, prob_chop = 0, prob_rev = 0, pitch_shift_mix = 0.0, amp = 1.0, pick = false, rate = 1.0)
dur = sample_duration(loop_name) * rate
onsets = sample_buffer(loop_name).onset_slices
onsets = onsets.shuffle if pick
onsets.each do |onset|
puts "onset: #{onset}"
@kn1kn1
kn1kn1 / sp-print-numbers.rb
Last active September 26, 2018 08:44
sp-print-numbers.rb
puts "num of chords: #{chord_names.size}"
puts "num of scales: #{scale_names.size}"
puts "num of samples: #{sample_groups.reduce(0){|acc, g| acc + sample_names(g).size}}"
puts "num of effects: #{fx_names.size}"