ruby-audio 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/LICENSE ADDED
@@ -0,0 +1,340 @@
1
+ GNU GENERAL PUBLIC LICENSE
2
+ Version 2, June 1991
3
+
4
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
5
+ 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
6
+ Everyone is permitted to copy and distribute verbatim copies
7
+ of this license document, but changing it is not allowed.
8
+
9
+ Preamble
10
+
11
+ The licenses for most software are designed to take away your
12
+ freedom to share and change it. By contrast, the GNU General Public
13
+ License is intended to guarantee your freedom to share and change free
14
+ software--to make sure the software is free for all its users. This
15
+ General Public License applies to most of the Free Software
16
+ Foundation's software and to any other program whose authors commit to
17
+ using it. (Some other Free Software Foundation software is covered by
18
+ the GNU Library General Public License instead.) You can apply it to
19
+ your programs, too.
20
+
21
+ When we speak of free software, we are referring to freedom, not
22
+ price. Our General Public Licenses are designed to make sure that you
23
+ have the freedom to distribute copies of free software (and charge for
24
+ this service if you wish), that you receive source code or can get it
25
+ if you want it, that you can change the software or use pieces of it
26
+ in new free programs; and that you know you can do these things.
27
+
28
+ To protect your rights, we need to make restrictions that forbid
29
+ anyone to deny you these rights or to ask you to surrender the rights.
30
+ These restrictions translate to certain responsibilities for you if you
31
+ distribute copies of the software, or if you modify it.
32
+
33
+ For example, if you distribute copies of such a program, whether
34
+ gratis or for a fee, you must give the recipients all the rights that
35
+ you have. You must make sure that they, too, receive or can get the
36
+ source code. And you must show them these terms so they know their
37
+ rights.
38
+
39
+ We protect your rights with two steps: (1) copyright the software, and
40
+ (2) offer you this license which gives you legal permission to copy,
41
+ distribute and/or modify the software.
42
+
43
+ Also, for each author's protection and ours, we want to make certain
44
+ that everyone understands that there is no warranty for this free
45
+ software. If the software is modified by someone else and passed on, we
46
+ want its recipients to know that what they have is not the original, so
47
+ that any problems introduced by others will not reflect on the original
48
+ authors' reputations.
49
+
50
+ Finally, any free program is threatened constantly by software
51
+ patents. We wish to avoid the danger that redistributors of a free
52
+ program will individually obtain patent licenses, in effect making the
53
+ program proprietary. To prevent this, we have made it clear that any
54
+ patent must be licensed for everyone's free use or not licensed at all.
55
+
56
+ The precise terms and conditions for copying, distribution and
57
+ modification follow.
58
+
59
+ GNU GENERAL PUBLIC LICENSE
60
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
61
+
62
+ 0. This License applies to any program or other work which contains
63
+ a notice placed by the copyright holder saying it may be distributed
64
+ under the terms of this General Public License. The "Program", below,
65
+ refers to any such program or work, and a "work based on the Program"
66
+ means either the Program or any derivative work under copyright law:
67
+ that is to say, a work containing the Program or a portion of it,
68
+ either verbatim or with modifications and/or translated into another
69
+ language. (Hereinafter, translation is included without limitation in
70
+ the term "modification".) Each licensee is addressed as "you".
71
+
72
+ Activities other than copying, distribution and modification are not
73
+ covered by this License; they are outside its scope. The act of
74
+ running the Program is not restricted, and the output from the Program
75
+ is covered only if its contents constitute a work based on the
76
+ Program (independent of having been made by running the Program).
77
+ Whether that is true depends on what the Program does.
78
+
79
+ 1. You may copy and distribute verbatim copies of the Program's
80
+ source code as you receive it, in any medium, provided that you
81
+ conspicuously and appropriately publish on each copy an appropriate
82
+ copyright notice and disclaimer of warranty; keep intact all the
83
+ notices that refer to this License and to the absence of any warranty;
84
+ and give any other recipients of the Program a copy of this License
85
+ along with the Program.
86
+
87
+ You may charge a fee for the physical act of transferring a copy, and
88
+ you may at your option offer warranty protection in exchange for a fee.
89
+
90
+ 2. You may modify your copy or copies of the Program or any portion
91
+ of it, thus forming a work based on the Program, and copy and
92
+ distribute such modifications or work under the terms of Section 1
93
+ above, provided that you also meet all of these conditions:
94
+
95
+ a) You must cause the modified files to carry prominent notices
96
+ stating that you changed the files and the date of any change.
97
+
98
+ b) You must cause any work that you distribute or publish, that in
99
+ whole or in part contains or is derived from the Program or any
100
+ part thereof, to be licensed as a whole at no charge to all third
101
+ parties under the terms of this License.
102
+
103
+ c) If the modified program normally reads commands interactively
104
+ when run, you must cause it, when started running for such
105
+ interactive use in the most ordinary way, to print or display an
106
+ announcement including an appropriate copyright notice and a
107
+ notice that there is no warranty (or else, saying that you provide
108
+ a warranty) and that users may redistribute the program under
109
+ these conditions, and telling the user how to view a copy of this
110
+ License. (Exception: if the Program itself is interactive but
111
+ does not normally print such an announcement, your work based on
112
+ the Program is not required to print an announcement.)
113
+
114
+ These requirements apply to the modified work as a whole. If
115
+ identifiable sections of that work are not derived from the Program,
116
+ and can be reasonably considered independent and separate works in
117
+ themselves, then this License, and its terms, do not apply to those
118
+ sections when you distribute them as separate works. But when you
119
+ distribute the same sections as part of a whole which is a work based
120
+ on the Program, the distribution of the whole must be on the terms of
121
+ this License, whose permissions for other licensees extend to the
122
+ entire whole, and thus to each and every part regardless of who wrote it.
123
+
124
+ Thus, it is not the intent of this section to claim rights or contest
125
+ your rights to work written entirely by you; rather, the intent is to
126
+ exercise the right to control the distribution of derivative or
127
+ collective works based on the Program.
128
+
129
+ In addition, mere aggregation of another work not based on the Program
130
+ with the Program (or with a work based on the Program) on a volume of
131
+ a storage or distribution medium does not bring the other work under
132
+ the scope of this License.
133
+
134
+ 3. You may copy and distribute the Program (or a work based on it,
135
+ under Section 2) in object code or executable form under the terms of
136
+ Sections 1 and 2 above provided that you also do one of the following:
137
+
138
+ a) Accompany it with the complete corresponding machine-readable
139
+ source code, which must be distributed under the terms of Sections
140
+ 1 and 2 above on a medium customarily used for software interchange; or,
141
+
142
+ b) Accompany it with a written offer, valid for at least three
143
+ years, to give any third party, for a charge no more than your
144
+ cost of physically performing source distribution, a complete
145
+ machine-readable copy of the corresponding source code, to be
146
+ distributed under the terms of Sections 1 and 2 above on a medium
147
+ customarily used for software interchange; or,
148
+
149
+ c) Accompany it with the information you received as to the offer
150
+ to distribute corresponding source code. (This alternative is
151
+ allowed only for noncommercial distribution and only if you
152
+ received the program in object code or executable form with such
153
+ an offer, in accord with Subsection b above.)
154
+
155
+ The source code for a work means the preferred form of the work for
156
+ making modifications to it. For an executable work, complete source
157
+ code means all the source code for all modules it contains, plus any
158
+ associated interface definition files, plus the scripts used to
159
+ control compilation and installation of the executable. However, as a
160
+ special exception, the source code distributed need not include
161
+ anything that is normally distributed (in either source or binary
162
+ form) with the major components (compiler, kernel, and so on) of the
163
+ operating system on which the executable runs, unless that component
164
+ itself accompanies the executable.
165
+
166
+ If distribution of executable or object code is made by offering
167
+ access to copy from a designated place, then offering equivalent
168
+ access to copy the source code from the same place counts as
169
+ distribution of the source code, even though third parties are not
170
+ compelled to copy the source along with the object code.
171
+
172
+ 4. You may not copy, modify, sublicense, or distribute the Program
173
+ except as expressly provided under this License. Any attempt
174
+ otherwise to copy, modify, sublicense or distribute the Program is
175
+ void, and will automatically terminate your rights under this License.
176
+ However, parties who have received copies, or rights, from you under
177
+ this License will not have their licenses terminated so long as such
178
+ parties remain in full compliance.
179
+
180
+ 5. You are not required to accept this License, since you have not
181
+ signed it. However, nothing else grants you permission to modify or
182
+ distribute the Program or its derivative works. These actions are
183
+ prohibited by law if you do not accept this License. Therefore, by
184
+ modifying or distributing the Program (or any work based on the
185
+ Program), you indicate your acceptance of this License to do so, and
186
+ all its terms and conditions for copying, distributing or modifying
187
+ the Program or works based on it.
188
+
189
+ 6. Each time you redistribute the Program (or any work based on the
190
+ Program), the recipient automatically receives a license from the
191
+ original licensor to copy, distribute or modify the Program subject to
192
+ these terms and conditions. You may not impose any further
193
+ restrictions on the recipients' exercise of the rights granted herein.
194
+ You are not responsible for enforcing compliance by third parties to
195
+ this License.
196
+
197
+ 7. If, as a consequence of a court judgment or allegation of patent
198
+ infringement or for any other reason (not limited to patent issues),
199
+ conditions are imposed on you (whether by court order, agreement or
200
+ otherwise) that contradict the conditions of this License, they do not
201
+ excuse you from the conditions of this License. If you cannot
202
+ distribute so as to satisfy simultaneously your obligations under this
203
+ License and any other pertinent obligations, then as a consequence you
204
+ may not distribute the Program at all. For example, if a patent
205
+ license would not permit royalty-free redistribution of the Program by
206
+ all those who receive copies directly or indirectly through you, then
207
+ the only way you could satisfy both it and this License would be to
208
+ refrain entirely from distribution of the Program.
209
+
210
+ If any portion of this section is held invalid or unenforceable under
211
+ any particular circumstance, the balance of the section is intended to
212
+ apply and the section as a whole is intended to apply in other
213
+ circumstances.
214
+
215
+ It is not the purpose of this section to induce you to infringe any
216
+ patents or other property right claims or to contest validity of any
217
+ such claims; this section has the sole purpose of protecting the
218
+ integrity of the free software distribution system, which is
219
+ implemented by public license practices. Many people have made
220
+ generous contributions to the wide range of software distributed
221
+ through that system in reliance on consistent application of that
222
+ system; it is up to the author/donor to decide if he or she is willing
223
+ to distribute software through any other system and a licensee cannot
224
+ impose that choice.
225
+
226
+ This section is intended to make thoroughly clear what is believed to
227
+ be a consequence of the rest of this License.
228
+
229
+ 8. If the distribution and/or use of the Program is restricted in
230
+ certain countries either by patents or by copyrighted interfaces, the
231
+ original copyright holder who places the Program under this License
232
+ may add an explicit geographical distribution limitation excluding
233
+ those countries, so that distribution is permitted only in or among
234
+ countries not thus excluded. In such case, this License incorporates
235
+ the limitation as if written in the body of this License.
236
+
237
+ 9. The Free Software Foundation may publish revised and/or new versions
238
+ of the General Public License from time to time. Such new versions will
239
+ be similar in spirit to the present version, but may differ in detail to
240
+ address new problems or concerns.
241
+
242
+ Each version is given a distinguishing version number. If the Program
243
+ specifies a version number of this License which applies to it and "any
244
+ later version", you have the option of following the terms and conditions
245
+ either of that version or of any later version published by the Free
246
+ Software Foundation. If the Program does not specify a version number of
247
+ this License, you may choose any version ever published by the Free Software
248
+ Foundation.
249
+
250
+ 10. If you wish to incorporate parts of the Program into other free
251
+ programs whose distribution conditions are different, write to the author
252
+ to ask for permission. For software which is copyrighted by the Free
253
+ Software Foundation, write to the Free Software Foundation; we sometimes
254
+ make exceptions for this. Our decision will be guided by the two goals
255
+ of preserving the free status of all derivatives of our free software and
256
+ of promoting the sharing and reuse of software generally.
257
+
258
+ NO WARRANTY
259
+
260
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
261
+ FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
262
+ OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
263
+ PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
264
+ OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
265
+ MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
266
+ TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
267
+ PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
268
+ REPAIR OR CORRECTION.
269
+
270
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
271
+ WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
272
+ REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
273
+ INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
274
+ OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
275
+ TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
276
+ YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
277
+ PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
278
+ POSSIBILITY OF SUCH DAMAGES.
279
+
280
+ END OF TERMS AND CONDITIONS
281
+
282
+ How to Apply These Terms to Your New Programs
283
+
284
+ If you develop a new program, and you want it to be of the greatest
285
+ possible use to the public, the best way to achieve this is to make it
286
+ free software which everyone can redistribute and change under these terms.
287
+
288
+ To do so, attach the following notices to the program. It is safest
289
+ to attach them to the start of each source file to most effectively
290
+ convey the exclusion of warranty; and each file should have at least
291
+ the "copyright" line and a pointer to where the full notice is found.
292
+
293
+ <one line to give the program's name and a brief idea of what it does.>
294
+ Copyright (C) <year> <name of author>
295
+
296
+ This program is free software; you can redistribute it and/or modify
297
+ it under the terms of the GNU General Public License as published by
298
+ the Free Software Foundation; either version 2 of the License, or
299
+ (at your option) any later version.
300
+
301
+ This program is distributed in the hope that it will be useful,
302
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
303
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
304
+ GNU General Public License for more details.
305
+
306
+ You should have received a copy of the GNU General Public License
307
+ along with this program; if not, write to the Free Software
308
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
309
+
310
+
311
+ Also add information on how to contact you by electronic and paper mail.
312
+
313
+ If the program is interactive, make it output a short notice like this
314
+ when it starts in an interactive mode:
315
+
316
+ Gnomovision version 69, Copyright (C) year name of author
317
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
318
+ This is free software, and you are welcome to redistribute it
319
+ under certain conditions; type `show c' for details.
320
+
321
+ The hypothetical commands `show w' and `show c' should show the appropriate
322
+ parts of the General Public License. Of course, the commands you use may
323
+ be called something other than `show w' and `show c'; they could even be
324
+ mouse-clicks or menu items--whatever suits your program.
325
+
326
+ You should also get your employer (if you work as a programmer) or your
327
+ school, if any, to sign a "copyright disclaimer" for the program, if
328
+ necessary. Here is a sample; alter the names:
329
+
330
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
331
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
332
+
333
+ <signature of Ty Coon>, 1 April 1989
334
+ Ty Coon, President of Vice
335
+
336
+ This General Public License does not permit incorporating your program into
337
+ proprietary programs. If your program is a subroutine library, you may
338
+ consider it more useful to permit linking proprietary applications with the
339
+ library. If this is what you want to do, use the GNU Library General
340
+ Public License instead of this License.
data/README ADDED
@@ -0,0 +1,38 @@
1
+ = ruby-audio
2
+
3
+ Gemified release of ruby/audio. ruby-audio wraps around libsndfile to provide
4
+ simplified sound reading and writing support to ruby programs. The core is the
5
+ Audio::Sound class, which is a subclass of NArray. Also provided is the
6
+ Audio::Soundfile class, which is a wrapper around the wonderful libsndfile.
7
+
8
+ == About This Release
9
+
10
+ Since it wasn't being maintained, I've taken it under my wing to get it usable.
11
+ Please contact me with any questions or comments.
12
+
13
+ == Installation
14
+
15
+ gem install ruby-audio --source="http://gemcutter.org"
16
+
17
+ === Prerequisites
18
+
19
+ - libsndfile[http://www.mega-nerd.com/libsndfile/]
20
+ - SWIG[http://www.swig.org/]
21
+
22
+ == License
23
+
24
+ Copyright (C) 2010 Hans Fugal and Stephen Augenstein
25
+
26
+ This program is free software; you can redistribute it and/or modify
27
+ it under the terms of the GNU General Public License as published by
28
+ the Free Software Foundation; either version 2 of the License, or
29
+ (at your option) any later version.
30
+
31
+ This program is distributed in the hope that it will be useful,
32
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
33
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
34
+ GNU General Public License for more details.
35
+
36
+ You should have received a copy of the GNU General Public License
37
+ along with this program; if not, write to the Free Software
38
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
data/Rakefile ADDED
@@ -0,0 +1,48 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+ require 'rake/testtask'
4
+ require 'rake/rdoctask'
5
+ require 'rake/gempackagetask'
6
+
7
+ spec = Gem::Specification.new do |s|
8
+ s.name = 'ruby-audio'
9
+ s.version = '0.2.0'
10
+ s.summary = 'ruby-audio wraps around libsndfile to provide simplified sound reading and writing support to ruby programs'
11
+ s.authors = ['Hans Fugal <hans@fugal.net>', 'Stephen Augenstein']
12
+ s.email = 'perl.programmer@gmail.com'
13
+ s.homepage = 'http://github.com/warhammerkid/ruby-audio'
14
+
15
+ s.platform = Gem::Platform::RUBY
16
+ s.has_rdoc = true
17
+ s.files = FileList['README', 'Rakefile', 'LICENSE', 'TODO', 'examples/**/*.rb', 'examples/**/*.wav', 'lib/**/*.rb', 'test/*.rb', 'test/*.wav', 'ext/sndfile/extconf.rb', 'ext/sndfile/sndfile.i']
18
+ s.require_path = 'lib'
19
+ s.extensions = ["ext/sndfile/extconf.rb"]
20
+ s.test_files = Dir[*['test/*.rb']]
21
+
22
+ s.add_dependency('narray')
23
+ s.requirements << 'libsndfile (http://www.mega-nerd.com/libsndfile/)'
24
+ s.requirements << 'SWIG (http://www.swig.org/)'
25
+ end
26
+
27
+ desc 'Default: Run the tests'
28
+ task :default => :test
29
+
30
+ # Rake gem & package routines
31
+ Rake::GemPackageTask.new spec do |pkg|
32
+ pkg.need_tar = true
33
+ pkg.need_zip = true
34
+ end
35
+
36
+ desc "Generate documentation"
37
+ Rake::RDocTask.new(:rdoc) do |rdoc|
38
+ rdoc.rdoc_dir = 'rdoc'
39
+ rdoc.title = 'ruby-audio'
40
+ rdoc.options << '--line-numbers' << '--main' << 'README'
41
+ rdoc.rdoc_files.include('README')
42
+ rdoc.rdoc_files.include('lib/**/*.rb')
43
+ end
44
+
45
+ desc "Run tests"
46
+ Rake::TestTask.new do |t|
47
+ t.libs += ['ext/sndfile']
48
+ end
data/TODO ADDED
@@ -0,0 +1,5 @@
1
+ automagic write bug
2
+ document Sndfile::SF_*
3
+ sebastian's error
4
+ leopard ugliness :(
5
+ carl's request for optional 2nd argument to {write,read}_*
@@ -0,0 +1,27 @@
1
+ require 'ostruct'
2
+ require 'pp'
3
+ require 'rubygems'
4
+ require 'google_chart'
5
+ require 'narray'
6
+
7
+ require 'lib/audio.rb'
8
+ require 'lib/audio/sndfile.rb'
9
+
10
+ @files = [
11
+ 'audio_files/063_1.WAV',
12
+ 'audio_files/063_2.WAV',
13
+ 'audio_files/063_3.WAV'
14
+ ]
15
+
16
+ @sound_files = []
17
+ @files.each do |f|
18
+ @sound_files << Audio::Soundfile.open(f)
19
+ end
20
+
21
+ @sounds = []
22
+ @sound_files.each do |sf|
23
+ @sounds << sf.read_int(sf.frames)
24
+ end
25
+
26
+ @f = @sounds.first
27
+ @l = @sounds.last
data/examples/t.rb ADDED
@@ -0,0 +1,10 @@
1
+ eval(File.read('load_samples.rb'))
2
+
3
+ @samples_to_graph = 500
4
+ lc = GoogleChart::LineChart.new('640x400', "Line Chart", false)
5
+ lc.data "First Sound", @f.to_a[0][0..@samples_to_graph], '0000ff'
6
+ lc.data "Last Sound", @l.to_a[0][0..@samples_to_graph], '00ff00'
7
+
8
+ lc.axis :y, :range => [[@f.min, @l.min].min, [@f.max,@l.max].max], :color => 'ff00ff', :font_size => 16, :alignment => :center
9
+ lc.axis :x, :range => [0,1000], :color => '00ffff', :font_size => 16, :alignment => :center
10
+ puts lc.to_url
@@ -0,0 +1,15 @@
1
+ require 'mkmf'
2
+ $CFLAGS = '-I/opt/local/include -I/opt/local/lib/ruby/gems/1.8/gems/narray-0.5.9.7 -I/Library/Ruby/Gems/1.8/gems/narray-0.5.9.7'
3
+ $LDFLAGS = '-L/opt/local/lib -L/usr/local/lib'
4
+ system 'swig -ruby -I/usr/include -I/usr/local/include -I/opt/local/include sndfile.i'
5
+ unless find_library 'sndfile', 'sf_open'
6
+ raise 'You need to install libsndfile'
7
+ exit
8
+ end
9
+ dir_config 'narray', CONFIG['sitearchdir'], CONFIG['sitearchdir']
10
+ # TODO /opt/local/lib/ruby/gems/1.8/gems/narray-0.5.9.4/narray.h
11
+ unless have_header 'narray.h'
12
+ raise 'You need to install NArray =(0.5.9.7)'
13
+ exit
14
+ end
15
+ create_makefile 'sndfile'
@@ -0,0 +1,90 @@
1
+ // TODO: sf_command,
2
+ %module "sndfile"
3
+ %{
4
+ #include <sndfile.h>
5
+ #include <narray.h>
6
+ %}
7
+
8
+ // this bit brought to you by stdio.h
9
+ #ifndef SEEK_SET
10
+ #define SEEK_SET 0 /* set file offset to offset */
11
+ #endif
12
+ #ifndef SEEK_CUR
13
+ #define SEEK_CUR 1 /* set file offset to current plus offset */
14
+ #endif
15
+ #ifndef SEEK_END
16
+ #define SEEK_END 2 /* set file offset to EOF plus offset */
17
+ #endif
18
+
19
+ %include "typemaps.i"
20
+ %typemap(out) int sf_format_check {
21
+ if ($1)
22
+ $result = Qtrue;
23
+ else
24
+ $result = Qfalse;
25
+ }
26
+
27
+ %typemap(out) sf_count_t {
28
+ $result = INT2NUM($1);
29
+ }
30
+ %typemap(in) sf_count_t {
31
+ $1 = (sf_count_t) NUM2INT($input);
32
+ }
33
+
34
+ // We have to do this or when a function like sf_get_string returns NULL it
35
+ // will raise an exception when trying to create the string.
36
+ %typemap(out) const char *{
37
+ if ($1 == 0)
38
+ $result = Qnil;
39
+ else
40
+ $result = rb_str_new2($1);
41
+ }
42
+
43
+ %typemap(in) (short *ptr, sf_count_t),
44
+ (const short *ptr, sf_count_t)
45
+ {
46
+ if (!(NA_IsNArray($input) && NA_TYPE($input) == NA_SINT))
47
+ rb_raise(rb_eArgError, "Expected NArray.sint");
48
+ $1 = NA_PTR_TYPE($input, $1_type);
49
+ $2 = NA_TOTAL($input);
50
+ }
51
+ %typemap(in) (int *ptr, sf_count_t),
52
+ (const int *ptr, sf_count_t)
53
+ {
54
+ if (!(NA_IsNArray($input) && NA_TYPE($input) == NA_LINT))
55
+ rb_raise(rb_eArgError, "Expected NArray.int");
56
+ $1 = NA_PTR_TYPE($input, $1_type);
57
+ $2 = NA_TOTAL($input);
58
+ }
59
+ %typemap(in) (float *ptr, sf_count_t),
60
+ (const float *ptr, sf_count_t)
61
+ {
62
+ if (!(NA_IsNArray($input) && NA_TYPE($input) == NA_SFLOAT))
63
+ rb_raise(rb_eArgError, "Expected NArray.sfloat");
64
+ $1 = NA_PTR_TYPE($input, $1_type);
65
+ $2 = NA_TOTAL($input);
66
+ }
67
+ %typemap(in) (double *ptr, sf_count_t),
68
+ (const double *ptr, sf_count_t)
69
+ {
70
+ if (!(NA_IsNArray($input) && NA_TYPE($input) == NA_DFLOAT))
71
+ rb_raise(rb_eArgError, "Expected NArray.float");
72
+ $1 = NA_PTR_TYPE($input, $1_type);
73
+ $2 = NA_TOTAL($input);
74
+ }
75
+
76
+ %typemap(in) (void *data, int datasize), (void *ptr, sf_count_t),
77
+ (const void *ptr, sf_count_t)
78
+ {
79
+ if (!NA_IsNArray($input))
80
+ rb_raise(rb_eArgError, "Expected NArray");
81
+ $1 = NA_STRUCT($input)->ptr;
82
+ $2 = NA_TOTAL($input) * na_sizeof[NA_TYPE($input)];
83
+ }
84
+
85
+
86
+ // sf_perror and sf_error_str are deprecated. sf_error_str probably doesn't
87
+ // work at all.
88
+
89
+ %include "sndfile.h"
90
+ // vim: filetype=c
data/lib/audio.rb ADDED
@@ -0,0 +1,134 @@
1
+ require 'rubygems'
2
+ require 'narray'
3
+
4
+ # TODO: libsamplerate, portaudio
5
+ module Audio
6
+
7
+ # A Sound is a NArray with some audio convenience methods. It should always
8
+ # have the shape <tt>[frames,channels]</tt>. (Even when m=1)
9
+ #
10
+ # *Notice* for NArray users: because most audio libraries do not agree with
11
+ # NArray on type names, Sound.float has a different meaning than
12
+ # NArray.float. Also, the shape of a new Sound is different than you might
13
+ # expect:
14
+ # s = Sound.float(10)
15
+ # n = NArray.float(10)
16
+ # s.shape #=> [10,1]
17
+ # n.shape #=> [10]
18
+ # s.typecode #=> 4
19
+ # n.typecode #=> 5
20
+ class Sound < NArray
21
+
22
+ # Mapping from typecode to type symbols
23
+ TYPES = [nil,:char,:short,:long,:float,:double]
24
+
25
+ # typecode:: Same as NArray, or a member of TYPES
26
+ # frames:: Number of frames
27
+ # channels:: Number of channels
28
+ #
29
+ # Note that the resulting shape is always [frames,channels].
30
+ def self.new(typecode,frames,channels=1)
31
+ case typecode
32
+ when String, Symbol
33
+ typecode = TYPES.index(typecode.to_sym)
34
+ end
35
+ super(typecode,frames,channels)
36
+ end
37
+
38
+ # One of TYPES
39
+ def type
40
+ TYPES[typecode]
41
+ end
42
+
43
+ # The number of frames
44
+ def frames
45
+ self.shape[0]
46
+ end
47
+
48
+ # The number of channels
49
+ def channels
50
+ self.shape[1]
51
+ end
52
+
53
+ # Returns a new Sound with the data from channel i
54
+ def channel(i)
55
+ self[true,i]
56
+ end
57
+
58
+ # A frame, i.e. an array containing the samples at position i from each
59
+ # channel. For a two-channel sound:
60
+ # sound.frame(i) #=> [0.42, 0.12]
61
+ #
62
+ # You may prefer to do this the NArray way: s[i,false]
63
+ def frame(i)
64
+ unless (0...frames).include? i
65
+ raise IndexError, "Index out of range"
66
+ end
67
+ self[i,false]
68
+ end
69
+
70
+ # For a two-channel sound:
71
+ # s.set_frame(i,[0.42,0.24])
72
+ # s.set_frame(i,0.42) #=> s.set_frame(i,[0.42,0.42])
73
+ #
74
+ # You may prefer to do this the NArray way: s[i,false] = val
75
+ def set_frame(i,val)
76
+ self[i,false] = val
77
+ end
78
+
79
+ def each_frame
80
+ frames.times do |i|
81
+ yield frame(i)
82
+ end
83
+ end
84
+
85
+ # Return a Sound with the channels interleaved.
86
+ # Sound[[0,1],[2,3]].interleaved #=> Sound[[0,2,1,3]]
87
+ def interleave
88
+ self.transpose(1,0).reshape!(self.size,1)
89
+ end
90
+ alias_method :interleaved, :interleave
91
+
92
+ # Fill this Sound's channels with deinterleaved data.
93
+ # Sound[[0,0],[0,0]].interleaved = NArray[0,2,1,3] #=> Sound[[0,1],[2,3]]
94
+ def interleave=(o)
95
+ self[] = o.reshape(channels,frames).transpose(1,0)
96
+ self
97
+ end
98
+ alias_method :interleaved=, :interleave=
99
+
100
+
101
+ # Creates a new Sound with the specified number of channels from the
102
+ # interleaved data in narray. narray should be evenly divisible by
103
+ # channels.
104
+ def self.deinterleave(narray,channels)
105
+ unless narray.size % channels == 0
106
+ raise ArgumentError, "narray not evenly divisible by channels"
107
+ end
108
+ frames = narray.size/channels
109
+ s = Sound.new(narray.typecode,frames,channels)
110
+ s.interleaved = narray
111
+ s
112
+ end
113
+ def deinterleave(channels)
114
+ self.class.deinterleave(self,channels)
115
+ end
116
+ def deinterleave!(channels)
117
+ s = deinterleave(channels)
118
+ reshape!(*s.shape)
119
+ self[] = s
120
+ end
121
+
122
+ %w{char short long float double}.each_with_index do |t,i|
123
+ eval "def self.#{t}(frames,channels=1); self.new(#{i+1},frames,channels); end"
124
+ end
125
+
126
+ # alias class methods
127
+ class << self
128
+ alias_method :byte, :char
129
+ alias_method :sint, :short
130
+ alias_method :int, :long
131
+ alias_method :sfloat, :float
132
+ end
133
+ end
134
+ end
@@ -0,0 +1,156 @@
1
+ require 'audio'
2
+ require 'sndfile.so'
3
+
4
+ module Audio
5
+ # libsndfile[http://www.mega-nerd.com/libsndfile/]
6
+ #
7
+ # = Synopsis
8
+ # require 'audio/sndfile'
9
+ #
10
+ # Audio::Soundfile.open('chunky_bacon.wav') do |sf|
11
+ # sound = sf.readf_float(sf.frames)
12
+ # puts "Maximum amplitude: #{sound.abs.max}"
13
+ # end
14
+ #
15
+ # = Details
16
+ # Refer to the libsndfile api[http://www.mega-nerd.com/libsndfile/api.html].
17
+ #
18
+ # Usage is quite straightforward: drop the +sf_+ prefix, omit the
19
+ # <tt>SNDFILE*</tt> parameter, and use Sound or Numeric instead of
20
+ # (pointer, size) pairs. So, if you have a Soundfile object named +sf+, then
21
+ # sf_read_float(SNDFILE, float *ptr, sf_count_t items)
22
+ # becomes
23
+ # buf = Sound.float(items)
24
+ # sf.read_float(buf)
25
+ # or
26
+ # buf = sf.read_float(items) # creates a new Sound
27
+ #
28
+ # Exceptions to this pattern are documented below.
29
+ #
30
+ # Constants are accessed as <tt>Soundfile::SF_FORMAT_WAV</tt>
31
+ class Soundfile
32
+ # SF_INFO
33
+ attr :info
34
+ attr_reader :mode
35
+
36
+ # mode:: One of %w{r w rw}
37
+ # info:: Instance of SF_INFO or nil
38
+ def initialize(path, mode='r', info=nil)
39
+ if info.nil?
40
+ info = SF_INFO.new
41
+ end
42
+
43
+ modes = {:r => SFM_READ, :w => SFM_WRITE, :rw => SFM_RDWR}
44
+ unless Numeric === mode
45
+ mode = modes[mode.to_sym]
46
+ end
47
+ unless [SFM_READ, SFM_WRITE, SFM_RDWR].include? mode
48
+ raise ArgumentError, "Invalid mode"
49
+ end
50
+
51
+ sf = Sndfile.sf_open(path.to_s, mode, info)
52
+ @sf = sf
53
+ @info = info
54
+ @mode = modes.invert[mode]
55
+ if block_given?
56
+ yield self
57
+ self.close
58
+ end
59
+ end
60
+
61
+ class << self
62
+ alias_method :open, :new
63
+ end
64
+
65
+ def frames
66
+ @info.frames
67
+ end
68
+ def samplerate
69
+ @info.samplerate
70
+ end
71
+ def channels
72
+ @info.channels
73
+ end
74
+ def format
75
+ @info.format
76
+ end
77
+ def sections
78
+ @info.sections
79
+ end
80
+ def seekable
81
+ @info.seekable
82
+ end
83
+
84
+ # The following are equivalent:
85
+ # sf_format_check(info) /* C */
86
+ # sf.format_check # ruby
87
+ def format_check
88
+ Sndfile.sf_format_check(@info)
89
+ end
90
+
91
+ TYPES = [nil,:char,:short,:int,:float,:double] #:nodoc:
92
+
93
+ # Automagic read method. Type is autodetected.
94
+ def read(na)
95
+ sym = "read_#{TYPES[na.typecode]}".to_sym
96
+ self.send sym, na
97
+ end
98
+
99
+ # Automagic write method. Type is autodetected.
100
+ def write(na)
101
+ sym = "write_#{TYPES[na.typecode]}".to_sym
102
+ self.send sym, na
103
+ end
104
+
105
+ %w{read readf}.each do |r|
106
+ %w{short int float double}.each do |t|
107
+ tc = TYPES.index(t.to_sym)
108
+ c = ', channels' if r == 'readf'
109
+ cmd = "#{r}_#{t}"
110
+ eval <<-EOF
111
+ def #{cmd}(arg)
112
+ if Numeric === arg
113
+ na = NArray.new(#{tc}, arg#{c})
114
+ n = Sndfile.sf_#{cmd}(@sf, na)
115
+ Sound.deinterleave(na, channels)
116
+ else
117
+ na = arg
118
+ n = Sndfile.sf_#{cmd}(@sf, na)
119
+ na.deinterleave!(channels)
120
+ n
121
+ end
122
+ end
123
+ EOF
124
+ end
125
+ end
126
+
127
+ %w{write writef}.each do |w|
128
+ %w{short int float double}.each do |t|
129
+ cmd = "#{w}_#{t}"
130
+ eval <<-EOF
131
+ def #{cmd}(sound)
132
+ raise "Format check failed: \#{perror}" unless format_check
133
+ Sndfile.sf_#{cmd}(@sf, sound.interleave)
134
+ end
135
+ EOF
136
+ end
137
+ end
138
+
139
+ def method_missing(name, *args) #:nodoc:
140
+ begin
141
+ Sndfile.send "sf_#{name}".to_sym, @sf, *args
142
+ rescue NameError
143
+ super
144
+ end
145
+ end
146
+
147
+ def self.const_missing(sym) #:nodoc:
148
+ begin
149
+ Sndfile.const_get(sym)
150
+ rescue NameError
151
+ super
152
+ end
153
+ end
154
+ end
155
+ end
156
+
@@ -0,0 +1,82 @@
1
+ require 'test/unit'
2
+ require 'audio'
3
+
4
+ class AudioTest < Test::Unit::TestCase
5
+ include Audio
6
+ def test_sound
7
+ %w{char short long float double}.each do |t|
8
+ eval "s = Sound.#{t}(10); assert_equal :#{t}, s.type"
9
+ end
10
+ s = Sound.float(6).indgen!
11
+ assert_equal [6,1], s.shape
12
+ assert_equal 1, s.channels
13
+ assert_equal 6, s.frames
14
+ s.reshape!(3,2)
15
+ assert_equal 2, s.channels
16
+ assert_equal 3, s.frames
17
+ assert_equal [[0.0,3.0,1.0,4.0,2.0,5.0]], s.interleave.to_a
18
+ assert_equal 6, s.size
19
+
20
+ s = Sound.byte(10); assert_equal :char, s.type
21
+ s = Sound.sint(10); assert_equal :short, s.type
22
+ s = Sound.int(10); assert_equal :long, s.type
23
+ s = Sound.sfloat(10); assert_equal :float, s.type
24
+
25
+ s = Sound.sfloat(10)
26
+ assert_equal 10, s.size
27
+ assert_equal 10, s.frames
28
+ assert_equal 1, s.channels
29
+ assert_equal :float, s.type
30
+ assert_kind_of NArray, s
31
+ s.channels.times do |i|
32
+ c = s.channel(i)
33
+ assert_kind_of NArray, c
34
+ assert_instance_of Sound, c
35
+ assert_equal 10, c.size
36
+ end
37
+
38
+ s = Sound.double(10,2)
39
+ assert_equal 2, s.channels
40
+ assert_equal 10, s.frames
41
+
42
+ c = s.channel(1)
43
+ assert_instance_of Sound, c
44
+ assert_equal 10, c.size
45
+
46
+ s.each_frame do |a|
47
+ assert_instance_of Sound, a
48
+ assert_kind_of Numeric, a[0]
49
+ assert_kind_of Numeric, a[1]
50
+ end
51
+
52
+ # test new
53
+ s = Sound.new(4,10)
54
+ assert_equal [10,1], s.shape
55
+ assert_equal 10, s.size
56
+ assert_equal 4, s.typecode
57
+ assert_equal :float, s.type
58
+ assert_equal 10, s.frames
59
+ assert_equal 1, s.channels
60
+
61
+ s = Sound.new(:long,10)
62
+ assert_equal [10,1], s.shape
63
+ assert_equal 10, s.size
64
+ assert_equal 3, s.typecode
65
+ assert_equal :long, s.type
66
+ assert_equal 10, s.frames
67
+ assert_equal 1, s.channels
68
+ end
69
+
70
+ def test_interleave
71
+ s = Sound.float(2,2).indgen!
72
+ i = s.interleave
73
+ assert_equal s[0,0], i[0]
74
+ assert_equal s[0,1], i[1]
75
+
76
+ s2 = Sound.deinterleave(i,2)
77
+ assert_equal s, s2
78
+
79
+ s2.interleave = i
80
+ assert_equal s, s2
81
+ end
82
+ end
@@ -0,0 +1,191 @@
1
+ require 'test/unit'
2
+ require 'audio/sndfile'
3
+ require 'narray'
4
+
5
+ class SndfileTest < Test::Unit::TestCase
6
+ include Sndfile
7
+ TEST_WAV='test/what.wav'
8
+ STEREO_TEST_WAV='test/what2.wav'
9
+
10
+ def setup
11
+ raise "Invalid test wav" unless File.readable?(TEST_WAV)
12
+ @inf = SF_INFO.new
13
+ @sf = sf_open(TEST_WAV,SFM_RDWR,@inf)
14
+ raise "Couldn't open #{TEST_WAV}: #{sf_strerror(@sf)}" if @sf.nil?
15
+ end
16
+
17
+ def teardown
18
+ sf_close(@sf)
19
+ end
20
+
21
+ def test_enums
22
+ enums = {
23
+ SF_FORMAT_WAV => 0x010000,
24
+ SF_FORMAT_AIFF => 0x020000,
25
+ SF_FORMAT_AU => 0x030000,
26
+ SF_FORMAT_RAW => 0x040000,
27
+ SF_FORMAT_PAF => 0x050000,
28
+ SF_FORMAT_SVX => 0x060000,
29
+ SF_FORMAT_NIST => 0x070000,
30
+ SF_FORMAT_VOC => 0x080000,
31
+ SF_FORMAT_IRCAM => 0x0A0000,
32
+ SF_FORMAT_W64 => 0x0B0000,
33
+ SF_FORMAT_MAT4 => 0x0C0000,
34
+ SF_FORMAT_MAT5 => 0x0D0000,
35
+ SF_FORMAT_PVF => 0x0E0000,
36
+ SF_FORMAT_XI => 0x0F0000,
37
+ SF_FORMAT_HTK => 0x100000,
38
+ SF_FORMAT_SDS => 0x110000,
39
+ SF_FORMAT_AVR => 0x120000,
40
+ SF_FORMAT_WAVEX => 0x130000,
41
+ SF_FORMAT_SD2 => 0x160000,
42
+ SF_FORMAT_FLAC => 0x170000,
43
+ SF_FORMAT_CAF => 0x180000,
44
+ SF_FORMAT_PCM_S8 => 0x0001,
45
+ SF_FORMAT_PCM_16 => 0x0002,
46
+ SF_FORMAT_PCM_24 => 0x0003,
47
+ SF_FORMAT_PCM_32 => 0x0004,
48
+ SF_FORMAT_PCM_U8 => 0x0005,
49
+ SF_FORMAT_FLOAT => 0x0006,
50
+ SF_FORMAT_DOUBLE => 0x0007,
51
+ SF_FORMAT_ULAW => 0x0010,
52
+ SF_FORMAT_ALAW => 0x0011,
53
+ SF_FORMAT_IMA_ADPCM => 0x0012,
54
+ SF_FORMAT_MS_ADPCM => 0x0013,
55
+ SF_FORMAT_GSM610 => 0x0020,
56
+ SF_FORMAT_VOX_ADPCM => 0x0021,
57
+ SF_FORMAT_G721_32 => 0x0030,
58
+ SF_FORMAT_G723_24 => 0x0031,
59
+ SF_FORMAT_G723_40 => 0x0032,
60
+ SF_FORMAT_DWVW_12 => 0x0040,
61
+ SF_FORMAT_DWVW_16 => 0x0041,
62
+ SF_FORMAT_DWVW_24 => 0x0042,
63
+ SF_FORMAT_DWVW_N => 0x0043,
64
+ SF_FORMAT_DPCM_8 => 0x0050,
65
+ SF_FORMAT_DPCM_16 => 0x0051,
66
+ SF_ENDIAN_FILE => 0x00000000,
67
+ SF_ENDIAN_LITTLE => 0x10000000,
68
+ SF_ENDIAN_BIG => 0x20000000,
69
+ SF_ENDIAN_CPU => 0x30000000,
70
+ SF_FORMAT_SUBMASK => 0x0000FFFF,
71
+ SF_FORMAT_TYPEMASK => 0x0FFF0000,
72
+ SF_FORMAT_ENDMASK => 0x30000000
73
+ }
74
+
75
+ enums.each_pair do |k,v|
76
+ assert_equal k,v
77
+ end
78
+ assert_equal SF_ERR_UNSUPPORTED_ENCODING, 4
79
+ end
80
+
81
+ def test_info
82
+ assert ! sf_format_check(SF_INFO.new)
83
+ assert @inf.frames > 0
84
+ assert_equal 16000, @inf.samplerate
85
+ assert_equal 1, @inf.channels
86
+ assert_equal SF_FORMAT_WAV|SF_FORMAT_PCM_16, @inf.format
87
+ assert_equal 1, @inf.sections
88
+ #assert_equal true, @inf.seekable
89
+ assert sf_format_check(@inf)
90
+ end
91
+
92
+ def test_error
93
+ File.delete('bogus.wav') if File.exist?('bogus.wav')
94
+ s = sf_open('bogus.wav',SFM_READ,SF_INFO.new)
95
+ assert_nil s
96
+ # on some systems (or versions?) libsndfile gives either
97
+ # SF_ERR_UNRECOGNIZED_FORMAT or SF_ERR_SYSTEM, so we just check that there
98
+ # was _some_ error.
99
+ assert_not_equal SF_ERR_NO_ERROR, sf_error(nil)
100
+ sf_close(s)
101
+ assert_equal SF_ERR_NO_ERROR, sf_error(@sf)
102
+ assert_equal 'No Error.', sf_strerror(@sf)
103
+ assert_kind_of String, sf_error_number(1)
104
+ end
105
+
106
+ def test_file
107
+ s = sf_open(TEST_WAV,SFM_READ,SF_INFO.new)
108
+ assert_not_nil s
109
+ assert_equal 0, sf_close(s)
110
+ end
111
+
112
+ def test_read
113
+ a = NArray.float(1000)
114
+ sf_read_double(@sf, a)
115
+ assert a.max > 0
116
+ end
117
+
118
+ def test_write
119
+ a = NArray.float(1000)
120
+ sf_read_double(@sf, a)
121
+ sf2 = nil
122
+ assert_nothing_raised do
123
+ sf2 = sf_open('bogus.wav',SFM_RDWR, @inf)
124
+ sf_write_double(sf2, a)
125
+ end
126
+ b = NArray.float(1000)
127
+ sf_seek(sf2, 0, SEEK_SET)
128
+ sf_read_double(sf2, b)
129
+ assert a == b
130
+ sf_close(sf2)
131
+ File.delete('bogus.wav') if File.exist?('bogus.wav')
132
+ end
133
+
134
+ def test_string
135
+ assert_nil sf_get_string(@sf,SF_STR_COMMENT)
136
+ end
137
+
138
+ def test_magical_open
139
+ sf = Audio::Soundfile.open(TEST_WAV)
140
+ assert_instance_of Audio::Soundfile, sf
141
+ assert sf.format_check
142
+ assert_equal Audio::Soundfile::SF_FORMAT_WAV, 0x010000
143
+ sf.close
144
+ end
145
+
146
+ def test_magical_read
147
+ Audio::Soundfile.open(TEST_WAV) do |sf|
148
+ a = sf.read_float(100)
149
+ assert_instance_of Audio::Sound, a
150
+ assert_equal :float, a.type
151
+ assert_equal 4, a.typecode
152
+ assert a.size <= 100
153
+ assert_equal sf.channels, a.channels
154
+
155
+ n = sf.read_float(a)
156
+ assert n <= a.size
157
+ n = sf.read(a)
158
+ assert n <= a.size
159
+ end
160
+ Audio::Soundfile.open(STEREO_TEST_WAV) do |sf|
161
+ a = sf.read_float(100)
162
+ assert a.size <= 100
163
+ assert_equal sf.channels, a.channels
164
+
165
+ n = sf.read_float(a)
166
+ assert n <= a.size
167
+ n = sf.read(a)
168
+ assert n <= a.size
169
+ end
170
+ end
171
+
172
+ def test_magical_write
173
+ Audio::Soundfile.open(TEST_WAV) do |sf|
174
+ # Read data
175
+ a = sf.read_float(1000)
176
+
177
+ # Test magical write
178
+ sf2 = Audio::Soundfile.open('bogus.wav', 'rw', sf.info)
179
+ sf2.write(a)
180
+
181
+ # Check that read data matches written data
182
+ sf2.seek(0, SEEK_SET)
183
+ b = sf2.read_float(1000)
184
+ assert a == b
185
+
186
+ # Clean up
187
+ sf2.close
188
+ File.delete('bogus.wav') if File.exist?('bogus.wav')
189
+ end
190
+ end
191
+ end
data/test/what.wav ADDED
Binary file
data/test/what2.wav ADDED
Binary file
metadata ADDED
@@ -0,0 +1,80 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ruby-audio
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.0
5
+ platform: ruby
6
+ authors:
7
+ - Hans Fugal <hans@fugal.net>
8
+ - Stephen Augenstein
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+
13
+ date: 2010-02-09 00:00:00 -05:00
14
+ default_executable:
15
+ dependencies:
16
+ - !ruby/object:Gem::Dependency
17
+ name: narray
18
+ type: :runtime
19
+ version_requirement:
20
+ version_requirements: !ruby/object:Gem::Requirement
21
+ requirements:
22
+ - - ">="
23
+ - !ruby/object:Gem::Version
24
+ version: "0"
25
+ version:
26
+ description:
27
+ email: perl.programmer@gmail.com
28
+ executables: []
29
+
30
+ extensions:
31
+ - ext/sndfile/extconf.rb
32
+ extra_rdoc_files: []
33
+
34
+ files:
35
+ - README
36
+ - Rakefile
37
+ - LICENSE
38
+ - TODO
39
+ - examples/load_samples.rb
40
+ - examples/t.rb
41
+ - lib/audio/sndfile.rb
42
+ - lib/audio.rb
43
+ - test/test_audio.rb
44
+ - test/test_sndfile.rb
45
+ - test/what.wav
46
+ - test/what2.wav
47
+ - ext/sndfile/extconf.rb
48
+ - ext/sndfile/sndfile.i
49
+ has_rdoc: true
50
+ homepage: http://github.com/warhammerkid/ruby-audio
51
+ licenses: []
52
+
53
+ post_install_message:
54
+ rdoc_options: []
55
+
56
+ require_paths:
57
+ - lib
58
+ required_ruby_version: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - ">="
61
+ - !ruby/object:Gem::Version
62
+ version: "0"
63
+ version:
64
+ required_rubygems_version: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: "0"
69
+ version:
70
+ requirements:
71
+ - libsndfile (http://www.mega-nerd.com/libsndfile/)
72
+ - SWIG (http://www.swig.org/)
73
+ rubyforge_project:
74
+ rubygems_version: 1.3.5
75
+ signing_key:
76
+ specification_version: 3
77
+ summary: ruby-audio wraps around libsndfile to provide simplified sound reading and writing support to ruby programs
78
+ test_files:
79
+ - test/test_audio.rb
80
+ - test/test_sndfile.rb