How to cut off the useless part of a recording?

2 visualizzazioni (ultimi 30 giorni)
Valerio Marcucci
Valerio Marcucci il 18 Set 2016
Risposto: Jordan Ross il 22 Set 2016
I've done a digital transmission which sends an image through an audio cable. The signal has been quite well modulated and demodulated using QPSK method and low pass filtering.
My problem is that I play the audio signal from a device and use audiorecorder on matlab, but I don't know how to cut off the noise at the beginning of the recording. I tried to use a pattern to detect the beginning of the useful information but it doesn't work. Please, help me!
This is the main code of transmitter and receiver:
%%TRANSMITTER
%%Lettura file immagine
imagepath = '../Data_Files/topolino.jpg';
[orig_data, height, width] = imagesize(imagepath);
len = 16; %numero di bit su cui mandare ciascuna dimensione dell'immagine (n_cifre*n_bit_su_cifra)
% NOTA BENE: deve essere multiplo di 4 (es: 12 o 16)
height_code = sizecode(height, len);
width_code = sizecode(width, len);
%%Grafico dati originali
figure(2)
stem(orig_data, 'linewidth',1), grid on;
title('Dati originali');
axis([ 0 length(orig_data)+1 0 1.5]);
%%Creazione sequenze iniziale e finale
start = [ones(1, 8) zeros(1, 8) height_code width_code];
ending = [zeros(1, 4) ones(1, 4) zeros(1, 4) ones(1, 4)];
%%Modulazione
% hamm_data = [start hamm_data ending];
orig_data = [start orig_data ending];
H = comm.QPSKModulator;
Tx_data = step(H, orig_data');
Tx_data = Tx_data';
%%Grafico dati da trasmettere
figure(3)
stem(Tx_data, 'linewidth',1), grid on;
title('Dati prima della trasmissione');
axis([ 0 length(Tx_data)+1 -1.5 1.5]);
%%Trasmissione audio
fTx=11025;
disp('Premi un tasto per avviare la trasmissione')
pause
disp('Inizio della trasmissione')
sound(Tx_data, fTx, 8) % per interrompere clear sound
%%RECEIVER
%%Registrazione segnale
sec = 14;
fc = 44100;
audiorec;
Ns = 4; % fc/fTx
Rx_sig = rec';
%%Filtro passa basso
N = length(Rx_sig);
df = Ns/N;
f_axis = -Ns/2:df:Ns/2-df;
Hlpf = abs(f_axis<1);
RX_FFT = fft(Rx_sig);
Rx_lpf = ifft(RX_FFT.*Hlpf);
%%Demodulazione
H = comm.QPSKDemodulator;
Rx_data = step(H, Rx_lpf'); %Rx_samp deve essere un vettore colonna per usare step
Rx_data = abs(Rx_data>0)'; %ritrasformo Rx_data in un vettore riga binario
%%-----HERE I WOULD LIKE TO DETECT THE USEFUL INFORMATION (or should I do it before???)--------
start = [ones(1,8) zeros(1,8)];
ending = [zeros(1,4) ones(1,4) zeros(1,4) ones(1,4)];
start_pos = strfind(Rx_data, start);
ending_pos = strfind(Rx_data, ending);
% Rx_data = Rx_data(1, start_pos(1+length(start)):ending_pos(1));
%%Grafico dati decodificati
figure(1)
stem(Rx_data,'linewidth',1)
title('Dati dopo la ricezione');
axis([ 0 length(Rx_data)+1 0 1.5]); %floor(length(sRx)/amp)+1
grid on;
EDIT: If someone else has this problem, maybe this solves it https://it.mathworks.com/matlabcentral/newsreader/view_thread/290369

Risposte (1)

Jordan Ross
Jordan Ross il 22 Set 2016
Hi Valerio,
In addition to the post you mentioned, the following answers post discusses removing unvoiced/silence regions from an audio signal: https://www.mathworks.com/matlabcentral/answers/168185-can-anyone-tell-me-how-to-remove-unvoiced-or-silenced-region-from-audio-file

Community Treasure Hunt

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

Start Hunting!

Translated by