audio_monster 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/audio_monster/monster.rb +30 -0
- data/lib/audio_monster/version.rb +1 -1
- data/test/monster_test.rb +9 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 90c980e642765f4c35134473c0d92b09fec4c0f2
|
4
|
+
data.tar.gz: a0b3238eced6fb26cfde4a0175be05202b4ac8c5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 14c77f7f830adc36820eae515ef2770196254c6521b71672d489b7ec72654d284f54877f44ab03dcee55a7324f321968497c1fd0617780f9da72ab10fe919024
|
7
|
+
data.tar.gz: 68c00653509a3e9b65fbab46336338a24bfc9afdec1998c73068bc71ee59e236519f6c228cc9619a3fd67272d4abc3516d773fa39905fb7502328896fa5bba75
|
@@ -23,6 +23,36 @@ module AudioMonster
|
|
23
23
|
check_binaries if ENV['AUDIO_MONSTER_DEBUG']
|
24
24
|
end
|
25
25
|
|
26
|
+
# Integrated loudness:
|
27
|
+
# I: -18.5 LUFS
|
28
|
+
# Threshold: -28.6 LUFS
|
29
|
+
|
30
|
+
# Loudness range:
|
31
|
+
# LRA: 7.1 LU
|
32
|
+
# Threshold: -38.7 LUFS
|
33
|
+
# LRA low: -23.6 LUFS
|
34
|
+
# LRA high: -16.5 LUFS
|
35
|
+
|
36
|
+
# True peak:
|
37
|
+
# Peak: -2.1 dBFS
|
38
|
+
def loudness_info(path)
|
39
|
+
command = "#{bin(:ffmpeg)} -nostats -vn -i '#{path}' -y -filter_complex ebur128=peak=true -f null - 2>&1 | tail -12"
|
40
|
+
out, err = run_command(command, echo_return: false)
|
41
|
+
|
42
|
+
lines = out.split("\n").map(&:strip).compact.map { |o| o.split(":").map(&:strip) }
|
43
|
+
group = nil
|
44
|
+
info = {}
|
45
|
+
lines.each do |i|
|
46
|
+
if i.length == 1 && i[0].length > 0
|
47
|
+
group = i[0].downcase.gsub(' ', '_')
|
48
|
+
info[group] ||= {}
|
49
|
+
elsif i.length == 2
|
50
|
+
info[group][i[0].downcase.gsub(' ', '_')] = i[1].to_f
|
51
|
+
end
|
52
|
+
end
|
53
|
+
info
|
54
|
+
end
|
55
|
+
|
26
56
|
def tone_detect(path, tone, threshold=0.05, min_time=0.5)
|
27
57
|
ranges = []
|
28
58
|
|
data/test/monster_test.rb
CHANGED
@@ -8,6 +8,15 @@ describe AudioMonster::Monster do
|
|
8
8
|
FileUtils.mkdir_p(out_dir)
|
9
9
|
}
|
10
10
|
|
11
|
+
it 'measures loudness' do
|
12
|
+
info = monster.loudness_info(in_file('test_long.wav'))
|
13
|
+
['integrated_loudness', 'loudness_range', 'true_peak'].
|
14
|
+
each { |t| info[t].wont_be_nil }
|
15
|
+
info['integrated_loudness']['i'].must_equal -18.5
|
16
|
+
info['loudness_range']['lra'].must_equal 7.1
|
17
|
+
info['true_peak']['peak'].must_equal -2.1
|
18
|
+
end
|
19
|
+
|
11
20
|
it 'can create an mp2 from a wav file' do
|
12
21
|
# try to create the mp2
|
13
22
|
monster.encode_mp2_from_wav(in_file('test_long.wav'), out_file('out.mp2')).wont_be_nil
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: audio_monster
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Kuklewicz
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-03-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nu_wav
|