osc-data 0.1.0__tar.gz
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.
- osc_data-0.1.0/Cargo.lock +307 -0
- osc_data-0.1.0/Cargo.toml +13 -0
- osc_data-0.1.0/PKG-INFO +12 -0
- osc_data-0.1.0/README.md +3 -0
- osc_data-0.1.0/pyproject.toml +24 -0
- osc_data-0.1.0/python/osc_data/__init__.py +1 -0
- osc_data-0.1.0/python/osc_data/audio.py +19 -0
- osc_data-0.1.0/python/osc_data/audio.pyi +9 -0
- osc_data-0.1.0/python/osc_data/py.typed +0 -0
- osc_data-0.1.0/python/osc_data/text.py +0 -0
- osc_data-0.1.0/src/audio.rs +85 -0
- osc_data-0.1.0/src/lib.rs +11 -0
- osc_data-0.1.0/test.ipynb +80 -0
|
@@ -0,0 +1,307 @@
|
|
|
1
|
+
# This file is automatically @generated by Cargo.
|
|
2
|
+
# It is not intended for manual editing.
|
|
3
|
+
version = 3
|
|
4
|
+
|
|
5
|
+
[[package]]
|
|
6
|
+
name = "autocfg"
|
|
7
|
+
version = "1.3.0"
|
|
8
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
9
|
+
checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0"
|
|
10
|
+
|
|
11
|
+
[[package]]
|
|
12
|
+
name = "bitflags"
|
|
13
|
+
version = "2.6.0"
|
|
14
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
15
|
+
checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de"
|
|
16
|
+
|
|
17
|
+
[[package]]
|
|
18
|
+
name = "cfg-if"
|
|
19
|
+
version = "1.0.0"
|
|
20
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
21
|
+
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
|
22
|
+
|
|
23
|
+
[[package]]
|
|
24
|
+
name = "getrandom"
|
|
25
|
+
version = "0.2.15"
|
|
26
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
27
|
+
checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7"
|
|
28
|
+
dependencies = [
|
|
29
|
+
"cfg-if",
|
|
30
|
+
"libc",
|
|
31
|
+
"wasi",
|
|
32
|
+
]
|
|
33
|
+
|
|
34
|
+
[[package]]
|
|
35
|
+
name = "indoc"
|
|
36
|
+
version = "1.0.9"
|
|
37
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
38
|
+
checksum = "bfa799dd5ed20a7e349f3b4639aa80d74549c81716d9ec4f994c9b5815598306"
|
|
39
|
+
|
|
40
|
+
[[package]]
|
|
41
|
+
name = "libc"
|
|
42
|
+
version = "0.2.158"
|
|
43
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
44
|
+
checksum = "d8adc4bb1803a324070e64a98ae98f38934d91957a99cfb3a43dcbc01bc56439"
|
|
45
|
+
|
|
46
|
+
[[package]]
|
|
47
|
+
name = "lock_api"
|
|
48
|
+
version = "0.4.12"
|
|
49
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
50
|
+
checksum = "07af8b9cdd281b7915f413fa73f29ebd5d55d0d3f0155584dade1ff18cea1b17"
|
|
51
|
+
dependencies = [
|
|
52
|
+
"autocfg",
|
|
53
|
+
"scopeguard",
|
|
54
|
+
]
|
|
55
|
+
|
|
56
|
+
[[package]]
|
|
57
|
+
name = "memoffset"
|
|
58
|
+
version = "0.9.1"
|
|
59
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
60
|
+
checksum = "488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a"
|
|
61
|
+
dependencies = [
|
|
62
|
+
"autocfg",
|
|
63
|
+
]
|
|
64
|
+
|
|
65
|
+
[[package]]
|
|
66
|
+
name = "once_cell"
|
|
67
|
+
version = "1.19.0"
|
|
68
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
69
|
+
checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92"
|
|
70
|
+
|
|
71
|
+
[[package]]
|
|
72
|
+
name = "osc-data"
|
|
73
|
+
version = "0.1.0"
|
|
74
|
+
dependencies = [
|
|
75
|
+
"pyo3",
|
|
76
|
+
"uuid",
|
|
77
|
+
]
|
|
78
|
+
|
|
79
|
+
[[package]]
|
|
80
|
+
name = "parking_lot"
|
|
81
|
+
version = "0.12.3"
|
|
82
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
83
|
+
checksum = "f1bf18183cf54e8d6059647fc3063646a1801cf30896933ec2311622cc4b9a27"
|
|
84
|
+
dependencies = [
|
|
85
|
+
"lock_api",
|
|
86
|
+
"parking_lot_core",
|
|
87
|
+
]
|
|
88
|
+
|
|
89
|
+
[[package]]
|
|
90
|
+
name = "parking_lot_core"
|
|
91
|
+
version = "0.9.10"
|
|
92
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
93
|
+
checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8"
|
|
94
|
+
dependencies = [
|
|
95
|
+
"cfg-if",
|
|
96
|
+
"libc",
|
|
97
|
+
"redox_syscall",
|
|
98
|
+
"smallvec",
|
|
99
|
+
"windows-targets",
|
|
100
|
+
]
|
|
101
|
+
|
|
102
|
+
[[package]]
|
|
103
|
+
name = "proc-macro2"
|
|
104
|
+
version = "1.0.86"
|
|
105
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
106
|
+
checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77"
|
|
107
|
+
dependencies = [
|
|
108
|
+
"unicode-ident",
|
|
109
|
+
]
|
|
110
|
+
|
|
111
|
+
[[package]]
|
|
112
|
+
name = "pyo3"
|
|
113
|
+
version = "0.19.2"
|
|
114
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
115
|
+
checksum = "e681a6cfdc4adcc93b4d3cf993749a4552018ee0a9b65fc0ccfad74352c72a38"
|
|
116
|
+
dependencies = [
|
|
117
|
+
"cfg-if",
|
|
118
|
+
"indoc",
|
|
119
|
+
"libc",
|
|
120
|
+
"memoffset",
|
|
121
|
+
"parking_lot",
|
|
122
|
+
"pyo3-build-config",
|
|
123
|
+
"pyo3-ffi",
|
|
124
|
+
"pyo3-macros",
|
|
125
|
+
"unindent",
|
|
126
|
+
]
|
|
127
|
+
|
|
128
|
+
[[package]]
|
|
129
|
+
name = "pyo3-build-config"
|
|
130
|
+
version = "0.19.2"
|
|
131
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
132
|
+
checksum = "076c73d0bc438f7a4ef6fdd0c3bb4732149136abd952b110ac93e4edb13a6ba5"
|
|
133
|
+
dependencies = [
|
|
134
|
+
"once_cell",
|
|
135
|
+
"target-lexicon",
|
|
136
|
+
]
|
|
137
|
+
|
|
138
|
+
[[package]]
|
|
139
|
+
name = "pyo3-ffi"
|
|
140
|
+
version = "0.19.2"
|
|
141
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
142
|
+
checksum = "e53cee42e77ebe256066ba8aa77eff722b3bb91f3419177cf4cd0f304d3284d9"
|
|
143
|
+
dependencies = [
|
|
144
|
+
"libc",
|
|
145
|
+
"pyo3-build-config",
|
|
146
|
+
]
|
|
147
|
+
|
|
148
|
+
[[package]]
|
|
149
|
+
name = "pyo3-macros"
|
|
150
|
+
version = "0.19.2"
|
|
151
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
152
|
+
checksum = "dfeb4c99597e136528c6dd7d5e3de5434d1ceaf487436a3f03b2d56b6fc9efd1"
|
|
153
|
+
dependencies = [
|
|
154
|
+
"proc-macro2",
|
|
155
|
+
"pyo3-macros-backend",
|
|
156
|
+
"quote",
|
|
157
|
+
"syn",
|
|
158
|
+
]
|
|
159
|
+
|
|
160
|
+
[[package]]
|
|
161
|
+
name = "pyo3-macros-backend"
|
|
162
|
+
version = "0.19.2"
|
|
163
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
164
|
+
checksum = "947dc12175c254889edc0c02e399476c2f652b4b9ebd123aa655c224de259536"
|
|
165
|
+
dependencies = [
|
|
166
|
+
"proc-macro2",
|
|
167
|
+
"quote",
|
|
168
|
+
"syn",
|
|
169
|
+
]
|
|
170
|
+
|
|
171
|
+
[[package]]
|
|
172
|
+
name = "quote"
|
|
173
|
+
version = "1.0.37"
|
|
174
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
175
|
+
checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af"
|
|
176
|
+
dependencies = [
|
|
177
|
+
"proc-macro2",
|
|
178
|
+
]
|
|
179
|
+
|
|
180
|
+
[[package]]
|
|
181
|
+
name = "redox_syscall"
|
|
182
|
+
version = "0.5.4"
|
|
183
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
184
|
+
checksum = "0884ad60e090bf1345b93da0a5de8923c93884cd03f40dfcfddd3b4bee661853"
|
|
185
|
+
dependencies = [
|
|
186
|
+
"bitflags",
|
|
187
|
+
]
|
|
188
|
+
|
|
189
|
+
[[package]]
|
|
190
|
+
name = "scopeguard"
|
|
191
|
+
version = "1.2.0"
|
|
192
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
193
|
+
checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49"
|
|
194
|
+
|
|
195
|
+
[[package]]
|
|
196
|
+
name = "smallvec"
|
|
197
|
+
version = "1.13.2"
|
|
198
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
199
|
+
checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67"
|
|
200
|
+
|
|
201
|
+
[[package]]
|
|
202
|
+
name = "syn"
|
|
203
|
+
version = "1.0.109"
|
|
204
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
205
|
+
checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237"
|
|
206
|
+
dependencies = [
|
|
207
|
+
"proc-macro2",
|
|
208
|
+
"quote",
|
|
209
|
+
"unicode-ident",
|
|
210
|
+
]
|
|
211
|
+
|
|
212
|
+
[[package]]
|
|
213
|
+
name = "target-lexicon"
|
|
214
|
+
version = "0.12.16"
|
|
215
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
216
|
+
checksum = "61c41af27dd6d1e27b1b16b489db798443478cef1f06a660c96db617ba5de3b1"
|
|
217
|
+
|
|
218
|
+
[[package]]
|
|
219
|
+
name = "unicode-ident"
|
|
220
|
+
version = "1.0.13"
|
|
221
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
222
|
+
checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe"
|
|
223
|
+
|
|
224
|
+
[[package]]
|
|
225
|
+
name = "unindent"
|
|
226
|
+
version = "0.1.11"
|
|
227
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
228
|
+
checksum = "e1766d682d402817b5ac4490b3c3002d91dfa0d22812f341609f97b08757359c"
|
|
229
|
+
|
|
230
|
+
[[package]]
|
|
231
|
+
name = "uuid"
|
|
232
|
+
version = "1.10.0"
|
|
233
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
234
|
+
checksum = "81dfa00651efa65069b0b6b651f4aaa31ba9e3c3ce0137aaad053604ee7e0314"
|
|
235
|
+
dependencies = [
|
|
236
|
+
"getrandom",
|
|
237
|
+
]
|
|
238
|
+
|
|
239
|
+
[[package]]
|
|
240
|
+
name = "wasi"
|
|
241
|
+
version = "0.11.0+wasi-snapshot-preview1"
|
|
242
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
243
|
+
checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
|
|
244
|
+
|
|
245
|
+
[[package]]
|
|
246
|
+
name = "windows-targets"
|
|
247
|
+
version = "0.52.6"
|
|
248
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
249
|
+
checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973"
|
|
250
|
+
dependencies = [
|
|
251
|
+
"windows_aarch64_gnullvm",
|
|
252
|
+
"windows_aarch64_msvc",
|
|
253
|
+
"windows_i686_gnu",
|
|
254
|
+
"windows_i686_gnullvm",
|
|
255
|
+
"windows_i686_msvc",
|
|
256
|
+
"windows_x86_64_gnu",
|
|
257
|
+
"windows_x86_64_gnullvm",
|
|
258
|
+
"windows_x86_64_msvc",
|
|
259
|
+
]
|
|
260
|
+
|
|
261
|
+
[[package]]
|
|
262
|
+
name = "windows_aarch64_gnullvm"
|
|
263
|
+
version = "0.52.6"
|
|
264
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
265
|
+
checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3"
|
|
266
|
+
|
|
267
|
+
[[package]]
|
|
268
|
+
name = "windows_aarch64_msvc"
|
|
269
|
+
version = "0.52.6"
|
|
270
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
271
|
+
checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469"
|
|
272
|
+
|
|
273
|
+
[[package]]
|
|
274
|
+
name = "windows_i686_gnu"
|
|
275
|
+
version = "0.52.6"
|
|
276
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
277
|
+
checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b"
|
|
278
|
+
|
|
279
|
+
[[package]]
|
|
280
|
+
name = "windows_i686_gnullvm"
|
|
281
|
+
version = "0.52.6"
|
|
282
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
283
|
+
checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66"
|
|
284
|
+
|
|
285
|
+
[[package]]
|
|
286
|
+
name = "windows_i686_msvc"
|
|
287
|
+
version = "0.52.6"
|
|
288
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
289
|
+
checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66"
|
|
290
|
+
|
|
291
|
+
[[package]]
|
|
292
|
+
name = "windows_x86_64_gnu"
|
|
293
|
+
version = "0.52.6"
|
|
294
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
295
|
+
checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78"
|
|
296
|
+
|
|
297
|
+
[[package]]
|
|
298
|
+
name = "windows_x86_64_gnullvm"
|
|
299
|
+
version = "0.52.6"
|
|
300
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
301
|
+
checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d"
|
|
302
|
+
|
|
303
|
+
[[package]]
|
|
304
|
+
name = "windows_x86_64_msvc"
|
|
305
|
+
version = "0.52.6"
|
|
306
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
307
|
+
checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
[package]
|
|
2
|
+
name = "osc-data"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
edition = "2021"
|
|
5
|
+
|
|
6
|
+
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
|
7
|
+
[lib]
|
|
8
|
+
name = "osc_data"
|
|
9
|
+
crate-type = ["cdylib"]
|
|
10
|
+
|
|
11
|
+
[dependencies]
|
|
12
|
+
pyo3 = "0.19.0"
|
|
13
|
+
uuid = { version = "1.10.0", features = ["v4"] }
|
osc_data-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
|
+
Name: osc-data
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Add your description here
|
|
5
|
+
Author-email: wangmengdi06 <wangmengdi06@58.com>
|
|
6
|
+
Requires-Python: >=3.8
|
|
7
|
+
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
|
|
8
|
+
|
|
9
|
+
# osc-data
|
|
10
|
+
|
|
11
|
+
Describe your project here.
|
|
12
|
+
|
osc_data-0.1.0/README.md
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "osc-data"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
description = "Add your description here"
|
|
5
|
+
authors = [
|
|
6
|
+
{ name = "wangmengdi06", email = "wangmengdi06@58.com" }
|
|
7
|
+
]
|
|
8
|
+
dependencies = []
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">= 3.8"
|
|
11
|
+
|
|
12
|
+
[build-system]
|
|
13
|
+
requires = ["maturin>=1.2,<2.0"]
|
|
14
|
+
build-backend = "maturin"
|
|
15
|
+
|
|
16
|
+
[tool.rye]
|
|
17
|
+
managed = true
|
|
18
|
+
dev-dependencies = []
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
[tool.maturin]
|
|
22
|
+
python-source = "python"
|
|
23
|
+
module-name = "osc_data._lowlevel"
|
|
24
|
+
features = ["pyo3/extension-module"]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from .audio import AudioDoc
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
from osc_data._lowlevel import AudioDoc as _AudioDoc
|
|
2
|
+
import requests
|
|
3
|
+
import librosa
|
|
4
|
+
from io import BytesIO
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class AudioDoc(_AudioDoc):
|
|
8
|
+
|
|
9
|
+
def load(self) -> None:
|
|
10
|
+
bytes = requests.get(self.url).content
|
|
11
|
+
self._audio, self.sr = librosa.load(BytesIO(bytes), sr=None, mono=False)
|
|
12
|
+
duration = librosa.get_duration(y=self._audio, sr=self.sr)
|
|
13
|
+
self.duration = duration
|
|
14
|
+
|
|
15
|
+
def __repr__(self):
|
|
16
|
+
return f'<AudioDoc url="{self.url}" id="{self.id}" duration={self.duration} mono={self.mono}>'
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
__all__ = ["AudioDoc"]
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
use pyo3::prelude::*;
|
|
2
|
+
use uuid::Uuid;
|
|
3
|
+
|
|
4
|
+
#[pyclass(subclass)]
|
|
5
|
+
pub struct AudioDoc {
|
|
6
|
+
id: String,
|
|
7
|
+
url: String,
|
|
8
|
+
duration: Option<f32>,
|
|
9
|
+
mono: Option<bool>,
|
|
10
|
+
sample_rate: Option<i8>,
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
#[pymethods]
|
|
14
|
+
impl AudioDoc {
|
|
15
|
+
#[new]
|
|
16
|
+
fn new(
|
|
17
|
+
url: String,
|
|
18
|
+
duration: Option<f32>,
|
|
19
|
+
mono: Option<bool>,
|
|
20
|
+
id: Option<String>,
|
|
21
|
+
sample_rate: Option<i8>,
|
|
22
|
+
) -> Self {
|
|
23
|
+
let id = match id {
|
|
24
|
+
Some(id) => id,
|
|
25
|
+
None => Uuid::new_v4().to_string(),
|
|
26
|
+
};
|
|
27
|
+
AudioDoc {
|
|
28
|
+
id,
|
|
29
|
+
url,
|
|
30
|
+
duration: duration,
|
|
31
|
+
mono: mono,
|
|
32
|
+
sample_rate: sample_rate,
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
#[getter]
|
|
37
|
+
fn id(&self) -> &str {
|
|
38
|
+
&self.id
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
#[setter]
|
|
42
|
+
fn set_id(&mut self, id: String) {
|
|
43
|
+
self.id = id;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
#[getter]
|
|
47
|
+
fn url(&self) -> &str {
|
|
48
|
+
&self.url
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
#[setter]
|
|
52
|
+
fn set_url(&mut self, url: String) {
|
|
53
|
+
self.url = url;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
#[getter]
|
|
57
|
+
fn duration(&self) -> Option<f32> {
|
|
58
|
+
self.duration
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
#[setter]
|
|
62
|
+
fn set_duration(&mut self, duration: Option<f32>) {
|
|
63
|
+
self.duration = duration;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
#[getter]
|
|
67
|
+
fn mono(&self) -> Option<bool> {
|
|
68
|
+
self.mono
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
#[setter]
|
|
72
|
+
fn set_mono(&mut self, mono: Option<bool>) {
|
|
73
|
+
self.mono = mono;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
#[getter]
|
|
77
|
+
fn sample_rate(&self) -> Option<i8> {
|
|
78
|
+
self.sample_rate
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
#[setter]
|
|
82
|
+
fn set_sample_rate(&mut self, sample_rate: Option<i8>) {
|
|
83
|
+
self.sample_rate = sample_rate;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
{
|
|
2
|
+
"cells": [
|
|
3
|
+
{
|
|
4
|
+
"cell_type": "code",
|
|
5
|
+
"execution_count": 1,
|
|
6
|
+
"metadata": {},
|
|
7
|
+
"outputs": [],
|
|
8
|
+
"source": [
|
|
9
|
+
"from osc_data import AudioDoc"
|
|
10
|
+
]
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
"cell_type": "code",
|
|
14
|
+
"execution_count": 2,
|
|
15
|
+
"metadata": {},
|
|
16
|
+
"outputs": [],
|
|
17
|
+
"source": [
|
|
18
|
+
"doc = AudioDoc(url='http://prod2.wos.58dns.org/nplKjIhGfnU/linkrecord/3706853751905976477.mp3')"
|
|
19
|
+
]
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"cell_type": "code",
|
|
23
|
+
"execution_count": 6,
|
|
24
|
+
"metadata": {},
|
|
25
|
+
"outputs": [],
|
|
26
|
+
"source": [
|
|
27
|
+
"doc.load()"
|
|
28
|
+
]
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
"cell_type": "code",
|
|
32
|
+
"execution_count": 7,
|
|
33
|
+
"metadata": {},
|
|
34
|
+
"outputs": [
|
|
35
|
+
{
|
|
36
|
+
"ename": "AttributeError",
|
|
37
|
+
"evalue": "'AudioDoc' object has no attribute 'waveform'",
|
|
38
|
+
"output_type": "error",
|
|
39
|
+
"traceback": [
|
|
40
|
+
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
|
|
41
|
+
"\u001b[0;31mAttributeError\u001b[0m Traceback (most recent call last)",
|
|
42
|
+
"Cell \u001b[0;32mIn[7], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m \u001b[43mdoc\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mwaveform\u001b[49m\n",
|
|
43
|
+
"\u001b[0;31mAttributeError\u001b[0m: 'AudioDoc' object has no attribute 'waveform'"
|
|
44
|
+
]
|
|
45
|
+
}
|
|
46
|
+
],
|
|
47
|
+
"source": [
|
|
48
|
+
"doc.waveform"
|
|
49
|
+
]
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
"cell_type": "code",
|
|
53
|
+
"execution_count": null,
|
|
54
|
+
"metadata": {},
|
|
55
|
+
"outputs": [],
|
|
56
|
+
"source": []
|
|
57
|
+
}
|
|
58
|
+
],
|
|
59
|
+
"metadata": {
|
|
60
|
+
"kernelspec": {
|
|
61
|
+
"display_name": "base",
|
|
62
|
+
"language": "python",
|
|
63
|
+
"name": "python3"
|
|
64
|
+
},
|
|
65
|
+
"language_info": {
|
|
66
|
+
"codemirror_mode": {
|
|
67
|
+
"name": "ipython",
|
|
68
|
+
"version": 3
|
|
69
|
+
},
|
|
70
|
+
"file_extension": ".py",
|
|
71
|
+
"mimetype": "text/x-python",
|
|
72
|
+
"name": "python",
|
|
73
|
+
"nbconvert_exporter": "python",
|
|
74
|
+
"pygments_lexer": "ipython3",
|
|
75
|
+
"version": "3.12.2"
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
"nbformat": 4,
|
|
79
|
+
"nbformat_minor": 2
|
|
80
|
+
}
|