audio_stream 3.3.2 → 3.3.3

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
  SHA256:
3
- metadata.gz: 1b69fd98d701aaba159d25fe0bc82fcb7e5b32feae3cda4619828af71b743d94
4
- data.tar.gz: 35d108a674d5f927dd837b815af5d1ca47fcf160ec6ca8235691d958694b689f
3
+ metadata.gz: 323737f59491d3d370ca863c47eb54a2bce18dad3e1bf97d29674725e9e4213d
4
+ data.tar.gz: 4b1c734a8249a74f49a4a971535c4a2ed8c305de2e671ef4038a3766c17ab733
5
5
  SHA512:
6
- metadata.gz: db32a11e833955d1a6b74f3dd0bd5008ae25019ecb7c125a0512b25f2af9dd845da867f15c3c942a33b82385c375a6e1c6c09dde2b89d15d554160bfa79253dc
7
- data.tar.gz: 7b916c7c7c31d120e5e0026896a8cd8f8a2ab256e859dd26b392a4c8577cf8f21c840b70826e1ddf9ff54fdc453ebf1ba28d4a0a1f56a9ccf3148a01af2637a0
6
+ metadata.gz: a0b928495b8a46798be15e08254216fc9abea9b88d361abd96a9de0ea5d9449328a64509932d592a3307906be3a643344b6a46a1671e6f499fcf7c2d987675f5
7
+ data.tar.gz: bcc7884d895e368710535f8f265fdb1d4ba6080d14fcbd50195f3734a43a88518377a75111d6b00c51a6bb05bcba43997bd374537ce05d03998da8618c57f3d6
@@ -2,21 +2,25 @@ module AudioStream
2
2
  module Fx
3
3
  class SchroederReverb
4
4
 
5
- def initialize(soundinfo, time:, dry: 1.0, wet: 0.7)
5
+ # @param soundinfo [AudioStream::SoundInfo]
6
+ # @param time [AudioStream::Rate] reverb time
7
+ # @param dry [AudioStream::Decibel] dry gain
8
+ # @param wet [AudioStream::Decibel] wet gain
9
+ def initialize(soundinfo, time:, dry: -1.0, wet: -20.0)
6
10
  @window_size = soundinfo.window_size
7
11
  @combs = [
8
- CombFilter.new(soundinfo, freq: ms2freq(39.85 / 2.0 * time), q: 0.871402),
9
- CombFilter.new(soundinfo, freq: ms2freq(36.10 / 2.0 * time), q: 0.882762),
10
- CombFilter.new(soundinfo, freq: ms2freq(33.27 / 2.0 * time), q: 0.891443),
11
- CombFilter.new(soundinfo, freq: ms2freq(30.15 / 2.0 * time), q: 0.901117),
12
+ CombFilter.new(soundinfo, freq: time * (39.85 * 0.002), q: 0.871402),
13
+ CombFilter.new(soundinfo, freq: time * (36.10 * 0.002), q: 0.882762),
14
+ CombFilter.new(soundinfo, freq: time * (33.27 * 0.002), q: 0.891443),
15
+ CombFilter.new(soundinfo, freq: time * (30.15 * 0.002), q: 0.901117),
12
16
  ]
13
17
  @allpasss = [
14
- AllPassFilter.create(soundinfo, freq: ms2freq(5.0), q: 0.7),
15
- AllPassFilter.create(soundinfo, freq: ms2freq(1.7), q: 0.7),
18
+ AllPassFilter.create(soundinfo, freq: Rate.msec(5.0).freq(soundinfo), q: BiquadFilter::DEFAULT_Q),
19
+ AllPassFilter.create(soundinfo, freq: Rate.msec(1.7).freq(soundinfo), q: BiquadFilter::DEFAULT_Q),
16
20
  ]
17
21
 
18
- @dry = dry.to_f
19
- @wet = wet.to_f
22
+ @dry = Decibel.create(dry).mag
23
+ @wet = Decibel.create(wet).mag
20
24
  end
21
25
 
22
26
  def process(input)
@@ -43,10 +47,6 @@ module AudioStream
43
47
 
44
48
  Buffer.new(*streams)
45
49
  end
46
-
47
- def ms2freq(ms)
48
- 1.0 / (ms / 1000.0)
49
- end
50
50
  end
51
51
  end
52
52
  end
@@ -47,6 +47,26 @@ module AudioStream
47
47
  2.0 * Math::PI / sample(soundinfo)
48
48
  end
49
49
 
50
+ def *(other)
51
+ other = other.to_f
52
+
53
+ if @sample
54
+ return self.class.new(sample: @sample * other)
55
+ end
56
+
57
+ if @sec
58
+ return self.class.new(sec: @sec * other)
59
+ end
60
+
61
+ if @freq
62
+ return self.class.new(freq: @freq / other)
63
+ end
64
+
65
+ if @sync
66
+ return self.class.new(sync: @sync * other)
67
+ end
68
+ end
69
+
50
70
  def self.sec(v)
51
71
  new(sec: v)
52
72
  end
@@ -1,3 +1,3 @@
1
1
  module AudioStream
2
- VERSION = "3.3.2"
2
+ VERSION = "3.3.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: audio_stream
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.3.2
4
+ version: 3.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yoshida Tetsuya
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-12-02 00:00:00.000000000 Z
11
+ date: 2019-12-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler