Class: StepSequencer::SoundBuilder::DefaultEffects::Slice
- Inherits:
-
Object
- Object
- StepSequencer::SoundBuilder::DefaultEffects::Slice
- Defined in:
- lib/step_sequencer/sound_builder/default_effects/slice.rb
Class Method Summary collapse
Class Method Details
.build(sources:, start_pct: nil, end_pct: nil, start_time: nil, end_time: nil) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/step_sequencer/sound_builder/default_effects/slice.rb', line 5 def self.build(sources:, start_pct: nil, end_pct: nil, start_time: nil, end_time: nil) sources.map do |source| len = get_audio_length(source) start_time ||= calc_start_time(source, len, start_pct) end_time ||= calc_end_time(source, len, end_pct) diff = (end_time - start_time).round(6) outfile = build_outfile_path `sox #{source} #{outfile} trim #{start_time} #{diff} 2> /dev/null` outfile end end |