sonic-midi 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/bin/sonic_midi +31 -0
- data/lib/shared_functions.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b0fb4309e57aafcbe1803396082e3cf22ce0490f
|
4
|
+
data.tar.gz: 6aade3093120692503dff3bffdf999b5b138a753
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c63f6f6ffb3ab2b7eae67b0e9bd41e98f2ba2a50d6c03b37c40e2efc69a4e3e45d35488e854411aa37c7bf202e9ff7dc384aed8ad43220fa454b0a50d851455a
|
7
|
+
data.tar.gz: 0cfd5e4cc3b5b5e3fd97285c40330e23eb6f4b37c9ae99977d6ac37054a6d17420eb8bf939be5ef9565b7dfd83113bdb451a71b1e7dec9af189881cc8b909d3c
|
data/bin/sonic_midi
CHANGED
@@ -36,6 +36,26 @@ def check_input(args)
|
|
36
36
|
return input
|
37
37
|
end
|
38
38
|
|
39
|
+
def print_sequence(title, sequence)
|
40
|
+
puts title
|
41
|
+
sequence.each do |values|
|
42
|
+
puts ' - [%s]' % values.join(', ')
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
def print_music(input)
|
47
|
+
require_relative '../lib/shared_functions'
|
48
|
+
load input
|
49
|
+
melody = melody()
|
50
|
+
if melody.respond_to?(:key)
|
51
|
+
melody.keys().each do |k|
|
52
|
+
print_sequence(k, melody[k])
|
53
|
+
end
|
54
|
+
elsif melody.respond_to?(:length)
|
55
|
+
print_sequence('m', melody)
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
39
59
|
def play_music(input)
|
40
60
|
melody = File.read(input)
|
41
61
|
shared_functions = File.read(local_path('shared_functions.rb'))
|
@@ -57,6 +77,17 @@ program :name, 'sonic_midi'
|
|
57
77
|
program :version, '0.1.0'
|
58
78
|
program :description, 'Sends music to Sonic Pi and convert it to Midi'
|
59
79
|
|
80
|
+
command :print do |c|
|
81
|
+
c.syntax = 'sonic_midi print <filename>'
|
82
|
+
c.summary = 'Prints the melody sequence'
|
83
|
+
c.description = 'Diagnostical print of the melody sequence'
|
84
|
+
c.example 'description', 'sonic_midi print melody.rb'
|
85
|
+
c.action do |args, options|
|
86
|
+
input = check_input(args)
|
87
|
+
print_music(input)
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
60
91
|
command :sonic do |c|
|
61
92
|
c.syntax = 'sonic_midi sonic <filename>'
|
62
93
|
c.summary = 'Send music to SonicPi'
|
data/lib/shared_functions.rb
CHANGED