aubio 0.3.3 → 0.3.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +2 -0
- data/README.md +13 -2
- data/Rakefile +7 -5
- data/aubio-ffi-generator.rb +8 -6
- data/aubio.gemspec +19 -17
- data/aubio.rb +240 -241
- data/bin/console +4 -3
- data/lib/aubio.rb +29 -30
- data/lib/aubio/aubio-ffi.rb +50 -50
- data/lib/aubio/beats.rb +27 -27
- data/lib/aubio/legacy_api.rb +40 -39
- data/lib/aubio/onsets.rb +52 -52
- data/lib/aubio/pitches.rb +27 -27
- data/lib/aubio/version.rb +3 -1
- metadata +22 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eaa1dc334733e618f7f8272a421894fac350213f48b93e59b177d49e01a71c1c
|
4
|
+
data.tar.gz: d857822bd9d8ec7f7bd76cbf572e79c1a07a479ad191c30f5a9052131e242726
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fdfe5eb61b80fd531f9ca5880d648bb4726662296ce575779b06f10d0779db3a269c057464c09d4a741cb304a57cec064dbe6013931ed3a43f12d1d451608868
|
7
|
+
data.tar.gz: e062505345d9045572fffac90d2a91de73ae204605dda9a101c889f7688425007f5719192bf60449ecd523f7a7c392d8ed47ce0ecc5c03a28f0eadd9ad9f1bae
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,5 +1,4 @@
|
|
1
|
-
# Aubio
|
2
|
-
## warning: pre-alpha subject to change
|
1
|
+
# Ruby Aubio
|
3
2
|
|
4
3
|
A Ruby binding for the `aubio` library.
|
5
4
|
|
@@ -16,6 +15,12 @@ In their own words...
|
|
16
15
|
|
17
16
|
## Using `ffi_gen` to autogenerate bindings
|
18
17
|
|
18
|
+
This is optional, and something being considered for future development. The
|
19
|
+
`ffi_gen` gem can analyse a library using clang to automatically write the ffi
|
20
|
+
bindings for us (similar to `bindgen` in Rust as I understand it).
|
21
|
+
|
22
|
+
You can see the results in the `autogen_bindings` branch.
|
23
|
+
|
19
24
|
```
|
20
25
|
brew install aubio --with-libsndfile --with-fftw --with-libsamplerate
|
21
26
|
brew install llvm --with-clang --enable-shared
|
@@ -23,6 +28,12 @@ brew install llvm --with-clang --enable-shared
|
|
23
28
|
LD_LIBRARY_PATH="/usr/local/opt/llvm35/lib/llvm-3.5/lib" ruby aubio-ffi-generator.rb
|
24
29
|
```
|
25
30
|
|
31
|
+
## Running tests
|
32
|
+
|
33
|
+
```
|
34
|
+
$ rake clobber && rake build && rake test
|
35
|
+
```
|
36
|
+
|
26
37
|
## Installation
|
27
38
|
|
28
39
|
Add this line to your application's Gemfile:
|
data/Rakefile
CHANGED
@@ -1,10 +1,12 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'bundler/gem_tasks'
|
4
|
+
require 'rake/testtask'
|
3
5
|
|
4
6
|
Rake::TestTask.new(:test) do |t|
|
5
|
-
t.libs <<
|
6
|
-
t.libs <<
|
7
|
+
t.libs << 'test'
|
8
|
+
t.libs << 'lib'
|
7
9
|
t.test_files = FileList['test/**/*_test.rb']
|
8
10
|
end
|
9
11
|
|
10
|
-
task :
|
12
|
+
task default: :spec
|
data/aubio-ffi-generator.rb
CHANGED
@@ -1,14 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# this needs to be set on the command line when running this script
|
2
4
|
# ENV['LD_LIBRARY_PATH'] = "/usr/local/opt/llvm35/lib/llvm-3.5/lib"
|
3
5
|
require 'ffi_gen'
|
4
6
|
|
5
7
|
FFIGen.generate(
|
6
|
-
module_name:
|
7
|
-
ffi_lib:
|
8
|
-
headers:
|
9
|
-
cflags:
|
8
|
+
module_name: 'Aubio::Api',
|
9
|
+
ffi_lib: '/usr/local/Cellar/aubio/0.4.4/lib/libaubio.dylib',
|
10
|
+
headers: Dir['/usr/local/Cellar/aubio/0.4.4/include/aubio/**/*.h'],
|
11
|
+
cflags: `/usr/local/opt/llvm35/bin/llvm-config-3.5 --cflags`.split(' '),
|
10
12
|
# the following can be used to trim the aubio_ from the generated function names
|
11
13
|
# prefixes: ["aubio_", "CX"],
|
12
|
-
prefixes:
|
13
|
-
output:
|
14
|
+
prefixes: [],
|
15
|
+
output: 'lib/aubio/aubio-ffi.rb'
|
14
16
|
)
|
data/aubio.gemspec
CHANGED
@@ -1,29 +1,31 @@
|
|
1
|
-
#
|
2
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
lib = File.expand_path('lib', __dir__)
|
3
4
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
5
|
require 'aubio/version'
|
5
6
|
|
6
7
|
Gem::Specification.new do |spec|
|
7
|
-
spec.name =
|
8
|
+
spec.name = 'aubio'
|
8
9
|
spec.version = Aubio::VERSION
|
9
|
-
spec.authors = [
|
10
|
-
spec.email = [
|
10
|
+
spec.authors = ['Xavier Riley']
|
11
|
+
spec.email = ['xavriley@hotmail.com']
|
11
12
|
|
12
|
-
spec.summary =
|
13
|
-
spec.description =
|
14
|
-
spec.homepage =
|
15
|
-
spec.license =
|
13
|
+
spec.summary = 'Ruby bindings for the aubio audio library'
|
14
|
+
spec.description = 'Aubio is a tool designed for the extraction of annotations from audio signals. Its features include segmenting a sound file before each of its attacks, performing pitch detection, tapping the beat and producing midi streams from live audio.'
|
15
|
+
spec.homepage = 'https://github.com/xavriley/ruby-aubio'
|
16
|
+
spec.license = 'MIT'
|
16
17
|
|
17
18
|
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
18
|
-
spec.bindir =
|
19
|
+
spec.bindir = 'exe'
|
19
20
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
20
|
-
spec.require_paths = [
|
21
|
+
spec.require_paths = ['lib']
|
21
22
|
|
22
|
-
spec.add_dependency
|
23
|
+
spec.add_dependency 'ffi', '~> 1.9'
|
23
24
|
|
24
|
-
spec.add_development_dependency
|
25
|
-
spec.
|
26
|
-
spec.add_development_dependency
|
27
|
-
spec.add_development_dependency
|
28
|
-
spec.add_development_dependency
|
25
|
+
spec.add_development_dependency 'bundler'
|
26
|
+
spec.add_dependency 'rake', '>= 12.3.3'
|
27
|
+
spec.add_development_dependency 'ffi_gen'
|
28
|
+
spec.add_development_dependency 'minitest', '~> 5.0'
|
29
|
+
spec.add_development_dependency 'pry'
|
30
|
+
spec.add_development_dependency 'rubocop'
|
29
31
|
end
|
data/aubio.rb
CHANGED
@@ -1,129 +1,131 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'ffi'
|
2
4
|
|
3
5
|
module Aubio
|
4
6
|
extend FFI::Library
|
5
7
|
ffi_lib '/usr/local/Cellar/aubio/0.4.2/lib/libaubio.4.2.2.dylib'
|
6
8
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
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
|
20
22
|
|
21
23
|
# beattracking / misc
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
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
|
27
29
|
|
28
30
|
# source
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
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
|
37
39
|
|
38
40
|
# sink
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
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
|
48
50
|
|
49
51
|
# onset
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
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
|
74
76
|
|
75
77
|
# pitch
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
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
|
84
86
|
|
85
87
|
# new fvec
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
def self.onsets(path, params={})
|
100
|
-
|
101
|
-
|
102
|
-
|
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
|
103
105
|
|
104
106
|
# parser.add_option("-O","--onset-method",
|
105
107
|
# action="store", dest="onset_method", default='default',
|
106
108
|
# metavar = "<onset_method>",
|
107
109
|
# help="onset detection method [default=default] \
|
108
110
|
# complexdomain|hfc|phase|specdiff|energy|kl|mkl")
|
109
|
-
onset_method = params[:onset_method] ||
|
111
|
+
onset_method = params[:onset_method] || 'default'
|
110
112
|
|
111
113
|
# # cutting methods
|
112
114
|
# parser.add_option("-b","--beat",
|
113
115
|
# action="store_true", dest="beat", default=False,
|
114
116
|
# help="use beat locations")
|
115
|
-
|
117
|
+
beat = params[:beat] || false
|
116
118
|
# """
|
117
119
|
# parser.add_option("-S","--silencecut",
|
118
120
|
# action="store_true", dest="silencecut", default=False,
|
119
121
|
# help="use silence locations")
|
120
|
-
|
122
|
+
silencecut = params[:silencecut] || false
|
121
123
|
|
122
124
|
# parser.add_option("-s","--silence",
|
123
125
|
# metavar = "<value>",
|
124
126
|
# action="store", dest="silence", default=-70,
|
125
127
|
# help="silence threshold [default=-70]")
|
126
|
-
|
128
|
+
silence = params[:silence] || -70
|
127
129
|
|
128
130
|
# """
|
129
131
|
# # algorithm parameters
|
@@ -231,22 +233,21 @@ module Aubio
|
|
231
233
|
# sys.exit(1)
|
232
234
|
# return options, args
|
233
235
|
|
234
|
-
|
235
|
-
onset
|
236
|
+
source = new_aubio_source(path, sample_rate, hop_size)
|
237
|
+
onset = new_aubio_onset('default', 512, hop_size)
|
236
238
|
aubio_onset_set_minioi_ms(onset, 12.0)
|
237
|
-
|
239
|
+
aubio_onset_set_threshold(onset, 0.3)
|
238
240
|
|
239
241
|
timestamps = []
|
240
242
|
total_frames = 0
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
end
|
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
|
250
251
|
# if options.beat:
|
251
252
|
# o = tempo(options.onset_method, bufsize, hopsize)
|
252
253
|
# else:
|
@@ -300,168 +301,166 @@ module Aubio
|
|
300
301
|
# info = 'created %(nstamps)d slices from %(source_file)s' % locals()
|
301
302
|
# info += ' (total %(duration).2fs at %(samplerate)dHz)\n' % locals()
|
302
303
|
# sys.stderr.write(info)
|
303
|
-
|
304
|
+
end
|
304
305
|
|
305
|
-
def self.get_features(path, params={})
|
306
|
-
sample_rate = params[:sample_rate] ||
|
307
|
-
|
308
|
-
hop_size
|
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
|
309
310
|
|
310
311
|
source = new_aubio_source(path, sample_rate, hop_size)
|
311
312
|
calculated_sample_rate = aubio_source_get_samplerate(source)
|
312
313
|
puts "samplerate: #{calculated_sample_rate}"
|
313
314
|
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
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 = []
|
318
319
|
|
319
|
-
|
320
|
-
|
320
|
+
pitch = new_aubio_pitch('default', window_size, hop_size, sample_rate)
|
321
|
+
aubio_pitch_set_unit(pitch, 'Hz')
|
321
322
|
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
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)
|
328
329
|
|
329
|
-
|
330
|
-
|
330
|
+
loop do
|
331
|
+
aubio_source_do(source, samples, tmp_read)
|
331
332
|
|
332
|
-
|
333
|
+
aubio_pitch_do(pitch, samples, out_fvec)
|
333
334
|
|
334
|
-
|
335
|
-
|
335
|
+
cur_time = total_frames_counter / sample_rate
|
336
|
+
last_pitch = fvec_get_sample(out_fvec, 0)
|
336
337
|
|
337
|
-
|
338
|
+
# puts "pitch at #{cur_time} seconds: #{last_pitch} Hz"
|
338
339
|
|
339
|
-
|
340
|
-
|
340
|
+
aubio_onset_do(onset, samples, out_fvec)
|
341
|
+
is_onset = fvec_get_sample(out_fvec, 0)
|
341
342
|
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
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
|
347
348
|
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
end
|
353
|
-
end
|
349
|
+
read = tmp_read.read_int
|
350
|
+
total_frames_counter += read
|
351
|
+
break if read != hop_size
|
352
|
+
end
|
354
353
|
|
355
|
-
|
356
|
-
|
357
|
-
|
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"
|
358
357
|
|
359
358
|
# cleanup
|
360
|
-
|
361
|
-
|
362
|
-
|
359
|
+
del_aubio_source(source)
|
360
|
+
del_aubio_onset(onset)
|
361
|
+
del_aubio_pitch(pitch)
|
363
362
|
|
364
363
|
onsets
|
365
364
|
end
|
366
365
|
|
367
|
-
# # change comments, swap args, convert to sym
|
368
|
-
|
369
|
-
# intPtr = 'int'
|
370
|
-
# stringPtr = "string" #ref.refType(ref.types.CString);
|
371
|
-
|
372
|
-
# {
|
373
|
-
# "aubio_tempo_do": [ "void", [ "pointer", "pointer", "pointer"]],
|
374
|
-
# "aubio_tempo_get_last": [ "int", ["pointer"]],
|
375
|
-
# "aubio_tempo_get_last_s": [ "float", ["pointer"]],
|
376
|
-
# "aubio_tempo_get_last_ms": [ "float", ["pointer"]],
|
377
|
-
# "aubio_tempo_set_silence": [ "int", ["pointer", "float"]],
|
378
|
-
# "aubio_tempo_get_silence": [ "float", ["pointer"]],
|
379
|
-
# "aubio_tempo_set_threshold": [ "int", ["pointer", "float"]],
|
380
|
-
# "aubio_tempo_get_threshold": [ "float", ["pointer"]],
|
381
|
-
# "aubio_tempo_get_bpm": [ "float", ["pointer"]],
|
382
|
-
# "aubio_tempo_get_confidence": [ "float", ["pointer"]],
|
383
|
-
# "del_aubio_tempo": [ "void", ["pointer"]],
|
384
|
-
|
385
|
-
# # beattracking / misc
|
386
|
-
# "new_aubio_beattracking": [ "pointer", [ "int", "int", "int"]],
|
387
|
-
# "aubio_beattracking_do": [ "void", [ "pointer", "pointer", "pointer"]],
|
388
|
-
# "aubio_beattracking_get_bpm": [ "float", ["pointer"]],
|
389
|
-
# "aubio_filter_do": [ "void", [ "pointer", "pointer" ]],
|
390
|
-
# "new_aubio_filter_a_weighting": [ "pointer", [ "int" ]],
|
391
|
-
|
392
|
-
# # source
|
393
|
-
# "new_aubio_source": [ "pointer", [ "string", "int", "int" ]],
|
394
|
-
# "aubio_source_do": [ "void", [ "pointer", "pointer", intPtr ]],
|
395
|
-
# "aubio_source_do_multi": [ "void", [ "pointer", "pointer", intPtr ]],
|
396
|
-
# "aubio_source_get_samplerate": [ "int", [ "pointer" ]],
|
397
|
-
# "aubio_source_get_channels": [ "int", [ "pointer" ]],
|
398
|
-
# "aubio_source_seek": [ "int", [ "pointer", "int" ]],
|
399
|
-
# "aubio_source_close": [ "int", [ "pointer" ]],
|
400
|
-
# "del_aubio_source": [ "void", [ "pointer" ]],
|
401
|
-
|
402
|
-
# # sink
|
403
|
-
# "new_aubio_sink": [ "pointer", [ "string", "int" ]],
|
404
|
-
# "aubio_sink_preset_samplerate": [ "void", [ "pointer", "int" ]],
|
405
|
-
# "aubio_sink_preset_channels": [ "void", [ "pointer", "int" ]],
|
406
|
-
# "aubio_sink_get_samplerate": [ "int", [ "pointer" ]],
|
407
|
-
# "aubio_sink_get_channels": [ "int", [ "pointer" ]],
|
408
|
-
# "aubio_sink_do": ["void", ["pointer", "pointer", "int"]],
|
409
|
-
# "aubio_sink_do_multi": ["void", ["pointer", "pointer", "int"]],
|
410
|
-
# "aubio_sink_close": [ "int", [ "pointer" ]],
|
411
|
-
# "del_aubio_sink": [ "void", [ "pointer" ]],
|
412
|
-
|
413
|
-
# # onset
|
414
|
-
# "new_aubio_onset": [ "pointer", [ "string", "int", "int", "int"]],
|
415
|
-
# "aubio_onset_do": [ "void", [ "pointer", "pointer", "pointer"]],
|
416
|
-
# "aubio_onset_get_last": [ "int", ["pointer"]],
|
417
|
-
# "aubio_onset_get_last_s": [ "float", ["pointer"]],
|
418
|
-
# "aubio_onset_get_last_ms": [ "float", ["pointer"]],
|
419
|
-
# "aubio_onset_set_silence": [ "int", ["pointer", "float"]],
|
420
|
-
# "aubio_onset_get_silence": [ "float", ["pointer"]],
|
421
|
-
# "aubio_onset_get_descriptor": [ "float", ["pointer"]],
|
422
|
-
# "aubio_onset_get_thresholded_descriptor": [ "float", ["pointer"]],
|
423
|
-
# "aubio_onset_set_threshold": [ "int", ["pointer", "float"]],
|
424
|
-
# "aubio_onset_set_minioi": [ "int", ["pointer", "int"]],
|
425
|
-
# "aubio_onset_set_minioi_s": [ "int", ["pointer", "int"]],
|
426
|
-
# "aubio_onset_set_minioi_ms": [ "int", ["pointer", "float"]],
|
427
|
-
# "aubio_onset_set_delay": [ "int", ["pointer", "int"]],
|
428
|
-
# "aubio_onset_set_delay_s": [ "int", ["pointer", "int"]],
|
429
|
-
# "aubio_onset_set_delay_ms": [ "int", ["pointer", "float"]],
|
430
|
-
# "aubio_onset_get_minioi": [ "int", ["pointer"]],
|
431
|
-
# "aubio_onset_get_minioi_s": [ "float", ["pointer"]],
|
432
|
-
# "aubio_onset_get_minioi_ms": [ "float", ["pointer"]],
|
433
|
-
# "aubio_onset_get_delay": [ "int", ["pointer"]],
|
434
|
-
# "aubio_onset_get_delay_s": [ "float", ["pointer"]],
|
435
|
-
# "aubio_onset_get_delay_ms": [ "float", ["pointer"]],
|
436
|
-
# "aubio_onset_get_threshold": [ "float", ["pointer"]],
|
437
|
-
# "del_aubio_onset": [ "void", ["pointer"]],
|
438
|
-
|
439
|
-
# # pitch
|
440
|
-
# "new_aubio_pitch": [ "pointer", [ "string", "int", "int", "int"]],
|
441
|
-
# "aubio_pitch_do": ["void", ["pointer", "pointer", "pointer"]],
|
442
|
-
# "aubio_pitch_set_tolerance": [ "int", ["pointer", "int"]],
|
443
|
-
# "aubio_pitch_set_unit": ["int", ["pointer", "string"]],
|
444
|
-
# "aubio_pitch_set_silence": ["int", ["pointer", "float"]],
|
445
|
-
# "aubio_pitch_get_silence": ["float", ["pointer"]],
|
446
|
-
# "aubio_pitch_get_confidence": ["float", ["pointer"]],
|
447
|
-
# "del_aubio_pitch": [ "void", ["pointer"]],
|
448
|
-
|
449
|
-
# # fvec
|
450
|
-
# "new_fvec": [ "pointer", [ "int" ]],
|
451
|
-
# "del_fvec": [ "void", [ "pointer" ]],
|
452
|
-
# "fvec_get_sample": [ "float", [ "pointer", "int" ]],
|
453
|
-
# "fvec_set_sample": [ "void", [ "pointer", "float", "int" ]],
|
454
|
-
# "fvec_get_data": [ "float", [ "pointer" ]],
|
455
|
-
# "fvec_print": [ "void", [ "pointer" ]],
|
456
|
-
# "fvec_set_all": [ "void", [ "pointer", "float" ]],
|
457
|
-
# "fvec_zeros": [ "void", [ "pointer" ]],
|
458
|
-
# "fvec_rev": [ "void", [ "pointer" ]],
|
459
|
-
# "fvec_weight": [ "void", [ "pointer", "pointer" ]],
|
460
|
-
# "fvec_copy": [ "void", [ "pointer", "pointer" ]],
|
461
|
-
# "fvec_ones": [ "void", [ "pointer" ]],
|
462
|
-
# }.each do |k,v|
|
463
|
-
# puts "attach_function :#{k.to_sym}, #{v.last.map(&:to_sym)}, :#{v.first.to_sym}"
|
464
|
-
# end
|
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
|
465
464
|
end
|
466
465
|
|
467
|
-
puts Aubio.get_features(
|
466
|
+
puts Aubio.get_features('/Applications/Sonic Pi.app/etc/samples/loop_amen.flac', hop_size: 256, sample_rate: 44_100).inspect
|