make a vector from wave sound

4 ビュー (過去 30 日間)
ayman daraghmah
ayman daraghmah 2015 年 9 月 29 日
コメント済み: Image Analyst 2015 年 9 月 29 日
[x,fs,nbits] = wavread('w.wav');
%sound(x,fs);
h = zeros(1,4000);
h(1) = 1;
h(1000) = 0.25;
h(2000) = (1/16);
h(3000) = 1/64;
h(4000) = 1/256;
y = conv(x,h);
y = y/max(y);
sound(y,fs);
it gives me an error "A and B must be vectors" as for y = conv(x,h) .

回答 (2 件)

Star Strider
Star Strider 2015 年 9 月 29 日
Check the size of ‘x’. It may be a two-column matrix (one column for each channel).
  3 件のコメント
Star Strider
Star Strider 2015 年 9 月 29 日
Not strictly 2D but do the same convolution on both channels, or if the same sound is duplicated in both channels, just one column of ‘x’ with your current code.
Image Analyst
Image Analyst 2015 年 9 月 29 日
You could do one 2D convolution or 2 1-D covolutions
rightChannel = x(:, 1);
echoRight = conv(rightChannel, h, 'same');
leftChannel = x(:, 2);
echoLeft = conv(leftChannel , h, 'same');
% Combine
newSignal = [echoRight, echoLeft];
or something like that.

サインインしてコメントする。


Image Analyst
Image Analyst 2015 年 9 月 29 日
Maybe try
y = conv2(x, [h,h], 'same');
or
y = conv2(x,[h;h], 'same');
so you're doing a 2D convolution

カテゴリ

Help Center および File ExchangeAudio Processing Algorithm Design についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by