Show More
@@ -103,6 +103,11 b' class Audio(DisplayObject):' | |||
|
103 | 103 | import struct |
|
104 | 104 | from io import BytesIO |
|
105 | 105 | import wave |
|
106 | try: | |
|
107 | import numpy as np | |
|
108 | data = np.array(data,dtype=float) | |
|
109 | scaled = list(np.int16(data/np.max(np.abs(data))*32767)) | |
|
110 | except ImportError: | |
|
106 | 111 | maxabsvalue = float(max(map(abs,data))) |
|
107 | 112 | scaled = map(lambda x: int(x/maxabsvalue*32767), data) |
|
108 | 113 | fp = BytesIO() |
General Comments 0
You need to be logged in to leave comments.
Login now