audio-trimmer 0.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +7 -0
  2. data/lib/audio_trimmer.rb +26 -0
  3. metadata +44 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 83cfad84df017e6fe467a9b4da5521a20114de23
4
+ data.tar.gz: 98bdcf12d2da99440a6012038afc4da2e5c57a28
5
+ SHA512:
6
+ metadata.gz: db6094d2a90864d378d5d14936aa569288f8f5916e764dd80afcbf48fdca5c5ce7c05a85166af7426fb9bfe6da5ff0019b1b58e5534e85a4558541e2f4046ea0
7
+ data.tar.gz: 5773e32fe2939c44c1a931aa74768d0917c61af9dd6a8384675ff8baab77103d96732fb24d1ae413303d88f49c919f617a851120a84b7d3f212c3cce8eeea5b1
@@ -0,0 +1,26 @@
1
+ # author: Ryan Brigden
2
+ # date: June 13, 2015
3
+
4
+ class AudioTrimmer
5
+
6
+ attr_accessor :input
7
+
8
+ def initialize(params = {})
9
+ @input = params.fetch(:input, "")
10
+ input_length = 0
11
+ if @input.empty?
12
+ raise "please specify input filepath"
13
+ end
14
+ end
15
+
16
+ def trim(start: 0, finish: get_length(@input), output: @input)
17
+ unless File.exist?(File.expand_path(@input)) or File.exist?(File.expand_path(output)) then raise "bad filepath" end
18
+ `sox #{@input} #{output} trim #{start} #{finish}`
19
+ end
20
+
21
+ def get_length file_path
22
+ return `soxi -D #{File.expand_path(file_path)}`.to_f
23
+ end
24
+
25
+ end
26
+
metadata ADDED
@@ -0,0 +1,44 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: audio-trimmer
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Ryan Brigden
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-06-14 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: audio trimmer powered by sox
14
+ email: rbrigden@cmu.edu
15
+ executables: []
16
+ extensions: []
17
+ extra_rdoc_files: []
18
+ files:
19
+ - lib/audio_trimmer.rb
20
+ homepage: http://rubygems.org/gems/audio-trimmer
21
+ licenses:
22
+ - MIT
23
+ metadata: {}
24
+ post_install_message:
25
+ rdoc_options: []
26
+ require_paths:
27
+ - lib
28
+ required_ruby_version: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ required_rubygems_version: !ruby/object:Gem::Requirement
34
+ requirements:
35
+ - - ">="
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ requirements: []
39
+ rubyforge_project:
40
+ rubygems_version: 2.4.5
41
+ signing_key:
42
+ specification_version: 4
43
+ summary: audio trimmer for most filetypes
44
+ test_files: []