fiddle_fluidsynth 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.standard.yml +3 -0
- data/CHANGELOG.md +5 -0
- data/LICENSE.txt +21 -0
- data/README.md +138 -0
- data/Rakefile +14 -0
- data/examples/enum.rb +30 -0
- data/examples/example.sf2 +0 -0
- data/examples/ffs_arpeggio.rb +252 -0
- data/examples/ffs_example.rb +47 -0
- data/examples/ffs_fx.rb +200 -0
- data/examples/ffs_metronome.rb +260 -0
- data/examples/ffs_midiplay.rb +122 -0
- data/examples/ffs_simple.rb +45 -0
- data/examples/ffs_test1.rb +41 -0
- data/examples/ffs_test3.rb +50 -0
- data/examples/fiddle-pointer.rb +18 -0
- data/examples/presets-each.rb +66 -0
- data/examples/presets-full_scan.rb +59 -0
- data/examples/settings-each.rb +106 -0
- data/exe/ffs_midiplay.rb +122 -0
- data/lib/fiddle_fluidsynth/audio_output/driver.rb +104 -0
- data/lib/fiddle_fluidsynth/audio_output/file_renderer.rb +84 -0
- data/lib/fiddle_fluidsynth/audio_output.rb +7 -0
- data/lib/fiddle_fluidsynth/command_interface/command_interface.rb +90 -0
- data/lib/fiddle_fluidsynth/command_interface/handler.rb +95 -0
- data/lib/fiddle_fluidsynth/command_interface/server.rb +79 -0
- data/lib/fiddle_fluidsynth/command_interface/shell.rb +76 -0
- data/lib/fiddle_fluidsynth/command_interface.rb +9 -0
- data/lib/fiddle_fluidsynth/core_ext/fiddle.rb +142 -0
- data/lib/fiddle_fluidsynth/core_ext/module.rb +123 -0
- data/lib/fiddle_fluidsynth/fiddle_fluidsynth.rb +172 -0
- data/lib/fiddle_fluidsynth/logging/logging.rb +82 -0
- data/lib/fiddle_fluidsynth/logging.rb +6 -0
- data/lib/fiddle_fluidsynth/midi_input/driver.rb +77 -0
- data/lib/fiddle_fluidsynth/midi_input/events.rb +255 -0
- data/lib/fiddle_fluidsynth/midi_input/midi_input.rb +70 -0
- data/lib/fiddle_fluidsynth/midi_input/player.rb +289 -0
- data/lib/fiddle_fluidsynth/midi_input/router.rb +225 -0
- data/lib/fiddle_fluidsynth/midi_input.rb +11 -0
- data/lib/fiddle_fluidsynth/misc/misc.rb +162 -0
- data/lib/fiddle_fluidsynth/misc.rb +6 -0
- data/lib/fiddle_fluidsynth/sequencer/events.rb +679 -0
- data/lib/fiddle_fluidsynth/sequencer/sequencer.rb +384 -0
- data/lib/fiddle_fluidsynth/sequencer.rb +7 -0
- data/lib/fiddle_fluidsynth/settings/settings.rb +465 -0
- data/lib/fiddle_fluidsynth/settings.rb +6 -0
- data/lib/fiddle_fluidsynth/soundfonts/generators.rb +128 -0
- data/lib/fiddle_fluidsynth/soundfonts/loader.rb +506 -0
- data/lib/fiddle_fluidsynth/soundfonts/modulators.rb +247 -0
- data/lib/fiddle_fluidsynth/soundfonts/soundfonts.rb +64 -0
- data/lib/fiddle_fluidsynth/soundfonts/voices.rb +178 -0
- data/lib/fiddle_fluidsynth/soundfonts.rb +11 -0
- data/lib/fiddle_fluidsynth/synth/audio_rendering.rb +100 -0
- data/lib/fiddle_fluidsynth/synth/effect/chorus.rb +269 -0
- data/lib/fiddle_fluidsynth/synth/effect/iir_filter.rb +81 -0
- data/lib/fiddle_fluidsynth/synth/effect/ladspa.rb +172 -0
- data/lib/fiddle_fluidsynth/synth/effect/reverb.rb +207 -0
- data/lib/fiddle_fluidsynth/synth/effect.rb +10 -0
- data/lib/fiddle_fluidsynth/synth/midi/messages.rb +292 -0
- data/lib/fiddle_fluidsynth/synth/midi/setup.rb +235 -0
- data/lib/fiddle_fluidsynth/synth/midi/tuning.rb +128 -0
- data/lib/fiddle_fluidsynth/synth/midi.rb +9 -0
- data/lib/fiddle_fluidsynth/synth/params/params.rb +200 -0
- data/lib/fiddle_fluidsynth/synth/params.rb +8 -0
- data/lib/fiddle_fluidsynth/synth/soundfont_management.rb +210 -0
- data/lib/fiddle_fluidsynth/synth/synth.rb +114 -0
- data/lib/fiddle_fluidsynth/synth/voice_control.rb +94 -0
- data/lib/fiddle_fluidsynth/synth.rb +18 -0
- data/lib/fiddle_fluidsynth/types/types.rb +131 -0
- data/lib/fiddle_fluidsynth/types.rb +10 -0
- data/lib/fiddle_fluidsynth/util/callback.rb +585 -0
- data/lib/fiddle_fluidsynth/util/interface/settings.rb +689 -0
- data/lib/fiddle_fluidsynth/util/interface/soundfont.rb +115 -0
- data/lib/fiddle_fluidsynth/util/interface/soundfont_preset.rb +69 -0
- data/lib/fiddle_fluidsynth/util/interface/soundfont_sample.rb +61 -0
- data/lib/fiddle_fluidsynth/util/interface.rb +11 -0
- data/lib/fiddle_fluidsynth/util/module_hier.rb +403 -0
- data/lib/fiddle_fluidsynth/util/util.rb +467 -0
- data/lib/fiddle_fluidsynth/util-after.rb +12 -0
- data/lib/fiddle_fluidsynth/util.rb +37 -0
- data/lib/fiddle_fluidsynth/version.rb +10 -0
- data/lib/fiddle_fluidsynth.rb +57 -0
- data/sig/fiddle_fluidsynth.rbs +4 -0
- metadata +128 -0
@@ -0,0 +1,247 @@
|
|
1
|
+
#
|
2
|
+
# filename: fiddle-fluidstynth/soundfonts/modulators.rb
|
3
|
+
#
|
4
|
+
|
5
|
+
|
6
|
+
# References
|
7
|
+
# - fluidstynth.org, [API Reference](https://www.fluidsynth.org/api/modules.html)
|
8
|
+
#
|
9
|
+
class FiddleFluidSynth
|
10
|
+
|
11
|
+
# SoundFont modulator functions and constants.
|
12
|
+
# ==== References
|
13
|
+
# - API Reference, SoundFont/[SoundFont Modulators](https://www.fluidsynth.org/api/group__modulators.html)
|
14
|
+
# - [library fiddle](https://docs.ruby-lang.org/ja/latest/library/fiddle.html)
|
15
|
+
#
|
16
|
+
|
17
|
+
|
18
|
+
# Enumerations.
|
19
|
+
#
|
20
|
+
#
|
21
|
+
|
22
|
+
# Flags defining the polarity, mapping function and type of a modulator
|
23
|
+
# source.
|
24
|
+
enum(
|
25
|
+
:fluid_mod_flags,
|
26
|
+
FLUID_MOD_POSITIVE: 0,
|
27
|
+
FLUID_MOD_NEGATIVE: 1,
|
28
|
+
|
29
|
+
FLUID_MOD_UNIPOLAR: 0,
|
30
|
+
FLUID_MOD_BIPOLAR: 2,
|
31
|
+
|
32
|
+
FLUID_MOD_LINEAR: 0,
|
33
|
+
FLUID_MOD_CONCAVE: 4,
|
34
|
+
FLUID_MOD_CONVEX: 8,
|
35
|
+
FLUID_MOD_SWITCH: 12,
|
36
|
+
|
37
|
+
FLUID_MOD_GC: 0,
|
38
|
+
FLUID_MOD_CC: 16,
|
39
|
+
FLUID_MOD_CUSTOM: 0x40,
|
40
|
+
FLUID_MOD_SIN: 0x80)
|
41
|
+
|
42
|
+
# General controller (if FLUID_MOD_GC in flags).
|
43
|
+
enum(
|
44
|
+
:fluid_mod_src,
|
45
|
+
FLUID_MOD_NONE: 0,
|
46
|
+
FLUID_MOD_VELOCITY: 2,
|
47
|
+
FLUID_MOD_KEY: 3,
|
48
|
+
FLUID_MOD_KEYPRESSURE: 10,
|
49
|
+
FLUID_MOD_CHANNELPRESSURE: 13,
|
50
|
+
FLUID_MOD_PITCHWHEEL: 14,
|
51
|
+
FLUID_MOD_PITCHWHEELSENS: 16,
|
52
|
+
)
|
53
|
+
|
54
|
+
# Transform types for the SoundFont2 modulators as defined by
|
55
|
+
# SoundFont 2.04 section 8.3.
|
56
|
+
enum(
|
57
|
+
:fluid_mod_transforms,
|
58
|
+
FLUID_MOD_TRANSFORM_LINEAR: 0,
|
59
|
+
FLUID_MOD_TRANSFORM_ABS: 2)
|
60
|
+
|
61
|
+
|
62
|
+
#
|
63
|
+
#
|
64
|
+
#
|
65
|
+
module C
|
66
|
+
|
67
|
+
|
68
|
+
# Lifecycle Functions (MIDI Sequencer).
|
69
|
+
#
|
70
|
+
#
|
71
|
+
|
72
|
+
# Create a new uninitialized modulator structure.
|
73
|
+
extern 'fluid_mod_t* new_fluid_mod(void)'
|
74
|
+
|
75
|
+
# Free a modulator structure.
|
76
|
+
extern 'void delete_fluid_mod(fluid_mod_t*)'
|
77
|
+
|
78
|
+
|
79
|
+
# Functions.
|
80
|
+
#
|
81
|
+
#
|
82
|
+
|
83
|
+
# Clone the modulators destination, sources, flags and amount.
|
84
|
+
extern 'void fluid_mod_clone(fluid_mod_t*, fluid_mod_t*)'
|
85
|
+
|
86
|
+
# Get the scale amount from a modulator.
|
87
|
+
extern 'double fluid_mod_get_amount(fluid_mod_t*)'
|
88
|
+
|
89
|
+
# Get destination effect from a modulator.
|
90
|
+
extern 'int fluid_mod_get_dest(fluid_mod_t*)'
|
91
|
+
|
92
|
+
# Get primary source flags from a modulator.
|
93
|
+
extern 'int fluid_mod_get_flags1(fluid_mod_t*)'
|
94
|
+
|
95
|
+
# Get secondary source flags from a modulator.
|
96
|
+
extern 'int fluid_mod_get_flags2(fluid_mod_t*)'
|
97
|
+
|
98
|
+
# Get the primary source value from a modulator.
|
99
|
+
extern 'int fluid_mod_get_source1(fluid_mod_t*)'
|
100
|
+
|
101
|
+
# Get the secondary source value from a modulator.
|
102
|
+
extern 'int fluid_mod_get_source2(fluid_mod_t*)'
|
103
|
+
|
104
|
+
# Get the transform type of a modulator.
|
105
|
+
extern 'int fluid_mod_get_transform(fluid_mod_t*)'
|
106
|
+
|
107
|
+
# Check if the modulator has the given destination.
|
108
|
+
extern 'int fluid_mod_has_dest(fluid_mod_t*, int)'
|
109
|
+
|
110
|
+
# Check if the modulator has the given source.
|
111
|
+
extern 'int fluid_mod_has_source(fluid_mod_t*, int, int)'
|
112
|
+
|
113
|
+
# Set the scale amount of a modulator.
|
114
|
+
extern 'void fluid_mod_set_amount(fluid_mod_t*, double)'
|
115
|
+
|
116
|
+
# Set the destination effect of a modulator.
|
117
|
+
extern 'void fluid_mod_set_dest(fluid_mod_t*, int)'
|
118
|
+
|
119
|
+
# Set a modulator's primary source controller and flags.
|
120
|
+
extern 'void fluid_mod_set_source1(fluid_mod_t*, int, int)'
|
121
|
+
|
122
|
+
# Set a modulator's secondary source controller and flags.
|
123
|
+
extern 'void fluid_mod_set_source2(fluid_mod_t*, int, int)'
|
124
|
+
|
125
|
+
# Set the transform type of a modulator.
|
126
|
+
extern 'void fluid_mod_set_transform(fluid_mod_t*, int)'
|
127
|
+
|
128
|
+
# Returns the size of the fluid_mod_t structure.
|
129
|
+
extern 'size_t fluid_mod_sizeof(void)'
|
130
|
+
|
131
|
+
# Checks if two modulators are identical in sources, flags and destination.
|
132
|
+
extern 'int fluid_mod_test_identity(fluid_mod_t*, fluid_mod_t*)'
|
133
|
+
|
134
|
+
|
135
|
+
end
|
136
|
+
end
|
137
|
+
|
138
|
+
|
139
|
+
# Lifecycle Functions.
|
140
|
+
#
|
141
|
+
#
|
142
|
+
class FiddleFluidSynth
|
143
|
+
|
144
|
+
#
|
145
|
+
def mod_new()
|
146
|
+
ret = C.new_fluid_mod()
|
147
|
+
ret
|
148
|
+
end
|
149
|
+
|
150
|
+
def mod_delete( mod )
|
151
|
+
ret = C.delete_fluid_mod(mod)
|
152
|
+
ret
|
153
|
+
end
|
154
|
+
|
155
|
+
|
156
|
+
end
|
157
|
+
|
158
|
+
# Functions.
|
159
|
+
#
|
160
|
+
#
|
161
|
+
class FiddleFluidSynth
|
162
|
+
|
163
|
+
#
|
164
|
+
def mod_clone( mod, src: )
|
165
|
+
ret = C.fluid_mod_clone(mod, src)
|
166
|
+
ret
|
167
|
+
end
|
168
|
+
|
169
|
+
def mod_get_amount( mod )
|
170
|
+
ret = C.fluid_mod_get_amount(mod)
|
171
|
+
ret
|
172
|
+
end
|
173
|
+
|
174
|
+
def mod_get_dest( mod )
|
175
|
+
ret = C.fluid_mod_get_dest(mod)
|
176
|
+
ret
|
177
|
+
end
|
178
|
+
|
179
|
+
def mod_get_flags1( mod )
|
180
|
+
ret = C.fluid_mod_get_flags1(mod)
|
181
|
+
ret
|
182
|
+
end
|
183
|
+
def mod_get_flags2( mod )
|
184
|
+
ret = C.fluid_mod_get_flags2(mod)
|
185
|
+
ret
|
186
|
+
end
|
187
|
+
def mod_get_source1( mod )
|
188
|
+
ret = C.fluid_mod_get_source1(mod)
|
189
|
+
ret
|
190
|
+
end
|
191
|
+
def mod_get_source2( mod )
|
192
|
+
ret = C.fluid_mod_get_source2(mod)
|
193
|
+
ret
|
194
|
+
end
|
195
|
+
|
196
|
+
#
|
197
|
+
def mod_get_transform( mod )
|
198
|
+
ret = C.fluid_mod_get_transform(mod)
|
199
|
+
ret
|
200
|
+
end
|
201
|
+
|
202
|
+
#
|
203
|
+
def mod_has_dest( mod, gen: )
|
204
|
+
ret = C.fluid_mod_has_dest(mod,gen)
|
205
|
+
ret
|
206
|
+
end
|
207
|
+
def mod_has_source( mod, cc: , ctrl: )
|
208
|
+
ret = C.fluid_mod_has_source(mod,cc,ctrl)
|
209
|
+
ret
|
210
|
+
end
|
211
|
+
|
212
|
+
#
|
213
|
+
def mod_set_amount( mod, amount: )
|
214
|
+
ret = C.fluid_mod_set_amount(mod, amount)
|
215
|
+
ret
|
216
|
+
end
|
217
|
+
def mod_set_dest( mod, dst: )
|
218
|
+
ret = C.fluid_mod_set_dest(mod, dst)
|
219
|
+
ret
|
220
|
+
end
|
221
|
+
def mod_set_source1( mod, src: , flags: )
|
222
|
+
ret = C.fluid_mod_set_amount(mod, amount)
|
223
|
+
ret
|
224
|
+
end
|
225
|
+
def mod_set_source2( mod, src: , flags: )
|
226
|
+
ret = C.fluid_mod_set_amount(mod, amount)
|
227
|
+
ret
|
228
|
+
end
|
229
|
+
def mod_set_transform( mod, type: )
|
230
|
+
ret = C.fluid_mod_set_amount(mod, amount)
|
231
|
+
ret
|
232
|
+
end
|
233
|
+
|
234
|
+
def mod_sizeof
|
235
|
+
ret = C.fluid_mod_sizeof()
|
236
|
+
ret
|
237
|
+
end
|
238
|
+
def mod_test_identity( mod1: , mod2: )
|
239
|
+
ret = C.fluid_mod_test_identity(mod1, mod2)
|
240
|
+
ret
|
241
|
+
end
|
242
|
+
|
243
|
+
|
244
|
+
end
|
245
|
+
|
246
|
+
|
247
|
+
#### endof filename: fiddle-fluidstynth/soundfonts/modulators.rb
|
@@ -0,0 +1,64 @@
|
|
1
|
+
#
|
2
|
+
# filename: soundfonts/soundfonts.rb
|
3
|
+
#
|
4
|
+
|
5
|
+
|
6
|
+
# References
|
7
|
+
# - fluidsynth.org, [API Reference](https://www.fluidsynth.org/api/modules.html)
|
8
|
+
#
|
9
|
+
class FiddleFluidSynth
|
10
|
+
|
11
|
+
#
|
12
|
+
module C
|
13
|
+
|
14
|
+
# SoundFont related functions.
|
15
|
+
# ==== References
|
16
|
+
# - API Reference, [SoundFonts](https://www.fluidsynth.org/api/group__soundfonts.html)
|
17
|
+
# - [library fiddle](https://docs.ruby-lang.org/ja/latest/library/fiddle.html)
|
18
|
+
#
|
19
|
+
|
20
|
+
|
21
|
+
# Lifecycle Functions.
|
22
|
+
#
|
23
|
+
#
|
24
|
+
|
25
|
+
|
26
|
+
# Functions.
|
27
|
+
#
|
28
|
+
#
|
29
|
+
|
30
|
+
# Pins all samples of the given preset.
|
31
|
+
extern 'int fluid_synth_pin_preset(fluid_synth_t*, int, int, int)'
|
32
|
+
|
33
|
+
# Unpin all samples of the given preset.
|
34
|
+
extern 'int fluid_synth_unpin_preset(fluid_synth_t*, int, int, int)'
|
35
|
+
|
36
|
+
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
|
41
|
+
# Lifecycle Functions.
|
42
|
+
#
|
43
|
+
#
|
44
|
+
|
45
|
+
|
46
|
+
# Functions.
|
47
|
+
#
|
48
|
+
#
|
49
|
+
class FiddleFluidSynth
|
50
|
+
|
51
|
+
#
|
52
|
+
def synth_pin_preset( synth=self.synth, sfid: , bknum: , prenum: )
|
53
|
+
ret = C.fluid_synth_pin_preset(synth, sfid, bknum, prenum)
|
54
|
+
ret
|
55
|
+
end
|
56
|
+
def synth_unpin_preset( synth=self.synth, sfid: , bknum: , prenum: )
|
57
|
+
ret = C.fluid_synth_unpin_preset(synth, sfid, bknum, prenum)
|
58
|
+
ret
|
59
|
+
end
|
60
|
+
|
61
|
+
end
|
62
|
+
|
63
|
+
|
64
|
+
#### endof filename: soundfonts/soundfonts.rb
|
@@ -0,0 +1,178 @@
|
|
1
|
+
#
|
2
|
+
# filename: fiddle-fluidstynth/soundfonts/voices.rb
|
3
|
+
#
|
4
|
+
|
5
|
+
|
6
|
+
# References
|
7
|
+
# - fluidstynth.org, [API Reference](https://www.fluidsynth.org/api/modules.html)
|
8
|
+
#
|
9
|
+
class FiddleFluidSynth
|
10
|
+
|
11
|
+
# Synthesis voice manipulation functions.
|
12
|
+
# ==== References
|
13
|
+
# - API Reference, SoundFonts/[Voice Manipulation](https://www.fluidsynth.org/api/group__voices.html)
|
14
|
+
# - [library fiddle](https://docs.ruby-lang.org/ja/latest/library/fiddle.html)
|
15
|
+
|
16
|
+
# Enumerations.
|
17
|
+
#
|
18
|
+
#
|
19
|
+
|
20
|
+
# Enum used with fluid_voice_add_mod() to specify how to handle duplicate
|
21
|
+
# modulators.
|
22
|
+
enum(
|
23
|
+
:fluid_voice_add_mod,
|
24
|
+
FLUID_VOICE_OVERWRITE: nil,
|
25
|
+
FLUID_VOICE_ADD: nil,
|
26
|
+
FLUID_VOICE_DEFAULT: nil,
|
27
|
+
)
|
28
|
+
|
29
|
+
#
|
30
|
+
module C
|
31
|
+
|
32
|
+
|
33
|
+
# Lifecycle Functions (MIDI Sequencer).
|
34
|
+
#
|
35
|
+
#
|
36
|
+
|
37
|
+
|
38
|
+
# Functions.
|
39
|
+
#
|
40
|
+
#
|
41
|
+
|
42
|
+
# Adds a modulator to the voice if the modulator has valid sources.
|
43
|
+
extern 'void fluid_voice_add_mod(fluid_voice_t*, fluid_mod_t*, int)'
|
44
|
+
|
45
|
+
# Get the value of a generator.
|
46
|
+
extern 'float fluid_voice_gen_get(fluid_voice_t*, int)'
|
47
|
+
|
48
|
+
# Offset the value of a generator.
|
49
|
+
extern 'void fluid_voice_gen_incr(fluid_voice_t*, int, float)'
|
50
|
+
|
51
|
+
# Set the value of a generator.
|
52
|
+
extern 'void fluid_voice_gen_set(fluid_voice_t*, int, float)'
|
53
|
+
|
54
|
+
# Return the effective MIDI key of the playing voice.
|
55
|
+
extern 'int fluid_voice_get_actual_key(fluid_voice_t*)'
|
56
|
+
|
57
|
+
# Return the effective MIDI velocity of the playing voice.
|
58
|
+
extern 'int fluid_voice_get_actual_velocity(fluid_voice_t*)'
|
59
|
+
|
60
|
+
# Return the MIDI channel the voice is playing on.
|
61
|
+
extern 'int fluid_voice_get_channel(fluid_voice_t*)'
|
62
|
+
|
63
|
+
# Get the unique ID of the noteon-event.
|
64
|
+
extern 'unsigned int fluid_voice_get_id(fluid_voice_t*)'
|
65
|
+
|
66
|
+
# Return the MIDI key from the starting noteon event.
|
67
|
+
extern 'int fluid_voice_get_key(fluid_voice_t*)'
|
68
|
+
|
69
|
+
# Return the MIDI velocity from the starting noteon event.
|
70
|
+
extern 'int fluid_voice_get_velocity(fluid_voice_t*)'
|
71
|
+
|
72
|
+
# Check if a voice is ON.
|
73
|
+
extern 'int fluid_voice_is_on(fluid_voice_t*)'
|
74
|
+
|
75
|
+
# Check if a voice is producing sound.
|
76
|
+
extern 'int fluid_voice_is_playing(fluid_voice_t*)'
|
77
|
+
|
78
|
+
# Check if a voice keeps playing after it has received a noteoff due to
|
79
|
+
# being held by sostenuto.
|
80
|
+
extern 'int fluid_voice_is_sostenuto(fluid_voice_t*)'
|
81
|
+
|
82
|
+
# Check if a voice keeps playing after it has received a noteoff due to
|
83
|
+
# being held by sustain.
|
84
|
+
extern 'int fluid_voice_is_sustained(fluid_voice_t*)'
|
85
|
+
|
86
|
+
# Calculate the peak volume of a sample for voice off optimization.
|
87
|
+
extern 'int fluid_voice_optimize_sample(fluid_sample_t*)'
|
88
|
+
|
89
|
+
# Update all the synthesis parameters which depend on generator gen.
|
90
|
+
extern 'void fluid_voice_update_param(fluid_voice_t*, int)'
|
91
|
+
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
|
96
|
+
# Lifecycle Functions.
|
97
|
+
#
|
98
|
+
#
|
99
|
+
|
100
|
+
|
101
|
+
# Functions.
|
102
|
+
#
|
103
|
+
#
|
104
|
+
class FiddleFluidSynth
|
105
|
+
|
106
|
+
def voice_add_mod( voice, mod: , mode: )
|
107
|
+
ret = C.fluid_voice_add_mod(voice,mod,mode)
|
108
|
+
ret
|
109
|
+
end
|
110
|
+
|
111
|
+
def voice_gen_get( voice, gen: )
|
112
|
+
ret = C.fluid_voice_gen_get(voice,gen)
|
113
|
+
ret
|
114
|
+
end
|
115
|
+
def voice_gen_incr( voice, i: , val: )
|
116
|
+
ret = C.fluid_voice_gen_get(voice, i, val)
|
117
|
+
ret
|
118
|
+
end
|
119
|
+
def voice_gen_set( voice, i: , val: )
|
120
|
+
ret = C.fluid_voice_gen_get(voice,i,val)
|
121
|
+
ret
|
122
|
+
end
|
123
|
+
|
124
|
+
def voice_get_actual_key( voice )
|
125
|
+
ret = C.fluid_voice_get_actual_key(voice)
|
126
|
+
ret
|
127
|
+
end
|
128
|
+
def voice_get_actual_velocity( voice )
|
129
|
+
ret = C.fluid_voice_get_actual_velocity(voice)
|
130
|
+
ret
|
131
|
+
end
|
132
|
+
def voice_get_channel( voice )
|
133
|
+
ret = C.fluid_voice_get_channel(voice)
|
134
|
+
ret
|
135
|
+
end
|
136
|
+
def voice_get_id( voice )
|
137
|
+
ret = C.fluid_voice_get_id(voice)
|
138
|
+
ret
|
139
|
+
end
|
140
|
+
def voice_get_key( voice )
|
141
|
+
ret = C.fluid_voice_get_key(voice)
|
142
|
+
ret
|
143
|
+
end
|
144
|
+
def voice_get_velocity( voice )
|
145
|
+
ret = C.fluid_voice_get_velocity(voice)
|
146
|
+
ret
|
147
|
+
end
|
148
|
+
|
149
|
+
#
|
150
|
+
def voice_is_on( voice )
|
151
|
+
ret = C.fluid_voice_is_on(voice)
|
152
|
+
ret
|
153
|
+
end
|
154
|
+
def voice_is_playing( voice )
|
155
|
+
ret = C.fluid_voice_is_playing(voice)
|
156
|
+
ret
|
157
|
+
end
|
158
|
+
def voice_is_sostenuto( voice )
|
159
|
+
ret = C.fluid_voice_is_sostenuto(voice)
|
160
|
+
ret
|
161
|
+
end
|
162
|
+
def voice_is_sustained( voice )
|
163
|
+
ret = C.fluid_voice_is_sustained(voice)
|
164
|
+
ret
|
165
|
+
end
|
166
|
+
def voice_optimize_sample( voice )
|
167
|
+
ret = C.fluid_voice_optimize_sample(voice)
|
168
|
+
ret
|
169
|
+
end
|
170
|
+
def voice_update_param( voice, gen: )
|
171
|
+
ret = C.fluid_voice_update_param(voice, gen)
|
172
|
+
ret
|
173
|
+
end
|
174
|
+
|
175
|
+
end
|
176
|
+
|
177
|
+
|
178
|
+
#### endof filename: fiddle-fluidstynth/soundfonts/voices.rb
|
@@ -0,0 +1,11 @@
|
|
1
|
+
#
|
2
|
+
# filename: fiddle-fluidsynth/soundfonts.rb
|
3
|
+
#
|
4
|
+
require_relative "./soundfonts/soundfonts"
|
5
|
+
|
6
|
+
require_relative "./soundfonts/generators"
|
7
|
+
require_relative "./soundfonts/loader"
|
8
|
+
require_relative "./soundfonts/modulators"
|
9
|
+
require_relative "./soundfonts/voices"
|
10
|
+
|
11
|
+
####
|
@@ -0,0 +1,100 @@
|
|
1
|
+
#
|
2
|
+
# filename: synth/audio_rendering.rb
|
3
|
+
#
|
4
|
+
|
5
|
+
|
6
|
+
# References
|
7
|
+
# - fluidstynth.org, [API Reference](https://www.fluidsynth.org/api/modules.html)
|
8
|
+
#
|
9
|
+
class FiddleFluidSynth
|
10
|
+
|
11
|
+
#
|
12
|
+
module C
|
13
|
+
|
14
|
+
# The functions in this section can be used to render audio directly
|
15
|
+
# to memory buffers.
|
16
|
+
# ==== References
|
17
|
+
# - API Reference, Synthesizer/[Audio Rendering](https://www.fluidsynth.org/api/group__audio__rendering.html)
|
18
|
+
# - [library fiddle](https://docs.ruby-lang.org/ja/latest/library/fiddle.html)
|
19
|
+
#
|
20
|
+
|
21
|
+
# Lifecycle Functions.
|
22
|
+
#
|
23
|
+
#
|
24
|
+
|
25
|
+
|
26
|
+
# Functions.
|
27
|
+
#
|
28
|
+
#
|
29
|
+
|
30
|
+
# Synthesize a block of floating point audio to separate audio buffers
|
31
|
+
# (multi-channel rendering).
|
32
|
+
# FIXME. float**
|
33
|
+
extern 'int fluid_synth_nwrite_float' +
|
34
|
+
'(fluid_synth_t*, int, void*, void*, void*, void*)'
|
35
|
+
|
36
|
+
# Synthesize floating point audio to stereo audio channels (implements
|
37
|
+
# the default interface fluid_audio_func_t).
|
38
|
+
extern 'int fluid_synth_process' +
|
39
|
+
'(fluid_synth_t*, int, int, void*, int, void*)'
|
40
|
+
|
41
|
+
# Synthesize a block of floating point audio samples to audio buffers.
|
42
|
+
extern 'int fluid_synth_write_float' +
|
43
|
+
'(fluid_synth_t*, int, void*, int, int, void*, int, int)'
|
44
|
+
|
45
|
+
# Synthesize a block of 16 bit audio samples to audio buffers.
|
46
|
+
extern 'int fluid_synth_write_s16' +
|
47
|
+
'(fluid_synth_t*, int, void*, int, int, void*, int, int)'
|
48
|
+
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
|
53
|
+
# Lifecycle Functions.
|
54
|
+
#
|
55
|
+
#
|
56
|
+
|
57
|
+
|
58
|
+
# Functions.
|
59
|
+
#
|
60
|
+
#
|
61
|
+
class FiddleFluidSynth
|
62
|
+
|
63
|
+
#
|
64
|
+
def synth_nwrite_float( synth=self.synth,
|
65
|
+
len: , left: , right: , fx_left: , fx_right: )
|
66
|
+
deprecated_msg_instead('fluid_synth_process()', meth: __method__)
|
67
|
+
|
68
|
+
ret = C.fluid_synth_nwrite_float(
|
69
|
+
synth, len, left,right, fx_left,fx_right)
|
70
|
+
ret
|
71
|
+
end
|
72
|
+
|
73
|
+
def synth_process( synth=self.synth,
|
74
|
+
len: , nfx: , fx: , nout: , outbuf: )
|
75
|
+
ret = C.fluid_synth_process(
|
76
|
+
synth, len, nfx,fx, nout,outbuf)
|
77
|
+
ret
|
78
|
+
end
|
79
|
+
|
80
|
+
def synth_write_float( synth=self.synth,
|
81
|
+
len: , lout: , loff: , lincr: ,
|
82
|
+
rout: , roff: , rincr: )
|
83
|
+
ret = C.fluid_synth_write_float(
|
84
|
+
synth, len, lout,loff,lincr, rout,roff,rincr )
|
85
|
+
ret
|
86
|
+
end
|
87
|
+
|
88
|
+
def synth_write_s16( synth=self.synth,
|
89
|
+
len: , lout: , loff: , lincr: ,
|
90
|
+
rout: , roff: , rincr: )
|
91
|
+
ret = C.fluid_synth_write_s16(
|
92
|
+
synth, len, lout,loff,lincr, rout,roff,rincr)
|
93
|
+
ret
|
94
|
+
end
|
95
|
+
|
96
|
+
|
97
|
+
end
|
98
|
+
|
99
|
+
|
100
|
+
#### endof filename: synth/rendering.rb
|