質問編集履歴
2
追加修正」
title
CHANGED
|
File without changes
|
body
CHANGED
|
@@ -105,7 +105,7 @@
|
|
|
105
105
|
### 試したこと
|
|
106
106
|
|
|
107
107
|
ファイルネームの拡張子を.npzに変えたりしました。
|
|
108
|
-
audio はnp.darrayのlist
|
|
108
|
+
audio はnp.darrayのlist 次元数は2です。
|
|
109
109
|
label は整数のlist
|
|
110
110
|
filename は元ファイルのパスを保存しているlistであることをtype()によって確認しました。
|
|
111
111
|
|
1
コードのインデントを修正しました。
title
CHANGED
|
File without changes
|
body
CHANGED
|
@@ -27,13 +27,10 @@
|
|
|
27
27
|
555
|
|
28
28
|
|
|
29
29
|
ValueError: could not broadcast input array from shape (20,883) into shape (20)
|
|
30
|
-
|
|
30
|
+
#コード
|
|
31
|
+
|
|
31
32
|
```
|
|
32
33
|
|
|
33
|
-
### 該当のソースコード
|
|
34
|
-
|
|
35
|
-
Python
|
|
36
|
-
ソースコード
|
|
37
34
|
import librosa
|
|
38
35
|
import os
|
|
39
36
|
import numpy as np
|
|
@@ -56,21 +53,23 @@
|
|
|
56
53
|
apath = os.path.join(angry,aud)
|
|
57
54
|
x,fs = librosa.load(apath,sr=44100)
|
|
58
55
|
mfccs= librosa.feature.mfcc(x,sr=fs)
|
|
59
|
-
|
|
56
|
+
#print (mfccs.shape)
|
|
57
|
+
#print(type(mfccs))
|
|
60
58
|
audio.append(mfccs)
|
|
61
59
|
if(max<mfccs.shape[1]):
|
|
62
60
|
max = mfccs.shape[1]
|
|
63
61
|
la = 0
|
|
64
62
|
label.append(la)
|
|
65
63
|
name.append(aud)
|
|
66
|
-
|
|
64
|
+
#print(type(audio))
|
|
67
65
|
|
|
68
66
|
print("33%")
|
|
69
67
|
for aud in normall:
|
|
70
68
|
apath = os.path.join(normal,aud)
|
|
71
69
|
x,fs = librosa.load(apath,sr=44100)
|
|
72
70
|
mfccs= librosa.feature.mfcc(x,sr=fs)
|
|
73
|
-
|
|
71
|
+
#print (mfccs.shape)
|
|
72
|
+
#print(type(mfccs))
|
|
74
73
|
audio.append(mfccs)
|
|
75
74
|
if(max<mfccs.shape[1]):
|
|
76
75
|
max = mfccs.shape[1]
|
|
@@ -83,6 +82,8 @@
|
|
|
83
82
|
apath = os.path.join(happy,aud)
|
|
84
83
|
x,fs = librosa.load(apath,sr=44100)
|
|
85
84
|
mfccs= librosa.feature.mfcc(x,sr=fs)
|
|
85
|
+
# print (mfccs.shape)
|
|
86
|
+
#print(type(mfccs))
|
|
86
87
|
audio.append(mfccs)
|
|
87
88
|
if(max<mfccs.shape[1]):
|
|
88
89
|
max = mfccs.shape[1]
|
|
@@ -100,6 +101,7 @@
|
|
|
100
101
|
print(max)
|
|
101
102
|
print("finish")
|
|
102
103
|
|
|
104
|
+
```Python
|
|
103
105
|
### 試したこと
|
|
104
106
|
|
|
105
107
|
ファイルネームの拡張子を.npzに変えたりしました。
|