フィルターのクリア

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 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