Class: Audiomator::Options

Inherits:
Struct
  • Object
show all
Defined in:
lib/audiomator/options.rb

Overview

Options which convert audio to

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(start_time, end_time, bitrate = '96k', sample_rate = '44100', metadata = {}) ⇒ Options

Returns a new instance of Options.



6
7
8
# File 'lib/audiomator/options.rb', line 6

def initialize(start_time, end_time, bitrate = '96k', sample_rate = '44100',  = {})
  super
end

Instance Attribute Details

#bitrateObject

Returns the value of attribute bitrate

Returns:

  • (Object)

    the current value of bitrate



4
5
6
# File 'lib/audiomator/options.rb', line 4

def bitrate
  @bitrate
end

#end_timeObject

Returns the value of attribute end_time

Returns:

  • (Object)

    the current value of end_time



4
5
6
# File 'lib/audiomator/options.rb', line 4

def end_time
  @end_time
end

#metadataObject

Returns the value of attribute metadata

Returns:

  • (Object)

    the current value of metadata



4
5
6
# File 'lib/audiomator/options.rb', line 4

def 
  @metadata
end

#sample_rateObject

Returns the value of attribute sample_rate

Returns:

  • (Object)

    the current value of sample_rate



4
5
6
# File 'lib/audiomator/options.rb', line 4

def sample_rate
  @sample_rate
end

#start_timeObject

Returns the value of attribute start_time

Returns:

  • (Object)

    the current value of start_time



4
5
6
# File 'lib/audiomator/options.rb', line 4

def start_time
  @start_time
end

Instance Method Details

#metadata_stringObject



11
12
13
14
# File 'lib/audiomator/options.rb', line 11

def 
  return '' if .empty?
  .map { |k, v| "-metadata #{k}=#{Shellwords.escape(v)}" }.join(' ')
end

#to_sObject



16
17
18
# File 'lib/audiomator/options.rb', line 16

def to_s
  "-b:a #{bitrate} -ar #{sample_rate} -ss #{start_time} -to #{end_time} #{}"
end