Does audioread not return a vector?
Mostra commenti meno recenti
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 Commento
Stephen23
il 19 Apr 2019
"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" .
Risposta accettata
Più risposte (1)
Walter Roberson
il 19 Apr 2019
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);
1 Commento
Logan Betts
il 19 Apr 2019
Categorie
Scopri di più su Audio and Video Data in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!