필터 지우기
필터 지우기

i cant find the error in line num 14 ([b, a] = butter(6, normalized​CutoffFreq​,'low'); )

조회 수: 1 (최근 30일)
ibrahim
ibrahim 2023년 10월 16일
댓글: Walter Roberson 2023년 10월 17일
% تحديد ملف الصوت المطلوب
audioFile = 'teeest33.mp3'; % مسار واسم ملف الصوت
% تحميل ملف الصوت
[audioData, fs] = audioread(audioFile);
% تضخيم الإشارة الصوتية
amplificationFactor = 10; % عامل التضخيم
amplifiedAudio = audioData * amplificationFactor;
% إزالة الضوضاء بواسطة تصفية الترددات المنخفضة
cutoffFrequency = 1000; % تردد القطع لتصفية الترددات المنخفضة (بالهرتز)
normalizedCutoffFreq = cutoffFrequency / (fs/2);
[b, a] = butter(6, normalizedCutoffFreq,'low');
% تطبيق التصفية
filteredAudio = filter(b, a, amplifiedAudio);
% تشغيل الإشارة الصوتية المصفاة
sound(filteredAudio, fs);

답변 (2개)

Sulaymon Eshkabilov
Sulaymon Eshkabilov 2023년 10월 16일
Your code syntax is ok. Maybe your audio file is incomplete or corrupted while downloading, etc.
  댓글 수: 1
Walter Roberson
Walter Roberson 2023년 10월 17일
There three kinds of incomplete or corrupted audio files for the purpose of audioread():
  1. files that are non-existent or not readable by audioread(). In such a case, audioread() would give an error before you reached the butter() call
  2. files that have a valid header but are too short considering the file header. In such a case, audioread() would either give an error or else return the information that could be read, including a valid frequency -- just with fewer samples than perhaps expected. In such a case, the cut-off frequency calculation would still be correct and butter() would not give a problem
  3. files in which the header itself is corrupted, possibly affecting the frequency information. In such a case either audioread() will error or else it will return data but with a possibly invalid frequency. In such a case you could potentially get an invalid cutoff frequency parameter to butter()

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


Walter Roberson
Walter Roberson 2023년 10월 17일
You would get an error in the call to butter() (but not in earlier lines) in the case that the frequency of the stored data in the audio file is no more than 2000 . For example if the frequency of the stored audio was 1500 then 1000 / (1500/2) would be 4/3 which would be more than 1, but that parmeter must be strictly less than 1 for butter()

카테고리

Help CenterFile Exchange에서 Audio Processing Algorithm Design에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by