source
stringclasses
1 value
repo
stringlengths
5
63
repo_url
stringlengths
24
82
path
stringlengths
5
167
language
stringclasses
1 value
license
stringclasses
5 values
stars
int64
10
51.4k
ref
stringclasses
23 values
size_bytes
int64
200
258k
text
stringlengths
137
258k
github
maca/scruby
https://github.com/maca/scruby
spec/server_spec.rb
Ruby
mit
92
main
558
RSpec.describe Server do it "should have a lot more tests" describe "sends graph" do let(:graph) { instance_double("UgenGraph", encode: "encoded-graph") } let(:blob) { OSC::Blob.new("encoded-graph") } let(:server) { Server.new } context "no completion message is provided" do before do ...
github
maca/scruby
https://github.com/maca/scruby
spec/ugen/env_gen_spec.rb
Ruby
mit
92
main
1,350
RSpec.describe Ugen::EnvGen do it_behaves_like "has done action" describe "EnvGen as graph node" do context "for default Env with defaults" do let(:ugen) { EnvGen.kr(Env.new) } include_context "node with graph" include_context "node with graph constants" do let(:constants) do ...
github
maca/scruby
https://github.com/maca/scruby
spec/ugen/unary_op_ugen_spec.rb
Ruby
mit
92
main
723
RSpec.describe Ugen::UnaryOpUgen do describe "negate" do shared_examples_for "is neg unary op ugen" do it { expect(operation).to be_a UnaryOpUgen } it { expect(operation.rate).to eq :control } it { expect(operation.operand).to eq ugen } it { expect(operation.operation).to eq :neg } end...
github
maca/scruby
https://github.com/maca/scruby
spec/ugen/binary_op_ugen_spec.rb
Ruby
mit
92
main
3,041
RSpec.describe Ugen::BinaryOpUgen do describe "build" do describe "rate" do let(:inputs) do [ instance_double("SinOsc", rate: :control), instance_double("SinOsc", rate: :audio) ] end it { expect(add(*inputs).rate).to eq :audio } it { expect(add(*inputs.reverse).rate).to ...
github
maca/scruby
https://github.com/maca/scruby
spec/ugen/multi_channel_spec.rb
Ruby
mit
92
main
2,726
RSpec.describe Ugen::MultiChannel do it "compares max size" do property_of { [ range(1, 10), range(1, 10) ] }.check do |n1, n2| size = MultiChannel.new([1] * n1).max_size([1] * n2) expect(size).to eq([n1, n2].max) end end describe "enumerable methods" do it "converst to array" do pr...
github
maca/scruby
https://github.com/maca/scruby
spec/ugen/gen_spec.rb
Ruby
mit
92
main
9,313
RSpec.describe Ugen::Gen do shared_examples_for "instance is copied" do it { expect(copy.object_id).not_to eq instance.object_id } end shared_examples_for "doesn't allow rate" do |_rate| it { expect { subject }.to raise_exception(ArgumentError) } end describe "#rates" do context "allowed rate i...
github
maca/scruby
https://github.com/maca/scruby
spec/ugen/graph_spec.rb
Ruby
mit
92
main
4,933
RSpec.describe UgenGraph do describe "initialize" do let(:root_ugen) { instance_double("Ugen::Base", input_values: []) } context "initialize with controls" do let(:control_params) do { k_1: 1, k_2: scalar(2), k_3: trigger(3), k_4: control(4) } end subject(:graph) do describ...
github
maca/scruby
https://github.com/maca/scruby
spec/ugen/base_spec.rb
Ruby
mit
92
main
1,202
RSpec.describe Ugen::Base do describe "multichannel" do subject(:subclass) do Class.new(Ugen::Base) do rates :audio inputs ins: nil attributes colors: nil end end describe "to multichannel" do let(:instance) { subclass.new } it { expect(instance.channels(2...
github
maca/scruby
https://github.com/maca/scruby
spec/server/options_spec.rb
Ruby
mit
92
main
809
RSpec.describe Scruby::Server::Options do subject(:options) { described_class.new } describe "some defaults" do it { expect(options.address).to eq "127.0.0.1" } it { expect(options.port).to be 57_110 } it { expect(options.protocol).to be :udp } it { expect(options.max_logins).to be 32 } it { ex...
github
maca/scruby
https://github.com/maca/scruby
spec/ugen_graph/ugen_node_spec.rb
Ruby
mit
92
main
2,554
RSpec.describe UgenGraph::UgenNode do include Scruby include Scruby::Ugen describe "inputs" do include_context "node with graph" let(:constants) { [ 440, -1 ] } let(:control_names) { %i(k_1 k_2) } let(:ugens) { [ Ugen::SinOsc.ar, Ugen::SinOsc.kr ] } let(:ugen) do instance_double("Ugen:...
github
maca/scruby
https://github.com/maca/scruby
spec/graph/node_spec.rb
Ruby
mit
92
main
397
RSpec.describe Scruby::Graph::Node do subject(:node) do described_class.new(:node_one, a: 1) end describe "graph" do let(:graph) { instance_double("Graph") } let(:children) { instance_double("Array") } before do node.graph = graph allow(graph).to receive(:children_for).with(node) { c...
github
maca/scruby
https://github.com/maca/scruby
spec/graph/decoder_spec.rb
Ruby
mit
92
main
2,350
RSpec.describe Scruby::Graph::Decoder do context "groups and synths" do # NODE TREE Group 0 # 1 group # 1018 group # 1020 sin # freq: 300 amp: 0 # 1019 sin # freq: 300 amp: 0 # 1015 group # 1017 sin # fr...
github
maca/scruby
https://github.com/maca/scruby
spec/integration/operation_graph_spec.rb
Ruby
mit
92
main
2,413
RSpec.describe UgenGraph do let(:server) { Server.new } before do allow(server).to receive(:send_msg) end describe "graph with float mult" do let(:graph) { UgenGraph.new(Out.ar(0, SinOsc.ar * 0.5), "mult") } it { expect(graph.nodes.map(&:name)) .to eq %w(SinOsc BinaryOpUGen Out) } ...
github
maca/scruby
https://github.com/maca/scruby
spec/integration/multichannel_graph_spec.rb
Ruby
mit
92
main
3,523
RSpec.describe UgenGraph do describe "simple graph with two channels" do let(:graph) do UgenGraph.new(Out.ar(0, [ SinOsc.ar, Saw.ar ]), "multichannel") end it { expect(graph.nodes.map(&:name)) .to eq %w(SinOsc Saw Out) } it { expect(graph.constants.map(&:value)).to eq [ 440, 0 ] } ...
github
maca/scruby
https://github.com/maca/scruby
spec/utils/positional_keyword_args_spec.rb
Ruby
mit
92
main
1,795
RSpec.describe Utils::PositionalKeywordArgs do let(:klass) do Class.new do include Utils::PositionalKeywordArgs public :positional_keyword_args end end let(:instance) { klass.new } let(:defaults) do { a: 1, b: 2, c: 3, d: 4 } end let(:args) { [] } let(:kwargs) { {} } subject(...
github
maca/scruby
https://github.com/maca/scruby
spec/support/node_examples.rb
Ruby
mit
92
main
3,605
RSpec.shared_examples_for "sent message to server" do before do allow(server).to receive(:send_msg).with(any_args) end it { expect(server).to have_received(:send_msg).with(*msg) } it { expect(subject).to eq node } end RSpec.shared_examples_for "sent bundle to server" do before do allow(server).to r...
github
maca/scruby
https://github.com/maca/scruby
spec/support/graph_node_examples.rb
Ruby
mit
92
main
326
RSpec.shared_context "node with graph" do let(:graph) { instance_double("Scruby::UgenGraph") } before do allow(graph).to receive(:add) allow(graph).to receive(:add_constant) end end RSpec.shared_context "node with graph constants" do before do allow(graph).to receive(:constants) { constants } en...
github
maca/scruby
https://github.com/maca/scruby
spec/support/buffer_examples.rb
Ruby
mit
92
main
808
RSpec.shared_context "query buffer info" do let!(:info_response) do Concurrent::Promises.fulfilled_future(info_msg) end let!(:info_msg) do instance_double("OSC::Message", address: "/b_info", args: response) end before do allow(server).to receive(:receive).with("/b_info") { |&block| next in...
github
maca/scruby
https://github.com/maca/scruby
spec/support/encode_matcher.rb
Ruby
mit
92
main
442
RSpec::Matchers.define :encode_as do |expected| match do |actual| actual.encode == expected end failure_message do |actual| <<~MSG expected: #{diff(expected, actual.encode)} got: #{diff(actual.encode, expected)} MSG end def diff(str_a, str_b) str_a.each_char.zip(str_b.each_cha...
github
maca/scruby
https://github.com/maca/scruby
bin/ugen_gen.rb
Ruby
mit
92
main
2,087
#!/usr/bin/env ruby # frozen_string_literal: true require "json" require "erb" require "facets/string/camelcase" require "facets/string/snakecase" path = ARGV[0] or raise "Provide a path for the json dump of Ugens" file = File.open File.expand_path(path) data = JSON.load file data.each do |name, specs| rate_map...
github
maca/scruby
https://github.com/maca/scruby
lib/scruby.rb
Ruby
mit
92
main
17,567
#-- # Copyright (c) 2008 Macario Ortega # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # any later version. # # This program is distributed in the hope tha...
github
maca/scruby
https://github.com/maca/scruby
lib/scruby/server_node.rb
Ruby
mit
92
main
3,217
require "concurrent-edge" module Scruby module ServerNode include PrettyInspectable POS = %i(head tail before after replace) MESSAGES = %w(/n_run /n_go /n_off /n_on /n_end /n_move) attr_reader :server def initialize(server, id = nil) @server, @id = server, id end def id @i...
github
maca/scruby
https://github.com/maca/scruby
lib/scruby/ugen_graph.rb
Ruby
mit
92
main
3,321
require "securerandom" module Scruby class UgenGraph include Encode include Equatable include PrettyInspectable attr_reader :name, :root, :nodes, :controls, :constants def initialize(root_ugen, name = nil, **controls) @name = name || SecureRandom.uuid @controls = controls.map &metho...
github
maca/scruby
https://github.com/maca/scruby
lib/scruby/buffer.rb
Ruby
mit
92
main
3,019
module Scruby class Buffer include OSC attr_reader :server, :frames, :channel_count, :path, :start_frame, :sample_rate def initialize(server) @server = server end def id @id ||= server.next_buffer_id end def duration return 0 if sample_rate.nil? ...
github
maca/scruby
https://github.com/maca/scruby
lib/scruby/group.rb
Ruby
mit
92
main
1,250
module Scruby class Group include ServerNode def node_to_head(other) other.move_to_head(self) end def node_to_tail(other) other.move_to_tail(self) end def free_all send_msg("/g_freeAll", id) end def deep_free send_msg("/g_deepFree", id) end def dump...
github
maca/scruby
https://github.com/maca/scruby
lib/scruby/helpers.rb
Ruby
mit
92
main
444
module Scruby module Helpers class << self def included(base) base.include Scruby base.include Ugen base.include Ugen::Operations::OperationHelpers end end def control(val) UgenGraph::ControlName.new(val, :control) end def scalar(val) UgenGraph::Co...
github
maca/scruby
https://github.com/maca/scruby
lib/scruby/env.rb
Ruby
mit
92
main
8,519
module Scruby class Env include Equatable include Utils::PositionalKeywordArgs extend Utils::PositionalKeywordArgs attr_reader :levels, :curves, :release_at, :loop_at, :offset SHAPES = { step: 0, linear: 1, exponential: 2, sine: 3, welch: 4, squared: 6, ...
github
maca/scruby
https://github.com/maca/scruby
lib/scruby/sclang.rb
Ruby
mit
92
main
1,181
require "concurrent-edge" module Scruby class SclangError < StandardError; end class Sclang include Concurrent def initialize @process = Process.new("sclang", "-i scruby") end def spawn spawn_async.value! end def spawn_async return Promises.fulfilled_future(self) if p...
github
maca/scruby
https://github.com/maca/scruby
lib/scruby/pretty_inspectable.rb
Ruby
mit
92
main
206
module Scruby module PrettyInspectable def inspect(**params) params = params.map { |k, v| "#{k}=#{v.inspect}" }.join(" ") "#<#{self.class.name || self.class} #{params}>" end end end
github
maca/scruby
https://github.com/maca/scruby
lib/scruby/bus.rb
Ruby
mit
92
main
1,975
module Scruby class Bus attr_reader :server, :rate, :channels, :main_bus def initialize(server, rate, channels = 1, main_bus = self, hardware_out = false) @server, @rate, @channels, @main_bus, @hardware_out = server, rate, channels, main_bus, hardware_out end def index @index ||= @server...
github
maca/scruby
https://github.com/maca/scruby
lib/scruby/synth_def.rb
Ruby
mit
92
main
840
module Scruby class SynthDef extend Forwardable attr_reader :graph def_delegators :graph, :encode, :send_to, :print, :name def initialize(name = nil, &block) controls = catch(:args) { param_defaults(&block) } root_ugen = yield(*controls.keys) unless root_ugen.is_a? Ugen::Base ...
github
maca/scruby
https://github.com/maca/scruby
lib/scruby/server.rb
Ruby
mit
92
main
6,330
require "ruby-osc" require "concurrent-edge" require "forwardable" module Scruby class Server class ServerError < StandardError; end class ClientInfo < Struct.new(:id, :max_logins); end extend Forwardable include OSC include Sclang::Helpers include PrettyInspectable include Encode ...
github
maca/scruby
https://github.com/maca/scruby
lib/scruby/ugen.rb
Ruby
mit
92
main
262
module Scruby module Ugen RATES = %i(scalar trigger demand control audio).freeze E_RATES = %i(scalar control audio demand).freeze class << self def max_rate(*args) MultiChannel.new([*args].flatten).rate end end end end
github
maca/scruby
https://github.com/maca/scruby
lib/scruby/synth.rb
Ruby
mit
92
main
1,405
module Scruby class Synth include ServerNode def get end def get_n end def name obj&.name end def params obj&.params end def create(action, target, name, **params) super(name, id, map_action(action), target.id, *params.flatten) end def creation_m...
github
maca/scruby
https://github.com/maca/scruby
lib/scruby/process.rb
Ruby
mit
92
main
2,015
require "tty-which" require "forwardable" require "concurrent-edge" module Scruby class Process extend Forwardable include PrettyInspectable attr_reader :binary, :flags, :env, :pid def initialize(binary, flags = "", env: {}) @binary = TTY::Which.which(binary) || binary @flags = flags ...
github
maca/scruby
https://github.com/maca/scruby
lib/scruby/graph.rb
Ruby
mit
92
main
752
module Scruby class Graph include Enumerable attr_reader :nodes, :parent_indices private :nodes def initialize(nodes) @nodes = nodes.map(&method(:node_pair)).to_h @parent_indices = nodes.group_by(&:parent) end def add(node) node.graph = self nodes[node.id] = node ...
github
maca/scruby
https://github.com/maca/scruby
lib/scruby/encode.rb
Ruby
mit
92
main
740
module Scruby module Encode module_function def encode_int8(num) encode_int8_array [ num & 255 ] end def encode_int16(num) encode_int16_array [ num ] end def encode_int32(num) encode_int32_array [ num ] end def encode_floats_array(array) [ array.size ].pack(...
github
maca/scruby
https://github.com/maca/scruby
lib/scruby/attributes.rb
Ruby
mit
92
main
956
module Scruby module Attributes class AttributeMap attr_reader :attributes def initialize(&block) @attributes = {} instance_eval(&block) end def attribute(name, value = nil) attributes.merge!(name.to_s => value) end end def attributes(&block) ...
github
maca/scruby
https://github.com/maca/scruby
lib/scruby/equatable.rb
Ruby
mit
92
main
269
module Scruby module Equatable def ==(other) self.class == other.class && other.equatable_state == equatable_state end protected def equatable_state instance_variables.map { |name| instance_variable_get(name) } end end end
github
maca/scruby
https://github.com/maca/scruby
lib/scruby/sclang/helpers.rb
Ruby
mit
92
main
533
module Scruby class Sclang module Helpers module_function def literal(value) case value when String, TrueClass, FalseClass, NilClass, Numeric value.inspect when Symbol "'#{value}'" else raise(ArgumentError, "#{value.inspect...
github
maca/scruby
https://github.com/maca/scruby
lib/scruby/ugen/compander.rb
Ruby
mit
92
main
218
module Scruby module Ugen class Compander < Gen rates :audio inputs input: 0, control: 0, thresh: 0.5, slope_below: 1, slope_above: 1, clamp_time: 0.01, relax_time: 0.1 end end end
github
maca/scruby
https://github.com/maca/scruby
lib/scruby/ugen/base.rb
Ruby
mit
92
main
3,866
module Scruby module Ugen class Base include Equatable include PrettyInspectable include Operations include Utils::PositionalKeywordArgs extend Utils::PositionalKeywordArgs def initialize(*args, rate: :audio, **kw) defaults = self.class.defaults positional_ke...
github
maca/scruby
https://github.com/maca/scruby
lib/scruby/ugen/pan_az.rb
Ruby
mit
92
main
202
module Scruby module Ugen class PanAz < Gen rates :control, :audio attributes channel_count: 1 inputs input: nil, pos: 0, level: 1, width: 2, orientation: 0.5 end end end
github
maca/scruby
https://github.com/maca/scruby
lib/scruby/ugen/gendy1.rb
Ruby
mit
92
main
331
module Scruby module Ugen class Gendy1 < Gen rates :control, :audio inputs ampdist: 1, durdist: 1, adparam: 1, ddparam: 1, minfreq: { control: 20, audio: 440 }, maxfreq: { control: 1000, audio: 660 }, ampscale: 0.5, durscale: 0.5, init_c_ps: 12, knum: nil end...
github
maca/scruby
https://github.com/maca/scruby
lib/scruby/ugen/operation.rb
Ruby
mit
92
main
473
module Scruby module Ugen class Operation < Base def special_index Operations.binary_indexes.fetch(operation) end def parameter_names [] end def print_name "#{operation.to_s.capitalize} (#{rate})" end class << self def inherited(base) ...
github
maca/scruby
https://github.com/maca/scruby
lib/scruby/ugen/gendy2.rb
Ruby
mit
92
main
349
module Scruby module Ugen class Gendy2 < Gen rates :control, :audio inputs ampdist: 1, durdist: 1, adparam: 1, ddparam: 1, minfreq: { control: 20, audio: 440 }, maxfreq: { control: 1000, audio: 660 }, ampscale: 0.5, durscale: 0.5, init_c_ps: 12, knum: nil, a: 1.1...
github
maca/scruby
https://github.com/maca/scruby
lib/scruby/ugen/vibrato.rb
Ruby
mit
92
main
263
module Scruby module Ugen class Vibrato < Gen rates :control, :audio inputs freq: 440, playback_rate: 6, depth: 0.02, delay: 0, onset: 0, rate_variation: 0.04, depth_variation: 0.1, iphase: 0, trig: 0 end end end
github
maca/scruby
https://github.com/maca/scruby
lib/scruby/ugen/stereo_convolution2_l.rb
Ruby
mit
92
main
211
module Scruby module Ugen class StereoConvolution2L < Gen rates :audio inputs input: nil, kernel_l: nil, kernel_r: nil, trigger: 0, framesize: 2048, crossfade: 1 end end end
github
maca/scruby
https://github.com/maca/scruby
lib/scruby/ugen/pitch.rb
Ruby
mit
92
main
315
module Scruby module Ugen class Pitch < Gen rates :control inputs input: 0, init_freq: 440, min_freq: 60, max_freq: 4000, exec_freq: 100, max_bins_per_octave: 16, median: 1, amp_threshold: 0.01, peak_threshold: 0.5, down_sample: 1, clar: 0 end end end
github
maca/scruby
https://github.com/maca/scruby
lib/scruby/ugen/done_actions.rb
Ruby
mit
92
main
580
module Scruby module Ugen module DoneActions ACTIONS = %i( none pause free free_and_prev free_and_next free_and_all_in_prev free_and_all_in_next free_self_to_head free_self_to_tail free_and_pause_prev free_and_pause_next...
github
maca/scruby
https://github.com/maca/scruby
lib/scruby/ugen/gendy3.rb
Ruby
mit
92
main
238
module Scruby module Ugen class Gendy3 < Gen rates :control, :audio inputs ampdist: 1, durdist: 1, adparam: 1, ddparam: 1, freq: 440, ampscale: 0.5, durscale: 0.5, init_c_ps: 12, knum: nil end end end
github
maca/scruby
https://github.com/maca/scruby
lib/scruby/ugen/grain_sin.rb
Ruby
mit
92
main
221
module Scruby module Ugen class GrainSin < Gen rates :audio attributes channel_count: 1 inputs trigger: 0, dur: 1, freq: 440, pan: 0, envbufnum: -1, max_grains: 512 end end end
github
maca/scruby
https://github.com/maca/scruby
lib/scruby/ugen/beat_track2.rb
Ruby
mit
92
main
219
module Scruby module Ugen class BeatTrack2 < Gen rates :control inputs busindex: nil, numfeatures: nil, windowsize: 2, phaseaccuracy: 0.02, lock: 0, weightingscheme: nil end end end
github
maca/scruby
https://github.com/maca/scruby
lib/scruby/ugen/demand_env_gen.rb
Ruby
mit
92
main
265
module Scruby module Ugen class DemandEnvGen < Gen rates :control, :audio inputs level: nil, dur: nil, shape: 1, curve: 0, gate: 1, reset: 1, level_scale: 1, level_bias: 0, time_scale: 1, done_action: 0 end end end
github
maca/scruby
https://github.com/maca/scruby
lib/scruby/ugen/gen.rb
Ruby
mit
92
main
1,073
module Scruby module Ugen class Gen < Base class << self def ar(*args, **kwargs) build(:audio, *args, **kwargs) end alias audio ar def kr(*args, **kwargs) build(:control, *args, **kwargs) end alias control kr def ir(*args, **kwarg...
github
maca/scruby
https://github.com/maca/scruby
lib/scruby/ugen/env_gen.rb
Ruby
mit
92
main
368
module Scruby module Ugen class EnvGen < Gen rates :control, :audio inputs envelope: nil, gate: 1, level_scale: 1, level_bias: 0, time_scale: 1, done_action: 0 def inputs %i(gate level_scale level_bias time_scale done_action envelope) .map { |name| [ name, super.f...
github
maca/scruby
https://github.com/maca/scruby
lib/scruby/ugen/grain_buf.rb
Ruby
mit
92
main
260
module Scruby module Ugen class GrainBuf < Gen rates :audio attributes channel_count: 1 inputs trigger: 0, dur: 1, sndbuf: nil, playback_rate: 1, pos: 0, interp: 2, pan: 0, envbufnum: -1, max_grains: 512 end end end
github
maca/scruby
https://github.com/maca/scruby
lib/scruby/ugen/grain_fm.rb
Ruby
mit
92
main
247
module Scruby module Ugen class GrainFM < Gen rates :audio attributes channel_count: 1 inputs trigger: 0, dur: 1, carfreq: 440, modfreq: 200, index: 1, pan: 0, envbufnum: -1, max_grains: 512 end end end
github
maca/scruby
https://github.com/maca/scruby
lib/scruby/ugen/pv_jensen_andersen.rb
Ruby
mit
92
main
224
module Scruby module Ugen class PVJensenAndersen < Gen rates :audio inputs buffer: nil, propsc: 0.25, prophfe: 0.25, prophfc: 0.25, propsf: 0.25, threshold: 1, waittime: 0.04 end end end
github
maca/scruby
https://github.com/maca/scruby
lib/scruby/ugen/record_buf.rb
Ruby
mit
92
main
239
module Scruby module Ugen class RecordBuf < Gen rates :control, :audio inputs input_array: nil, bufnum: 0, offset: 0, rec_level: 1, pre_level: 0, run: 1, loop: 1, trigger: 1, done_action: 0 end end end
github
maca/scruby
https://github.com/maca/scruby
lib/scruby/ugen/warp1.rb
Ruby
mit
92
main
264
module Scruby module Ugen class Warp1 < Gen rates :audio attributes channel_count: 1 inputs bufnum: 0, pointer: 0, freq_scale: 1, window_size: 0.2, envbufnum: -1, overlaps: 8, window_rand_ratio: 0, interp: 1 end end end
github
maca/scruby
https://github.com/maca/scruby
lib/scruby/ugen/pitch_shift.rb
Ruby
mit
92
main
202
module Scruby module Ugen class PitchShift < Gen rates :audio inputs input: 0, window_size: 0.2, pitch_ratio: 1, pitch_dispersion: 0, time_dispersion: 0 end end end
github
maca/scruby
https://github.com/maca/scruby
lib/scruby/ugen/play_buf.rb
Ruby
mit
92
main
239
module Scruby module Ugen class PlayBuf < Gen rates :control, :audio attributes channel_count: 1 inputs bufnum: 0, playback_rate: 1, trigger: 1, start_pos: 0, loop: 0, done_action: 0 end end end
github
maca/scruby
https://github.com/maca/scruby
lib/scruby/ugen/operations.rb
Ruby
mit
92
main
4,909
module Scruby module Ugen module Operations OperationHelpers = Module.new class << self def unary_indexes @unary_indexes ||= {} end def binary_indexes @binary_indexes ||= {} end def operations unary_indexes.keys + binary_indexes....
github
maca/scruby
https://github.com/maca/scruby
lib/scruby/ugen/onsets.rb
Ruby
mit
92
main
253
module Scruby module Ugen class Onsets < Gen rates :control inputs chain: nil, threshold: 0.5, odftype: "rcomplex", relaxtime: 1, floor: 0.1, mingap: 10, medianspan: 11, whtype: 1, rawodf: 0 end end end
github
maca/scruby
https://github.com/maca/scruby
lib/scruby/ugen/multi_channel.rb
Ruby
mit
92
main
940
module Scruby module Ugen class MultiChannel include Equatable include Enumerable include Operations def initialize(ugens) @ugens = ugens.to_a end def each return enum_for(:each) unless block_given? @ugens.each { |u| yield u } end def rate...
github
maca/scruby
https://github.com/maca/scruby
lib/scruby/ugen/g_verb.rb
Ruby
mit
92
main
270
module Scruby module Ugen class GVerb < Gen rates :audio inputs input: nil, roomsize: 10, revtime: 3, damping: 0.5, inputbw: 0.5, spread: 15, drylevel: 1, earlyreflevel: 0.7, taillevel: 0.5, maxroomsize: 300 end end end
github
maca/scruby
https://github.com/maca/scruby
lib/scruby/ugen/binary_op_ugen.rb
Ruby
mit
92
main
1,206
module Scruby module Ugen class BinaryOpUgen < Operation attributes operation: nil inputs left: nil, right: nil class << self def apply(operation, left, right) rate = Ugen.max_rate(left, right) return optimize_add(rate, left, right) if operation == :add ne...
github
maca/scruby
https://github.com/maca/scruby
lib/scruby/ugen/control.rb
Ruby
mit
92
main
282
module Scruby module Ugen class Control < Gen rates :scalar, :control, :trigger attributes control_names: [] def output_specs control_names.map(&:rate_index) end def channel_count control_names.count end end end end
github
maca/scruby
https://github.com/maca/scruby
lib/scruby/ugen/compander_d.rb
Ruby
mit
92
main
208
module Scruby module Ugen class CompanderD < Gen rates :audio inputs input: 0, thresh: 0.5, slope_below: 1, slope_above: 1, clamp_time: 0.01, relax_time: 0.01 end end end
github
maca/scruby
https://github.com/maca/scruby
lib/scruby/ugen/abstract_out.rb
Ruby
mit
92
main
449
module Scruby module Ugen class AbstractOut < Ugen::Base def output_specs; [] end def channel_count; 0 end def input_values super.flatten end def parameter_names super - %i(channels_array) end def out? true end class << self ...
github
maca/scruby
https://github.com/maca/scruby
lib/scruby/ugen/grain_in.rb
Ruby
mit
92
main
221
module Scruby module Ugen class GrainIn < Gen rates :audio attributes channel_count: 1 inputs trigger: 0, dur: 1, input: nil, pan: 0, envbufnum: -1, max_grains: 512 end end end
github
maca/scruby
https://github.com/maca/scruby
lib/scruby/ugen/t_grains.rb
Ruby
mit
92
main
244
module Scruby module Ugen class TGrains < Gen rates :audio attributes channel_count: 1 inputs trigger: 0, bufnum: 0, playback_rate: 1, center_pos: 0, dur: 0.1, pan: 0, amp: 0.1, interp: 4 end end end
github
maca/scruby
https://github.com/maca/scruby
lib/scruby/ugen/unary_op_ugen.rb
Ruby
mit
92
main
285
module Scruby module Ugen class UnaryOpUgen < Operation attributes operation: nil inputs operand: nil class << self def apply(operation, operand) UnaryOpUgen.new(operation, operand, rate: operand.rate) end end end end end
github
maca/scruby
https://github.com/maca/scruby
lib/scruby/process/registry.rb
Ruby
mit
92
main
704
require "concurrent" require "singleton" module Scruby class Process class Registry include Singleton def initialize @processes = Concurrent::Array.new at_exit { @processes.each(&:kill) } Thread.new do loop do @processes.select!(&:alive?) ...
github
maca/scruby
https://github.com/maca/scruby
lib/scruby/ugen_graph/ugen_node.rb
Ruby
mit
92
main
3,910
require "forwardable" module Scruby class UgenGraph class UgenNode extend Forwardable include Encode include Equatable include PrettyInspectable def_delegators :ugen, :name, :print_name, :rate, :rate_index, :parameter_names, :channel_count, ...
github
maca/scruby
https://github.com/maca/scruby
lib/scruby/ugen_graph/control_name.rb
Ruby
mit
92
main
975
module Scruby class UgenGraph class ControlName include Equatable include PrettyInspectable include Encode attr_reader :default, :rate, :name def initialize(default, rate = :control, name = nil) rates.include?(rate) || raise(ArgumentError, "rate `#...
github
maca/scruby
https://github.com/maca/scruby
lib/scruby/ugen_graph/constant.rb
Ruby
mit
92
main
449
module Scruby class UgenGraph class Constant include Equatable include PrettyInspectable attr_reader :value def initialize(value) @value = value.to_f end def input_specs(graph) [ -1, graph.constants.index(self) ] end def inspect super(val...
github
maca/scruby
https://github.com/maca/scruby
lib/scruby/ugen_graph/control.rb
Ruby
mit
92
main
897
module Scruby class UgenGraph class ControlName include Equatable include PrettyInspectable include Encode RATES = %i(scalar control trigger) attr_reader :rate, :default, :name def initialize(default, rate = :control, name = nil) RATES.include?(rate) || rai...
github
maca/scruby
https://github.com/maca/scruby
lib/scruby/server/options.rb
Ruby
mit
92
main
3,832
module Scruby class Server class Options extend Attributes include Enumerable attributes do attribute :bind_address, "127.0.0.1" attribute :protocol, :udp attribute :port, 57_110 attribute :num_audio_bus_channels, 1024 attribute :num_control_bus_channels,...
github
maca/scruby
https://github.com/maca/scruby
lib/scruby/server/nodes.rb
Ruby
mit
92
main
1,173
module Scruby class Server class Nodes include Enumerable attr_reader :server, :semaphore, :graph private :server, :semaphore def initialize(server) @graph = Graph.new([]) @server = server @semaphore = Mutex.new end def decode_and_update(msg) ...
github
maca/scruby
https://github.com/maca/scruby
lib/scruby/server/message_queue.rb
Ruby
mit
92
main
2,224
require "ruby-osc" require "concurrent-edge" module Scruby class Server class MessageQueue include Concurrent include OSC attr_reader :message_id, :server, :patterns, :thread attr_accessor :debug private :message_id, :server, :patterns, :thread def initialize(server) ...
github
maca/scruby
https://github.com/maca/scruby
lib/scruby/graph/print.rb
Ruby
mit
92
main
1,339
module Scruby class Graph module Print class << self def print(root) puts visualize(root) end def visualize(root) visualize_node(root, [], "", nil) end protected def visualize_node(node, siblings, padding, param_name) is_last =...
github
maca/scruby
https://github.com/maca/scruby
lib/scruby/graph/node.rb
Ruby
mit
92
main
420
module Scruby class Graph class Node attr_accessor :obj, :id, :parent, :graph def initialize(obj = nil, id = nil, parent = nil) @obj, @id, @parent = obj, id, parent end def children graph.children_for(self) end def ==(other) self.class == other.class ...
github
maca/scruby
https://github.com/maca/scruby
lib/scruby/graph/decoder.rb
Ruby
mit
92
main
1,086
require "ostruct" module Scruby class Graph module Decoder class << self def decode(msg) Graph.new decode_node(msg.to_enum.tap(&:next), nil, []) end private def decode_node(bytes, parent, acc) id = bytes.next children_count = bytes.next ...
github
maca/scruby
https://github.com/maca/scruby
lib/scruby/utils/positional_keyword_args.rb
Ruby
mit
92
main
797
module Scruby module Utils module PositionalKeywordArgs private def positional_keyword_args(defaults, *args, **kwargs) if args.size > defaults.size raise ArgumentError, %W[ (wrong number of arguments (given #{args.size}, expected less than #{defaults.size})) ...
github
sclinede/blood_contracts
https://github.com/sclinede/blood_contracts
blood_contracts.gemspec
Ruby
mit
92
master
843
Gem::Specification.new do |spec| spec.name = "blood_contracts" spec.version = "1.0.0" spec.authors = ["Sergey Dolganov (sclinede)"] spec.email = ["sclinede@evilmartians.com"] spec.summary = " Ruby gem for runtime data validation and monitoring using the contracts approach....
github
sclinede/blood_contracts
https://github.com/sclinede/blood_contracts
Rakefile
Ruby
mit
92
master
679
require "bundler/gem_tasks" require "rspec/core/rake_task" RSpec::Core::RakeTask.new(:spec) task default: :spec task "db:prepare" do require "dotenv" Dotenv.load(".env.development") sh "createdb #{env_database_name}" do # Ignore errors end Dotenv.overload(".env.test") sh "createdb #{env_database_name...
github
sclinede/blood_contracts
https://github.com/sclinede/blood_contracts
spec/spec_helper.rb
Ruby
mit
92
master
413
require "bundler/setup" require "blood_contracts" require "dotenv" Dotenv.load(".env.test") RSpec.configure do |config| # Enable flags like --only-failures and --next-failure config.example_status_persistence_file_path = ".rspec_status" # Disable RSpec exposing methods globally on `Module` and `main` config.d...
github
sclinede/blood_contracts
https://github.com/sclinede/blood_contracts
spec/blood_contracts_spec.rb
Ruby
mit
92
master
998
RSpec.describe BloodContracts do describe ".run_name" do before { BloodContracts.run_name = "External run name" } it { expect(BloodContracts.run_name).to eq("External run name") } end describe ".storage" do context "when default configuration" do let(:expected_backend) { BloodContracts::Storag...
github
chrismo/tablesmith
https://github.com/chrismo/tablesmith
Appraisals
Ruby
mit
92
master
408
# frozen_string_literal: true appraise 'activerecord-4' do gem 'activerecord', '~> 4.0' gem 'sqlite3', '~> 1.3.6' end appraise 'activerecord-5.1' do gem 'activerecord', '~> 5.1.0' gem 'sqlite3', '~> 1.4' end appraise 'activerecord-5.2' do gem 'activerecord', '~> 5.2.0' gem 'sqlite3', '~> 1.4' end apprai...
github
chrismo/tablesmith
https://github.com/chrismo/tablesmith
Rakefile
Ruby
mit
92
master
330
# frozen_string_literal: true require 'rspec/core/rake_task' require 'bundler/gem_tasks' FileList['tasks/*.rake'].each(&method(:load)) task default: :spec desc 'Run the specs.' RSpec::Core::RakeTask.new do |t| t.pattern = '*_spec.rb' end require 'rubocop/rake_task' RuboCop::RakeTask.new(:rubocop) task default:...
github
chrismo/tablesmith
https://github.com/chrismo/tablesmith
tablesmith.gemspec
Ruby
mit
92
master
1,263
# frozen_string_literal: true lib = File.expand_path('lib', __dir__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'tablesmith/version' Gem::Specification.new do |gem| gem.name = 'tablesmith' gem.version = Tablesmith::VERSION gem.authors = ['chrismo'] gem.email =...
github
chrismo/tablesmith
https://github.com/chrismo/tablesmith
lib/tablesmith.rb
Ruby
mit
92
master
321
# frozen_string_literal: true require 'tablesmith/delegated_array_class' require 'tablesmith/table' require 'tablesmith/array_rows_source' require 'tablesmith/hash_rows_base' require 'tablesmith/hash_rows_source' require 'tablesmith/active_record_source' require 'tablesmith/html_formatter' require 'tablesmith/version'
github
chrismo/tablesmith
https://github.com/chrismo/tablesmith
lib/tablesmith/hash_rows_source.rb
Ruby
mit
92
master
1,544
# frozen_string_literal: true module Tablesmith::HashRowsSource include Tablesmith::HashRowsBase def text_table build_columns if columns.nil? super end def convert_item_to_hash_row(item) flatten_hash_to_row(item, columns) end def flatten_hash_to_row(deep_hash, columns) row = {} colum...
github
chrismo/tablesmith
https://github.com/chrismo/tablesmith
lib/tablesmith/active_record_source.rb
Ruby
mit
92
master
2,929
# frozen_string_literal: true module Tablesmith::ActiveRecordSource include Tablesmith::HashRowsBase def convert_item_to_hash_row(item) item.reload unless item.new_record? hash = item.serializable_hash(process_all_columns(serializable_options)) hash = fold_un_sourced_attributes_into_source_hash(first....
github
chrismo/tablesmith
https://github.com/chrismo/tablesmith
lib/tablesmith/array_rows_source.rb
Ruby
mit
92
master
547
# frozen_string_literal: true module Tablesmith::ArrayRowsSource def text_table build_columns if columns.nil? super end def convert_item_to_hash_row(item) item end # TODO: no support for deep def build_columns @columns ||= [] map do |array_row| @columns << array_row.map { |item|...
github
chrismo/tablesmith
https://github.com/chrismo/tablesmith
lib/tablesmith/delegated_array_class.rb
Ruby
mit
92
master
1,746
# frozen_string_literal: true require 'delegate' module Tablesmith # This adjustment to `DelegateClass(Array)` is necessary to allow calling puts # on a `Tablesmith::Table` and still get the table output, rather than the # default puts output of the underlying `Array`. # # Explaining why requires breaking s...
github
chrismo/tablesmith
https://github.com/chrismo/tablesmith
lib/tablesmith/table.rb
Ruby
mit
92
master
4,713
# frozen_string_literal: true require 'text-table' require 'csv' module Tablesmith class Table < Tablesmith.delegated_array_class def initialize(array = []) super(array) @array = array end def method_missing(meth_id, *args) # In order to support `Kernel::puts` of a `Table`, we need to...
github
chrismo/tablesmith
https://github.com/chrismo/tablesmith
lib/tablesmith/hash_rows_base.rb
Ruby
mit
92
master
1,216
# frozen_string_literal: true # ActiveRecord and HashRowsSource share a lot, but not everything. module Tablesmith::HashRowsBase # not all resulting rows will have data in all columns, so make sure all rows pad out missing columns def normalize_keys(rows) all_keys = rows.map(&:keys).flatten.uniq rows.map {...