Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUtil.py
More file actions
Latest commit
48 lines (34 loc) · 1.14 KB
/
Copy pathUtil.py
File metadata and controls
48 lines (34 loc) · 1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
importnumpyasnp
defconstruct_2D_audio_frame(cube_size, val):
"""
:param cube_size:
:param val: array of size cube_size, contains values from 0 to 100
:return: frame
"""
div=100/cube_size
iflen(val) !=cube_size:
returnNone
translated_values= []
forxinval:
translated_values=translated_values+ [round(x/div)]
frame= []
forxinrange(cube_size**2):
frame=frame+ [1iftranslated_values[x%8] >=int(np.ceil(((cube_size**2) -x) /8)) else0]
returnframe
defconstruct_2D_audio_frame(cube_size, val, layer):
"""
:param cube_size:
:param val: array of size cube_size, contains values from 0 to 100
:return: frame
"""
div=100/cube_size
iflen(val) !=cube_size:
returnNone
translated_values= []
forxinval:
translated_values=translated_values+ [round(x/div)]
frame= []
forxinrange(cube_size**2):
frame=frame+ [1ifnp.sqrt(translated_values[x%8] *translated_values[layer]) >=int(
np.ceil(((cube_size**2) -x) /8)) -1else0]
returnframe