removing pops/clicks from audio file

14 次查看(过去 30 天)
Hello there, I have the folowing file: https://transfer.sh/fR2wht/vinyl.mp3
which includes pops and clicks because vinyl got scratched
you can hear them even better if you listen to part between 2 songs
I tried to remove them using a simple method (Walk through all the samples from start to finish., If we detect large difference in amplitude and oscillations, we have found a click., then we just set samples inside click amplitude to 0 to correct it) but it seams my click remover removes nothing it also seams to adds aditional clicks to the signal (although it does work on silcence, if signal is selent, then there is no clicks)
clearvars;
close all;
clear sound;
%% Read in the file
info = audioinfo("vinyl.mp3");
Fs = info.SampleRate;
signal_silence = audioread("vinyl.mp3", round([66, 70] * Fs)); %Read between 2 songs, where there is silence
disp("Sample rate: " + Fs);
%sound(signal_silence, Fs);
%Plot our signal
figure;
subplot(1,2,1)
%plot(signal_silence);
specgram(signal_silence(:,1),1024,Fs);
caxis([-15 15]);
title('Spectrogram of Original signal')
%% Remove clicks
threshold = .2; %threshold where click starts
diffsig = diff(signal_silence);
diffsig(abs(diffsig)>threshold) = 0; %Set click value to 0
newsig = cumsum(diffsig); %signal without clicks
%% See signal
subplot(1,2,2)
%plot(newsig);
specgram(newsig(:,1),1024,Fs);
caxis([-15 15]);
title('Spectrogram of cleaned signal')
%% Listen to signal
sound(newsig, Fs);
As you can see from Spectrogram and time domain, there is additional click added while, if there is silcence, clicks are not heard, as soon as song starts, threshold kikcs in and block usable signal as well
Hope anyone has any idea what to do, Thanks for Anwsering and Best Regads

采纳的回答

Star Strider
Star Strider 2022-5-15
The filloutliers function (or one of its friends) could be an option —
[y,Fs] = audioread('https://transfer.sh/fR2wht/vinyl.mp3');
t = linspace(0, size(y,1)-1, size(y,1))/Fs;
figure
subplot(2,1,1)
plot(t, y(:,1))
title('L Ch')
grid
subplot(2,1,2)
plot(t, y(:,2))
title('R Ch')
grid
xlabel('Time (s)')
sgtitle('Original')
yfo = filloutliers(y, 'clip', 'movmedian',150);
figure
subplot(2,1,1)
plot(t, yfo(:,1))
title('L Ch')
grid
subplot(2,1,2)
plot(t, yfo(:,2))
title('R Ch')
grid
xlabel('Time (s)')
sgtitle('After ‘filloutliers’')
.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Measurements and Spatial Audio 的更多信息

产品


版本

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by