carrierwave-audio 1.0.6 → 1.0.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fc52f0f740d2c0e991b05cd320ae11ecd943c989
4
- data.tar.gz: efa91bef6f74e088b95f56cef3f9651e46cf521c
3
+ metadata.gz: 5cfd9c0f3a67df48a91532f5fc4824efade4cd07
4
+ data.tar.gz: 56886d59465e49ade882804c82d07596280ca0e4
5
5
  SHA512:
6
- metadata.gz: bcf72a9e54478c4b81a16efd96695324191c14df2b9ad0127d579cbb054b98a815347137ebfa421900cb987ad107e9462d99b3873b33a6d9cfe0bb6a1b5de4c0
7
- data.tar.gz: a60c7674dd03e62b1c1894bbc5a7e9b533c21e775ba949111918661ae7015328f7b14398e44dee963276ca52c2d29d44510ebe86e03e2f2b52e690143c26ea22
6
+ metadata.gz: 8c6693acb8a3a42eb9cbeb7ff5f1a8e80b50e1ab7c97a36ebd71c4dcf3384efd7e95c9997ec9c9f8f3fddc471e77cacb3bfcc0288772d8cbce517f7d512fe761
7
+ data.tar.gz: 8e1af9bdd51d822b47f88b056c572d75398fecc449a74c45f540848b894f1bf6f6ec13028265f62727c40391eaa0127c2b1665041be8ee8352d883bec64bd763
data/README.md CHANGED
@@ -34,7 +34,7 @@ If you'd like to convert from your initially uploaded file-type to a different o
34
34
 
35
35
  ```ruby
36
36
  version :mp3 do
37
- process :convert => [:mp3]
37
+ process :convert => [{output_format: :mp3}]
38
38
 
39
39
  def full_filename(for_file)
40
40
  "#{super.chomp(File.extname(super))}.mp3"
@@ -42,13 +42,13 @@ If you'd like to convert from your initially uploaded file-type to a different o
42
42
  end
43
43
  ```
44
44
 
45
- `process :convert` accepts two parameters:
45
+ `process :convert` accepts a hash with one or two parameters:
46
46
 
47
47
  ```ruby
48
- process :convert => [output_format, output_options]
48
+ process :convert => [{output_format:, output_options:}]
49
49
  ```
50
50
 
51
- `output_format` - Optional. The only currently available option is the default, `:mp3`.
51
+ `output_format` - Accepts a symbol. The only currently available option is the default, `:mp3`.
52
52
 
53
53
  `output_options` - Optional. Sox options for the output file (see [ruby-sox](https://github.com/TMXCredit/ruby-sox) and the [SoX documentation](http://sox.sourceforge.net/sox.pdf)). Defaults to:
54
54
 
@@ -67,7 +67,10 @@ If you'd like to add a watermark over the top of your file, use `watermark` like
67
67
 
68
68
  ```ruby
69
69
  version :watermarked do
70
- process :watermark => ["#{Rails.root}/db/watermark.mp3"]
70
+ process :watermark => [{
71
+ output_format: :mp3,
72
+ watermark_file: "#{Rails.root}/db/watermark.mp3"
73
+ }]
71
74
 
72
75
  def full_filename(for_file)
73
76
  "#{super.chomp(File.extname(super))}.mp3"
@@ -75,17 +78,17 @@ If you'd like to add a watermark over the top of your file, use `watermark` like
75
78
  end
76
79
  ```
77
80
 
78
- `process :watermark` accepts three parameters:
81
+ `process :watermark` accepts a hash with up to three parameters:
79
82
 
80
83
  ```ruby
81
- process :watermark => [watermark_file_path, output_format, output_options]
84
+ process :watermark => [{watermark_file:, output_format:, output_options:}]
82
85
  ```
83
86
 
84
- `watermark_file_path` - REQUIRED. Path to where your watermarked file is stored.
87
+ `watermark_file` - REQUIRED. Path to where your watermarked file is stored.
85
88
 
86
89
  VERY IMPORTANT: The watermarked file must be a 44.1k, 2-channel mp3. It needs to be a long file. It'll be truncated to fit the length of your uploaded file.
87
90
 
88
- `output_format` - Optional. The only currently available option is the default, `:mp3`.
91
+ `output_format` - Accepts a symbol. The only currently available option is the default, `:mp3`.
89
92
 
90
93
  `output_options` - Optional. Sox options for the output file (see [ruby-sox](https://github.com/TMXCredit/ruby-sox) and the [SoX documentation](http://sox.sourceforge.net/sox.pdf)). Defaults to:
91
94
 
@@ -88,26 +88,16 @@ module CarrierWave
88
88
 
89
89
  ext = File.extname(source)
90
90
  input_options = { type: ext.gsub(/\./, '') }
91
- normalized_filename = tmp_filename(source: source, format: format, prefix: "norm")
92
- @log.timed("\nNormalizing file to -6dB...") do
93
- convert_file(
94
- input_file_path: source,
95
- input_options: input_options,
96
- output_file_path: normalized_filename,
97
- output_options: output_options_for_format(input_options[:type]),
98
- fx: { gain: "-n -6" }
99
- )
100
- end
101
91
 
102
92
  watermark_ext = File.extname(watermark_file_path)
103
93
  watermark_options = { type: watermark_ext.gsub(/\./, '') }
104
94
  final_filename = tmp_filename(source: source, format: format, prefix: "wtmk")
105
- @log.timed("\nCombining normalized file and watermark, normalizing final output to 0dB...") do
95
+ @log.timed("\nCombining source file and watermark, limiting final output...") do
106
96
  combiner = Sox::Cmd.new(combine: :mix)
107
- combiner.add_input normalized_filename, input_options
97
+ combiner.add_input source, input_options
108
98
  combiner.add_input watermark_file_path, watermark_options
109
99
  combiner.set_output final_filename, output_options_for_format(format)
110
- combiner.set_effects({ trim: "0 =#{Soxi::Wrapper.file(source).seconds}", gain: "-n" })
100
+ combiner.set_effects({ trim: "0 =#{Soxi::Wrapper.file(source).seconds}", vol: "0 db 0.01" })
111
101
  combiner.run
112
102
  end
113
103
 
@@ -1,5 +1,5 @@
1
1
  module CarrierWave
2
2
  module Audio
3
- VERSION = '1.0.6'
3
+ VERSION = '1.0.7'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: carrierwave-audio
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.6
4
+ version: 1.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Trevor Hinesley
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-11-23 00:00:00.000000000 Z
11
+ date: 2017-08-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: carrierwave
@@ -119,3 +119,4 @@ specification_version: 4
119
119
  summary: Simple SoX wrapper for CarrierWave uploader that allows audio file conversion
120
120
  and watermarking
121
121
  test_files: []
122
+ has_rdoc: