필터 지우기
필터 지우기

Error in my code

조회 수: 1 (최근 30일)
Abdullah Adam
Abdullah Adam 2021년 12월 14일
댓글: Abdullah Adam 2021년 12월 17일
%Hi everyone,
%This is my code it is working fine but I'm getting error. Why? and how can I fix it?
%One more question how can download the modified audio from MATLAB?
[y,Fs] = audioread('noisy2_group2.wav'); %read file from directory
[b,a] = butter(4, [0.015, 0.125], 'bandpass'); %Implement bandpass filter with specified frequency ranges
fOut = filter(b, a, y); %create the updated signal
sound(fOut,Fs) % play the sound signal and plot it
subplot(2,1,2), plot(y); %plot given signal
subplot(2,1,2), plot(fOut);
wav write(fOut , 16000, 'fOut') %Obtain the new signal
  댓글 수: 1
Walter Roberson
Walter Roberson 2021년 12월 14일
Perhaps you wanted wavwrite instead of wav write ?

댓글을 달려면 로그인하십시오.

답변 (1개)

Alagu Sankar Esakkiappan
Alagu Sankar Esakkiappan 2021년 12월 17일
Hi Abdullah,
I see that you're trying to filter an audio file and store the filtered audio signal in a new file. wavwrite is a legacy function which is removed from MATLAB 2015b. Instead, You may make use of audiowrite function as an alternate to write audio signal.
Following is a code reference for the same:
% Syntax for audiowrite is audiowrite(filename, audioSignal, bitRate)
audiowrite('new_signal.wav' , fOut, 16000); %Obtain the new signal
Also in the Sample Code in question, both y and fOut are plotted in the same subplot. i.e subplot(2,1,2). Instead, You may try to use both upper and lower portions of the plot as follows:
subplot(2,1,1), plot(y);
subplot(2,1,2), plot(fOut);
For more details on how to use sub plots, You may refer to subplot
  댓글 수: 1
Abdullah Adam
Abdullah Adam 2021년 12월 17일
Thank you so much for your help

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Audio and Video Data에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by