class Chaussettes::Effect::Synth

Represents a synth effect

Constants

DEFAULTS
OPT_NAMES
SWEEPS

Attributes

commands[R]

Public Class Methods

new(length = nil, type = nil) { |self| ... } click to toggle source
# File lib/chaussettes/effect/synth.rb, line 8
def initialize(length = nil, type = nil)
  @length = length
  @type = type

  @just_intonation = nil
  @combine = nil
  @start_tone = nil
  @end_tone = nil
  @headroom = true

  yield self if block_given?

  _build_commands
end

Public Instance Methods

_append_opts(opts) click to toggle source
# File lib/chaussettes/effect/synth.rb, line 47
def _append_opts(opts)
  return unless opts && opts.any?

  OPT_NAMES.each do |opt|
    value = opts[opt] || DEFAULTS[opt]
    break unless value
    @commands << value
  end
end
_append_start_params() click to toggle source
# File lib/chaussettes/effect/synth.rb, line 38
def _append_start_params
  return unless @length
  @commands << @length
  _append_opts @start_opts
end
_append_tones() click to toggle source
# File lib/chaussettes/effect/synth.rb, line 57
def _append_tones
  return unless @start_tone

  tone = if @end_tone
           "#{@start_tone}#{@sweep}#{@end_tone}"
         else
           @start_tone
         end

  @commands << tone

  _append_opts @end_opts
end
_build_commands() click to toggle source
# File lib/chaussettes/effect/synth.rb, line 23
def _build_commands
  @commands = [ 'synth' ]
  @commands << '-j' << @just_intonation if @just_intonation
  @commands << '-n' unless @headroom

  _append_start_params

  @commands << @type if @type
  @commands << @combine if @combine

  _append_tones

  @commands.freeze
end
combine(method) click to toggle source
# File lib/chaussettes/effect/synth.rb, line 81
def combine(method)
  @combine = method
  self
end
end_tone(end_tone, sweep = :linear, opts = {}) click to toggle source

options are:

bias:
shift:
p1:
p2:
p3:
# File lib/chaussettes/effect/synth.rb, line 114
def end_tone(end_tone, sweep = :linear, opts = {})
  @end_tone = end_tone
  @sweep = SWEEPS.fetch(sweep, sweep)
  @end_opts = opts
  self
end
headroom(enabled) click to toggle source
# File lib/chaussettes/effect/synth.rb, line 71
def headroom(enabled)
  @headroom = enabled
  self
end
just_intonation(semitones) click to toggle source
# File lib/chaussettes/effect/synth.rb, line 76
def just_intonation(semitones)
  @just_intonation = semitones
  self
end
length(len) click to toggle source
# File lib/chaussettes/effect/synth.rb, line 86
def length(len)
  @length = len
  self
end
start_tone(start_tone, opts = {}) click to toggle source

options are:

bias:
shift:
p1:
p2:
p3:
# File lib/chaussettes/effect/synth.rb, line 102
def start_tone(start_tone, opts = {})
  @start_tone = start_tone
  @start_opts = opts
  self
end
type(type) click to toggle source
# File lib/chaussettes/effect/synth.rb, line 91
def type(type)
  @type = type
  self
end