waveform 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -87,6 +87,10 @@ Sample sound file used in tests is in the Public Domain from soundbible.com: <ht
87
87
  Changes
88
88
  =======
89
89
 
90
+ 0.1.1
91
+ -----
92
+ * Fixed RMS calculation (was calculating RMSD instead of RMS before) -- thanks, cviedmai
93
+
90
94
  0.1.0
91
95
  -----
92
96
  * No more wrapping ffmpeg to automatically convert mp3 to wav
@@ -214,12 +214,8 @@ class Waveform
214
214
 
215
215
  # Returns the rms value across the given collection of frames for the given
216
216
  # channel.
217
- #
218
- # FIXME: this RMS calculation might be wrong...
219
- # refactored this from: http://pscode.org/javadoc/src-html/org/pscode/ui/audiotrace/AudioPlotPanel.html#line.996
220
217
  def channel_rms(frames, channel=0)
221
- avg = frames.inject(0.0){ |sum, frame| sum += frame ? Array(frame)[channel] : 0 }/frames.size.to_f
222
- Math.sqrt(frames.inject(0.0){ |sum, frame| sum += frame ? (Array(frame)[channel]-avg)**2 : 0 }/frames.size.to_f)
218
+ Math.sqrt(frames.inject(0.0){ |sum, frame| sum += (frame ? Array(frame)[channel] ** 2 : 0) } / frames.size)
223
219
  end
224
220
  end
225
221
  end
@@ -1,3 +1,3 @@
1
1
  class Waveform
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: waveform
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 25
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 0
10
- version: 0.1.0
9
+ - 1
10
+ version: 0.1.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Ben Alavi
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-09-27 00:00:00 Z
18
+ date: 2012-09-28 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: ruby-audio
@@ -91,7 +91,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
91
91
  requirements: []
92
92
 
93
93
  rubyforge_project:
94
- rubygems_version: 1.8.5
94
+ rubygems_version: 1.8.24
95
95
  signing_key:
96
96
  specification_version: 3
97
97
  summary: Generate waveform images from audio files