Vous êtes sur la page 1sur 5

Interfaz

function varargout = Interfaz(varargin)


% INTERFAZ MATLAB code for Interfaz.fig
% INTERFAZ, by itself, creates a new INTERFAZ or raises the existing
% singleton*.
%
% H = INTERFAZ returns the handle to a new INTERFAZ or the handle to
% the existing singleton*.
%
% INTERFAZ('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in INTERFAZ.M with the given input
arguments.
%
% INTERFAZ('Property','Value',...) creates a new INTERFAZ or raises
the
% existing singleton*. Starting from the left, property value pairs
are
% applied to the GUI before Interfaz_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property
application
% stop. All inputs are passed to Interfaz_OpeningFcn via varargin.
%
% *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only
one
% instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES

% Edit the above text to modify the response to help Interfaz

% Last Modified by GUIDE v2.5 05-Jun-2018 21:33:00

% Begin initialization code - DO NOT EDIT


gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @Interfaz_OpeningFcn, ...
'gui_OutputFcn', @Interfaz_OutputFcn, ...
'gui_LayoutFcn', [] , ...
'gui_Callback', []);
if nargin && ischar(varargin{1})
gui_State.gui_Callback = str2func(varargin{1});
end

if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT

% --- Executes just before Interfaz is made visible.


function Interfaz_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% varargin command line arguments to Interfaz (see VARARGIN)

% Choose default command line output for Interfaz


handles.output = hObject;

% Update handles structure


guidata(hObject, handles);

% UIWAIT makes Interfaz wait for user response (see UIRESUME)


% uiwait(handles.figure1);

% --- Outputs from this function are returned to the command line.
function varargout = Interfaz_OutputFcn(hObject, eventdata, handles)
% varargout cell array for returning output args (see VARARGOUT);
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)

% Get default command line output from handles structure


varargout{1} = handles.output;

% --- Executes on button press in Grabar.


function Grabar_Callback(hObject, eventdata, handles)
% hObject handle to Grabar (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
addpath C:\Users\E\Documents\Camilo\Sensores\Proyecto\Proyecto
a = audiorecorder(8000,24,1);
record(a, 5);
pause(3);
b = getaudiodata(a);
figure(1)
subplot(2,1,1);
plot(b);
title('record');
subplot(2,1,2);
c=fft(b);
plot(abs(c));
title('expectro');
audiowrite('Grabacion.wav',b,8000);
plot(handles.Original,abs(c));
sound(b);

% --- Executes on button press in PasaBaja.


function PasaBaja_Callback(hObject, eventdata, handles)
% hObject handle to PasaBaja (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
addpath C:\Users\E\Documents\Camilo\Sensores\Proyecto\Proyecto
[y fs]= audioread('Grabacion.wav');%lectura de nuestro archivo de audio y
almacenado en variables
%sound(y,fs);%prueba de captura de sonido
L = length(y);%determina la longitud
NFFT = 2^nextpow2(L);%longitud de la se?al para fourier
Y = fft(y,NFFT)/L; %transformada rapida de fourier
f= fs/2*linspace(0,1,NFFT/2+1);
y1 = filter(PasaBaja,y); %se aplica el filtro a nuestro archivo de audio
audiowrite('Prueba bajo.wav',y1,fs);
c=fft(y1);
%plot(abs(c));
plot(handles.Actual,abs(c));
sound(y1);
% handles structure with handles and user data (see GUIDATA)

% --- Executes on button press in PasaBanda.


function PasaBanda_Callback(hObject, eventdata, handles)
% hObject handle to PasaBanda (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
addpath C:\Users\E\Documents\Camilo\Sensores\Proyecto\Proyecto
[y fs]= audioread('Grabacion.wav');%lectura de nuestro archivo de audio y
almacenado en variables
%sound(y,fs);%prueba de captura de sonido
L = length(y);%determina la longitud
NFFT = 2^nextpow2(L);%longitud de la se?al para fourier
Y = fft(y,NFFT)/L; %transformada rapida de fourier
f= fs/2*linspace(0,1,NFFT/2+1);
y1 = filter(PasaBanda,y); %se aplica el filtro a nuestro archivo de audio
audiowrite('Prueba banda.wav',y1,fs);
c=fft(y1);
%plot(abs(c));
plot(handles.Actual,abs(c));
sound(y1);

% --- Executes on button press in PasaAlta.


function PasaAlta_Callback(hObject, eventdata, handles)
% hObject handle to PasaAlta (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
addpath C:\Users\E\Documents\Camilo\Sensores\Proyecto\Proyecto
[y fs]= audioread('Grabacion.wav');%lectura de nuestro archivo de audio y
almacenado en variables
%sound(y,fs);%prueba de captura de sonido
L = length(y);%determina la longitud
NFFT = 2^nextpow2(L);%longitud de la se?al para fourier
Y = fft(y,NFFT)/L; %transformada rapida de fourier
f= fs/2*linspace(0,1,NFFT/2+1);
y1 = filter(PasaAlta,y); %se aplica el filtro a nuestro archivo de audio
audiowrite('Prueba alto.wav',y1,fs);
c=fft(y1);
%plot(abs(c));
plot(handles.Actual,abs(c));
sound(y1);
Pasa Bajo

function Hd = PasaBaja
%PASABAJA Returns a discrete-time filter object.

% MATLAB Code
% Generated by MATLAB(R) 9.0 and the Signal Processing Toolbox 7.2.
% Generated on: 04-Jun-2018 22:35:56

% Chebyshev Type I Lowpass filter designed using FDESIGN.LOWPASS.

% All frequency values are in Hz.


Fs = 8000; % Sampling Frequency

Fpass = 1000; % Passband Frequency


Fstop = 1500; % Stopband Frequency
Apass = 1; % Passband Ripple (dB)
Astop = 80; % Stopband Attenuation (dB)
match = 'passband'; % Band to match exactly

% Construct an FDESIGN object and call its CHEBY1 method.


h = fdesign.lowpass(Fpass, Fstop, Apass, Astop, Fs);
Hd = design(h, 'cheby1', 'MatchExactly', match);

% [EOF]

Pasa Alto

function Hd = PasaAlta
%PASAALTA Returns a discrete-time filter object.

% MATLAB Code
% Generated by MATLAB(R) 9.0 and the Signal Processing Toolbox 7.2.
% Generated on: 04-Jun-2018 23:16:51

% Chebyshev Type II Highpass filter designed using FDESIGN.HIGHPASS.

% All frequency values are in Hz.


Fs = 28000; % Sampling Frequency

Fstop = 6000; % Stopband Frequency


Fpass = 8000; % Passband Frequency
Astop = 80; % Stopband Attenuation (dB)
Apass = 1; % Passband Ripple (dB)
match = 'stopband'; % Band to match exactly

% Construct an FDESIGN object and call its CHEBY2 method.


h = fdesign.highpass(Fstop, Fpass, Astop, Apass, Fs);
Hd = design(h, 'cheby2', 'MatchExactly', match);

% [EOF]

Pasa Banda
function Hd = PasaBanda
%PASABANDA Returns a discrete-time filter object.

% MATLAB Code
% Generated by MATLAB(R) 9.0 and the Signal Processing Toolbox 7.2.
% Generated on: 05-Jun-2018 17:17:59

% FIR Window Bandpass filter designed using the FIR1 function.

% All frequency values are in Hz.


Fs = 12000; % Sampling Frequency

N = 35; % Order
Fc1 = 1000; % First Cutoff Frequency
Fc2 = 5000; % Second Cutoff Frequency
flag = 'scale'; % Sampling Flag
% Create the window vector for the design algorithm.
win = rectwin(N+1);

% Calculate the coefficients using the FIR1 function.


b = fir1(N, [Fc1 Fc2]/(Fs/2), 'bandpass', win, flag);
Hd = dfilt.dffir(b);

% [EOF]

Vous aimerez peut-être aussi