当前位置:网站首页>Chapter 19 signal lamp image simulation control technology based on speech recognition
Chapter 19 signal lamp image simulation control technology based on speech recognition
2022-06-22 02:05:00 【Haibao 7】

With the development of science and technology , Increased traffic flow on roads , Thus causing traffic congestion , Environmental pollution , And energy waste . The general solution is to expand the road, etc , However, due to the increase of urban population, roads are far from meeting the growth rate of vehicles . Therefore, intelligent transportation system is proposed , Various detection technologies and intelligent control algorithms are used to improve the traffic capacity of the road network . There is no doubt about it , In automotive intelligent technology 、 Automobile new energy technology 、 Automotive electronics is a race track for the best . The requirements of intelligent driving technology are also constantly improving .
Intelligent vehicle teaching platform 、 Intelligent network teaching platform 、 Automobile electronic teaching equipment 、 In the loop simulation system , At present, there are many mainstream systems , Common basic parts and algorithm development , Intelligent driving module , It is better to get started matlab platform .MATLAB/Simulink The two key parts of the are :m The application of the language and the development of various toolkits .
The signal lamp image analog control technology based on speech recognition is presented in this paper , That is to say matlab Application of a set of visual programs developed on the platform .
The main program is as follows :
function varargout = EmotionRec(varargin)
% EMOTIONREC M-file for EmotionRec.fig
% EMOTIONREC, by itself, creates a new EMOTIONREC or raises the existing
% singleton*.
%
% H = EMOTIONREC returns the handle to a new EMOTIONREC or the handle to
% the existing singleton*.
%
% EMOTIONREC('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in EMOTIONREC.M with the given input arguments.
%
% EMOTIONREC('Property','Value',...) creates a new EMOTIONREC or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before EmotionRec_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to EmotionRec_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 EmotionRec
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @EmotionRec_OpeningFcn, ...
'gui_OutputFcn', @EmotionRec_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 EmotionRec is made visible.
function EmotionRec_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 EmotionRec (see VARARGIN)
% Choose default command line output for EmotionRec
handles.output = hObject;
addpath(fullfile(pwd, 'voicebox'));
clc;
axes(handles.axes1); cla reset; box on;
set(gca, 'XTick', [], 'YTick', [], ...
'XTickLabel', '', 'YTickLabel', '', 'Color', [0.7020 0.7804 1.0000]);
set(handles.axes2, 'XTick', [], 'YTick', [], ...
'XTickLabel', '', 'YTickLabel', '', 'Color', [0.7020 0.7804 1.0000], ...
'Box', 'On');
handles.dirName = 0;
handles.S = 0;
handles.fileurl = 0;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes EmotionRec wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = EmotionRec_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 pushbutton1.
function pushbutton1_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
%% Load voice library
% Database path
dirName = './wav/Database';
dirName = uigetdir(dirName);
if isequal(dirName, 0)
return;
end
msgbox(sprintf(' load %s success !', dirName), ' Prompt information ');
handles.dirName = dirName;
guidata(hObject, handles);
% --- Executes on button press in pushbutton2.
function pushbutton2_Callback(hObject, eventdata, handles)
% 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)
%% Extract feature parameters
if isequal(handles.dirName, 0)
msgbox(' Please select the audio library Directory ', ' Prompt information ', 'modal');
return;
end
S = GetDatabase(handles.dirName);
handles.S = S;
guidata(hObject, handles);
msgbox(' Audio signal feature extraction is completed ', ' Prompt information ', 'modal');
% --- Executes on button press in pushbutton3.
function pushbutton3_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton3 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
%% Select test file
file = './wav/Test/1.wav';
[Filename, Pathname] = uigetfile('*.wav', ' Open a new voice file ',...
file);
if Filename == 0
return;
end
fileurl = fullfile(Pathname,Filename);
[signal, fs] = audioread(fileurl);
axes(handles.axes1); cla reset; box on;
plot(signal); title(' Voice signal to be recognized ', 'FontWeight', 'Bold');
msgbox(' Loading voice file succeeded ', ' Prompt information ', 'modal');
handles.fileurl = fileurl;
handles.signal = signal;
handles.fs = fs;
guidata(hObject, handles);
% --- Executes on button press in pushbutton4.
function pushbutton4_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton4 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
%% distinguish
if isequal(handles.fileurl, 0)
msgbox(' Please select an audio file ', ' Prompt information ', 'modal');
return;
end
if isequal(handles.S, 0)
msgbox(' Please calculate the audio library MFCC features ', ' Prompt information ', 'modal');
return;
end
S = handles.S;
[num, MC] = Reco(S, handles.fileurl);
result = S(num).name;
result = result(1:2);
c = 'r';
switch result
case ' open '
c = 'r';
case ' close '
c = 'g';
case ' continue '
c = 'b';
case ' Start '
c = 'c';
case ' stop it '
c = 'y';
case ' Pause '
c = 'm';
end
PlotInfo(handles.axes2, c);
msgbox(' Identification complete ', ' Prompt information ', 'modal');
% --- Executes on button press in pushbutton5.
function pushbutton5_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton5 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
%% Play the test file
if isequal(handles.fileurl, 0)
msgbox(' Please select an audio file ', ' Prompt information ', 'modal');
return;
end
sound(handles.signal, handles.fs);
% --- Executes on button press in pushbutton7.
function pushbutton7_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton7 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Send control command button
str = get(handles.textReconResult, 'String');
if isequal(strtrim(str), '')
msgbox(' No control command !', ' Prompt information ', 'modal');
return;
end
str = sprintf(' Control command "%s" Has been sent !', str);
msgbox(str, ' Prompt information ', 'modal');
Directory functions 
Recognize sound processing .
Z Final effect 

Partial subfunction :
function [num, MC] = Reco(S, file)
MC = GetFeather(file);
N = [];
h = waitbar(0, '', 'Name', ' Audio recognition ...');
steps = length(MC);
for i = 1 : length(MC)
mc = MC{
i};
mindis = [];
for j = 1 : length(S)
MCJ = S(j).MC;
disk = [];
for k = 1 : length(MCJ)
mck = MCJ{
k};
disk(k) = norm(mc-mck);
end
mindis = [mindis min(disk)];
end
[mind, indd] = min(mindis(:));
N = [N indd];
waitbar(i/steps, h, sprintf(' Disposed of :%d%%', round(i/steps*100)));
end
close(h);
Ni = [];
for i = 1 : length(S)
Ni(i) = numel(find(N == i));
end
[maxNi, ind] = max(Ni);
num = ind;
Subfunctions
enframe.m
function f=enframe(x,win,inc)
nx=length(x);
nwin=length(win);
if (nwin == 1)
len = win;
else
len = nwin;
end
if (nargin < 3)
inc = len;
end
nf = fix((nx-len+inc)/inc);
f=zeros(nf,len);
indf= inc*(0:(nf-1)).';
inds = (1:len);
f(:) = x(indf(:,ones(1,len))+inds(ones(nf,1),:));
if (nwin > 1)
w = win(:)';
f = f .* w(ones(nf,1),:);
end
Get the characteristic subfunction
GetFeather.m
function MC = GetFeather(file, flag)
if nargin < 2
flag = 0;
end
if nargin < 1
file = '.\wav\Database\ close \ close _bsm.wav';
end
[signal, fs] = audioread(file);
framelength = 1024;
framenumber = fix(length(signal)/framelength);
for L = 1:framenumber;
for m = 1:framelength;
framedata(m) = signal((L-1)*framelength+m);
end
E(L) = sum(framedata.^2);
end
if flag
figure; plot(E);
end
meanE = mean(E);
startflag=0;
startnum=0;
startframe=0;
endframe = 0;
S = [];
for L = 1 : framenumber
if E(L) > meanE
startnum = startnum+1;
if startnum == 2
startframe = L-2;
startflag = 1;
end
end
if E(L) < meanE
if startflag == 1
endframe = L-1;
S = [S; startframe endframe];
startflag = 0;
startnum = 0;
end
end
end
if size(S, 1) > 1
ms = min(S(:, 1));
es = max(S(:, 2));
else
ms = S(1);
es = S(2);
end
MC = [];
snum = 1;
for i = ms : es
si = (i-1)*framelength;
ei = i*framelength;
fi = signal(si:ei);
mc = mfcc(fi,fs);
MC{
snum} = mc;
snum = snum + 1;
end
Voice signal library 
Sound processing function toolkit 
The source code of this supporting document Download portal –=>
https://download.csdn.net/download/dongbao520/85695370
边栏推荐
猜你喜欢

GAMES-101-个人总结归纳-Transformation

Games-101 personal summary transformation

Commission contract on BSV (3)

Machine learning compilation lesson 1: overview of machine learning compilation

Zhongang Mining Co., Ltd.: fluorite is a scarce resource with enhanced attributes, and there may be a gap between supply and demand in the future

快速学会CAD绘制传输线路图纸

Function test - Introduction to MySQL database

BSV上的委托合约

ShardingSphere-proxy-5.0.0分布式哈希取模分片实现(四)

GAMES-101-个人总结归纳-Rasterization
随机推荐
Function test - Introduction to MySQL database
GAMES-101-个人总结归纳-Transformation
光照相关 shader
Mba-day23 at most at least questions - exercises
Shell script syntax overview
[Chapter 15 wavelet based image compression technology deep learning machine learning image processing application matlab.]
Localdatetime format time
How to restore the IE browser auto jump edge
【AMD 综合求职经验分享618】
Chapter 12 panoramic image mosaic based on block matching -- Application of MATLAB in-depth learning and actual combat image processing
Ansible profile
GAMES-101-个人总结归纳-Rasterization
软件测试工程师面试接口测试常见问题
acwing 835. Trie string statistics
"Good morning, good afternoon, good night" game jam
中午不睡觉下午困
Ansible Inventory 主机清单
基于DPDK的高效包处理系统
idea----复制黏贴
Commission contract on BSV (2)