waveformjson 0.0.2 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +2 -1
- data/bin/waveformjson +26 -11
- data/lib/waveformjson/version.rb +1 -1
- data/waveformjson.gemspec +1 -1
- metadata +10 -15
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: ac6ff9fd6c1ad25d94930f520c89f41e7cba753a
|
4
|
+
data.tar.gz: 14f9ff6bef263e94a617fc2ab850adabf00ae418
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 8c7ef2ca906496eb9a301f4ba445953c414cc16eb302e95d4767af42c639c9e40303f9676c2a6a5ff85f1c9fd58eb7a0ab3bdda690912d124be3ba2f1b18c313
|
7
|
+
data.tar.gz: 199456469d889f5c8402cda2cf48fd67f5bbbc12ebd1855aa7de855d976b8a4e77eee59e424c3865110fbeb5e0255784c41b266730404ede783ce5edc117a9d8
|
data/README.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
Waveformjson
|
2
2
|
========
|
3
3
|
|
4
|
-
Waveformjson is based on [waveform](https://github.com/benalavi/waveform) and functions the same. The only difference is that it generates json instead of
|
4
|
+
Waveformjson is based on [waveform](https://github.com/benalavi/waveform) and functions the same. The only difference is that it generates json instead of png files.
|
5
5
|
|
6
6
|
Installation
|
7
7
|
============
|
@@ -35,6 +35,7 @@ There are also some less-nifty options:
|
|
35
35
|
-q will generate your waveform without printing out a bunch of stuff.
|
36
36
|
-h will print out a help screen with all this info.
|
37
37
|
-F will automatically overwrite destination file.
|
38
|
+
-o will output your waveform data to the console.
|
38
39
|
|
39
40
|
Usage in code
|
40
41
|
=============
|
data/bin/waveformjson
CHANGED
@@ -21,10 +21,16 @@ optparse = OptionParser.new do |o|
|
|
21
21
|
end
|
22
22
|
|
23
23
|
options[:force] = false
|
24
|
-
o.on("-F", "--force", "Force
|
24
|
+
o.on("-F", "--force", "Force generation of waveform if file exists") do
|
25
25
|
options[:force] = true
|
26
26
|
end
|
27
27
|
|
28
|
+
options[:output] = false
|
29
|
+
o.on("-o", "--output", "Output waveform data") do
|
30
|
+
options[:logger] = nil
|
31
|
+
options[:output] = true
|
32
|
+
end
|
33
|
+
|
28
34
|
o.on("-h", "--help", "Display this screen") do
|
29
35
|
puts o
|
30
36
|
exit
|
@@ -34,26 +40,35 @@ end
|
|
34
40
|
optparse.parse!
|
35
41
|
|
36
42
|
begin
|
37
|
-
|
43
|
+
samples = Waveformjson.generate(ARGV[0], options)
|
38
44
|
|
39
|
-
|
40
|
-
|
45
|
+
json = "["
|
46
|
+
|
47
|
+
samples.each_with_index do |d, index|
|
48
|
+
json << d.to_s
|
49
|
+
json << ", " unless index == samples.size - 1
|
41
50
|
end
|
42
51
|
|
43
|
-
json
|
44
|
-
|
45
|
-
|
52
|
+
json << "]"
|
53
|
+
|
54
|
+
if options[:output]
|
55
|
+
print json
|
56
|
+
else
|
57
|
+
filename = ARGV[1] || "waveform.json"
|
46
58
|
|
47
|
-
|
48
|
-
|
49
|
-
f << ', ' unless index == json.size - 1
|
59
|
+
if File.exists?(filename) && !options[:force]
|
60
|
+
raise RuntimeError.new("Destination file #{filename} exists. Use --force if you want to automatically remove it.")
|
50
61
|
end
|
51
62
|
|
52
|
-
|
63
|
+
File.open(filename, "w") do |f|
|
64
|
+
f << json
|
65
|
+
end
|
53
66
|
end
|
54
67
|
rescue ArgumentError => e
|
55
68
|
puts e.message + "\n\n"
|
56
69
|
puts optparse
|
70
|
+
exit 1
|
57
71
|
rescue RuntimeError => e
|
58
72
|
puts e.message
|
73
|
+
exit 1
|
59
74
|
end
|
data/lib/waveformjson/version.rb
CHANGED
data/waveformjson.gemspec
CHANGED
@@ -4,7 +4,7 @@ Gem::Specification.new do |s|
|
|
4
4
|
s.name = "waveformjson"
|
5
5
|
s.version = Waveformjson::VERSION
|
6
6
|
s.summary = "Generate waveform json from audio files"
|
7
|
-
s.description = "Generate waveform json from audio files. Includes a Waveform class for generating waveforms in your code as well as a simple command-line program called '
|
7
|
+
s.description = "Generate waveform json from audio files. Includes a Waveform class for generating waveforms in your code as well as a simple command-line program called 'waveformjson' for generating on the command line."
|
8
8
|
s.authors = ["liufengyun"]
|
9
9
|
s.email = ["liufengyunchina@gmail.com"]
|
10
10
|
s.homepage = "http://github.com/liufengyun/waveformjson"
|
metadata
CHANGED
@@ -1,35 +1,32 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: waveformjson
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
5
|
-
prerelease:
|
4
|
+
version: 0.1.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- liufengyun
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2015-11-12 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: ruby-audio
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - '>='
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: '0'
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- -
|
24
|
+
- - '>='
|
28
25
|
- !ruby/object:Gem::Version
|
29
26
|
version: '0'
|
30
27
|
description: Generate waveform json from audio files. Includes a Waveform class for
|
31
28
|
generating waveforms in your code as well as a simple command-line program called
|
32
|
-
'
|
29
|
+
'waveformjson' for generating on the command line.
|
33
30
|
email:
|
34
31
|
- liufengyunchina@gmail.com
|
35
32
|
executables:
|
@@ -46,27 +43,25 @@ files:
|
|
46
43
|
- bin/waveformjson
|
47
44
|
homepage: http://github.com/liufengyun/waveformjson
|
48
45
|
licenses: []
|
46
|
+
metadata: {}
|
49
47
|
post_install_message:
|
50
48
|
rdoc_options: []
|
51
49
|
require_paths:
|
52
50
|
- lib
|
53
51
|
required_ruby_version: !ruby/object:Gem::Requirement
|
54
|
-
none: false
|
55
52
|
requirements:
|
56
|
-
- -
|
53
|
+
- - '>='
|
57
54
|
- !ruby/object:Gem::Version
|
58
55
|
version: '0'
|
59
56
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
60
|
-
none: false
|
61
57
|
requirements:
|
62
|
-
- -
|
58
|
+
- - '>='
|
63
59
|
- !ruby/object:Gem::Version
|
64
60
|
version: '0'
|
65
61
|
requirements: []
|
66
62
|
rubyforge_project:
|
67
|
-
rubygems_version:
|
63
|
+
rubygems_version: 2.0.14
|
68
64
|
signing_key:
|
69
|
-
specification_version:
|
65
|
+
specification_version: 4
|
70
66
|
summary: Generate waveform json from audio files
|
71
67
|
test_files: []
|
72
|
-
has_rdoc:
|