aubio 0.3.4 → 0.3.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/aubio/version.rb +1 -1
- data/lib/{aubio.rb → ruby_aubio.rb} +0 -0
- metadata +3 -4
- data/aubio.rb +0 -466
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9fc99bdb6d49e019a2b9c191f0a4abebb23b8d09046158a2dac7c9520364ea96
|
4
|
+
data.tar.gz: '01368333aac8d7e716332e4a340b1fa870500afdac82099ced8ad15cb245a0ad'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: db793a973410c4ca64cad4f5f94ce4e309ed4b5074a254e770b000d8d726a18a178419f674ec8a2bf10f114b62606a02776cb9da1d8218a9236abee45e07feb5
|
7
|
+
data.tar.gz: ed1a6fdd7d08bd0ec0d047b645625d02b88777060b3be09253a5413c2422269c8b4a17a7abdbf7ef8047b9045d2fc7f8bb7933347d55790863ea372cb094799b
|
data/lib/aubio/version.rb
CHANGED
File without changes
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aubio
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Xavier Riley
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-08-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ffi
|
@@ -127,16 +127,15 @@ files:
|
|
127
127
|
- Rakefile
|
128
128
|
- aubio-ffi-generator.rb
|
129
129
|
- aubio.gemspec
|
130
|
-
- aubio.rb
|
131
130
|
- bin/console
|
132
131
|
- bin/setup
|
133
|
-
- lib/aubio.rb
|
134
132
|
- lib/aubio/aubio-ffi.rb
|
135
133
|
- lib/aubio/beats.rb
|
136
134
|
- lib/aubio/legacy_api.rb
|
137
135
|
- lib/aubio/onsets.rb
|
138
136
|
- lib/aubio/pitches.rb
|
139
137
|
- lib/aubio/version.rb
|
138
|
+
- lib/ruby_aubio.rb
|
140
139
|
homepage: https://github.com/xavriley/ruby-aubio
|
141
140
|
licenses:
|
142
141
|
- MIT
|
data/aubio.rb
DELETED
@@ -1,466 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'ffi'
|
4
|
-
|
5
|
-
module Aubio
|
6
|
-
extend FFI::Library
|
7
|
-
ffi_lib '/usr/local/Cellar/aubio/0.4.2/lib/libaubio.4.2.2.dylib'
|
8
|
-
|
9
|
-
# tempo
|
10
|
-
attach_function :new_aubio_tempo, %i[string int int int], :pointer
|
11
|
-
attach_function :aubio_tempo_do, %i[pointer pointer pointer], :void
|
12
|
-
attach_function :aubio_tempo_get_last, [:pointer], :int
|
13
|
-
attach_function :aubio_tempo_get_last_s, [:pointer], :float
|
14
|
-
attach_function :aubio_tempo_get_last_ms, [:pointer], :float
|
15
|
-
attach_function :aubio_tempo_set_silence, %i[pointer float], :int
|
16
|
-
attach_function :aubio_tempo_get_silence, [:pointer], :float
|
17
|
-
attach_function :aubio_tempo_set_threshold, %i[pointer float], :int
|
18
|
-
attach_function :aubio_tempo_get_threshold, [:pointer], :float
|
19
|
-
attach_function :aubio_tempo_get_bpm, [:pointer], :float
|
20
|
-
attach_function :aubio_tempo_get_confidence, [:pointer], :float
|
21
|
-
attach_function :del_aubio_tempo, [:pointer], :void
|
22
|
-
|
23
|
-
# beattracking / misc
|
24
|
-
attach_function :new_aubio_beattracking, %i[int int int], :pointer
|
25
|
-
attach_function :aubio_beattracking_do, %i[pointer pointer pointer], :void
|
26
|
-
attach_function :aubio_beattracking_get_bpm, [:pointer], :float
|
27
|
-
attach_function :aubio_filter_do, %i[pointer pointer], :void
|
28
|
-
attach_function :new_aubio_filter_a_weighting, [:int], :pointer
|
29
|
-
|
30
|
-
# source
|
31
|
-
attach_function :new_aubio_source, %i[string int int], :pointer
|
32
|
-
attach_function :aubio_source_do, %i[pointer pointer pointer], :void
|
33
|
-
attach_function :aubio_source_do_multi, %i[pointer pointer pointer], :void
|
34
|
-
attach_function :aubio_source_get_samplerate, [:pointer], :int
|
35
|
-
attach_function :aubio_source_get_channels, [:pointer], :int
|
36
|
-
attach_function :aubio_source_seek, %i[pointer int], :int
|
37
|
-
attach_function :aubio_source_close, [:pointer], :int
|
38
|
-
attach_function :del_aubio_source, [:pointer], :void
|
39
|
-
|
40
|
-
# sink
|
41
|
-
attach_function :new_aubio_sink, %i[string int], :pointer
|
42
|
-
attach_function :aubio_sink_preset_samplerate, %i[pointer int], :void
|
43
|
-
attach_function :aubio_sink_preset_channels, %i[pointer int], :void
|
44
|
-
attach_function :aubio_sink_get_samplerate, [:pointer], :int
|
45
|
-
attach_function :aubio_sink_get_channels, [:pointer], :int
|
46
|
-
attach_function :aubio_sink_do, %i[pointer pointer int], :void
|
47
|
-
attach_function :aubio_sink_do_multi, %i[pointer pointer int], :void
|
48
|
-
attach_function :aubio_sink_close, [:pointer], :int
|
49
|
-
attach_function :del_aubio_sink, [:pointer], :void
|
50
|
-
|
51
|
-
# onset
|
52
|
-
attach_function :new_aubio_onset, %i[string int int int], :pointer
|
53
|
-
attach_function :aubio_onset_do, %i[pointer pointer pointer], :void
|
54
|
-
attach_function :aubio_onset_get_last, [:pointer], :int
|
55
|
-
attach_function :aubio_onset_get_last_s, [:pointer], :float
|
56
|
-
attach_function :aubio_onset_get_last_ms, [:pointer], :float
|
57
|
-
attach_function :aubio_onset_set_silence, %i[pointer float], :int
|
58
|
-
attach_function :aubio_onset_get_silence, [:pointer], :float
|
59
|
-
attach_function :aubio_onset_get_descriptor, [:pointer], :float
|
60
|
-
attach_function :aubio_onset_get_thresholded_descriptor, [:pointer], :float
|
61
|
-
attach_function :aubio_onset_set_threshold, %i[pointer float], :int
|
62
|
-
attach_function :aubio_onset_set_minioi, %i[pointer int], :int
|
63
|
-
attach_function :aubio_onset_set_minioi_s, %i[pointer int], :int
|
64
|
-
attach_function :aubio_onset_set_minioi_ms, %i[pointer float], :int
|
65
|
-
attach_function :aubio_onset_set_delay, %i[pointer int], :int
|
66
|
-
attach_function :aubio_onset_set_delay_s, %i[pointer int], :int
|
67
|
-
attach_function :aubio_onset_set_delay_ms, %i[pointer float], :int
|
68
|
-
attach_function :aubio_onset_get_minioi, [:pointer], :int
|
69
|
-
attach_function :aubio_onset_get_minioi_s, [:pointer], :float
|
70
|
-
attach_function :aubio_onset_get_minioi_ms, [:pointer], :float
|
71
|
-
attach_function :aubio_onset_get_delay, [:pointer], :int
|
72
|
-
attach_function :aubio_onset_get_delay_s, [:pointer], :float
|
73
|
-
attach_function :aubio_onset_get_delay_ms, [:pointer], :float
|
74
|
-
attach_function :aubio_onset_get_threshold, [:pointer], :float
|
75
|
-
attach_function :del_aubio_onset, [:pointer], :void
|
76
|
-
|
77
|
-
# pitch
|
78
|
-
attach_function :new_aubio_pitch, %i[string int int int], :pointer
|
79
|
-
attach_function :aubio_pitch_do, %i[pointer pointer pointer], :void
|
80
|
-
attach_function :aubio_pitch_set_tolerance, %i[pointer int], :int
|
81
|
-
attach_function :aubio_pitch_set_unit, %i[pointer string], :int
|
82
|
-
attach_function :aubio_pitch_set_silence, %i[pointer float], :int
|
83
|
-
attach_function :aubio_pitch_get_silence, [:pointer], :float
|
84
|
-
attach_function :aubio_pitch_get_confidence, [:pointer], :float
|
85
|
-
attach_function :del_aubio_pitch, [:pointer], :void
|
86
|
-
|
87
|
-
# new fvec
|
88
|
-
attach_function :new_fvec, [:int], :pointer
|
89
|
-
attach_function :del_fvec, [:pointer], :void
|
90
|
-
attach_function :fvec_get_sample, %i[pointer int], :float
|
91
|
-
attach_function :fvec_set_sample, %i[pointer float int], :void
|
92
|
-
attach_function :fvec_get_data, [:pointer], :float
|
93
|
-
attach_function :fvec_print, [:pointer], :void
|
94
|
-
attach_function :fvec_set_all, %i[pointer float], :void
|
95
|
-
attach_function :fvec_zeros, [:pointer], :void
|
96
|
-
attach_function :fvec_rev, [:pointer], :void
|
97
|
-
attach_function :fvec_weight, %i[pointer pointer], :void
|
98
|
-
attach_function :fvec_copy, %i[pointer pointer], :void
|
99
|
-
attach_function :fvec_ones, [:pointer], :void
|
100
|
-
|
101
|
-
def self.onsets(path, params = {})
|
102
|
-
sample_rate = params[:sample_rate] || 44_100
|
103
|
-
window_size = params[:window_size] || 1024
|
104
|
-
hop_size = params[:hop_size] || 512
|
105
|
-
|
106
|
-
# parser.add_option("-O","--onset-method",
|
107
|
-
# action="store", dest="onset_method", default='default',
|
108
|
-
# metavar = "<onset_method>",
|
109
|
-
# help="onset detection method [default=default] \
|
110
|
-
# complexdomain|hfc|phase|specdiff|energy|kl|mkl")
|
111
|
-
onset_method = params[:onset_method] || 'default'
|
112
|
-
|
113
|
-
# # cutting methods
|
114
|
-
# parser.add_option("-b","--beat",
|
115
|
-
# action="store_true", dest="beat", default=False,
|
116
|
-
# help="use beat locations")
|
117
|
-
beat = params[:beat] || false
|
118
|
-
# """
|
119
|
-
# parser.add_option("-S","--silencecut",
|
120
|
-
# action="store_true", dest="silencecut", default=False,
|
121
|
-
# help="use silence locations")
|
122
|
-
silencecut = params[:silencecut] || false
|
123
|
-
|
124
|
-
# parser.add_option("-s","--silence",
|
125
|
-
# metavar = "<value>",
|
126
|
-
# action="store", dest="silence", default=-70,
|
127
|
-
# help="silence threshold [default=-70]")
|
128
|
-
silence = params[:silence] || -70
|
129
|
-
|
130
|
-
# """
|
131
|
-
# # algorithm parameters
|
132
|
-
# parser.add_option("-r", "--samplerate",
|
133
|
-
# metavar = "<freq>", type='int',
|
134
|
-
# action="store", dest="samplerate", default=0,
|
135
|
-
# help="samplerate at which the file should be represented")
|
136
|
-
# parser.add_option("-B","--bufsize",
|
137
|
-
# action="store", dest="bufsize", default=512,
|
138
|
-
# metavar = "<size>", type='int',
|
139
|
-
# help="buffer size [default=512]")
|
140
|
-
# parser.add_option("-H","--hopsize",
|
141
|
-
# metavar = "<size>", type='int',
|
142
|
-
# action="store", dest="hopsize", default=256,
|
143
|
-
# help="overlap size [default=256]")
|
144
|
-
# parser.add_option("-t","--onset-threshold",
|
145
|
-
# metavar = "<value>", type="float",
|
146
|
-
# action="store", dest="threshold", default=0.3,
|
147
|
-
# help="onset peak picking threshold [default=0.3]")
|
148
|
-
# parser.add_option("-c","--cut",
|
149
|
-
# action="store_true", dest="cut", default=False,
|
150
|
-
# help="cut input sound file at detected labels \
|
151
|
-
# best used with option -L")
|
152
|
-
|
153
|
-
# # minioi
|
154
|
-
# parser.add_option("-M","--minioi",
|
155
|
-
# metavar = "<value>", type='string',
|
156
|
-
# action="store", dest="minioi", default="12ms",
|
157
|
-
# help="minimum inter onset interval [default=12ms]")
|
158
|
-
|
159
|
-
# """
|
160
|
-
# parser.add_option("-D","--delay",
|
161
|
-
# action = "store", dest = "delay", type = "float",
|
162
|
-
# metavar = "<seconds>", default=0,
|
163
|
-
# help="number of seconds to take back [default=system]\
|
164
|
-
# default system delay is 3*hopsize/samplerate")
|
165
|
-
# parser.add_option("-C","--dcthreshold",
|
166
|
-
# metavar = "<value>",
|
167
|
-
# action="store", dest="dcthreshold", default=1.,
|
168
|
-
# help="onset peak picking DC component [default=1.]")
|
169
|
-
# parser.add_option("-L","--localmin",
|
170
|
-
# action="store_true", dest="localmin", default=False,
|
171
|
-
# help="use local minima after peak detection")
|
172
|
-
# parser.add_option("-d","--derivate",
|
173
|
-
# action="store_true", dest="derivate", default=False,
|
174
|
-
# help="derivate onset detection function")
|
175
|
-
# parser.add_option("-z","--zerocross",
|
176
|
-
# metavar = "<value>",
|
177
|
-
# action="store", dest="zerothres", default=0.008,
|
178
|
-
# help="zero-crossing threshold for slicing [default=0.00008]")
|
179
|
-
# """
|
180
|
-
# # plotting functions
|
181
|
-
# """
|
182
|
-
# parser.add_option("-p","--plot",
|
183
|
-
# action="store_true", dest="plot", default=False,
|
184
|
-
# help="draw plot")
|
185
|
-
# parser.add_option("-x","--xsize",
|
186
|
-
# metavar = "<size>",
|
187
|
-
# action="store", dest="xsize", default=1.,
|
188
|
-
# type='float', help="define xsize for plot")
|
189
|
-
# parser.add_option("-y","--ysize",
|
190
|
-
# metavar = "<size>",
|
191
|
-
# action="store", dest="ysize", default=1.,
|
192
|
-
# type='float', help="define ysize for plot")
|
193
|
-
# parser.add_option("-f","--function",
|
194
|
-
# action="store_true", dest="func", default=False,
|
195
|
-
# help="print detection function")
|
196
|
-
# parser.add_option("-n","--no-onsets",
|
197
|
-
# action="store_true", dest="nplot", default=False,
|
198
|
-
# help="do not plot detected onsets")
|
199
|
-
# parser.add_option("-O","--outplot",
|
200
|
-
# metavar = "<output_image>",
|
201
|
-
# action="store", dest="outplot", default=None,
|
202
|
-
# help="save plot to output.{ps,png}")
|
203
|
-
# parser.add_option("-F","--spectrogram",
|
204
|
-
# action="store_true", dest="spectro", default=False,
|
205
|
-
# help="add spectrogram to the plot")
|
206
|
-
# """
|
207
|
-
# parser.add_option("-o","--output", type = str,
|
208
|
-
# metavar = "<outputdir>",
|
209
|
-
# action="store", dest="output_directory", default=None,
|
210
|
-
# help="specify path where slices of the original file should be created")
|
211
|
-
# parser.add_option("--cut-until-nsamples", type = int,
|
212
|
-
# metavar = "<samples>",
|
213
|
-
# action = "store", dest = "cut_until_nsamples", default = None,
|
214
|
-
# help="how many extra samples should be added at the end of each slice")
|
215
|
-
# parser.add_option("--cut-until-nslices", type = int,
|
216
|
-
# metavar = "<slices>",
|
217
|
-
# action = "store", dest = "cut_until_nslices", default = None,
|
218
|
-
# help="how many extra slices should be added at the end of each slice")
|
219
|
-
|
220
|
-
# parser.add_option("-v","--verbose",
|
221
|
-
# action="store_true", dest="verbose", default=True,
|
222
|
-
# help="make lots of noise [default]")
|
223
|
-
# parser.add_option("-q","--quiet",
|
224
|
-
# action="store_false", dest="verbose", default=True,
|
225
|
-
# help="be quiet")
|
226
|
-
# (options, args) = parser.parse_args()
|
227
|
-
# if not options.source_file:
|
228
|
-
# import os.path
|
229
|
-
# if len(args) == 1:
|
230
|
-
# options.source_file = args[0]
|
231
|
-
# else:
|
232
|
-
# print "no file name given\n", usage
|
233
|
-
# sys.exit(1)
|
234
|
-
# return options, args
|
235
|
-
|
236
|
-
source = new_aubio_source(path, sample_rate, hop_size)
|
237
|
-
onset = new_aubio_onset('default', 512, hop_size)
|
238
|
-
aubio_onset_set_minioi_ms(onset, 12.0)
|
239
|
-
aubio_onset_set_threshold(onset, 0.3)
|
240
|
-
|
241
|
-
timestamps = []
|
242
|
-
total_frames = 0
|
243
|
-
# create output for source
|
244
|
-
samples = new_fvec(hop_size)
|
245
|
-
total_frames_counter = 0
|
246
|
-
tmp_read = FFI::MemoryPointer.new(:int)
|
247
|
-
|
248
|
-
loop do
|
249
|
-
aubio_source_do(source, samples, tmp_read)
|
250
|
-
end
|
251
|
-
# if options.beat:
|
252
|
-
# o = tempo(options.onset_method, bufsize, hopsize)
|
253
|
-
# else:
|
254
|
-
# o = onset(options.onset_method, bufsize, hopsize)
|
255
|
-
# if options.minioi:
|
256
|
-
# if options.minioi.endswith('ms'):
|
257
|
-
# o.set_minioi_ms(int(options.minioi[:-2]))
|
258
|
-
# elif options.minioi.endswith('s'):
|
259
|
-
# o.set_minioi_s(int(options.minioi[:-1]))
|
260
|
-
# else:
|
261
|
-
# o.set_minioi(int(options.minioi))
|
262
|
-
# o.set_threshold(options.threshold)
|
263
|
-
|
264
|
-
# timestamps = []
|
265
|
-
# total_frames = 0
|
266
|
-
# # analyze pass
|
267
|
-
# while True:
|
268
|
-
# samples, read = s()
|
269
|
-
# if o(samples):
|
270
|
-
# timestamps.append (o.get_last())
|
271
|
-
# if options.verbose: print "%.4f" % o.get_last_s()
|
272
|
-
# total_frames += read
|
273
|
-
# if read < hopsize: break
|
274
|
-
# del s
|
275
|
-
# # print some info
|
276
|
-
# nstamps = len(timestamps)
|
277
|
-
# duration = float (total_frames) / float(samplerate)
|
278
|
-
# info = 'found %(nstamps)d timestamps in %(source_file)s' % locals()
|
279
|
-
# info += ' (total %(duration).2fs at %(samplerate)dHz)\n' % locals()
|
280
|
-
# sys.stderr.write(info)
|
281
|
-
|
282
|
-
# # cutting pass
|
283
|
-
# if options.cut and nstamps > 0:
|
284
|
-
# # generate output files
|
285
|
-
# from aubio.slicing import slice_source_at_stamps
|
286
|
-
# timestamps_end = None
|
287
|
-
# if options.cut_until_nslices and options.cut_until_nsamples:
|
288
|
-
# print "warning: using cut_until_nslices, but cut_until_nsamples is set"
|
289
|
-
# if options.cut_until_nsamples:
|
290
|
-
# timestamps_end = [t + options.cut_until_nsamples for t in timestamps[1:]]
|
291
|
-
# timestamps_end += [ 1e120 ]
|
292
|
-
# if options.cut_until_nslices:
|
293
|
-
# timestamps_end = [t for t in timestamps[1 + options.cut_until_nslices:]]
|
294
|
-
# timestamps_end += [ 1e120 ] * (options.cut_until_nslices + 1)
|
295
|
-
# slice_source_at_stamps(source_file, timestamps, timestamps_end = timestamps_end,
|
296
|
-
# output_dir = options.output_directory,
|
297
|
-
# samplerate = samplerate)
|
298
|
-
|
299
|
-
# # print some info
|
300
|
-
# duration = float (total_frames) / float(samplerate)
|
301
|
-
# info = 'created %(nstamps)d slices from %(source_file)s' % locals()
|
302
|
-
# info += ' (total %(duration).2fs at %(samplerate)dHz)\n' % locals()
|
303
|
-
# sys.stderr.write(info)
|
304
|
-
end
|
305
|
-
|
306
|
-
def self.get_features(path, params = {})
|
307
|
-
sample_rate = params[:sample_rate] || 44_100
|
308
|
-
window_size = params[:window_size] || 1024
|
309
|
-
hop_size = params[:hop_size] || 512
|
310
|
-
|
311
|
-
source = new_aubio_source(path, sample_rate, hop_size)
|
312
|
-
calculated_sample_rate = aubio_source_get_samplerate(source)
|
313
|
-
puts "samplerate: #{calculated_sample_rate}"
|
314
|
-
|
315
|
-
onset = new_aubio_onset('default', window_size, hop_size, sample_rate)
|
316
|
-
aubio_onset_set_minioi_ms(onset, 12.0)
|
317
|
-
aubio_onset_set_threshold(onset, 0.3)
|
318
|
-
onsets = []
|
319
|
-
|
320
|
-
pitch = new_aubio_pitch('default', window_size, hop_size, sample_rate)
|
321
|
-
aubio_pitch_set_unit(pitch, 'Hz')
|
322
|
-
|
323
|
-
# create output for source
|
324
|
-
samples = new_fvec(hop_size)
|
325
|
-
# create output for pitch and beat
|
326
|
-
out_fvec = new_fvec(1)
|
327
|
-
total_frames_counter = 0
|
328
|
-
tmp_read = FFI::MemoryPointer.new(:int)
|
329
|
-
|
330
|
-
loop do
|
331
|
-
aubio_source_do(source, samples, tmp_read)
|
332
|
-
|
333
|
-
aubio_pitch_do(pitch, samples, out_fvec)
|
334
|
-
|
335
|
-
cur_time = total_frames_counter / sample_rate
|
336
|
-
last_pitch = fvec_get_sample(out_fvec, 0)
|
337
|
-
|
338
|
-
# puts "pitch at #{cur_time} seconds: #{last_pitch} Hz"
|
339
|
-
|
340
|
-
aubio_onset_do(onset, samples, out_fvec)
|
341
|
-
is_onset = fvec_get_sample(out_fvec, 0)
|
342
|
-
|
343
|
-
if is_onset > 0.0
|
344
|
-
last_onset = aubio_onset_get_last_s(onset)
|
345
|
-
onsets << last_onset
|
346
|
-
puts "onset at #{last_onset}"
|
347
|
-
end
|
348
|
-
|
349
|
-
read = tmp_read.read_int
|
350
|
-
total_frames_counter += read
|
351
|
-
break if read != hop_size
|
352
|
-
end
|
353
|
-
|
354
|
-
cur_time = total_frames_counter.to_f / sample_rate
|
355
|
-
puts "total time : #{cur_time} seconds (#{total_frames_counter} frames)"
|
356
|
-
puts "found #{onsets.length} onsets total"
|
357
|
-
|
358
|
-
# cleanup
|
359
|
-
del_aubio_source(source)
|
360
|
-
del_aubio_onset(onset)
|
361
|
-
del_aubio_pitch(pitch)
|
362
|
-
|
363
|
-
onsets
|
364
|
-
end
|
365
|
-
|
366
|
-
# # change comments, swap args, convert to sym
|
367
|
-
|
368
|
-
# intPtr = 'int'
|
369
|
-
# stringPtr = "string" #ref.refType(ref.types.CString);
|
370
|
-
|
371
|
-
# {
|
372
|
-
# "aubio_tempo_do": [ "void", [ "pointer", "pointer", "pointer"]],
|
373
|
-
# "aubio_tempo_get_last": [ "int", ["pointer"]],
|
374
|
-
# "aubio_tempo_get_last_s": [ "float", ["pointer"]],
|
375
|
-
# "aubio_tempo_get_last_ms": [ "float", ["pointer"]],
|
376
|
-
# "aubio_tempo_set_silence": [ "int", ["pointer", "float"]],
|
377
|
-
# "aubio_tempo_get_silence": [ "float", ["pointer"]],
|
378
|
-
# "aubio_tempo_set_threshold": [ "int", ["pointer", "float"]],
|
379
|
-
# "aubio_tempo_get_threshold": [ "float", ["pointer"]],
|
380
|
-
# "aubio_tempo_get_bpm": [ "float", ["pointer"]],
|
381
|
-
# "aubio_tempo_get_confidence": [ "float", ["pointer"]],
|
382
|
-
# "del_aubio_tempo": [ "void", ["pointer"]],
|
383
|
-
|
384
|
-
# # beattracking / misc
|
385
|
-
# "new_aubio_beattracking": [ "pointer", [ "int", "int", "int"]],
|
386
|
-
# "aubio_beattracking_do": [ "void", [ "pointer", "pointer", "pointer"]],
|
387
|
-
# "aubio_beattracking_get_bpm": [ "float", ["pointer"]],
|
388
|
-
# "aubio_filter_do": [ "void", [ "pointer", "pointer" ]],
|
389
|
-
# "new_aubio_filter_a_weighting": [ "pointer", [ "int" ]],
|
390
|
-
|
391
|
-
# # source
|
392
|
-
# "new_aubio_source": [ "pointer", [ "string", "int", "int" ]],
|
393
|
-
# "aubio_source_do": [ "void", [ "pointer", "pointer", intPtr ]],
|
394
|
-
# "aubio_source_do_multi": [ "void", [ "pointer", "pointer", intPtr ]],
|
395
|
-
# "aubio_source_get_samplerate": [ "int", [ "pointer" ]],
|
396
|
-
# "aubio_source_get_channels": [ "int", [ "pointer" ]],
|
397
|
-
# "aubio_source_seek": [ "int", [ "pointer", "int" ]],
|
398
|
-
# "aubio_source_close": [ "int", [ "pointer" ]],
|
399
|
-
# "del_aubio_source": [ "void", [ "pointer" ]],
|
400
|
-
|
401
|
-
# # sink
|
402
|
-
# "new_aubio_sink": [ "pointer", [ "string", "int" ]],
|
403
|
-
# "aubio_sink_preset_samplerate": [ "void", [ "pointer", "int" ]],
|
404
|
-
# "aubio_sink_preset_channels": [ "void", [ "pointer", "int" ]],
|
405
|
-
# "aubio_sink_get_samplerate": [ "int", [ "pointer" ]],
|
406
|
-
# "aubio_sink_get_channels": [ "int", [ "pointer" ]],
|
407
|
-
# "aubio_sink_do": ["void", ["pointer", "pointer", "int"]],
|
408
|
-
# "aubio_sink_do_multi": ["void", ["pointer", "pointer", "int"]],
|
409
|
-
# "aubio_sink_close": [ "int", [ "pointer" ]],
|
410
|
-
# "del_aubio_sink": [ "void", [ "pointer" ]],
|
411
|
-
|
412
|
-
# # onset
|
413
|
-
# "new_aubio_onset": [ "pointer", [ "string", "int", "int", "int"]],
|
414
|
-
# "aubio_onset_do": [ "void", [ "pointer", "pointer", "pointer"]],
|
415
|
-
# "aubio_onset_get_last": [ "int", ["pointer"]],
|
416
|
-
# "aubio_onset_get_last_s": [ "float", ["pointer"]],
|
417
|
-
# "aubio_onset_get_last_ms": [ "float", ["pointer"]],
|
418
|
-
# "aubio_onset_set_silence": [ "int", ["pointer", "float"]],
|
419
|
-
# "aubio_onset_get_silence": [ "float", ["pointer"]],
|
420
|
-
# "aubio_onset_get_descriptor": [ "float", ["pointer"]],
|
421
|
-
# "aubio_onset_get_thresholded_descriptor": [ "float", ["pointer"]],
|
422
|
-
# "aubio_onset_set_threshold": [ "int", ["pointer", "float"]],
|
423
|
-
# "aubio_onset_set_minioi": [ "int", ["pointer", "int"]],
|
424
|
-
# "aubio_onset_set_minioi_s": [ "int", ["pointer", "int"]],
|
425
|
-
# "aubio_onset_set_minioi_ms": [ "int", ["pointer", "float"]],
|
426
|
-
# "aubio_onset_set_delay": [ "int", ["pointer", "int"]],
|
427
|
-
# "aubio_onset_set_delay_s": [ "int", ["pointer", "int"]],
|
428
|
-
# "aubio_onset_set_delay_ms": [ "int", ["pointer", "float"]],
|
429
|
-
# "aubio_onset_get_minioi": [ "int", ["pointer"]],
|
430
|
-
# "aubio_onset_get_minioi_s": [ "float", ["pointer"]],
|
431
|
-
# "aubio_onset_get_minioi_ms": [ "float", ["pointer"]],
|
432
|
-
# "aubio_onset_get_delay": [ "int", ["pointer"]],
|
433
|
-
# "aubio_onset_get_delay_s": [ "float", ["pointer"]],
|
434
|
-
# "aubio_onset_get_delay_ms": [ "float", ["pointer"]],
|
435
|
-
# "aubio_onset_get_threshold": [ "float", ["pointer"]],
|
436
|
-
# "del_aubio_onset": [ "void", ["pointer"]],
|
437
|
-
|
438
|
-
# # pitch
|
439
|
-
# "new_aubio_pitch": [ "pointer", [ "string", "int", "int", "int"]],
|
440
|
-
# "aubio_pitch_do": ["void", ["pointer", "pointer", "pointer"]],
|
441
|
-
# "aubio_pitch_set_tolerance": [ "int", ["pointer", "int"]],
|
442
|
-
# "aubio_pitch_set_unit": ["int", ["pointer", "string"]],
|
443
|
-
# "aubio_pitch_set_silence": ["int", ["pointer", "float"]],
|
444
|
-
# "aubio_pitch_get_silence": ["float", ["pointer"]],
|
445
|
-
# "aubio_pitch_get_confidence": ["float", ["pointer"]],
|
446
|
-
# "del_aubio_pitch": [ "void", ["pointer"]],
|
447
|
-
|
448
|
-
# # fvec
|
449
|
-
# "new_fvec": [ "pointer", [ "int" ]],
|
450
|
-
# "del_fvec": [ "void", [ "pointer" ]],
|
451
|
-
# "fvec_get_sample": [ "float", [ "pointer", "int" ]],
|
452
|
-
# "fvec_set_sample": [ "void", [ "pointer", "float", "int" ]],
|
453
|
-
# "fvec_get_data": [ "float", [ "pointer" ]],
|
454
|
-
# "fvec_print": [ "void", [ "pointer" ]],
|
455
|
-
# "fvec_set_all": [ "void", [ "pointer", "float" ]],
|
456
|
-
# "fvec_zeros": [ "void", [ "pointer" ]],
|
457
|
-
# "fvec_rev": [ "void", [ "pointer" ]],
|
458
|
-
# "fvec_weight": [ "void", [ "pointer", "pointer" ]],
|
459
|
-
# "fvec_copy": [ "void", [ "pointer", "pointer" ]],
|
460
|
-
# "fvec_ones": [ "void", [ "pointer" ]],
|
461
|
-
# }.each do |k,v|
|
462
|
-
# puts "attach_function :#{k.to_sym}, #{v.last.map(&:to_sym)}, :#{v.first.to_sym}"
|
463
|
-
# end
|
464
|
-
end
|
465
|
-
|
466
|
-
puts Aubio.get_features('/Applications/Sonic Pi.app/etc/samples/loop_amen.flac', hop_size: 256, sample_rate: 44_100).inspect
|