can anyone tell me how to remove unvoiced or silenced region from audio file?
6 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
pranjal
le 26 Déc 2014
Commenté : krishna Chauhan
le 14 Déc 2022
I have .wav file having voiced and unvoiced segments.I want to remove unvoiced part of it. so that processing time can be reduced.
4 commentaires
huda farooqui
le 1 Nov 2018
hey kindly tell me ...i want to reduce the gap between words but dont want to totally remove it...removing whole gap mix the words that we can not detect the end of each word
Image Analyst
le 1 Nov 2018
Find the gaps but then when you stitch the segments together, insert a few elements of zeros.
Réponse acceptée
Image Analyst
le 26 Déc 2014
Modifié(e) : Image Analyst
le 16 Juin 2019
See my program where I find where the envelope of the standard guitar demo file that ships with MATLAB is below 0.13 and I cut out those portions. Normal sine wave oscillation on a short time scale are retained so as to not alter the sound.
clc; % Clear the command window.
close all; % Close all figures (except those of imtool.)
clear; % Erase all existing variables. Or clearvars if you want.
workspace; % Make sure the workspace panel is showing.
format long g;
format compact;
fontSize = 20;
% Read in data and plot it.
[y, Fs] = audioread('guitartune.wav');
subplot(2, 1, 1);
plot(y, 'b-');
grid on;
title('Original Signal + Envelope', 'FontSize', fontSize);
% Enlarge figure to full screen.
set(gcf, 'Units', 'Normalized', 'OuterPosition', [0 0 1 1]);
drawnow;
% Find the envelope by taking a moving max operation, imdilate.
envelope = imdilate(abs(y), true(1501, 1));
% Plot it.
hold on;
plot(envelope, 'r-', 'LineWidth', 2);
plot(-envelope, 'r-', 'LineWidth', 2);
legend('Data', 'Envelope');
% Save the x axis length so we can apply it to the edit plot
% so they are displayed on the same time frame
% So we can see how it got shorter.
xl = xlim();
% Find the quiet parts.
quietParts = envelope < 0.13; % Or whatever value you want.
% Cut out quiet parts and plot.
yEdited = y; % Initialize
yEdited(quietParts) = [];
subplot(2, 1, 2);
plot(yEdited, 'b-', 'LineWidth', 2);
title('Edited Signal, shorter because data was removed', 'FontSize', fontSize);
grid on;
% Make it plot over the same time range as the original
xlim(xl);
5 commentaires
Alexandra
le 13 Mai 2016
envelope = imdilate(meanOfBothChannels, true(1501, 1)); I don't understand how this value 1501 was chosen. If someone could explain to me. Thanks
Image Analyst
le 14 Mai 2016
Modifié(e) : Image Analyst
le 14 Mai 2016
It was probably trial and error until a value was found that worked well. By the way, there is now an envelope() function in the Signal Processing Toolbox:
[yupper,ylower] = envelope(x) returns the upper and lower envelopes of the input sequence, x, as the magnitude of its analytic signal. The analytic signal of x is found using the discrete Fourier transform as implemented in hilbert. The function initially removes the mean of x and adds it back after computing the envelopes. If x is a matrix, then envelope operates independently over each column of x.
There is also a movmax() function that is like imdilate() in that it takes the max in a moving window.
Plus de réponses (1)
Chad Greene
le 26 Déc 2014
Hi Pranjal,
There are a number of ways to do this, but I cannot think of a perfect solution. The easiest way I can think of is to say the levels must exceed a certain threshold. But, you can't say each individual data point must exceed a certain threshold, you'll need to do some moving max or moving rms or moving spl. Here's a solution with moving max, using Aslak Grinsted's moving function.
First, load some data. I'm going to add a 12000 point stretch of low-volume noise in the middle:
load train
y = [y(1:4200);.01*randn(12000,1);y(4200:end)];
t = (0:length(y)-1)/Fs; % time
The sound signal looks and sounds like this:
plot(t,y,'blue')
box off; axis tight; hold on
xlabel('time (s)')
soundsc(y,Fs) % <- turn your speakers on
Now use moving to get the moving max centered over 35 data points and plot the moving maximum in red:
ymax = moving(y,35,@max);
plot(t,ymax,'red')
Now let's say we only want data whose moving max value exceeds 0.15. Create a clipped array corresponding to ymax>0.15
yclipped = y(ymax>0.15);
tclipped = (0:length(yclipped)-1)/Fs;
figure
plot(tclipped,yclipped,'b')
box off; axis tight
xlabel('time (s)')
5 commentaires
Image Analyst
le 14 Déc 2022
@krishna Chauhan then there would be no modulation of air pressure and no sound except for a faint hiss. The waveform produced by the microphone would then, during those time periods, look just like a low level white noise, just as it would if there was no talking going on. Granted maybe a little higher signal than complete silence, but that just means you may have to raise your threshold slightly to ignore cases when someone is doing that. The algorithms would just remain the same, just the threshold parameter to divide voiced/talking from unvoiced/silence would be slightly different. Are you implying that the algorithm to find the talking vs unvoiced/silent parts of the signal would be different?
krishna Chauhan
le 14 Déc 2022
Please take it is as discussion as this question already has an accepted answer.
I read somewher, this two things are different and there should be different anaysis for both.
Voir également
Catégories
En savoir plus sur Audio Processing Algorithm Design dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!