Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

第5章前半を追加 #72

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

dksuga11
Copy link
Contributor

実行結果
q01.py
[0.7868537-0.61713958j 1. +0.j 0.7868537+0.61713958j]

q02.py
[0.7868537 -0.61713958j 0.6148926 +0.78861086j 0.97051349-0.2410468j ]

q04.py
[[[1. +0.j 1.25+0.j]
[1.25+0.j 5.25+0.j]]
[[4. +0.j 1.5 +0.j]
[1.5 +0.j 1.25+0.j]]
[[9. +0.j 0.75+0.j]
[0.75+0.j 0.75+0.j]]]

@rkatotmu
Copy link
Contributor

q02だけ確認が必要かもです

plt.plot(np.arange(0, sec * y.shape[0]) / fs, y)
plt.plot(np.arange(0, sec * y.shape[0]) / fs, x1_pad)
plt.xlim(0.02, 0.04)
plt.savefig("q07.pdf")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

以下のコードを記述するとSNRの比較ができます!参考までに

S1 = my_stft(L, S, s, win)
_x1 = my_istft(S, X1, win)
_s1 = my_istft(S, S1, win)
print("input SNR:", 10 * np.log10(np.sum(_s1 ** 2) / np.sum((_x1 - _s1) ** 2)))  # input SNR: 9.95
print("output SNR:", 10 * np.log10(np.sum(_s1 ** 2) / np.sum((y - _s1) ** 2)))  # output SNR: 14.51

F = L // 2 + 1
fs = 16000

d_list = [2, 5, 10] # マイク間隔
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

コメント:

単位はmとなっているので、意図する2 [cm], 5 [cm], 10 [cm]とはなっていないことに注意です

w = np.empty([F, 360, M], dtype="complex")
for f in range(0, F):
for theta in range(0, 360):
w[f, theta, :] = q01.linear_array_vector(0.05, M, theta, f)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

コメント:

q01.linear_array_vector(0.05, M, theta, f)の引数fは周波数を想定しているのに対し、32行目では周波数インデックスを渡しています

def linear_array_vector(d, M, theta, f):
    """直線状アレイのアレイマニフォールドベクトルを求める
    Args:
        d (double): アレイ間隔
        M (int): マイク数
        theta (int): 音源方向(y軸から反時計回りが正の向き)
        f (int): 周波数
    Return:
        amv: アレイマニフォールドベクトル
    """

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

コメント:

ビームフォーマの式は正しくは $\mathbf{w}_f = \frac{\mathbf{a}_f}{\mathbf{a}_f^H \mathbf{a}_f}$ なので以下の処理を追加する必要があるかと思います!
w[f, theta, :] = w[f, theta, :] / (w[f, theta, :].conjugate() @ w[f, theta, :])

@rkatotmu
Copy link
Contributor

rkatotmu commented Aug 9, 2023

第5章前半 q02について 変更確認しました okです!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants