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 +4 -4
- data/README.md +12 -9
- data/lib/carrierwave/audio/processor.rb +3 -13
- data/lib/carrierwave/audio/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5cfd9c0f3a67df48a91532f5fc4824efade4cd07
|
4
|
+
data.tar.gz: 56886d59465e49ade882804c82d07596280ca0e4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
48
|
+
process :convert => [{output_format:, output_options:}]
|
49
49
|
```
|
50
50
|
|
51
|
-
`output_format` -
|
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 => [
|
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 => [
|
84
|
+
process :watermark => [{watermark_file:, output_format:, output_options:}]
|
82
85
|
```
|
83
86
|
|
84
|
-
`
|
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` -
|
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
|
95
|
+
@log.timed("\nCombining source file and watermark, limiting final output...") do
|
106
96
|
combiner = Sox::Cmd.new(combine: :mix)
|
107
|
-
combiner.add_input
|
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}",
|
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
|
|
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.
|
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:
|
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:
|