spcore 0.1.5 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
data/ChangeLog.rdoc CHANGED
@@ -27,4 +27,12 @@ Add EnvelopeDetector#attack_time= and EnvelopeDetector#release_time=
27
27
 
28
28
  === 0.1.4 / 2013-02-19
29
29
 
30
- Fixed gemspec to always depend on gnuplot (not just for development).
30
+ Fixed gemspec to always depend on gnuplot (not just for development).
31
+
32
+ === 0.1.5 / 2013-02-19
33
+
34
+ Adjust project documentation.
35
+
36
+ === 0.1.6 / 2013-03-21
37
+
38
+ Update to be compatible with hashmake-0.1.6.
@@ -8,11 +8,11 @@ class DelayLine
8
8
  attr_reader :sample_rate, :max_delay_seconds, :delay_seconds, :delay_samples
9
9
 
10
10
  # Used to process hashed arguments in #initialize.
11
- ARG_SPECS = [
12
- Hashmake::ArgSpec.new(:reqd => true, :key => :sample_rate, :type => Float, :validator => ->(a){ a > 0.0 } ),
13
- Hashmake::ArgSpec.new(:reqd => true, :key => :max_delay_seconds, :type => Float, :validator => ->(a){ (a > 0.0) } ),
14
- Hashmake::ArgSpec.new(:reqd => false, :key => :delay_seconds, :type => Float, :default => 0.0, :validator => ->(a){ a >= 0.0 } ),
15
- ]
11
+ ARG_SPECS = {
12
+ :sample_rate => arg_spec(:reqd => true, :type => Float, :validator => ->(a){ a > 0.0 } ),
13
+ :max_delay_seconds => arg_spec(:reqd => true, :type => Float, :validator => ->(a){ (a > 0.0) } ),
14
+ :delay_seconds => arg_spec(:reqd => false, :type => Float, :default => 0.0, :validator => ->(a){ a >= 0.0 } ),
15
+ }
16
16
 
17
17
  # A new instance of DelayLine. The circular buffer is filled by pushing an array
18
18
  # of zeros.
@@ -6,11 +6,11 @@ class EnvelopeDetector
6
6
  include Hashmake::HashMakeable
7
7
 
8
8
  # Used to process hashed arguments in #initialize.
9
- ARG_SPECS = [
10
- Hashmake::ArgSpec.new(:reqd => true, :key => :sample_rate, :type => Float, :validator => ->(a){ a > 0.0 } ),
11
- Hashmake::ArgSpec.new(:reqd => true, :key => :attack_time, :type => Float, :validator => ->(a){ a > 0.0 } ),
12
- Hashmake::ArgSpec.new(:reqd => true, :key => :release_time, :type => Float, :validator => ->(a){ a > 0.0 } ),
13
- ]
9
+ ARG_SPECS = {
10
+ :sample_rate => arg_spec(:reqd => true, :type => Float, :validator => ->(a){ a > 0.0 } ),
11
+ :attack_time => arg_spec(:reqd => true, :type => Float, :validator => ->(a){ a > 0.0 } ),
12
+ :release_time => arg_spec(:reqd => true, :type => Float, :validator => ->(a){ a > 0.0 } ),
13
+ }
14
14
 
15
15
  attr_reader :envelope, :sample_rate, :attack_time, :release_time
16
16
 
@@ -21,14 +21,14 @@ class Oscillator
21
21
  WAVES = [WAVE_SINE, WAVE_TRIANGLE, WAVE_SAWTOOTH, WAVE_SQUARE]
22
22
 
23
23
  # Used to process hashed arguments in #initialize.
24
- ARG_SPECS = [
25
- Hashmake::ArgSpec.new(:reqd => true, :key => :sample_rate, :type => Float, :validator => ->(a){ a > 0.0 } ),
26
- Hashmake::ArgSpec.new(:reqd => false, :key => :wave_type, :type => Symbol, :default => WAVE_SINE, :validator => ->(a){ WAVES.include? a } ),
27
- Hashmake::ArgSpec.new(:reqd => false, :key => :frequency, :type => Float, :default => 1.0, :validator => ->(a){ a > 0.0 } ),
28
- Hashmake::ArgSpec.new(:reqd => false, :key => :amplitude, :type => Float, :default => 1.0 ),
29
- Hashmake::ArgSpec.new(:reqd => false, :key => :phase_offset, :type => Float, :default => 0.0 ),
30
- Hashmake::ArgSpec.new(:reqd => false, :key => :dc_offset, :type => Float, :default => 0.0 ),
31
- ]
24
+ ARG_SPECS = {
25
+ :sample_rate => arg_spec(:reqd => true, :type => Float, :validator => ->(a){ a > 0.0 } ),
26
+ :wave_type => arg_spec(:reqd => false, :type => Symbol, :default => WAVE_SINE, :validator => ->(a){ WAVES.include? a } ),
27
+ :frequency => arg_spec(:reqd => false, :type => Float, :default => 1.0, :validator => ->(a){ a > 0.0 } ),
28
+ :amplitude => arg_spec(:reqd => false, :type => Float, :default => 1.0 ),
29
+ :phase_offset => arg_spec(:reqd => false, :type => Float, :default => 0.0 ),
30
+ :dc_offset => arg_spec(:reqd => false, :type => Float, :default => 0.0 ),
31
+ }
32
32
 
33
33
  # A new instance of Oscillator. The controllable wave parameters are frequency,
34
34
  # amplitude, phase offset, and DC offset. The current phase angle is initialized
@@ -7,10 +7,10 @@ class Signal
7
7
  include Hashmake::HashMakeable
8
8
 
9
9
  # Used to process hashed arguments in #initialize.
10
- ARG_SPECS = [
11
- Hashmake::ArgSpec.new(:key => :data, :reqd => true, :type => Array, :validator => ->(a){ a.any? }),
12
- Hashmake::ArgSpec.new(:key => :sample_rate, :reqd => true, :type => Float, :validator => ->(a){ a > 0.0 })
13
- ]
10
+ ARG_SPECS = {
11
+ :data => arg_spec(:reqd => true, :type => Array, :validator => ->(a){ a.any? }),
12
+ :sample_rate => arg_spec(:reqd => true, :type => Float, :validator => ->(a){ a > 0.0 })
13
+ }
14
14
 
15
15
  attr_reader :data, :sample_rate
16
16
 
@@ -11,13 +11,13 @@ class DualSincFilter
11
11
  include Hashmake::HashMakeable
12
12
 
13
13
  # Use to process hashed args in #initialize.
14
- ARG_SPECS = [
15
- Hashmake::ArgSpec.new(:key => :order, :reqd => true, :type => Fixnum, :validator => ->(a){ a % 2 == 0 } ),
16
- Hashmake::ArgSpec.new(:key => :sample_rate, :reqd => true, :type => Numeric, :validator => ->(a){ a > 0.0 } ),
17
- Hashmake::ArgSpec.new(:key => :left_cutoff_freq, :reqd => true, :type => Numeric, :validator => ->(a){ a > 0.0 } ),
18
- Hashmake::ArgSpec.new(:key => :right_cutoff_freq, :reqd => true, :type => Numeric, :validator => ->(a){ a > 0.0 } ),
19
- Hashmake::ArgSpec.new(:key => :window_class, :reqd => false, :type => Class, :default => BlackmanWindow ),
20
- ]
14
+ ARG_SPECS = {
15
+ :order => arg_spec(:reqd => true, :type => Fixnum, :validator => ->(a){ a % 2 == 0 } ),
16
+ :sample_rate => arg_spec(:reqd => true, :type => Numeric, :validator => ->(a){ a > 0.0 } ),
17
+ :left_cutoff_freq => arg_spec(:reqd => true, :type => Numeric, :validator => ->(a){ a > 0.0 } ),
18
+ :right_cutoff_freq => arg_spec(:reqd => true, :type => Numeric, :validator => ->(a){ a > 0.0 } ),
19
+ :window_class => arg_spec(:reqd => false, :type => Class, :default => BlackmanWindow ),
20
+ }
21
21
 
22
22
  attr_reader :bandpass_fir, :bandstop_fir, :left_filter, :right_filter
23
23
 
@@ -12,12 +12,12 @@ class SincFilter
12
12
  include Hashmake::HashMakeable
13
13
 
14
14
  # Use to process hashed args in #initialize.
15
- ARG_SPECS = [
16
- Hashmake::ArgSpec.new(:key => :order, :reqd => true, :type => Fixnum, :validator => ->(a){ a % 2 == 0 } ),
17
- Hashmake::ArgSpec.new(:key => :sample_rate, :reqd => true, :type => Numeric, :validator => ->(a){ a > 0.0 } ),
18
- Hashmake::ArgSpec.new(:key => :cutoff_freq, :reqd => true, :type => Numeric, :validator => ->(a){ a > 0.0 } ),
19
- Hashmake::ArgSpec.new(:key => :window_class, :reqd => false, :type => Class, :default => BlackmanWindow ),
20
- ]
15
+ ARG_SPECS = {
16
+ :order => arg_spec(:reqd => true, :type => Fixnum, :validator => ->(a){ a % 2 == 0 } ),
17
+ :sample_rate => arg_spec(:reqd => true, :type => Numeric, :validator => ->(a){ a > 0.0 } ),
18
+ :cutoff_freq => arg_spec(:reqd => true, :type => Numeric, :validator => ->(a){ a > 0.0 } ),
19
+ :window_class => arg_spec(:reqd => false, :type => Class, :default => BlackmanWindow ),
20
+ }
21
21
 
22
22
  attr_reader :lowpass_fir, :highpass_fir
23
23
 
@@ -7,14 +7,14 @@ class Plotter
7
7
  include Hashmake::HashMakeable
8
8
 
9
9
  # Used to process hashed args passed to #initialize.
10
- ARG_SPECS = [
11
- Hashmake::ArgSpec.new(:key => :title, :type => String, :reqd => false, :default => ""),
12
- Hashmake::ArgSpec.new(:key => :xlabel, :type => String, :reqd => false, :default => "x"),
13
- Hashmake::ArgSpec.new(:key => :ylabel, :type => String, :reqd => false, :default => "y"),
14
- Hashmake::ArgSpec.new(:key => :linestyle, :type => String, :reqd => false, :default => "lines"),
15
- Hashmake::ArgSpec.new(:key => :linewidth, :type => Fixnum, :reqd => false, :default => 1, :validator => ->(a){ a >= 1 }),
16
- Hashmake::ArgSpec.new(:key => :logscale, :type => String, :reqd => false, :default => ""),
17
- ]
10
+ ARG_SPECS = {
11
+ :title => arg_spec(:type => String, :reqd => false, :default => ""),
12
+ :xlabel => arg_spec(:type => String, :reqd => false, :default => "x"),
13
+ :ylabel => arg_spec(:type => String, :reqd => false, :default => "y"),
14
+ :linestyle => arg_spec(:type => String, :reqd => false, :default => "lines"),
15
+ :linewidth => arg_spec(:type => Fixnum, :reqd => false, :default => 1, :validator => ->(a){ a >= 1 }),
16
+ :logscale => arg_spec(:type => String, :reqd => false, :default => ""),
17
+ }
18
18
 
19
19
  # A new instance of Plotter.
20
20
  # @param [Hash] hashed_args A hash containing initialization parameters.
@@ -4,10 +4,10 @@ class SignalGenerator
4
4
  include Hashmake::HashMakeable
5
5
 
6
6
  # used to process hashed args in #initialize.
7
- ARG_SPECS = [
8
- Hashmake::ArgSpec.new(:key => :size, :reqd => true, :type => Fixnum, :validator => ->(a){ a > 0 }),
9
- Hashmake::ArgSpec.new(:key => :sample_rate, :reqd => true, :type => Float, :validator => ->(a){ a > 0.0 })
10
- ]
7
+ ARG_SPECS = {
8
+ :size => arg_spec(:reqd => true, :type => Fixnum, :validator => ->(a){ a > 0 }),
9
+ :sample_rate => arg_spec(:reqd => true, :type => Float, :validator => ->(a){ a > 0.0 })
10
+ }
11
11
 
12
12
  attr_reader :sample_rate, :size
13
13
 
@@ -1,5 +1,5 @@
1
1
  # A library of signal processing methods and classes.
2
2
  module SPCore
3
3
  # spcore version
4
- VERSION = "0.1.5"
4
+ VERSION = "0.1.6"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spcore
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-02-19 00:00:00.000000000 Z
12
+ date: 2013-03-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: hashmake
@@ -222,7 +222,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
222
222
  version: '0'
223
223
  segments:
224
224
  - 0
225
- hash: -207484525
225
+ hash: 718250849
226
226
  required_rubygems_version: !ruby/object:Gem::Requirement
227
227
  none: false
228
228
  requirements:
@@ -231,7 +231,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
231
231
  version: '0'
232
232
  segments:
233
233
  - 0
234
- hash: -207484525
234
+ hash: 718250849
235
235
  requirements: []
236
236
  rubyforge_project:
237
237
  rubygems_version: 1.8.23