build_audulus_wavetable_node 0.3.1 → 0.4.0

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/midi_patch.rb +17 -2
  3. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8f13b7e4ccfcffd4b4eb974ff206d26eb9804242
4
- data.tar.gz: ffc90c1491e1cae78406dd319cda5a157c8cb7e9
3
+ metadata.gz: b0430540d97d29d13391b6466220caa8beef3952
4
+ data.tar.gz: d75945b017b74ab830417884512cd3f6e07b8d1c
5
5
  SHA512:
6
- metadata.gz: 6ded39eb56c36c9d5f127d818bfc681003f98a4774546c4824391c7f6e8d4e8c3b2344ebbf8108f18065a237b53fd2dadbdbc0789b7c928fa4691bf3f534f96a
7
- data.tar.gz: 6249624355929227ac4741c45a532ccd58fd8bc56b8730b40b01033c00db761a1248a49f65a5b7c3daf61bbe3f284bb34b30fb319564a8ea2fa99ecb5d2a27b5
6
+ metadata.gz: a272a9846e85be361a8b2afd8815bac51c4c21e4bdcffc77e4b6a7871b86f610e6f776ce53bd0d8eefc4562b6e4dc583b58a311f8a695569ee28277381ed9200
7
+ data.tar.gz: 942129e6fbffecee61f4135fbe544f295ab2440b27ea3c4662dc9a04e88796239a6372babc9d5a5e1b7e427fb16db530c6693552391a44752e75422a6c933eb0
@@ -4,6 +4,8 @@ require_relative 'spline_helper'
4
4
  require 'pry'
5
5
 
6
6
  module MidiPatch
7
+ STEPWISE_X_DELTA = 0.0001
8
+
7
9
  def self.build_patch(path)
8
10
  seq = MIDI::Sequence.new()
9
11
 
@@ -56,7 +58,8 @@ module MidiPatch
56
58
  }
57
59
 
58
60
  coordinates = scaled_times.zip(scaled_notes)
59
- SplineHelper.build_spline_node_from_coordinates(coordinates)
61
+ stepwise_coordinates = make_stepwise(coordinates)
62
+ SplineHelper.build_spline_node_from_coordinates(stepwise_coordinates)
60
63
  end
61
64
 
62
65
  def self.build_gate_node(seq)
@@ -82,7 +85,8 @@ module MidiPatch
82
85
  end
83
86
  }
84
87
 
85
- SplineHelper.build_spline_node_from_coordinates(coordinates)
88
+ stepwise_coordinates = make_stepwise(coordinates)
89
+ SplineHelper.build_spline_node_from_coordinates(stepwise_coordinates)
86
90
  end
87
91
 
88
92
  def self.scale_time(time, min_time, max_time)
@@ -100,4 +104,15 @@ module MidiPatch
100
104
  def self.remove_from_stack(stack, event)
101
105
  stack.delete_if {|e| e.note == event.note}
102
106
  end
107
+
108
+ def self.make_stepwise(coordinates)
109
+ last_y = nil
110
+ coordinates.flat_map {|x, y|
111
+ result = []
112
+ result << [x-STEPWISE_X_DELTA, last_y] unless last_y.nil?
113
+ result << [x, y]
114
+ last_y = y
115
+ result
116
+ }
117
+ end
103
118
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: build_audulus_wavetable_node
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jimmy Thrasher
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-05-17 00:00:00.000000000 Z
11
+ date: 2018-05-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fftw3
@@ -97,5 +97,5 @@ rubyforge_project:
97
97
  rubygems_version: 2.6.13
98
98
  signing_key:
99
99
  specification_version: 4
100
- summary: Builds a wavetable patch for Audulus given a WAV file
100
+ summary: Builds Audulus patches based on WAV or MIDI file inputs
101
101
  test_files: []