0% found this document useful (0 votes)
6 views5 pages

Control Mediante Voz

Uploaded by

daniel.falcon99
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views5 pages

Control Mediante Voz

Uploaded by

daniel.falcon99
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

UNIVERSIDAD PRIVADA DEL NORTE

PROCESAMIENTO DE SEÑALES

PROGRAMA GUIDE-Matlab: Control mediante voz

Plantilla elaborado en GUIDE de Matlab

Programa en Matlab (se direcciona desde la plantilla GUIDE a través del


comando Callback)

function varargout = reconocedorGuide(varargin)


% RECONOCEDORGUIDE M-file for reconocedorGuide.fig
% RECONOCEDORGUIDE, by itself, creates a new RECONOCEDORGUIDE or raises the existing
% singleton*.
function reconocedorGuide_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject handle to figure

% --- Executes on button press in pushbutton1.


function pushbutton1_Callback(hObject, eventdata, handles) %////////BOTON 1
% hObject handle to pushbutton1 (see GCBO)

clear all
Fs = 44100/2;
y = wavrecord(1.5*Fs,Fs,1);
wavwrite(y,Fs,16,'voz.wav');
function pushbutton2_Callback(hObject, eventdata, handles) %///////BOTON 2
% hObject handle to pushbutton2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)

[y , Fs] = wavread('voz.wav');
v1 = wavread('a');
v2 = wavread('e');
v3 = wavread('i');
v4 = wavread('o');
v5 = wavread('u');

vocala = normalizar(v1);
vocale = normalizar(v2);
vocali = normalizar(v3);
vocalo = normalizar(v4);
vocalu = normalizar(v5);

transfvocala = abs(fft(vocala,32768));
transfvocale = abs(fft(vocale,32768));
transfvocali = abs(fft(vocali,32768));
transfvocalo = abs(fft(vocalo,32768));
transfvocalu = abs(fft(vocalu,32768));

voz_usuario = y;
usuario = normalizar(voz_usuario);
transfusuario = abs(fft(usuario,32768));

error(1) = mean(abs(transfvocala-transfusuario));
error(2) = mean(abs(transfvocale-transfusuario));
error(3) = mean(abs(transfvocali-transfusuario));
error(4) = mean(abs(transfvocalo-transfusuario));
error(5) = mean(abs(transfvocalu-transfusuario));

[min_error , pos] = min(error);

%ENVIO DE DATOS (Transmisión serial)


clc;
disp('BEGIN')
ser = serial('COM4');
set(ser,'BaudRate',2400);
set(ser,'DataBits',8);
set(ser,'Parity','none');
set(ser,'StopBits',1);
set(ser,'FlowControl','none');
fopen(ser);

%//////////////////////////////////
if pos ==1
set(handles.text1, 'String','A');
fprintf(ser,'%s','A')
pause(2);
elseif pos==2
set(handles.text1, 'String','E');
fprintf(ser,'%s','E')
pause(2);

elseif pos==3
set(handles.text1, 'String','I');
fprintf(ser,'%s','I')
pause(2);
elseif pos==4
set(handles.text1, 'String','O');
fprintf(ser,'%s','O')
pause(2);
elseif pos==5
set(handles.text1, 'String','U');
fprintf(ser,'%s','U')
pause(2);
end

% %ENVIO DE DATOS
% if (min(error) == error(1));
% set(handles.text1, 'String','A');
% end
% if (min_error == error(2));
% set(handles.text1, 'String','E');
% end
%
% if (min_error == error(3));
% set(handles.text1, 'String','I');
% end
%
% if (min_error == error(4));
% set(handles.text1, 'String','O');
% end
%
% if (min_error == error(5));
% set(handles.text1, 'String','U');
% end
%

%FIN DE ENVIO DE DATOS


fclose(ser);
delete(ser)
clear ser
disp('STOP')

function text1_CreateFcn(hObject, eventdata, handles)


% hObject handle to text1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called

if ispc && isequal(get(hObject,'BackgroundColor'),get(0,'defaultUicontrolBackgroundColor'))


set(hObject,'BackgroundColor','white');
end
COMUNICACIÓN VIRTUAL SERIAL PORT/PROTEUS/MATLAB/PIC16F628A

PROGRAMA: “RECONOCEDOR-DE-VOZ” (en PIC BASIC PRO)

include "modedefs.bas"

DER var BYTE


IZQ VAR BYTE

Trisb = %00000001
portb = %00000000
inicio:

serin portb.0, T2400, DER, izq

if DER == "O" then high portb.1


if IZQ == "I" then HIGH portb.2

goto inicio

Facultad de Ingeniería
Profesor: Carlos Sánchez Márquez

You might also like