Code covered by the BSD License  

Highlights from
Subband coders

image thumbnail

Subband coders

by

 

07 Feb 2014 (Updated )

This MATLAB exercise implements a two-band subband coder.

Callbacks_subband_coders_GUI25(f,C,start_path)
function Callbacks_subband_coders_GUI25(f,C,start_path)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%SENSE COMPUTER AND SET FILE DELIMITER
switch(computer)				
    case 'MACI64',		char= '/';
    case 'GLNX86',  char='/';
    case 'PCWIN',	char= '\';
    case 'PCWIN64', char='\';
    case 'GLNXA64', char='/';
end

x=C{1,1};
y=C{1,2};
a=C{1,3};
b=C{1,4};
u=C{1,5};
v=C{1,6};
m=C{1,7};
n=C{1,8};
lengthbutton=C{1,9};
widthbutton=C{1,10};
enterType=C{1,11};
enterString=C{1,12};
enterLabel=C{1,13};
noPanels=C{1,14};
noGraphicPanels=C{1,15};
noButtons=C{1,16};
labelDist=C{1,17};%distance that the label is below the button
noTitles=C{1,18};
buttonTextSize=C{1,19};
labelTextSize=C{1,20};
textboxFont=C{1,21};
textboxString=C{1,22};
textboxWeight=C{1,23};
textboxAngle=C{1,24};
labelHeight=C{1,25};
fileName=C{1,26};
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%PANELS
for j=0:noPanels-1
uipanel('Parent',f,...
'Units','Normalized',...
'Position',[x(1+4*j) y(1+4*j) x(2+4*j)-x(1+4*j) y(3+4*j)-y(2+4*j)]);
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%GRAPHIC PANELS
for i=0:noGraphicPanels-1
switch (i+1)
case 1
graphicPanel1 = axes('parent',f,...
'Units','Normalized',...
'Position',[a(1+4*i) b(1+4*i) a(2+4*i)-a(1+4*i) b(3+4*i)-b(2+4*i)],...
'GridLineStyle','--');
case 2
graphicPanel2 = axes('parent',f,...
'Units','Normalized',...
'Position',[a(1+4*i) b(1+4*i) a(2+4*i)-a(1+4*i) b(3+4*i)-b(2+4*i)],...
'GridLineStyle','--');
case 3
graphicPanel3 = axes('parent',f,...
'Units','Normalized',...
'Position',[a(1+4*i) b(1+4*i) a(2+4*i)-a(1+4*i) b(3+4*i)-b(2+4*i)],...
'GridLineStyle','--');
case 4
graphicPanel4 = axes('parent',f,...
'Units','Normalized',...
'Position',[a(1+4*i) b(1+4*i) a(2+4*i)-a(1+4*i) b(3+4*i)-b(2+4*i)],...
'GridLineStyle','--');
case 5
graphicPanel5 = axes('parent',f,...
'Units','Normalized',...
'Position',[a(1+4*i) b(1+4*i) a(2+4*i)-a(1+4*i) b(3+4*i)-b(2+4*i)],...
'GridLineStyle','--');
case 6
graphicPanel6 = axes('parent',f,...
'Units','Normalized',...
'Position',[a(1+4*i) b(1+4*i) a(2+4*i)-a(1+4*i) b(3+4*i)-b(2+4*i)],...
'GridLineStyle','--');
case 7
graphicPanel7 = axes('parent',f,...
'Units','Normalized',...
'Position',[a(1+4*i) b(1+4*i) a(2+4*i)-a(1+4*i) b(3+4*i)-b(2+4*i)],...
'GridLineStyle','--');
case 8
graphicPanel8 = axes('parent',f,...
'Units','Normalized',...
'Position',[a(1+4*i) b(1+4*i) a(2+4*i)-a(1+4*i) b(3+4*i)-b(2+4*i)],...
'GridLineStyle','--');
case 9
graphicPanel9 = axes('parent',f,...
'Units','Normalized',...
'Position',[a(1+4*i) b(1+4*i) a(2+4*i)-a(1+4*i) b(3+4*i)-b(2+4*i)],...
'GridLineStyle','--');
case 10
graphicPanel10 = axes('parent',f,...
'Units','Normalized',...
'Position',[a(1+4*i) b(1+4*i) a(2+4*i)-a(1+4*i) b(3+4*i)-b(2+4*i)],...
'GridLineStyle','--');
end
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%TITLE BOXES
for k=0:noTitles-1
switch (k+1)
case 1
titleBox1 = uicontrol('parent',f,...
'Units','Normalized',...
'Position',[u(1+4*k) v(1+4*k) u(2+4*k)-u(1+4*k) v(3+4*k)-v(2+4*k)],...
'Style','text',...
'FontSize',textboxFont{k+1},...
'String',textboxString(k+1),...
'FontWeight',textboxWeight{k+1},...
'FontAngle',textboxAngle{k+1});
end
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%BUTTONS
for i=0:(noButtons-1)
enterColor='w';
if strcmp(enterType{i+1},'pushbutton')==1 ||strcmp(enterType{i+1},'text')==1
enterColor='default';
end
if (strcmp(enterLabel{1,(i+1)},'')==0 &&...
        strcmp(enterLabel{1,(i+1)},'...')==0) %i.e. there is a label
%creating a label for some buttons
uicontrol('Parent',f,...
'Units','Normalized',...
'Position',[m(1+2*i) n(1+2*i)-labelDist-labelHeight(i+1) ...
(m(2+2*i)-m(1+2*i)) labelHeight(i+1)],...
'Style','text',...
'String',enterLabel{i+1},...
'FontSize', labelTextSize(i+1),...
'HorizontalAlignment','center');
end
switch (i+1)
case 1
button1=uicontrol('Parent',f,...
'Units','Normalized',...
'Position',[m(1+2*i) n(1+2*i) (m(2+2*i)-m(1+2*i)) (n(2+2*i)-n(1+2*i))],...
'Style',enterType{i+1},...
'String',enterString{i+1},...
'FontSize', buttonTextSize(1+i),...
'BackgroundColor',enterColor,...
'HorizontalAlignment','center',...
'Callback',@button1Callback);
case 2
button2=uicontrol('Parent',f,...
'Units','Normalized',...
'Position',[m(1+2*i) n(1+2*i) (m(2+2*i)-m(1+2*i)) (n(2+2*i)-n(1+2*i))],...
'Style',enterType{i+1},...
'String',enterString{i+1},...
'FontSize', buttonTextSize(1+i),...
'BackgroundColor',enterColor,...
'HorizontalAlignment','center',...
'Callback',@button2Callback);
case 3
button3=uicontrol('Parent',f,...
'Units','Normalized',...
'Position',[m(1+2*i) n(1+2*i) (m(2+2*i)-m(1+2*i)) (n(2+2*i)-n(1+2*i))],...
'Style',enterType{i+1},...
'String',enterString{i+1},...
'FontSize', buttonTextSize(1+i),...
'BackgroundColor',enterColor,...
'HorizontalAlignment','center',...
'Callback',@button3Callback);
case 4
button4=uicontrol('Parent',f,...
'Units','Normalized',...
'Position',[m(1+2*i) n(1+2*i) (m(2+2*i)-m(1+2*i)) (n(2+2*i)-n(1+2*i))],...
'Style',enterType{i+1},...
'String',enterString{i+1},...
'FontSize', buttonTextSize(1+i),...
'BackgroundColor',enterColor,...
'HorizontalAlignment','center',...
'Callback',@button4Callback);
case 5
button5=uicontrol('Parent',f,...
'Units','Normalized',...
'Position',[m(1+2*i) n(1+2*i) (m(2+2*i)-m(1+2*i)) (n(2+2*i)-n(1+2*i))],...
'Style',enterType{i+1},...
'String',enterString{i+1},...
'FontSize', buttonTextSize(1+i),...
'BackgroundColor',enterColor,...
'HorizontalAlignment','center',...
'Callback',@button5Callback);
case 6
button6=uicontrol('Parent',f,...
'Units','Normalized',...
'Position',[m(1+2*i) n(1+2*i) (m(2+2*i)-m(1+2*i)) (n(2+2*i)-n(1+2*i))],...
'Style',enterType{i+1},...
'String',enterString{i+1},...
'FontSize', buttonTextSize(1+i),...
'BackgroundColor',enterColor,...
'HorizontalAlignment','center',...
'Callback',@button6Callback);
case 7
button7=uicontrol('Parent',f,...
'Units','Normalized',...
'Position',[m(1+2*i) n(1+2*i) (m(2+2*i)-m(1+2*i)) (n(2+2*i)-n(1+2*i))],...
'Style',enterType{i+1},...
'String',enterString{i+1},...
'FontSize', buttonTextSize(1+i),...
'BackgroundColor',enterColor,...
'HorizontalAlignment','center',...
'Callback',@button7Callback);
case 8
button8=uicontrol('Parent',f,...
'Units','Normalized',...
'Position',[m(1+2*i) n(1+2*i) (m(2+2*i)-m(1+2*i)) (n(2+2*i)-n(1+2*i))],...
'Style',enterType{i+1},...
'String',enterString{i+1},...
'FontSize', buttonTextSize(1+i),...
'BackgroundColor',enterColor,...
'HorizontalAlignment','center',...
'Callback',@button8Callback);
end
end

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%USER CODE FOR THE VARIABLES AND CALLBACKS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Initialize Variables
    curr_file=1;
    fs=8000;
    directory_name='abcd';
    wav_file_names='abce';
    fin_path='filename';
    fname='output';
    fnameo='output';
    nsamp=1;
    x=[];
    xin=[];
    ysav=[];
    fs=10000;
    ss=1;
    es=19400;
    bbf='h24D';
    bbfind=1;
    bits=12;
    nbits=[12 12];
    filter=[];
    nbitsc=[12 12];
    snr=100;

% Name the GUI
    set(f,'Name','subband_coder');

% CALLBACKS
% Callback for button1 -- Get Speech Files Directory
 function button1Callback(h,eventdata)
     directory_name=uigetdir(start_path,'dialog_title');
%      if isempty(getpref('SpeechApps'))
%          url = sprintf('%s%s%s',...
%              'http://www.mathworks.com/matlabcentral/fileexchange/',...
%              '42911-speech-and-audio-files-for-speech-processing-excercises',...
%              '?download=true');
%          [saveloc,~,~] = fileparts(pwd); %save to one level up from current folder
%          % Create a waitbar during download
%          h = waitbar(0.35,'This may take several minutes...',...
%              'Name','Downloading Speech Files...');
%          % Download the zipped file
%          [filestr,status] = urlwrite(url,[saveloc filesep 'speech_files.zip'],...
%              'Timeout',10);
%          if status
%              delete(h);
%              hh1= helpdlg('Downloaded. Select a location to UNZIP the speech files.');
%              uiwait(hh1);
%              unziploc = uigetdir(saveloc,'Select a location to unzip the speech files');
%              h2 = waitbar(0.2,'This may take a minute...',...
%                  'Name','Unzipping the Speech Files to Location Selected...');
%              unzip(filestr,unziploc);
%              delete(h2)
%              addpref('SpeechApps','path',unziploc);
%              hh2= helpdlg('Ready. Select the speech_files folder in the next window');
%              uiwait(hh2);
%          else
%              warndlg('No Internet Connection to MATLAB Central!');
%          end
%          
%      else
%      end
%      directory_name=uigetdir(getpref('SpeechApps','path'));
     A=strvcat(strcat((directory_name),[char,'*.wav']));
     struct_filenames=dir(A);
     wav_file_names={struct_filenames.name};
     set(button2,'String',wav_file_names);
     
% once the popupmenu/drop down menu is created, by default, the first
% selection from the popupmenu/drop down menu id not called
    indexOfDrpDwnMenu=1;
    
% by default first option from the popupmenu/dropdown menu will be loaded
    [curr_file,fs]=loadSelection(directory_name,wav_file_names,indexOfDrpDwnMenu);
 end

% Callback for button2 -- Choose speech file for play and plot
 function button2Callback(h,eventdata)
     indexOfDrpDwnMenu=get(button2,'val');
     [curr_file,fs]=loadSelection(directory_name,wav_file_names,indexOfDrpDwnMenu);
 end

%*************************************************************************
% function -- load selection from designated directory and file
%
function [curr_file,fs]=loadSelection(directory_name,wav_file_names,...
    indexOfDrpDwnMenu);
%
% read in speech/audio file
% fin_path is the complete path of the .wav file that is selected
    fin_path=strcat(directory_name,char,strvcat(wav_file_names(indexOfDrpDwnMenu)));
    
% clear speech/audio file
    clear curr_file;
    
% read in speech/audio signal into curr_file; sampling rate is fs 
    [curr_file,fs]=wavread(fin_path);
    xin=curr_file*32768;
    
% create title information with file, sampling rate, number of samples
    fname=wav_file_names(indexOfDrpDwnMenu);
    FS=num2str(fs);
    nsamp=num2str(length(curr_file));
    file_info_string=strcat('  file: ',fname,', fs: ',FS,' Hz, nsamp:',nsamp);
    
% read in filename (fname) from cell array
    fname=wav_file_names{indexOfDrpDwnMenu};
    fnameo=fname;
end

% Callback for button3 -- bbf: baseband filter
 function button3Callback(h,eventdata)
     bbfind=get(button3,'val');
     bbfind=bbfind+1;
     if (bbfind == 2)
         bbf='h24D';
     elseif (bbfind == 3)
         bbf='h48D';
     elseif (bbfind == 4)
         bbf='h8A';
     elseif (bbfind == 5)
         bbf='h12A';
     elseif (bbfind == 6)
         bbf='h12B';
     elseif (bbfind == 7)
         bbf='h16A';
     elseif (bbfind == 8)
         bbf='h16B';
     elseif (bbfind == 9)
         bbf='h16C';
     elseif (bbfind == 10)
         bbf='h24B';
     elseif (bbfind == 11)
         bbf='h24C';
     elseif (bbfind == 12)
         bbf='h32C';
     elseif (bbfind == 13)
         bbf='h32D';
     elseif (bbfind == 14)
         bbf='h32E';
     elseif (bbfind == 15)
         bbf='h48C';
     elseif (bbfind == 16)
         bbf='h48E';
     elseif (bbfind == 17)
         bbf='h64D';
     elseif (bbfind == 18)
         bbf='h64E';
     end
 end

% Callback for button4 -- bits: number of quantizer bits
 function button4Callback(h,eventdata)
     bits=get(button4,'val');
    if (bits == 1) bits=12; 
    end
    bits
 end

% Callback for button5 -- Run Subband Coder
 function button5Callback(h,eventdata)
     
% check parameters for playing pitch period contours
    button3Callback(h,eventdata);
    button4Callback(h,eventdata);
    
% setup baseband coder filters and process signal
    setup_subband_coder(xin,fs,bbf,bbfind,nbits,fname);
 end

%**********************************************************************

    function setup_subband_coder(xin,fs,bbf,bbfind,nbits,fname)
%
% create QMF filters; create subband coder using QMF
% versions of the filters; process speech using subband coder; quantize
% signal to one of 9 bits/sample levels; measure system response and
% overall signal-to-noise ratio

% Inputs:
%   xin: speech signal array
%   fs: speech sampling rate
%   bbf: baseband filter name (h24D, ...)
%   bbfind: baseband filter index (2-18)
%   nbits: number of bits/sample in quantizer
%   fname: speech filename

    ss=1;
    es=length(xin);

% load baseband filter
    str=load('QMF_filters');
    fno=bbfind-1;

    if (bbfind == 2)
        filter=str.h24D;
    elseif (bbfind == 3)
        filter=str.h48D;
    elseif (bbfind == 4)
        filter=str.h8A;
    elseif (bbfind == 5)
        filter=str.h12A;
    elseif (bbfind == 6)
        filter=str.h12B;
    elseif (bbfind == 7)
        filter=str.h16A;
    elseif (bbfind == 8)
        filter=str.h16B;
    elseif (bbfind == 9)
        filter=str.h16C;
    elseif (bbfind == 10)
        filter=str.h24B;
    elseif (bbfind == 11)
        filter=str.h24C;
    elseif (bbfind == 12)
        filter=str.h32C;
    elseif (bbfind == 13)
        filter=str.h32D;
    elseif (bbfind == 14)
        filter=str.h32E;
    elseif (bbfind == 15)
        filter=str.h48C;
    elseif (bbfind == 16)
        filter=str.h48E;
    elseif (bbfind == 17)
        filter=str.h64D;
    elseif (bbfind == 18)
        filter=str.h64E;
    end
    nleng=length(filter);
    plotresp_GUI(filter,nleng,fs,bbf);
    
% choose quantizer levels
% nbitsc(1)=number of quantization bits for lower channel
% nbitsc(2)=number of quantization bits for upper channel
            nbits=[bits bits];

% process speech by subband coder
            ysav=subband_filter(xin,filter,fs,nbits);
     
%  measure system response and snr
            subband_system_snr_GUI(filter,nleng,nbits,fno,bbf,fs);
    end

%**********************************************************************
function plotresp_GUI(h0,N,fs,fname)
%
% function to plot impulse and frequency responses of 2-band QMF filters
%
% Inputs:
%   h0: lower band impulse response
%   N: length of lower band impulse response
%   fs: sampling rate of input signal
%   fname: file with lower band impulse response

% form upper band impulse response from lower band response
    h1=(-1).^(0:N-1)'.*h0;
    
% use fft size of 1000
    nfft=1000;
    
% clear graphics Panel 8
        reset(graphicPanel8);
        axes(graphicPanel8);
        cla;
    
% plot lower band impulse response in graphics Panel 8
    plot(0:N-1,h0,'k','LineWidth',2);grid on,axis tight;
    xpp=['Time in Samples; fs=',num2str(fs),' samples/second'];
        xlabel(xpp),ylabel('h0');legend('lower band impulse response');
        
% clear graphics Panel 9
        reset(graphicPanel9);
        axes(graphicPanel9);
        cla;
        
% plot upper band impulse response in graphics Panel 9
    plot(0:N-1,h1,'k','LineWidth',2);grid on,axis tight;
        xlabel(xpp),ylabel('h1');legend('upper band impulse response');
        
% calculate log magnitude frequency responses of lower and upper band filters
    h0log=20*log10(abs(fft(h0,nfft)));
    h1log=20*log10(abs(fft(h1,nfft)));
    h0lin=abs(fft(h0,nfft));
    h1lin=abs(fft(h1,nfft));
    h0linsq=h0lin.*h0lin;
    h1linsq=h1lin.*h1lin;
    hsum=h0linsq+h1linsq;
    
% clear graphics Panel 5
        reset(graphicPanel5);
        axes(graphicPanel5);
        cla;
        
% plot lower band log magnitude frequency response in graphics Panel 5
    plot(0:fs/nfft:fs/2,h0log(1:nfft/2+1),'k','LineWidth',2);
        grid on,axis ([0 fs/2 -50 10]);xlabel('Frequency (Hz)'),ylabel('dB');
        legend('lower band log frequency response');
        
% clear graphics Panel 6
        reset(graphicPanel6);
        axes(graphicPanel6);
        cla;
        
% plot upper band log magnitude frequency response in graphics Panel 6
    plot(0:fs/nfft:fs/2,h1log(1:nfft/2+1),'k','LineWidth',2);
        grid on,axis ([0 fs/2 -50 10]);xlabel('Frequency (Hz)'),ylabel('(dB)');
        legend('upper band log frequency response');
        
% clear graphics Panel 2
        reset(graphicPanel2);
        axes(graphicPanel2);
        cla;
        
% plot lower band linear magnitude frequency response in graphics Panel 2
    plot(0:fs/nfft:fs/2,h0lin(1:nfft/2+1),'k','LineWidth',2);
        grid on,axis ([0 fs/2 0 1]);xlabel('Frequency (Hz)'),ylabel('Mag');
        legend('lower band linear frequency response');
        
% clear graphics Panel 3
        reset(graphicPanel3);
        axes(graphicPanel3);
        cla;
        
% plot upper band linear magnitude frequency response in graphics Panel 3
    plot(0:fs/nfft:fs/2,h1lin(1:nfft/2+1),'k','LineWidth',2);
        grid on,axis ([0 fs/2 0 1]);xlabel('Frequency (Hz)'),ylabel('Mag');
        legend('upper band linear frequency response');
        
% clear graphics Panel 1
        reset(graphicPanel1);
        axes(graphicPanel1);
        cla;
        
% plot composite filter bank linear magnitude frequency response in
% graphics Panel 1
    plot(0:fs/nfft:fs/2,hsum(1:nfft/2+1),'k','LineWidth',2);
        grid on,axis ([0 fs/2 min(hsum) max(hsum)]);
        xlabel('Frequency (Hz)'),ylabel('Mag');
        legend('composite linear frequency response');
    stitle=sprintf('QMF Filter:%s, composite response',fname);
end

%********************************************************************
function subband_system_snr_GUI(filter,nleng,nbits,nfilt,bbf,fs)
%
% function to computer 2-band subband coder SNR
%
% Inputs:
%	filter: subband filter impulse response (QMF filter)
%   nleng: length of filter impulse response
%   nbits: number of bits for quantization of each channel
%   nfilt: filter number test (1,2,...,)
%   bbf: subband filter name (e.g., h8A, h12A, ...)
%   fs: sampling frequency of input speech
%
% Output:
%   computed SNR

% use impulse to measure overall system response
    ximp=[1; zeros(200,1)];
    y=subband(ximp,filter,nbits);
    
% plot 2-band coder response to impulse
% clear graphics Panel 10
        reset(graphicPanel10);
        axes(graphicPanel10);
        cla;
    
% plot 2-band subband coder composite impulse response in graphics Panel 10
    plot(0:length(y)-1,y,'k','LineWidth',2);
    xpp=['Time in Samples; fs=',num2str(fs),' samples/second'];
        grid on,xlabel(xpp),ylabel('Impulse Response');
        legend('composite impulse response');
    stitle=strcat('2-band subband coder using filter:',bbf,' -- nbits:',num2str(nbits(1)));
        
% display fname and signal processing parameters in titleBox1
        set(titleBox1,'string',stitle);
        set(titleBox1,'FontSize',20);
        
% plot log magnitude and phase responses of overall 2-band subband coder
    [H,W]=freqz(y,1,512);
    W=W*fs/(2*pi);
    
% clear graphics Panel 7
        reset(graphicPanel7);
        axes(graphicPanel7);
        cla;
        
% plot composite log magnitude frequency response of 2-band subband coder
% in graphics Panel 7
    plot(W,20*log10(abs(H)),'k','LineWidth',2),...
        grid on,xlabel('Frequency(Hz)'),ylabel('Log Magnitude (db)');
    legend('composite log frequency response');
    
% clear graphics Panel 4
        reset(graphicPanel4);
        axes(graphicPanel4);
        cla;
        
% plot composite phase response of 2-band subband coder in graphics Panel 4
    plot(W,atan2(imag(H),real(H)),'k','LineWidth',2),...
        grid on,xlabel('Frequency (Hz)'),ylabel('Phase in Degrees');
    legend('compositle phase response');
        
% measure signal-to-noise ratio
% first create gaussian noise signal
    xnoise=randn(1000,1);
    
% filter xnoise using 2-band subband coder with nbits quantization of
% channel signals
    y=subband(xnoise,filter,nbits);
    
% form the difference between the input signal and the quantized output
% signal
    e=xnoise(1:1000-nleng)-y(nleng:999);
    
% compute SNR
    snr=10*log10(sum(xnoise(1:1000-nleng).^2)/sum(e(1:1000-nleng).^2));
    fprintf('nbits:%d, snr:%7.2f db \n',nbits(1),snr);
    set(button7,'string',num2str(snr));
end

% Callback for button7 -- display SNR
    function button7Callback(h,eventdata)
        set(button7,'string',num2str(snr));
    end

% Callback for button8 -- play original - coded - original
    function button8Callback(h,eventdata);
length(xin)
length(y)
fs
        soundsc(xin,fs);pause(0.25);
        soundsc(ysav,fs); pause(0.25);
        soundsc(xin,fs);
    end

% Callback for button6 -- Close GUI
 function button6Callback(h,eventdata)
     fclose('all');
     close(gcf);
 end
end

Contact us