Filter löschen
Filter löschen

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

1 Ansicht (letzte 30 Tage)
% تحديد ملف الصوت المطلوب
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);

Antworten (2)

Sulaymon Eshkabilov
Sulaymon Eshkabilov am 16 Okt. 2023
Your code syntax is ok. Maybe your audio file is incomplete or corrupted while downloading, etc.
  1 Kommentar
Walter Roberson
Walter Roberson am 17 Okt. 2023
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()

Melden Sie sich an, um zu kommentieren.


Walter Roberson
Walter Roberson am 17 Okt. 2023
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()

Kategorien

Mehr zu Audio Processing Algorithm Design finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by