fake-bpy-module 20240417__py3-none-any.whl → 20240419__py3-none-any.whl
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.
Potentially problematic release.
This version of fake-bpy-module might be problematic. Click here for more details.
- _bpy_internal/__init__.pyi +4 -0
- _bpy_internal/freedesktop/__init__.pyi +88 -0
- _bpy_internal/freedesktop/py.typed +0 -0
- _bpy_internal/py.typed +0 -0
- aud/__init__.pyi +121 -48
- bgl/__init__.pyi +2443 -1265
- bl_math/__init__.pyi +19 -3
- bl_operators/geometry_nodes/__init__.pyi +13 -0
- bl_ui/properties_data_light/__init__.pyi +337 -0
- blf/__init__.pyi +63 -13
- bmesh/__init__.pyi +13 -0
- bmesh/geometry/__init__.pyi +5 -0
- bmesh/ops/__init__.pyi +157 -68
- bmesh/types/__init__.pyi +109 -62
- bmesh/utils/__init__.pyi +11 -2
- bpy/__init__.pyi +7 -0
- bpy/app/__init__.pyi +13 -0
- bpy/app/handlers/__init__.pyi +41 -0
- bpy/app/icons/__init__.pyi +4 -2
- bpy/app/timers/__init__.pyi +38 -2
- bpy/app/translations/__init__.pyi +58 -0
- bpy/msgbus/__init__.pyi +46 -0
- bpy/ops/__init__.pyi +151 -0
- bpy/ops/action/__init__.pyi +76 -76
- bpy/ops/anim/__init__.pyi +104 -104
- bpy/ops/armature/__init__.pyi +96 -96
- bpy/ops/asset/__init__.pyi +32 -32
- bpy/ops/boid/__init__.pyi +16 -16
- bpy/ops/brush/__init__.pyi +18 -18
- bpy/ops/buttons/__init__.pyi +12 -12
- bpy/ops/cachefile/__init__.pyi +10 -10
- bpy/ops/camera/__init__.pyi +4 -4
- bpy/ops/clip/__init__.pyi +184 -184
- bpy/ops/cloth/__init__.pyi +2 -2
- bpy/ops/collection/__init__.pyi +18 -18
- bpy/ops/console/__init__.pyi +42 -42
- bpy/ops/constraint/__init__.pyi +36 -36
- bpy/ops/curve/__init__.pyi +102 -102
- bpy/ops/curves/__init__.pyi +54 -54
- bpy/ops/cycles/__init__.pyi +6 -6
- bpy/ops/dpaint/__init__.pyi +10 -10
- bpy/ops/ed/__init__.pyi +24 -24
- bpy/ops/export_anim/__init__.pyi +2 -2
- bpy/ops/export_mesh/__init__.pyi +2 -2
- bpy/ops/export_scene/__init__.pyi +7 -7
- bpy/ops/file/__init__.pyi +80 -80
- bpy/ops/fluid/__init__.pyi +28 -28
- bpy/ops/font/__init__.pyi +46 -46
- bpy/ops/geometry/__init__.pyi +20 -20
- bpy/ops/gizmogroup/__init__.pyi +4 -4
- bpy/ops/gpencil/__init__.pyi +300 -300
- bpy/ops/graph/__init__.pyi +130 -130
- bpy/ops/grease_pencil/__init__.pyi +112 -112
- bpy/ops/image/__init__.pyi +92 -92
- bpy/ops/import_anim/__init__.pyi +2 -2
- bpy/ops/import_curve/__init__.pyi +2 -2
- bpy/ops/import_mesh/__init__.pyi +2 -2
- bpy/ops/import_scene/__init__.pyi +6 -6
- bpy/ops/info/__init__.pyi +14 -14
- bpy/ops/lattice/__init__.pyi +16 -16
- bpy/ops/marker/__init__.pyi +22 -22
- bpy/ops/mask/__init__.pyi +78 -78
- bpy/ops/material/__init__.pyi +6 -6
- bpy/ops/mball/__init__.pyi +16 -16
- bpy/ops/mesh/__init__.pyi +326 -326
- bpy/ops/nla/__init__.pyi +80 -80
- bpy/ops/node/__init__.pyi +202 -202
- bpy/ops/object/__init__.pyi +509 -500
- bpy/ops/outliner/__init__.pyi +138 -138
- bpy/ops/paint/__init__.pyi +104 -104
- bpy/ops/paintcurve/__init__.pyi +16 -16
- bpy/ops/palette/__init__.pyi +14 -14
- bpy/ops/particle/__init__.pyi +72 -72
- bpy/ops/pose/__init__.pyi +78 -78
- bpy/ops/poselib/__init__.pyi +18 -18
- bpy/ops/preferences/__init__.pyi +76 -76
- bpy/ops/ptcache/__init__.pyi +14 -14
- bpy/ops/render/__init__.pyi +24 -24
- bpy/ops/rigidbody/__init__.pyi +26 -26
- bpy/ops/scene/__init__.pyi +78 -78
- bpy/ops/screen/__init__.pyi +78 -78
- bpy/ops/script/__init__.pyi +6 -6
- bpy/ops/sculpt/__init__.pyi +62 -62
- bpy/ops/sculpt_curves/__init__.pyi +8 -8
- bpy/ops/sequencer/__init__.pyi +170 -170
- bpy/ops/sound/__init__.pyi +14 -14
- bpy/ops/spreadsheet/__init__.pyi +8 -8
- bpy/ops/surface/__init__.pyi +12 -12
- bpy/ops/text/__init__.pyi +86 -86
- bpy/ops/text_editor/__init__.pyi +2 -2
- bpy/ops/texture/__init__.pyi +8 -8
- bpy/ops/transform/__init__.pyi +54 -54
- bpy/ops/ui/__init__.pyi +64 -64
- bpy/ops/uilist/__init__.pyi +6 -6
- bpy/ops/uv/__init__.pyi +98 -98
- bpy/ops/view2d/__init__.pyi +28 -28
- bpy/ops/view3d/__init__.pyi +134 -134
- bpy/ops/wm/__init__.pyi +224 -224
- bpy/ops/workspace/__init__.pyi +14 -14
- bpy/ops/world/__init__.pyi +2 -2
- bpy/path/__init__.pyi +6 -0
- bpy/props/__init__.pyi +141 -29
- bpy/types/__init__.pyi +101517 -5027
- bpy/utils/__init__.pyi +18 -3
- bpy/utils/previews/__init__.pyi +15 -0
- bpy/utils/units/__init__.pyi +11 -3
- bpy_extras/__init__.pyi +19 -0
- bpy_extras/asset_utils/__init__.pyi +5 -0
- {fake_bpy_module-20240417.dist-info → fake_bpy_module-20240419.dist-info}/METADATA +1 -1
- {fake_bpy_module-20240417.dist-info → fake_bpy_module-20240419.dist-info}/RECORD +139 -135
- {fake_bpy_module-20240417.dist-info → fake_bpy_module-20240419.dist-info}/top_level.txt +1 -0
- freestyle/__init__.pyi +18 -0
- freestyle/chainingiterators/__init__.pyi +20 -5
- freestyle/functions/__init__.pyi +151 -155
- freestyle/predicates/__init__.pyi +53 -46
- freestyle/shaders/__init__.pyi +91 -32
- freestyle/types/__init__.pyi +362 -120
- freestyle/utils/ContextFunctions/__init__.pyi +32 -7
- freestyle/utils/__init__.pyi +13 -1
- gpu/__init__.pyi +225 -0
- gpu/capabilities/__init__.pyi +37 -15
- gpu/matrix/__init__.pyi +7 -1
- gpu/platform/__init__.pyi +5 -0
- gpu/select/__init__.pyi +5 -0
- gpu/shader/__init__.pyi +77 -0
- gpu/state/__init__.pyi +15 -4
- gpu/texture/__init__.pyi +5 -0
- gpu/types/__init__.pyi +91 -33
- gpu_extras/__init__.pyi +15 -0
- gpu_extras/presets/__init__.pyi +16 -4
- imbuf/__init__.pyi +13 -0
- imbuf/types/__init__.pyi +20 -5
- mathutils/__init__.pyi +349 -227
- mathutils/bvhtree/__init__.pyi +21 -8
- mathutils/geometry/__init__.pyi +23 -9
- mathutils/interpolate/__init__.pyi +5 -0
- mathutils/kdtree/__init__.pyi +19 -5
- mathutils/noise/__init__.pyi +87 -41
- {fake_bpy_module-20240417.dist-info → fake_bpy_module-20240419.dist-info}/WHEEL +0 -0
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import typing
|
|
2
|
+
|
|
3
|
+
GenericType = typing.TypeVar("GenericType")
|
|
4
|
+
|
|
5
|
+
def argparse_create():
|
|
6
|
+
""" """
|
|
7
|
+
|
|
8
|
+
...
|
|
9
|
+
|
|
10
|
+
def call_handle_checked(fn, do_register, all_users):
|
|
11
|
+
""" """
|
|
12
|
+
|
|
13
|
+
...
|
|
14
|
+
|
|
15
|
+
def filepath_ensure_removed(path):
|
|
16
|
+
""" """
|
|
17
|
+
|
|
18
|
+
...
|
|
19
|
+
|
|
20
|
+
def filepath_repr(filepath):
|
|
21
|
+
""" """
|
|
22
|
+
|
|
23
|
+
...
|
|
24
|
+
|
|
25
|
+
def handle_bin(do_register, all_users):
|
|
26
|
+
""" """
|
|
27
|
+
|
|
28
|
+
...
|
|
29
|
+
|
|
30
|
+
def handle_desktop_file(do_register, all_users):
|
|
31
|
+
""" """
|
|
32
|
+
|
|
33
|
+
...
|
|
34
|
+
|
|
35
|
+
def handle_icon(do_register, all_users):
|
|
36
|
+
""" """
|
|
37
|
+
|
|
38
|
+
...
|
|
39
|
+
|
|
40
|
+
def handle_mime_association_default(do_register, all_users):
|
|
41
|
+
""" """
|
|
42
|
+
|
|
43
|
+
...
|
|
44
|
+
|
|
45
|
+
def handle_mime_association_xml(do_register, all_users):
|
|
46
|
+
""" """
|
|
47
|
+
|
|
48
|
+
...
|
|
49
|
+
|
|
50
|
+
def handle_thumbnailer(do_register, all_users):
|
|
51
|
+
""" """
|
|
52
|
+
|
|
53
|
+
...
|
|
54
|
+
|
|
55
|
+
def main():
|
|
56
|
+
""" """
|
|
57
|
+
|
|
58
|
+
...
|
|
59
|
+
|
|
60
|
+
def main_run_as_root(do_register):
|
|
61
|
+
""" """
|
|
62
|
+
|
|
63
|
+
...
|
|
64
|
+
|
|
65
|
+
def path_exists_or_is_link(path):
|
|
66
|
+
""" """
|
|
67
|
+
|
|
68
|
+
...
|
|
69
|
+
|
|
70
|
+
def register(all_users):
|
|
71
|
+
""" """
|
|
72
|
+
|
|
73
|
+
...
|
|
74
|
+
|
|
75
|
+
def register_impl(do_register, all_users):
|
|
76
|
+
""" """
|
|
77
|
+
|
|
78
|
+
...
|
|
79
|
+
|
|
80
|
+
def system_path_contains(dirpath):
|
|
81
|
+
""" """
|
|
82
|
+
|
|
83
|
+
...
|
|
84
|
+
|
|
85
|
+
def unregister(all_users):
|
|
86
|
+
""" """
|
|
87
|
+
|
|
88
|
+
...
|
|
File without changes
|
_bpy_internal/py.typed
ADDED
|
File without changes
|
aud/__init__.pyi
CHANGED
|
@@ -1,3 +1,16 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Audaspace (pronounced "outer space") is a high level audio library.
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
--------------------
|
|
6
|
+
|
|
7
|
+
This script shows how to use the classes: Device, Sound and
|
|
8
|
+
Handle.
|
|
9
|
+
|
|
10
|
+
```../examples/aud.py```
|
|
11
|
+
|
|
12
|
+
"""
|
|
13
|
+
|
|
1
14
|
import typing
|
|
2
15
|
|
|
3
16
|
GenericType = typing.TypeVar("GenericType")
|
|
@@ -46,7 +59,7 @@ The speed of sound in air is typically 343.3 m/s."""
|
|
|
46
59
|
"""
|
|
47
60
|
...
|
|
48
61
|
|
|
49
|
-
def play(self, sound: Sound, keep: bool = False) ->
|
|
62
|
+
def play(self, sound: Sound, keep: bool = False) -> Handle:
|
|
50
63
|
"""Plays a sound.
|
|
51
64
|
|
|
52
65
|
:param sound: The sound to play.
|
|
@@ -90,20 +103,23 @@ class DynamicMusic:
|
|
|
90
103
|
volume: typing.Any
|
|
91
104
|
""" The volume of the scene."""
|
|
92
105
|
|
|
93
|
-
def addScene(self, scene: Sound) ->
|
|
106
|
+
def addScene(self, scene: Sound) -> int:
|
|
94
107
|
"""Adds a new scene.
|
|
95
108
|
|
|
96
109
|
:param scene: The scene sound.
|
|
97
110
|
:type scene: Sound
|
|
98
111
|
:return: The new scene id.
|
|
112
|
+
:rtype: int
|
|
99
113
|
"""
|
|
100
114
|
...
|
|
101
115
|
|
|
102
|
-
def addTransition(self, ini, end, transition: Sound) ->
|
|
116
|
+
def addTransition(self, ini: int, end: int, transition: Sound) -> bool:
|
|
103
117
|
"""Adds a new scene.
|
|
104
118
|
|
|
105
119
|
:param ini: the initial scene foor the transition.
|
|
120
|
+
:type ini: int
|
|
106
121
|
:param end: The final scene for the transition.
|
|
122
|
+
:type end: int
|
|
107
123
|
:param transition: The transition sound.
|
|
108
124
|
:type transition: Sound
|
|
109
125
|
:return: false if the ini or end scenes don't exist, true othrwise.
|
|
@@ -138,7 +154,7 @@ class DynamicMusic:
|
|
|
138
154
|
class HRTF:
|
|
139
155
|
"""An HRTF object represents a set of head related transfer functions as impulse responses. It's used for binaural sound"""
|
|
140
156
|
|
|
141
|
-
def loadLeftHrtfSet(self, extension: typing.Union[str, str], directory):
|
|
157
|
+
def loadLeftHrtfSet(self, extension: typing.Union[str, str], directory) -> HRTF:
|
|
142
158
|
"""Loads all HRTFs from a directory.
|
|
143
159
|
|
|
144
160
|
:param extension: The file extension of the hrtfs.
|
|
@@ -149,7 +165,7 @@ class HRTF:
|
|
|
149
165
|
"""
|
|
150
166
|
...
|
|
151
167
|
|
|
152
|
-
def loadLeftHrtfSet(self, extension: typing.Union[str, str], directory):
|
|
168
|
+
def loadLeftHrtfSet(self, extension: typing.Union[str, str], directory) -> HRTF:
|
|
153
169
|
"""Loads all HRTFs from a directory.
|
|
154
170
|
|
|
155
171
|
:param extension: The file extension of the hrtfs.
|
|
@@ -160,13 +176,17 @@ class HRTF:
|
|
|
160
176
|
"""
|
|
161
177
|
...
|
|
162
178
|
|
|
163
|
-
def addImpulseResponseFromSound(
|
|
179
|
+
def addImpulseResponseFromSound(
|
|
180
|
+
self, sound: Sound, azimuth: float, elevation: float
|
|
181
|
+
) -> bool:
|
|
164
182
|
"""Adds a new hrtf to the HRTF object
|
|
165
183
|
|
|
166
184
|
:param sound: The sound that contains the hrtf.
|
|
167
185
|
:type sound: Sound
|
|
168
186
|
:param azimuth: The azimuth angle of the hrtf.
|
|
187
|
+
:type azimuth: float
|
|
169
188
|
:param elevation: The elevation angle of the hrtf.
|
|
189
|
+
:type elevation: float
|
|
170
190
|
:return: Whether the action succeeded.
|
|
171
191
|
:rtype: bool
|
|
172
192
|
"""
|
|
@@ -233,7 +253,7 @@ This can be used to seek the sound to some position and start playback again."""
|
|
|
233
253
|
volume_minimum: typing.Any
|
|
234
254
|
""" The minimum volume of the source.:attr:`Device.distance_model`"""
|
|
235
255
|
|
|
236
|
-
def pause(self):
|
|
256
|
+
def pause(self) -> bool:
|
|
237
257
|
"""Pauses playback.
|
|
238
258
|
|
|
239
259
|
:return: Whether the action succeeded.
|
|
@@ -265,11 +285,13 @@ class ImpulseResponse:
|
|
|
265
285
|
class PlaybackManager:
|
|
266
286
|
"""A PlabackManager object allows to easily control groups os sounds organized in categories."""
|
|
267
287
|
|
|
268
|
-
def addCategory(self, volume):
|
|
288
|
+
def addCategory(self, volume: float) -> int:
|
|
269
289
|
"""Adds a category with a custom volume.
|
|
270
290
|
|
|
271
291
|
:param volume: The volume for ther new category.
|
|
292
|
+
:type volume: float
|
|
272
293
|
:return: The key of the new category.
|
|
294
|
+
:rtype: int
|
|
273
295
|
"""
|
|
274
296
|
...
|
|
275
297
|
|
|
@@ -277,57 +299,66 @@ class PlaybackManager:
|
|
|
277
299
|
"""Cleans all the invalid and finished sound from the playback manager."""
|
|
278
300
|
...
|
|
279
301
|
|
|
280
|
-
def getVolume(self, catKey):
|
|
302
|
+
def getVolume(self, catKey: int) -> float:
|
|
281
303
|
"""Retrieves the volume of a category.
|
|
282
304
|
|
|
283
305
|
:param catKey: the key of the category.
|
|
306
|
+
:type catKey: int
|
|
284
307
|
:return: The volume of the cateogry.
|
|
308
|
+
:rtype: float
|
|
285
309
|
"""
|
|
286
310
|
...
|
|
287
311
|
|
|
288
|
-
def pause(self, catKey):
|
|
312
|
+
def pause(self, catKey: int) -> bool:
|
|
289
313
|
"""Pauses playback of the category.
|
|
290
314
|
|
|
291
315
|
:param catKey: the key of the category.
|
|
316
|
+
:type catKey: int
|
|
292
317
|
:return: Whether the action succeeded.
|
|
293
318
|
:rtype: bool
|
|
294
319
|
"""
|
|
295
320
|
...
|
|
296
321
|
|
|
297
|
-
def play(self, sound: Sound, catKey):
|
|
322
|
+
def play(self, sound: Sound, catKey: int) -> Handle:
|
|
298
323
|
"""Plays a sound through the playback manager and assigns it to a category.
|
|
299
324
|
|
|
300
325
|
:param sound: The sound to play.
|
|
301
326
|
:type sound: Sound
|
|
302
327
|
:param catKey: the key of the category in which the sound will be added,
|
|
303
328
|
if it doesn't exist, a new one will be created.
|
|
329
|
+
:type catKey: int
|
|
304
330
|
:return: The playback handle with which playback can be controlled with.
|
|
305
331
|
:rtype: Handle
|
|
306
332
|
"""
|
|
307
333
|
...
|
|
308
334
|
|
|
309
|
-
def resume(self, catKey):
|
|
335
|
+
def resume(self, catKey: int) -> bool:
|
|
310
336
|
"""Resumes playback of the catgory.
|
|
311
337
|
|
|
312
338
|
:param catKey: the key of the category.
|
|
339
|
+
:type catKey: int
|
|
313
340
|
:return: Whether the action succeeded.
|
|
314
341
|
:rtype: bool
|
|
315
342
|
"""
|
|
316
343
|
...
|
|
317
344
|
|
|
318
|
-
def setVolume(self, volume, catKey):
|
|
345
|
+
def setVolume(self, volume: float, catKey: int) -> int:
|
|
319
346
|
"""Changes the volume of a category.
|
|
320
347
|
|
|
321
348
|
:param volume: the new volume value.
|
|
349
|
+
:type volume: float
|
|
322
350
|
:param catKey: the key of the category.
|
|
351
|
+
:type catKey: int
|
|
323
352
|
:return: Whether the action succeeded.
|
|
353
|
+
:rtype: int
|
|
324
354
|
"""
|
|
325
355
|
...
|
|
326
356
|
|
|
327
|
-
def stop(self, catKey):
|
|
357
|
+
def stop(self, catKey: int) -> bool:
|
|
328
358
|
"""Stops playback of the category.
|
|
329
359
|
|
|
330
360
|
:param catKey: the key of the category.
|
|
361
|
+
:type catKey: int
|
|
331
362
|
:return: Whether the action succeeded.
|
|
332
363
|
:rtype: bool
|
|
333
364
|
"""
|
|
@@ -359,7 +390,7 @@ This factor is a scaling factor for the velocity vectors in doppler calculation.
|
|
|
359
390
|
""" The speed of sound of the sequence.
|
|
360
391
|
The speed of sound in air is typically 343.3 m/s."""
|
|
361
392
|
|
|
362
|
-
def add(self):
|
|
393
|
+
def add(self) -> SequenceEntry:
|
|
363
394
|
"""Adds a new entry to the sequence.
|
|
364
395
|
|
|
365
396
|
:return: The entry added.
|
|
@@ -432,7 +463,7 @@ class Sound:
|
|
|
432
463
|
""" The sample specification of the sound as a tuple with rate and channel count."""
|
|
433
464
|
|
|
434
465
|
@classmethod
|
|
435
|
-
def buffer(cls, data, rate: float) ->
|
|
466
|
+
def buffer(cls, data, rate: float) -> Sound:
|
|
436
467
|
"""Creates a sound from a data buffer.
|
|
437
468
|
|
|
438
469
|
:param data: The data as two dimensional numpy array.
|
|
@@ -444,7 +475,7 @@ class Sound:
|
|
|
444
475
|
...
|
|
445
476
|
|
|
446
477
|
@classmethod
|
|
447
|
-
def file(cls, filename: str) ->
|
|
478
|
+
def file(cls, filename: str) -> Sound:
|
|
448
479
|
"""Creates a sound object of a sound file.
|
|
449
480
|
|
|
450
481
|
:param filename: Path of the file.
|
|
@@ -464,78 +495,93 @@ class Sound:
|
|
|
464
495
|
...
|
|
465
496
|
|
|
466
497
|
@classmethod
|
|
467
|
-
def sawtooth(cls, frequency, rate=48000):
|
|
498
|
+
def sawtooth(cls, frequency: float, rate: int = 48000) -> Sound:
|
|
468
499
|
"""Creates a sawtooth sound which plays a sawtooth wave.
|
|
469
500
|
|
|
470
501
|
:param frequency: The frequency of the sawtooth wave in Hz.
|
|
502
|
+
:type frequency: float
|
|
471
503
|
:param rate: The sampling rate in Hz. It's recommended to set this
|
|
472
504
|
value to the playback device's samling rate to avoid resamping.
|
|
505
|
+
:type rate: int
|
|
473
506
|
:return: The created `Sound` object.
|
|
474
507
|
:rtype: Sound
|
|
475
508
|
"""
|
|
476
509
|
...
|
|
477
510
|
|
|
478
511
|
@classmethod
|
|
479
|
-
def silence(cls, rate=48000):
|
|
512
|
+
def silence(cls, rate: int = 48000) -> Sound:
|
|
480
513
|
"""Creates a silence sound which plays simple silence.
|
|
481
514
|
|
|
482
515
|
:param rate: The sampling rate in Hz. It's recommended to set this
|
|
483
516
|
value to the playback device's samling rate to avoid resamping.
|
|
517
|
+
:type rate: int
|
|
484
518
|
:return: The created `Sound` object.
|
|
485
519
|
:rtype: Sound
|
|
486
520
|
"""
|
|
487
521
|
...
|
|
488
522
|
|
|
489
523
|
@classmethod
|
|
490
|
-
def sine(cls, frequency, rate=48000):
|
|
524
|
+
def sine(cls, frequency: float, rate: int = 48000) -> Sound:
|
|
491
525
|
"""Creates a sine sound which plays a sine wave.
|
|
492
526
|
|
|
493
527
|
:param frequency: The frequency of the sine wave in Hz.
|
|
528
|
+
:type frequency: float
|
|
494
529
|
:param rate: The sampling rate in Hz. It's recommended to set this
|
|
495
530
|
value to the playback device's samling rate to avoid resamping.
|
|
531
|
+
:type rate: int
|
|
496
532
|
:return: The created `Sound` object.
|
|
497
533
|
:rtype: Sound
|
|
498
534
|
"""
|
|
499
535
|
...
|
|
500
536
|
|
|
501
537
|
@classmethod
|
|
502
|
-
def square(cls, frequency, rate=48000):
|
|
538
|
+
def square(cls, frequency: float, rate: int = 48000) -> Sound:
|
|
503
539
|
"""Creates a square sound which plays a square wave.
|
|
504
540
|
|
|
505
541
|
:param frequency: The frequency of the square wave in Hz.
|
|
542
|
+
:type frequency: float
|
|
506
543
|
:param rate: The sampling rate in Hz. It's recommended to set this
|
|
507
544
|
value to the playback device's samling rate to avoid resamping.
|
|
545
|
+
:type rate: int
|
|
508
546
|
:return: The created `Sound` object.
|
|
509
547
|
:rtype: Sound
|
|
510
548
|
"""
|
|
511
549
|
...
|
|
512
550
|
|
|
513
551
|
@classmethod
|
|
514
|
-
def triangle(cls, frequency, rate=48000):
|
|
552
|
+
def triangle(cls, frequency: float, rate: int = 48000) -> Sound:
|
|
515
553
|
"""Creates a triangle sound which plays a triangle wave.
|
|
516
554
|
|
|
517
555
|
:param frequency: The frequency of the triangle wave in Hz.
|
|
556
|
+
:type frequency: float
|
|
518
557
|
:param rate: The sampling rate in Hz. It's recommended to set this
|
|
519
558
|
value to the playback device's samling rate to avoid resamping.
|
|
559
|
+
:type rate: int
|
|
520
560
|
:return: The created `Sound` object.
|
|
521
561
|
:rtype: Sound
|
|
522
562
|
"""
|
|
523
563
|
...
|
|
524
564
|
|
|
525
|
-
def ADSR(
|
|
565
|
+
def ADSR(
|
|
566
|
+
self, attack: float, decay: float, sustain: float, release: float
|
|
567
|
+
) -> Sound:
|
|
526
568
|
"""Attack-Decay-Sustain-Release envelopes the volume of a sound.
|
|
527
569
|
Note: there is currently no way to trigger the release with this API.
|
|
528
570
|
|
|
529
571
|
:param attack: The attack time in seconds.
|
|
572
|
+
:type attack: float
|
|
530
573
|
:param decay: The decay time in seconds.
|
|
574
|
+
:type decay: float
|
|
531
575
|
:param sustain: The sustain level.
|
|
576
|
+
:type sustain: float
|
|
532
577
|
:param release: The release level.
|
|
578
|
+
:type release: float
|
|
533
579
|
:return: The created `Sound` object.
|
|
534
580
|
:rtype: Sound
|
|
535
581
|
"""
|
|
536
582
|
...
|
|
537
583
|
|
|
538
|
-
def accumulate(self, additive=False):
|
|
584
|
+
def accumulate(self, additive=False) -> Sound:
|
|
539
585
|
"""Accumulates a sound by summing over positive input
|
|
540
586
|
differences thus generating a monotonic sigal.
|
|
541
587
|
If additivity is set to true negative input differences get added too,
|
|
@@ -581,59 +627,68 @@ class Sound:
|
|
|
581
627
|
"""
|
|
582
628
|
...
|
|
583
629
|
|
|
584
|
-
def data(self)
|
|
630
|
+
def data(self):
|
|
585
631
|
"""Retrieves the data of the sound as numpy array.
|
|
586
632
|
|
|
587
633
|
:return: A two dimensional numpy float array.
|
|
588
634
|
"""
|
|
589
635
|
...
|
|
590
636
|
|
|
591
|
-
def delay(self, time):
|
|
637
|
+
def delay(self, time: float) -> Sound:
|
|
592
638
|
"""Delays by playing adding silence in front of the other sound's data.
|
|
593
639
|
|
|
594
640
|
:param time: How many seconds of silence should be added before the sound.
|
|
641
|
+
:type time: float
|
|
595
642
|
:return: The created `Sound` object.
|
|
596
643
|
:rtype: Sound
|
|
597
644
|
"""
|
|
598
645
|
...
|
|
599
646
|
|
|
600
|
-
def envelope(
|
|
647
|
+
def envelope(
|
|
648
|
+
self, attack: float, release: float, threshold: float, arthreshold: float
|
|
649
|
+
) -> Sound:
|
|
601
650
|
"""Delays by playing adding silence in front of the other sound's data.
|
|
602
651
|
|
|
603
652
|
:param attack: The attack factor.
|
|
653
|
+
:type attack: float
|
|
604
654
|
:param release: The release factor.
|
|
655
|
+
:type release: float
|
|
605
656
|
:param threshold: The general threshold value.
|
|
657
|
+
:type threshold: float
|
|
606
658
|
:param arthreshold: The attack/release threshold value.
|
|
659
|
+
:type arthreshold: float
|
|
607
660
|
:return: The created `Sound` object.
|
|
608
661
|
:rtype: Sound
|
|
609
662
|
"""
|
|
610
663
|
...
|
|
611
664
|
|
|
612
|
-
def fadein(self, start, length):
|
|
665
|
+
def fadein(self, start: float, length: float) -> Sound:
|
|
613
666
|
"""Fades a sound in by raising the volume linearly in the given
|
|
614
667
|
time interval.
|
|
615
668
|
|
|
616
669
|
:param start: Time in seconds when the fading should start.
|
|
670
|
+
:type start: float
|
|
617
671
|
:param length: Time in seconds how long the fading should last.
|
|
672
|
+
:type length: float
|
|
618
673
|
:return: The created `Sound` object.
|
|
619
674
|
:rtype: Sound
|
|
620
675
|
"""
|
|
621
676
|
...
|
|
622
677
|
|
|
623
|
-
def fadeout(self, start, length):
|
|
678
|
+
def fadeout(self, start: float, length: float) -> Sound:
|
|
624
679
|
"""Fades a sound in by lowering the volume linearly in the given
|
|
625
680
|
time interval.
|
|
626
681
|
|
|
627
682
|
:param start: Time in seconds when the fading should start.
|
|
683
|
+
:type start: float
|
|
628
684
|
:param length: Time in seconds how long the fading should last.
|
|
685
|
+
:type length: float
|
|
629
686
|
:return: The created `Sound` object.
|
|
630
687
|
:rtype: Sound
|
|
631
688
|
"""
|
|
632
689
|
...
|
|
633
690
|
|
|
634
|
-
def filter(
|
|
635
|
-
self, b: typing.List[float], a: typing.List[float] = 1
|
|
636
|
-
) -> typing.List[float]:
|
|
691
|
+
def filter(self, b: typing.List[float], a: typing.List[float] = 1) -> Sound:
|
|
637
692
|
"""Filters a sound with the supplied IIR filter coefficients.
|
|
638
693
|
Without the second parameter you'll get a FIR filter.If the first value of the a sequence is 0,
|
|
639
694
|
it will be set to 1 automatically.
|
|
@@ -650,12 +705,14 @@ class Sound:
|
|
|
650
705
|
"""
|
|
651
706
|
...
|
|
652
707
|
|
|
653
|
-
def highpass(self, frequency, Q=0.5):
|
|
708
|
+
def highpass(self, frequency: float, Q: float = 0.5) -> Sound:
|
|
654
709
|
"""Creates a second order highpass filter based on the transfer
|
|
655
710
|
function H(s) = s^2 / (s^2 + s/Q + 1)
|
|
656
711
|
|
|
657
712
|
:param frequency: The cut off trequency of the highpass.
|
|
713
|
+
:type frequency: float
|
|
658
714
|
:param Q: Q factor of the lowpass.
|
|
715
|
+
:type Q: float
|
|
659
716
|
:return: The created `Sound` object.
|
|
660
717
|
:rtype: Sound
|
|
661
718
|
"""
|
|
@@ -671,17 +728,19 @@ class Sound:
|
|
|
671
728
|
"""
|
|
672
729
|
...
|
|
673
730
|
|
|
674
|
-
def limit(self, start, end):
|
|
731
|
+
def limit(self, start: float, end: float) -> Sound:
|
|
675
732
|
"""Limits a sound within a specific start and end time.
|
|
676
733
|
|
|
677
734
|
:param start: Start time in seconds.
|
|
735
|
+
:type start: float
|
|
678
736
|
:param end: End time in seconds.
|
|
737
|
+
:type end: float
|
|
679
738
|
:return: The created `Sound` object.
|
|
680
739
|
:rtype: Sound
|
|
681
740
|
"""
|
|
682
741
|
...
|
|
683
742
|
|
|
684
|
-
def loop(self, count):
|
|
743
|
+
def loop(self, count) -> Sound:
|
|
685
744
|
"""Loops a sound.
|
|
686
745
|
|
|
687
746
|
:param count: How often the sound should be looped.
|
|
@@ -691,11 +750,13 @@ class Sound:
|
|
|
691
750
|
"""
|
|
692
751
|
...
|
|
693
752
|
|
|
694
|
-
def lowpass(self, frequency, Q=0.5):
|
|
753
|
+
def lowpass(self, frequency: float, Q: float = 0.5) -> Sound:
|
|
695
754
|
"""Creates a second order lowpass filter based on the transfer function H(s) = 1 / (s^2 + s/Q + 1)
|
|
696
755
|
|
|
697
756
|
:param frequency: The cut off trequency of the lowpass.
|
|
757
|
+
:type frequency: float
|
|
698
758
|
:param Q: Q factor of the lowpass.
|
|
759
|
+
:type Q: float
|
|
699
760
|
:return: The created `Sound` object.
|
|
700
761
|
:rtype: Sound
|
|
701
762
|
"""
|
|
@@ -739,30 +800,33 @@ class Sound:
|
|
|
739
800
|
"""
|
|
740
801
|
...
|
|
741
802
|
|
|
742
|
-
def pitch(self, factor):
|
|
803
|
+
def pitch(self, factor: float) -> Sound:
|
|
743
804
|
"""Changes the pitch of a sound with a specific factor.
|
|
744
805
|
|
|
745
806
|
:param factor: The factor to change the pitch with.
|
|
807
|
+
:type factor: float
|
|
746
808
|
:return: The created `Sound` object.
|
|
747
809
|
:rtype: Sound
|
|
748
810
|
"""
|
|
749
811
|
...
|
|
750
812
|
|
|
751
|
-
def rechannel(self, channels):
|
|
813
|
+
def rechannel(self, channels: int) -> Sound:
|
|
752
814
|
"""Rechannels the sound.
|
|
753
815
|
|
|
754
816
|
:param channels: The new channel configuration.
|
|
817
|
+
:type channels: int
|
|
755
818
|
:return: The created `Sound` object.
|
|
756
819
|
:rtype: Sound
|
|
757
820
|
"""
|
|
758
821
|
...
|
|
759
822
|
|
|
760
|
-
def resample(self, rate: float, quality):
|
|
823
|
+
def resample(self, rate: float, quality: int) -> Sound:
|
|
761
824
|
"""Resamples the sound.
|
|
762
825
|
|
|
763
826
|
:param rate: The new sample rate.
|
|
764
827
|
:type rate: float
|
|
765
828
|
:param quality: Resampler performance vs quality choice (0=fastest, 3=slowest).
|
|
829
|
+
:type quality: int
|
|
766
830
|
:return: The created `Sound` object.
|
|
767
831
|
:rtype: Sound
|
|
768
832
|
"""
|
|
@@ -784,22 +848,24 @@ class Sound:
|
|
|
784
848
|
"""
|
|
785
849
|
...
|
|
786
850
|
|
|
787
|
-
def threshold(self, threshold=0):
|
|
851
|
+
def threshold(self, threshold: float = 0) -> Sound:
|
|
788
852
|
"""Makes a threshold wave out of an audio wave by setting all samples
|
|
789
853
|
with a amplitude >= threshold to 1, all <= -threshold to -1 and
|
|
790
854
|
all between to 0.
|
|
791
855
|
|
|
792
856
|
:param threshold: Threshold value over which an amplitude counts
|
|
793
857
|
non-zero.
|
|
858
|
+
:type threshold: float
|
|
794
859
|
:return: The created `Sound` object.
|
|
795
860
|
:rtype: Sound
|
|
796
861
|
"""
|
|
797
862
|
...
|
|
798
863
|
|
|
799
|
-
def volume(self, volume):
|
|
864
|
+
def volume(self, volume: float) -> Sound:
|
|
800
865
|
"""Changes the volume of a sound.
|
|
801
866
|
|
|
802
867
|
:param volume: The new volume..
|
|
868
|
+
:type volume: float
|
|
803
869
|
:return: The created `Sound` object.
|
|
804
870
|
:rtype: Sound
|
|
805
871
|
"""
|
|
@@ -808,25 +874,32 @@ class Sound:
|
|
|
808
874
|
def write(
|
|
809
875
|
self,
|
|
810
876
|
filename: str,
|
|
811
|
-
rate,
|
|
812
|
-
channels,
|
|
813
|
-
format,
|
|
814
|
-
container,
|
|
815
|
-
codec,
|
|
816
|
-
bitrate,
|
|
817
|
-
buffersize,
|
|
877
|
+
rate: int,
|
|
878
|
+
channels: int,
|
|
879
|
+
format: int,
|
|
880
|
+
container: int,
|
|
881
|
+
codec: int,
|
|
882
|
+
bitrate: int,
|
|
883
|
+
buffersize: int,
|
|
818
884
|
):
|
|
819
885
|
"""Writes the sound to a file.
|
|
820
886
|
|
|
821
887
|
:param filename: The path to write to.
|
|
822
888
|
:type filename: str
|
|
823
889
|
:param rate: The sample rate to write with.
|
|
890
|
+
:type rate: int
|
|
824
891
|
:param channels: The number of channels to write with.
|
|
892
|
+
:type channels: int
|
|
825
893
|
:param format: The sample format to write with.
|
|
894
|
+
:type format: int
|
|
826
895
|
:param container: The container format for the file.
|
|
896
|
+
:type container: int
|
|
827
897
|
:param codec: The codec to use in the file.
|
|
898
|
+
:type codec: int
|
|
828
899
|
:param bitrate: The bitrate to write with.
|
|
900
|
+
:type bitrate: int
|
|
829
901
|
:param buffersize: The size of the writing buffer.
|
|
902
|
+
:type buffersize: int
|
|
830
903
|
"""
|
|
831
904
|
...
|
|
832
905
|
|