Does audioread not return a vector?
이전 댓글 표시
I'm having a small issue with understanding why this conv wont pass through.
Fs = 33600;%sampling frequency
T = 1;
samples = [1,T*Fs];%this is my sample range, for seconds recorded change the multiplier
[filename,filepath] = uigetfile('*.*', 'Please choose audio data');
B = audioread(strcat(filepath,filename),samples);
A = zeros(1,100);
op = conv(A, B);
When I run this and select the file that I want to read, I get this Error:
Error using conv (line 28)
A and B must be vectors.
Error in convcheck (line 8)
op = conv(A, B);
I was under the impression that Audioread did return a vector, but if i'm wrong then there has to be another way to convolute audio signals that I'm unaware of?
thank you for your time.
댓글 수: 1
Stephen23
2019년 4월 19일
"I was under the impression that Audioread did return a vector..."
The audioread documentation clearly states that the first output is "returned as an m-by-n matrix, where m is the number of audio samples read and n is the number of audio channels in the file. " So the answer to your question is no if there are two or more channels in the file.
It is more reliable to read the documentation than to rely on an "impression" .
채택된 답변
추가 답변 (1개)
Walter Roberson
2019년 4월 19일
No, often audioread() does not return a vector. audioread() normally returns a 2D array with one column per channel.
Note: you should think about providing an option such as 'valid' or 'same' to conv()
Note by the way that convolving with 0 is always going to return all zeros. You could skip the conv() call and just do
op = zeros(length(B) + length(A) - 1, 1);
카테고리
도움말 센터 및 File Exchange에서 Audio and Video Data에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!