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

关于音频读入的问题 #60

Open
FBSalol opened this issue May 25, 2024 · 3 comments
Open

关于音频读入的问题 #60

FBSalol opened this issue May 25, 2024 · 3 comments

Comments

@FBSalol
Copy link

FBSalol commented May 25, 2024

作者你好,我在加载音频时,读入的src参数维数不是二维,此问题在加载不同音频时时有时无,请问作者遇到过类似的问题吗,是如何解决的呢?谢谢
280b90e5d4ef5ff095301789b3889bb
Traceback (most recent call last):
File "D:\model\Dual-Path-RNN-Pytorch-master\Dual-Path-RNN-Pytorch-master\dualrnn_test_wav.py", line 73, in
main()
File "D:\model\Dual-Path-RNN-Pytorch-master\Dual-Path-RNN-Pytorch-master\dualrnn_test_wav.py", line 69, in main
separation.inference(args.save_path)
File "D:\model\Dual-Path-RNN-Pytorch-master\Dual-Path-RNN-Pytorch-master\dualrnn_test_wav.py", line 50, in inference
write_wav(filename, s, 16000)
File "D:\model\Dual-Path-RNN-Pytorch-master\Dual-Path-RNN-Pytorch-master\data_loader\AudioReader.py", line 37, in write_wav
torchaudio.save(fname, src, sample_rate)
File "C:\Users\dell\AppData\Local\conda\conda\envs\d2l\lib\site-packages\torchaudio_backend\utils.py", line 288, in save
return backend.save(uri, src, sample_rate, channels_first, format, encoding, bits_per_sample, buffer_size)
File "C:\Users\dell\AppData\Local\conda\conda\envs\d2l\lib\site-packages\torchaudio_backend\soundfile.py", line 39, in save
soundfile_backend.save(
File "C:\Users\dell\AppData\Local\conda\conda\envs\d2l\lib\site-packages\torchaudio_backend\soundfile_backend.py", line 427, in save
raise ValueError(f"Expected 2D Tensor, got {src.ndim}D.")
ValueError: Expected 2D Tensor, got 1D.

@JusperLee
Copy link
Owner

你可以用view(B, 2, T)

@heyun913
Copy link

hello ,解决了么,遇到了同样的问题

@FBSalol
Copy link
Author

FBSalol commented May 29, 2024

hello ,解决了么,遇到了同样的问题

没有,估计大概率是音频的原因,我使用自己录制的音频就不会出现此问题,你可以看看作者提供的混合音频的代码

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

No branches or pull requests

3 participants