回答編集履歴
2
修正
answer
CHANGED
@@ -5,9 +5,11 @@
|
|
5
5
|
fs = wf.getframerate() # サンプリング周波数
|
6
6
|
nchannels = wf.getnchannels()
|
7
7
|
x = wf.readframes(wf.getnframes()*nchannels)
|
8
|
-
化
|
9
8
|
wf.close()
|
10
9
|
|
10
|
+
# bytes arrayからnumpy.arrayに変換
|
11
|
+
x = np.frombuffer(x, dtype= "int16") / 32768.0
|
12
|
+
|
11
13
|
# stereo音源の場合、左右に分割
|
12
14
|
if nchannles == 2:
|
13
15
|
Lchannle = x[::2]
|
1
fix typo
answer
CHANGED
@@ -11,6 +11,6 @@
|
|
11
11
|
# stereo音源の場合、左右に分割
|
12
12
|
if nchannles == 2:
|
13
13
|
Lchannle = x[::2]
|
14
|
-
Rchannle = x[::
|
14
|
+
Rchannle = x[1::2]
|
15
15
|
|
16
16
|
```
|