Class: StepSequencer::SoundBuilder::DefaultEffects::Pitch
- Inherits:
-
Object
- Object
- StepSequencer::SoundBuilder::DefaultEffects::Pitch
- Defined in:
- lib/step_sequencer/sound_builder/default_effects/pitch.rb
Class Method Summary collapse
- .build(sources:, value:, speed_correction: true) ⇒ Object
- .change_pitch(value, speed_correction) ⇒ Object
Class Method Details
.build(sources:, value:, speed_correction: true) ⇒ Object
5 6 7 |
# File 'lib/step_sequencer/sound_builder/default_effects/pitch.rb', line 5 def self.build(sources:, value:, speed_correction: true) sources.map &change_pitch(value, speed_correction) end |
.change_pitch(value, speed_correction) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/step_sequencer/sound_builder/default_effects/pitch.rb', line 9 def self.change_pitch(value, speed_correction) ->(source){ outfile = build_outfile_name(source, value) cmd = " ffmpeg -y -i \#{source} -af \\\n asetrate=44100*\#{value} \\\n \#{outfile} \\\n 2> /dev/null\n SH\n system cmd\n return outfile unless speed_correction\n outfile_with_correct_speed = correct_speed(outfile, value)\n outfile_with_correct_speed\n }\nend\n" |