jstrait-wavefile 0.2.0 → 0.2.1
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.
- data/{README → README.markdown} +7 -3
- data/lib/wavefile.rb +2 -2
- metadata +2 -2
data/{README → README.markdown}
RENAMED
@@ -1,4 +1,6 @@
|
|
1
|
-
A
|
1
|
+
A Ruby gem for reading and writing wave files (*.wav).
|
2
|
+
|
3
|
+
# Installation
|
2
4
|
|
3
5
|
First, install the WaveFile gem...
|
4
6
|
|
@@ -8,6 +10,8 @@ First, install the WaveFile gem...
|
|
8
10
|
|
9
11
|
require 'wavefile'
|
10
12
|
|
13
|
+
# Usage
|
14
|
+
|
11
15
|
To open a wave file and get the raw sample data:
|
12
16
|
|
13
17
|
w = WaveFile.open("myfile.wav")
|
@@ -41,9 +45,9 @@ To create and save a new wave file:
|
|
41
45
|
w.sample_data = <array of samples goes here>
|
42
46
|
w.save("myfile.wav")
|
43
47
|
|
44
|
-
When calling the sample_data=() method, the passed in array can contain either raw samples or normalized samples. If the first item in the array is a Float, the entire array is assumed to be normalized. Normalized samples are automatically converted into raw samples when saving.
|
48
|
+
When calling the `sample_data=()` method, the passed in array can contain either raw samples or normalized samples. If the first item in the array is a Float, the entire array is assumed to be normalized. Normalized samples are automatically converted into raw samples when saving.
|
45
49
|
|
46
|
-
You can reverse a file with the reverse() method:
|
50
|
+
You can reverse a file with the `reverse()` method:
|
47
51
|
|
48
52
|
w = WaveFile.open("myfile.wav")
|
49
53
|
w.reverse()
|
data/lib/wavefile.rb
CHANGED
@@ -305,11 +305,11 @@ private
|
|
305
305
|
|
306
306
|
i = 0
|
307
307
|
while i < data.length
|
308
|
-
multichannel_data << data[i
|
308
|
+
multichannel_data << data[i...(num_channels + i)]
|
309
309
|
i += num_channels
|
310
310
|
end
|
311
311
|
|
312
|
-
data =
|
312
|
+
data = multichannel_data
|
313
313
|
end
|
314
314
|
rescue EOFError
|
315
315
|
file.close()
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jstrait-wavefile
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joel Strait
|
@@ -23,7 +23,7 @@ extra_rdoc_files: []
|
|
23
23
|
|
24
24
|
files:
|
25
25
|
- LICENSE
|
26
|
-
- README
|
26
|
+
- README.markdown
|
27
27
|
- lib/wavefile.rb
|
28
28
|
has_rdoc: false
|
29
29
|
homepage: http://www.joelstrait.com/
|