beeps 0.1.32 → 0.1.34
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.doc/ext/beeps/adsr.cpp +139 -0
- data/.doc/ext/beeps/analyser.cpp +128 -0
- data/.doc/ext/beeps/beeps.cpp +9 -1
- data/.doc/ext/beeps/file_in.cpp +55 -9
- data/.doc/ext/beeps/gain.cpp +64 -0
- data/.doc/ext/beeps/mic_in.cpp +83 -0
- data/.doc/ext/beeps/native.cpp +20 -8
- data/.doc/ext/beeps/oscillator.cpp +88 -0
- data/.doc/ext/beeps/pitch_shift.cpp +64 -0
- data/.doc/ext/beeps/processor.cpp +31 -2
- data/.doc/ext/beeps/sound.cpp +90 -7
- data/.doc/ext/beeps/sound_player.cpp +156 -0
- data/.doc/ext/beeps/time_stretch.cpp +64 -0
- data/.github/workflows/release-gem.yml +4 -1
- data/ChangeLog.md +14 -0
- data/Rakefile +26 -4
- data/VERSION +1 -1
- data/beeps.gemspec +2 -2
- data/ext/beeps/adsr.cpp +150 -0
- data/ext/beeps/analyser.cpp +134 -0
- data/ext/beeps/beeps.cpp +10 -1
- data/ext/beeps/extconf.rb +1 -2
- data/ext/beeps/file_in.cpp +60 -9
- data/ext/beeps/gain.cpp +67 -0
- data/ext/beeps/mic_in.cpp +88 -0
- data/ext/beeps/native.cpp +20 -8
- data/ext/beeps/oscillator.cpp +93 -0
- data/ext/beeps/pitch_shift.cpp +67 -0
- data/ext/beeps/processor.cpp +34 -2
- data/ext/beeps/sound.cpp +99 -7
- data/ext/beeps/sound_player.cpp +169 -0
- data/ext/beeps/time_stretch.cpp +67 -0
- data/include/beeps/beeps.h +2 -1
- data/include/beeps/filter.h +179 -0
- data/include/beeps/generator.h +120 -0
- data/include/beeps/processor.h +37 -68
- data/include/beeps/ruby/filter.h +78 -0
- data/include/beeps/ruby/generator.h +60 -0
- data/include/beeps/ruby/processor.h +5 -45
- data/include/beeps/ruby/sound.h +14 -3
- data/include/beeps/signals.h +10 -4
- data/include/beeps/sound.h +67 -2
- data/lib/beeps/beeps.rb +6 -1
- data/lib/beeps/processor.rb +95 -15
- data/lib/beeps/sound.rb +29 -2
- data/src/adsr.cpp +245 -0
- data/src/analyser.cpp +254 -0
- data/src/beeps.cpp +14 -2
- data/src/file_in.cpp +94 -0
- data/src/gain.cpp +55 -0
- data/src/mic_in.cpp +271 -0
- data/src/mic_in.h +22 -0
- data/src/openal.cpp +1 -2
- data/src/oscillator.cpp +145 -0
- data/src/osx/signals.mm +83 -0
- data/src/pitch_shift.cpp +82 -0
- data/src/processor.cpp +202 -88
- data/src/processor.h +98 -0
- data/src/signals.cpp +326 -20
- data/src/signals.h +192 -2
- data/src/sound.cpp +735 -113
- data/src/sound.h +6 -1
- data/src/time_stretch.cpp +91 -0
- data/test/helper.rb +2 -1
- data/test/test_beeps.rb +10 -7
- data/test/test_beeps_init.rb +18 -0
- data/test/test_file_in.rb +15 -0
- data/test/test_processor.rb +50 -0
- data/test/test_sound.rb +87 -11
- data/test/test_sound_player.rb +134 -0
- metadata +54 -16
- data/.doc/ext/beeps/sawtooth_wave.cpp +0 -61
- data/.doc/ext/beeps/sine_wave.cpp +0 -61
- data/.doc/ext/beeps/square_wave.cpp +0 -61
- data/ext/beeps/sawtooth_wave.cpp +0 -64
- data/ext/beeps/sine_wave.cpp +0 -64
- data/ext/beeps/square_wave.cpp +0 -64
@@ -0,0 +1,64 @@
|
|
1
|
+
#include "beeps/ruby/filter.h"
|
2
|
+
|
3
|
+
|
4
|
+
#include "beeps/ruby/processor.h"
|
5
|
+
#include "defs.h"
|
6
|
+
|
7
|
+
|
8
|
+
RUCY_DEFINE_WRAPPER_VALUE_FROM_TO(Beeps::PitchShift)
|
9
|
+
|
10
|
+
#define THIS to<Beeps::PitchShift*>(self)
|
11
|
+
|
12
|
+
#define CHECK RUCY_CHECK_OBJ(Beeps::PitchShift, self)
|
13
|
+
|
14
|
+
|
15
|
+
static
|
16
|
+
VALUE alloc(VALUE klass)
|
17
|
+
{
|
18
|
+
return value(new Beeps::RubyProcessor<Beeps::PitchShift>, klass);
|
19
|
+
}
|
20
|
+
|
21
|
+
static
|
22
|
+
VALUE set_shift(VALUE self, VALUE shift)
|
23
|
+
{
|
24
|
+
CHECK;
|
25
|
+
|
26
|
+
THIS->set_shift(to<float>(shift));
|
27
|
+
return shift;
|
28
|
+
}
|
29
|
+
|
30
|
+
static
|
31
|
+
VALUE get_shift(VALUE self)
|
32
|
+
{
|
33
|
+
CHECK;
|
34
|
+
|
35
|
+
return value(THIS->shift());
|
36
|
+
}
|
37
|
+
|
38
|
+
|
39
|
+
static Class cPitchShift;
|
40
|
+
|
41
|
+
void
|
42
|
+
Init_beeps_pitch_shift ()
|
43
|
+
{
|
44
|
+
Module mBeeps = rb_define_module("Beeps");
|
45
|
+
|
46
|
+
cPitchShift = mBeeps.define_class("PitchShift", Beeps::processor_class());
|
47
|
+
rb_define_alloc_func(cPitchShift, alloc);
|
48
|
+
rb_define_method(cPitchShift, "shift=", RUBY_METHOD_FUNC(set_shift), 1);
|
49
|
+
rb_define_method(cPitchShift, "shift", RUBY_METHOD_FUNC(get_shift), 0);
|
50
|
+
}
|
51
|
+
|
52
|
+
|
53
|
+
namespace Beeps
|
54
|
+
{
|
55
|
+
|
56
|
+
|
57
|
+
Class
|
58
|
+
pitch_shift_class ()
|
59
|
+
{
|
60
|
+
return cPitchShift;
|
61
|
+
}
|
62
|
+
|
63
|
+
|
64
|
+
}// Beeps
|
@@ -5,11 +5,11 @@
|
|
5
5
|
#include "defs.h"
|
6
6
|
|
7
7
|
|
8
|
-
|
8
|
+
RUCY_DEFINE_WRAPPER_VALUE_FROM_TO(Beeps::Processor)
|
9
9
|
|
10
10
|
#define THIS to<Beeps::Processor*>(self)
|
11
11
|
|
12
|
-
#define CHECK
|
12
|
+
#define CHECK RUCY_CHECK_OBJ(Beeps::Processor, self)
|
13
13
|
|
14
14
|
|
15
15
|
static
|
@@ -18,6 +18,32 @@ VALUE alloc(VALUE klass)
|
|
18
18
|
Beeps::beeps_error(__FILE__, __LINE__);
|
19
19
|
}
|
20
20
|
|
21
|
+
static
|
22
|
+
VALUE reset(VALUE self)
|
23
|
+
{
|
24
|
+
CHECK;
|
25
|
+
|
26
|
+
THIS->reset();
|
27
|
+
return self;
|
28
|
+
}
|
29
|
+
|
30
|
+
static
|
31
|
+
VALUE set_input(VALUE self, VALUE input)
|
32
|
+
{
|
33
|
+
CHECK;
|
34
|
+
|
35
|
+
THIS->set_input(input ? to<Beeps::Processor*>(input) : NULL);
|
36
|
+
return input;
|
37
|
+
}
|
38
|
+
|
39
|
+
static
|
40
|
+
VALUE get_input(VALUE self)
|
41
|
+
{
|
42
|
+
CHECK;
|
43
|
+
|
44
|
+
return value(THIS->input());
|
45
|
+
}
|
46
|
+
|
21
47
|
|
22
48
|
static Class cProcessor;
|
23
49
|
|
@@ -28,6 +54,9 @@ Init_beeps_processor ()
|
|
28
54
|
|
29
55
|
cProcessor = rb_define_class_under(mBeeps, "Processor", rb_cObject);
|
30
56
|
rb_define_alloc_func(cProcessor, alloc);
|
57
|
+
rb_define_method(cProcessor, "reset", RUBY_METHOD_FUNC(reset), 0);
|
58
|
+
rb_define_method(cProcessor, "input=", RUBY_METHOD_FUNC(set_input), 1);
|
59
|
+
rb_define_method(cProcessor, "input", RUBY_METHOD_FUNC(get_input), 0);
|
31
60
|
}
|
32
61
|
|
33
62
|
|
data/.doc/ext/beeps/sound.cpp
CHANGED
@@ -8,7 +8,7 @@ RUCY_DEFINE_VALUE_FROM_TO(Beeps::Sound)
|
|
8
8
|
|
9
9
|
#define THIS to<Beeps::Sound*>(self)
|
10
10
|
|
11
|
-
#define CHECK
|
11
|
+
#define CHECK RUCY_CHECK_OBJ(Beeps::Sound, self)
|
12
12
|
|
13
13
|
|
14
14
|
static
|
@@ -18,11 +18,13 @@ VALUE alloc(VALUE klass)
|
|
18
18
|
}
|
19
19
|
|
20
20
|
static
|
21
|
-
VALUE
|
21
|
+
VALUE setup(VALUE self, VALUE processor, VALUE seconds, VALUE nchannels, VALUE sample_rate)
|
22
22
|
{
|
23
|
-
|
23
|
+
CHECK;
|
24
24
|
|
25
|
-
*THIS = Beeps::Sound(
|
25
|
+
*THIS = Beeps::Sound(
|
26
|
+
to<Beeps::Processor*>(processor),
|
27
|
+
to<float>(seconds), to<uint>(nchannels), to<double>(sample_rate));
|
26
28
|
return self;
|
27
29
|
}
|
28
30
|
|
@@ -31,10 +33,82 @@ VALUE play(VALUE self)
|
|
31
33
|
{
|
32
34
|
CHECK;
|
33
35
|
|
34
|
-
THIS->play();
|
36
|
+
return value(THIS->play());
|
37
|
+
}
|
38
|
+
|
39
|
+
static
|
40
|
+
VALUE save(VALUE self, VALUE path)
|
41
|
+
{
|
42
|
+
CHECK;
|
43
|
+
|
44
|
+
THIS->save(path.c_str());
|
35
45
|
return self;
|
36
46
|
}
|
37
47
|
|
48
|
+
static
|
49
|
+
VALUE get_sample_rate(VALUE self)
|
50
|
+
{
|
51
|
+
CHECK;
|
52
|
+
|
53
|
+
return value(THIS->sample_rate());
|
54
|
+
}
|
55
|
+
|
56
|
+
static
|
57
|
+
VALUE get_nchannels(VALUE self)
|
58
|
+
{
|
59
|
+
CHECK;
|
60
|
+
|
61
|
+
return value(THIS->nchannels());
|
62
|
+
}
|
63
|
+
|
64
|
+
static
|
65
|
+
VALUE get_seconds(VALUE self)
|
66
|
+
{
|
67
|
+
CHECK;
|
68
|
+
|
69
|
+
return value(THIS->seconds());
|
70
|
+
}
|
71
|
+
|
72
|
+
static
|
73
|
+
VALUE set_gain(VALUE self, VALUE gain)
|
74
|
+
{
|
75
|
+
CHECK;
|
76
|
+
|
77
|
+
THIS->set_gain(to<float>(gain));
|
78
|
+
return gain;
|
79
|
+
}
|
80
|
+
|
81
|
+
static
|
82
|
+
VALUE get_gain(VALUE self)
|
83
|
+
{
|
84
|
+
CHECK;
|
85
|
+
|
86
|
+
return value(THIS->gain());
|
87
|
+
}
|
88
|
+
|
89
|
+
static
|
90
|
+
VALUE set_loop(VALUE self, VALUE loop)
|
91
|
+
{
|
92
|
+
CHECK;
|
93
|
+
|
94
|
+
THIS->set_loop(to<bool>(loop));
|
95
|
+
return loop;
|
96
|
+
}
|
97
|
+
|
98
|
+
static
|
99
|
+
VALUE get_loop(VALUE self)
|
100
|
+
{
|
101
|
+
CHECK;
|
102
|
+
|
103
|
+
return value(THIS->loop());
|
104
|
+
}
|
105
|
+
|
106
|
+
static
|
107
|
+
VALUE load(VALUE self, VALUE path)
|
108
|
+
{
|
109
|
+
return value(Beeps::load_sound(to<const char*>(path)));
|
110
|
+
}
|
111
|
+
|
38
112
|
|
39
113
|
static Class cSound;
|
40
114
|
|
@@ -45,8 +119,17 @@ Init_beeps_sound ()
|
|
45
119
|
|
46
120
|
cSound = rb_define_class_under(mBeeps, "Sound", rb_cObject);
|
47
121
|
rb_define_alloc_func(cSound, alloc);
|
48
|
-
rb_define_private_method(cSound, "
|
49
|
-
|
122
|
+
rb_define_private_method(cSound, "setup", RUBY_METHOD_FUNC(setup), 4);
|
123
|
+
cSound.define_private_method("play!", play);
|
124
|
+
rb_define_method(cSound, "save", RUBY_METHOD_FUNC(save), 1);
|
125
|
+
rb_define_method(cSound, "sample_rate", RUBY_METHOD_FUNC(get_sample_rate), 0);
|
126
|
+
rb_define_method(cSound, "nchannels", RUBY_METHOD_FUNC(get_nchannels), 0);
|
127
|
+
rb_define_method(cSound, "seconds", RUBY_METHOD_FUNC(get_seconds), 0);
|
128
|
+
rb_define_method(cSound, "gain=", RUBY_METHOD_FUNC(set_gain), 1);
|
129
|
+
rb_define_method(cSound, "gain", RUBY_METHOD_FUNC(get_gain), 0);
|
130
|
+
rb_define_method(cSound, "loop=", RUBY_METHOD_FUNC(set_loop), 1);
|
131
|
+
rb_define_method(cSound, "loop", RUBY_METHOD_FUNC(get_loop), 0);
|
132
|
+
rb_define_singleton_method(cSound, "load", RUBY_METHOD_FUNC(load), 1);
|
50
133
|
}
|
51
134
|
|
52
135
|
|
@@ -0,0 +1,156 @@
|
|
1
|
+
#include "beeps/ruby/sound.h"
|
2
|
+
|
3
|
+
|
4
|
+
#include "defs.h"
|
5
|
+
|
6
|
+
|
7
|
+
RUCY_DEFINE_VALUE_FROM_TO(Beeps::SoundPlayer)
|
8
|
+
|
9
|
+
#define THIS to<Beeps::SoundPlayer*>(self)
|
10
|
+
|
11
|
+
#define CHECK RUCY_CHECK_OBJ(Beeps::SoundPlayer, self)
|
12
|
+
|
13
|
+
|
14
|
+
static
|
15
|
+
VALUE alloc(VALUE klass)
|
16
|
+
{
|
17
|
+
return new_type<Beeps::SoundPlayer>(klass);
|
18
|
+
}
|
19
|
+
|
20
|
+
static
|
21
|
+
VALUE play(VALUE self)
|
22
|
+
{
|
23
|
+
CHECK;
|
24
|
+
|
25
|
+
THIS->play();
|
26
|
+
return self;
|
27
|
+
}
|
28
|
+
|
29
|
+
static
|
30
|
+
VALUE pause(VALUE self)
|
31
|
+
{
|
32
|
+
CHECK;
|
33
|
+
|
34
|
+
THIS->pause();
|
35
|
+
return self;
|
36
|
+
}
|
37
|
+
|
38
|
+
static
|
39
|
+
VALUE rewind(VALUE self)
|
40
|
+
{
|
41
|
+
CHECK;
|
42
|
+
|
43
|
+
THIS->rewind();
|
44
|
+
return self;
|
45
|
+
}
|
46
|
+
|
47
|
+
static
|
48
|
+
VALUE stop(VALUE self)
|
49
|
+
{
|
50
|
+
CHECK;
|
51
|
+
|
52
|
+
THIS->stop();
|
53
|
+
return self;
|
54
|
+
}
|
55
|
+
|
56
|
+
static
|
57
|
+
VALUE is_playing(VALUE self)
|
58
|
+
{
|
59
|
+
CHECK;
|
60
|
+
|
61
|
+
return value(THIS->is_playing());
|
62
|
+
}
|
63
|
+
|
64
|
+
static
|
65
|
+
VALUE is_paused(VALUE self)
|
66
|
+
{
|
67
|
+
CHECK;
|
68
|
+
|
69
|
+
return value(THIS->is_paused());
|
70
|
+
}
|
71
|
+
|
72
|
+
static
|
73
|
+
VALUE is_stopped(VALUE self)
|
74
|
+
{
|
75
|
+
CHECK;
|
76
|
+
|
77
|
+
return value(THIS->is_stopped());
|
78
|
+
}
|
79
|
+
|
80
|
+
static
|
81
|
+
VALUE set_gain(VALUE self, VALUE gain)
|
82
|
+
{
|
83
|
+
CHECK;
|
84
|
+
|
85
|
+
THIS->set_gain(to<float>(gain));
|
86
|
+
return gain;
|
87
|
+
}
|
88
|
+
|
89
|
+
static
|
90
|
+
VALUE get_gain(VALUE self)
|
91
|
+
{
|
92
|
+
CHECK;
|
93
|
+
|
94
|
+
return value(THIS->gain());
|
95
|
+
}
|
96
|
+
|
97
|
+
static
|
98
|
+
VALUE set_loop(VALUE self, VALUE loop)
|
99
|
+
{
|
100
|
+
CHECK;
|
101
|
+
|
102
|
+
THIS->set_loop(to<bool>(loop));
|
103
|
+
return loop;
|
104
|
+
}
|
105
|
+
|
106
|
+
static
|
107
|
+
VALUE get_loop(VALUE self)
|
108
|
+
{
|
109
|
+
CHECK;
|
110
|
+
|
111
|
+
return value(THIS->loop());
|
112
|
+
}
|
113
|
+
|
114
|
+
static
|
115
|
+
VALUE stop_all(VALUE self)
|
116
|
+
{
|
117
|
+
Beeps::stop_all_sound_players();
|
118
|
+
}
|
119
|
+
|
120
|
+
|
121
|
+
static Class cSoundPlayer;
|
122
|
+
|
123
|
+
void
|
124
|
+
Init_beeps_sound_player ()
|
125
|
+
{
|
126
|
+
Module mBeeps = rb_define_module("Beeps");
|
127
|
+
|
128
|
+
cSoundPlayer = rb_define_class_under(mBeeps, "SoundPlayer", rb_cObject);
|
129
|
+
rb_define_alloc_func(cSoundPlayer, alloc);
|
130
|
+
rb_define_method(cSoundPlayer, "play", RUBY_METHOD_FUNC(play), 0);
|
131
|
+
rb_define_method(cSoundPlayer, "pause", RUBY_METHOD_FUNC(pause), 0);
|
132
|
+
rb_define_method(cSoundPlayer, "rewind", RUBY_METHOD_FUNC(rewind), 0);
|
133
|
+
rb_define_method(cSoundPlayer, "stop", RUBY_METHOD_FUNC(stop), 0);
|
134
|
+
cSoundPlayer.define_method("playing?", is_playing);
|
135
|
+
cSoundPlayer.define_method("paused?", is_paused);
|
136
|
+
cSoundPlayer.define_method("stopped?", is_stopped);
|
137
|
+
rb_define_method(cSoundPlayer, "gain=", RUBY_METHOD_FUNC(set_gain), 1);
|
138
|
+
rb_define_method(cSoundPlayer, "gain", RUBY_METHOD_FUNC(get_gain), 0);
|
139
|
+
rb_define_method(cSoundPlayer, "loop=", RUBY_METHOD_FUNC(set_loop), 1);
|
140
|
+
rb_define_method(cSoundPlayer, "loop", RUBY_METHOD_FUNC(get_loop), 0);
|
141
|
+
rb_define_singleton_method(cSoundPlayer, "stop_all", RUBY_METHOD_FUNC(stop_all), 0);
|
142
|
+
}
|
143
|
+
|
144
|
+
|
145
|
+
namespace Beeps
|
146
|
+
{
|
147
|
+
|
148
|
+
|
149
|
+
Class
|
150
|
+
sound_player_class ()
|
151
|
+
{
|
152
|
+
return cSoundPlayer;
|
153
|
+
}
|
154
|
+
|
155
|
+
|
156
|
+
}// Beeps
|
@@ -0,0 +1,64 @@
|
|
1
|
+
#include "beeps/ruby/filter.h"
|
2
|
+
|
3
|
+
|
4
|
+
#include "beeps/ruby/processor.h"
|
5
|
+
#include "defs.h"
|
6
|
+
|
7
|
+
|
8
|
+
RUCY_DEFINE_WRAPPER_VALUE_FROM_TO(Beeps::TimeStretch)
|
9
|
+
|
10
|
+
#define THIS to<Beeps::TimeStretch*>(self)
|
11
|
+
|
12
|
+
#define CHECK RUCY_CHECK_OBJ(Beeps::TimeStretch, self)
|
13
|
+
|
14
|
+
|
15
|
+
static
|
16
|
+
VALUE alloc(VALUE klass)
|
17
|
+
{
|
18
|
+
return value(new Beeps::RubyProcessor<Beeps::TimeStretch>, klass);
|
19
|
+
}
|
20
|
+
|
21
|
+
static
|
22
|
+
VALUE set_scale(VALUE self, VALUE scale)
|
23
|
+
{
|
24
|
+
CHECK;
|
25
|
+
|
26
|
+
THIS->set_scale(to<float>(scale));
|
27
|
+
return scale;
|
28
|
+
}
|
29
|
+
|
30
|
+
static
|
31
|
+
VALUE get_scale(VALUE self)
|
32
|
+
{
|
33
|
+
CHECK;
|
34
|
+
|
35
|
+
return value(THIS->scale());
|
36
|
+
}
|
37
|
+
|
38
|
+
|
39
|
+
static Class cTimeStretch;
|
40
|
+
|
41
|
+
void
|
42
|
+
Init_beeps_time_stretch ()
|
43
|
+
{
|
44
|
+
Module mBeeps = rb_define_module("Beeps");
|
45
|
+
|
46
|
+
cTimeStretch = mBeeps.define_class("TimeStretch", Beeps::processor_class());
|
47
|
+
rb_define_alloc_func(cTimeStretch, alloc);
|
48
|
+
rb_define_method(cTimeStretch, "scale=", RUBY_METHOD_FUNC(set_scale), 1);
|
49
|
+
rb_define_method(cTimeStretch, "scale", RUBY_METHOD_FUNC(get_scale), 0);
|
50
|
+
}
|
51
|
+
|
52
|
+
|
53
|
+
namespace Beeps
|
54
|
+
{
|
55
|
+
|
56
|
+
|
57
|
+
Class
|
58
|
+
time_stretch_class ()
|
59
|
+
{
|
60
|
+
return cTimeStretch;
|
61
|
+
}
|
62
|
+
|
63
|
+
|
64
|
+
}// Beeps
|
@@ -20,8 +20,11 @@ jobs:
|
|
20
20
|
- name: setup dependencies
|
21
21
|
run: "ruby -I.github/workflows -rutils -e 'setup_dependencies'"
|
22
22
|
|
23
|
+
- name: install gems
|
24
|
+
run: gem install yard
|
25
|
+
|
23
26
|
- name: test
|
24
|
-
run: rake test
|
27
|
+
run: rake quiet test
|
25
28
|
|
26
29
|
- name: create gem
|
27
30
|
id: gem
|
data/ChangeLog.md
CHANGED
@@ -1,6 +1,20 @@
|
|
1
1
|
# beeps ChangeLog
|
2
2
|
|
3
3
|
|
4
|
+
## [v0.1.34] - 2023-04-25
|
5
|
+
|
6
|
+
- Clear mic streams on exit
|
7
|
+
- Fix compile errors on assert lines
|
8
|
+
|
9
|
+
|
10
|
+
## [v0.1.33] - 2023-04-22
|
11
|
+
|
12
|
+
- Stream playback is now supported.
|
13
|
+
- Pause, resume, and stop after playback, as well as methods to check the status of the playback.
|
14
|
+
- Support for saving and loading sound files
|
15
|
+
- Added Oscillator, MicIn, Gain, ADSR, TimeStretch, PitchShift, and Analyser classes.
|
16
|
+
|
17
|
+
|
4
18
|
## [v0.1.32] - 2023-03-01
|
5
19
|
|
6
20
|
- fix bugs
|
data/Rakefile
CHANGED
@@ -13,14 +13,36 @@ require 'beeps/extension'
|
|
13
13
|
|
14
14
|
|
15
15
|
EXTENSIONS = [Xot, Rucy, Beeps]
|
16
|
-
TESTS_ALONE = ['test/
|
16
|
+
TESTS_ALONE = ['test/test_beeps_init.rb']
|
17
17
|
|
18
18
|
use_external_library 'https://github.com/thestk/stk',
|
19
|
-
tag: '
|
20
|
-
|
21
|
-
|
19
|
+
tag: '4.6.2',
|
20
|
+
incdirs: 'include',
|
21
|
+
srcdirs: 'src',
|
22
22
|
excludes: %w[stk/src/include Tcp Udp Socket Thread Mutex InetWv /Rt]
|
23
23
|
|
24
|
+
use_external_library 'https://github.com/adamstark/AudioFile',
|
25
|
+
tag: '1.1.1',
|
26
|
+
srcdirs: 'NOSRC',
|
27
|
+
excludes: %w[examples/ tests/]
|
28
|
+
|
29
|
+
use_external_library 'https://github.com/avaneev/r8brain-free-src',
|
30
|
+
tag: 'version-6.2',
|
31
|
+
excludes: %w[DLL/ bench/ other/ pffft_double example.cpp],
|
32
|
+
&proc {
|
33
|
+
filter_file('r8bconf.h') do |conf|
|
34
|
+
<<~EOS + conf
|
35
|
+
#ifndef R8B_PFFFT
|
36
|
+
#define R8B_PFFFT 1
|
37
|
+
#endif
|
38
|
+
EOS
|
39
|
+
end
|
40
|
+
}
|
41
|
+
|
42
|
+
use_external_library 'https://github.com/Signalsmith-Audio/signalsmith-stretch',
|
43
|
+
commit: 'fddcdb628f326ef187b7e5694f285f35a528aba3',
|
44
|
+
srcdirs: 'NOSRC'
|
45
|
+
|
24
46
|
default_tasks :ext
|
25
47
|
build_native_library
|
26
48
|
build_ruby_extension
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.34
|
data/beeps.gemspec
CHANGED
@@ -28,8 +28,8 @@ Gem::Specification.new do |s|
|
|
28
28
|
s.platform = Gem::Platform::RUBY
|
29
29
|
s.required_ruby_version = '>= 2.7.0'
|
30
30
|
|
31
|
-
s.add_runtime_dependency 'xot', '~> 0.1.
|
32
|
-
s.add_runtime_dependency 'rucy', '~> 0.1.
|
31
|
+
s.add_runtime_dependency 'xot', '~> 0.1.33'
|
32
|
+
s.add_runtime_dependency 'rucy', '~> 0.1.33'
|
33
33
|
|
34
34
|
s.add_development_dependency 'rake'
|
35
35
|
s.add_development_dependency 'test-unit'
|
data/ext/beeps/adsr.cpp
ADDED
@@ -0,0 +1,150 @@
|
|
1
|
+
#include "beeps/ruby/filter.h"
|
2
|
+
|
3
|
+
|
4
|
+
#include "beeps/ruby/processor.h"
|
5
|
+
#include "defs.h"
|
6
|
+
|
7
|
+
|
8
|
+
RUCY_DEFINE_WRAPPER_VALUE_FROM_TO(Beeps::ADSR)
|
9
|
+
|
10
|
+
#define THIS to<Beeps::ADSR*>(self)
|
11
|
+
|
12
|
+
#define CHECK RUCY_CHECK_OBJ(Beeps::ADSR, self)
|
13
|
+
|
14
|
+
|
15
|
+
static
|
16
|
+
RUCY_DEF_ALLOC(alloc, klass)
|
17
|
+
{
|
18
|
+
return value(new Beeps::RubyProcessor<Beeps::ADSR>, klass);
|
19
|
+
}
|
20
|
+
RUCY_END
|
21
|
+
|
22
|
+
static
|
23
|
+
RUCY_DEF1(note_on, delay)
|
24
|
+
{
|
25
|
+
CHECK;
|
26
|
+
|
27
|
+
THIS->note_on(to<float>(delay));
|
28
|
+
}
|
29
|
+
RUCY_END
|
30
|
+
|
31
|
+
static
|
32
|
+
RUCY_DEF1(note_off, delay)
|
33
|
+
{
|
34
|
+
CHECK;
|
35
|
+
|
36
|
+
THIS->note_off(to<float>(delay));
|
37
|
+
}
|
38
|
+
RUCY_END
|
39
|
+
|
40
|
+
static
|
41
|
+
RUCY_DEF1(set_attack_time, time)
|
42
|
+
{
|
43
|
+
CHECK;
|
44
|
+
|
45
|
+
THIS->set_attack_time(to<float>(time));
|
46
|
+
return time;
|
47
|
+
}
|
48
|
+
RUCY_END
|
49
|
+
|
50
|
+
static
|
51
|
+
RUCY_DEF0(get_attack_time)
|
52
|
+
{
|
53
|
+
CHECK;
|
54
|
+
|
55
|
+
return value(THIS->attack_time());
|
56
|
+
}
|
57
|
+
RUCY_END
|
58
|
+
|
59
|
+
static
|
60
|
+
RUCY_DEF1(set_decay_time, time)
|
61
|
+
{
|
62
|
+
CHECK;
|
63
|
+
|
64
|
+
THIS->set_decay_time(to<float>(time));
|
65
|
+
return time;
|
66
|
+
}
|
67
|
+
RUCY_END
|
68
|
+
|
69
|
+
static
|
70
|
+
RUCY_DEF0(get_decay_time)
|
71
|
+
{
|
72
|
+
CHECK;
|
73
|
+
|
74
|
+
return value(THIS->decay_time());
|
75
|
+
}
|
76
|
+
RUCY_END
|
77
|
+
|
78
|
+
static
|
79
|
+
RUCY_DEF1(set_sustain_level, level)
|
80
|
+
{
|
81
|
+
CHECK;
|
82
|
+
|
83
|
+
THIS->set_sustain_level(to<float>(level));
|
84
|
+
return level;
|
85
|
+
}
|
86
|
+
RUCY_END
|
87
|
+
|
88
|
+
static
|
89
|
+
RUCY_DEF0(get_sustain_level)
|
90
|
+
{
|
91
|
+
CHECK;
|
92
|
+
|
93
|
+
return value(THIS->sustain_level());
|
94
|
+
}
|
95
|
+
RUCY_END
|
96
|
+
|
97
|
+
static
|
98
|
+
RUCY_DEF1(set_release_time, time)
|
99
|
+
{
|
100
|
+
CHECK;
|
101
|
+
|
102
|
+
THIS->set_release_time(to<float>(time));
|
103
|
+
return time;
|
104
|
+
}
|
105
|
+
RUCY_END
|
106
|
+
|
107
|
+
static
|
108
|
+
RUCY_DEF0(get_release_time)
|
109
|
+
{
|
110
|
+
CHECK;
|
111
|
+
|
112
|
+
return value(THIS->release_time());
|
113
|
+
}
|
114
|
+
RUCY_END
|
115
|
+
|
116
|
+
|
117
|
+
static Class cADSR;
|
118
|
+
|
119
|
+
void
|
120
|
+
Init_beeps_adsr ()
|
121
|
+
{
|
122
|
+
Module mBeeps = define_module("Beeps");
|
123
|
+
|
124
|
+
cADSR = mBeeps.define_class("ADSR", Beeps::processor_class());
|
125
|
+
cADSR.define_alloc_func(alloc);
|
126
|
+
cADSR.define_private_method("note_on!", note_on);
|
127
|
+
cADSR.define_private_method("note_off!", note_off);
|
128
|
+
cADSR.define_method( "attack_time=", set_attack_time);
|
129
|
+
cADSR.define_method( "attack_time", get_attack_time);
|
130
|
+
cADSR.define_method( "decay_time=", set_decay_time);
|
131
|
+
cADSR.define_method( "decay_time", get_decay_time);
|
132
|
+
cADSR.define_method("sustain_level=", set_sustain_level);
|
133
|
+
cADSR.define_method("sustain_level", get_sustain_level);
|
134
|
+
cADSR.define_method("release_time=", set_release_time);
|
135
|
+
cADSR.define_method("release_time", get_release_time);
|
136
|
+
}
|
137
|
+
|
138
|
+
|
139
|
+
namespace Beeps
|
140
|
+
{
|
141
|
+
|
142
|
+
|
143
|
+
Class
|
144
|
+
adsr_class ()
|
145
|
+
{
|
146
|
+
return cADSR;
|
147
|
+
}
|
148
|
+
|
149
|
+
|
150
|
+
}// Beeps
|