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 +9 -1
- data/lib/spcore/core/delay_line.rb +5 -5
- data/lib/spcore/core/envelope_detector.rb +5 -5
- data/lib/spcore/core/oscillator.rb +8 -8
- data/lib/spcore/core/signal.rb +4 -4
- data/lib/spcore/filters/fir/dual_sinc_filter.rb +7 -7
- data/lib/spcore/filters/fir/sinc_filter.rb +6 -6
- data/lib/spcore/util/plotter.rb +8 -8
- data/lib/spcore/util/signal_generator.rb +4 -4
- data/lib/spcore/version.rb +1 -1
- metadata +4 -4
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
|
-
|
13
|
-
|
14
|
-
|
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
|
-
|
11
|
-
|
12
|
-
|
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
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
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
|
data/lib/spcore/core/signal.rb
CHANGED
@@ -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
|
-
|
12
|
-
|
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
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
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
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
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
|
|
data/lib/spcore/util/plotter.rb
CHANGED
@@ -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
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
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
|
-
|
9
|
-
|
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
|
|
data/lib/spcore/version.rb
CHANGED
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.
|
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-
|
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:
|
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:
|
234
|
+
hash: 718250849
|
235
235
|
requirements: []
|
236
236
|
rubyforge_project:
|
237
237
|
rubygems_version: 1.8.23
|