sonic-midi 0.2.0 → 0.2.1

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: 6d7a570b58f2debf9059e51205ea158848dfd055
4
- data.tar.gz: f4729980238abceb71058315950d1e5b46fcfeb2
3
+ metadata.gz: b0fb4309e57aafcbe1803396082e3cf22ce0490f
4
+ data.tar.gz: 6aade3093120692503dff3bffdf999b5b138a753
5
5
  SHA512:
6
- metadata.gz: 4c4d6308413aa8683fc7f3b03c3ffde736bfee0ab7b4fec49f6701b8f14874fefbdfc13e95801edf1e37cb156547bf5c3c566de09da3cefad7887b8753b2c109
7
- data.tar.gz: c70e9fb3d13ab1756cf22fd561cd38a477f40e75562953b35fd2d0b24d59ccdf561e234197c5de6b0f9c1813a0f8682e0de7ceca4382b466ea1cce9f786c3a2c
6
+ metadata.gz: c63f6f6ffb3ab2b7eae67b0e9bd41e98f2ba2a50d6c03b37c40e2efc69a4e3e45d35488e854411aa37c7bf202e9ff7dc384aed8ad43220fa454b0a50d851455a
7
+ data.tar.gz: 0cfd5e4cc3b5b5e3fd97285c40330e23eb6f4b37c9ae99977d6ac37054a6d17420eb8bf939be5ef9565b7dfd83113bdb451a71b1e7dec9af189881cc8b909d3c
@@ -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'
@@ -14,7 +14,7 @@
14
14
 
15
15
  def repa(array, x)
16
16
  result = []
17
- (0..x).each do
17
+ (1..x).each do
18
18
  result.concat(array)
19
19
  end
20
20
  return result
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sonic-midi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Airapetyan