当前位置:网站首页>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
边栏推荐
- 新员工入职,了解工作信息
- 剑指offer 26:树的子结构
- NOIP初赛 CSP-J1 CSP-S1 第1轮 初赛 信奥中的数学知识(二)
- Common shortcut keys in Excel summary of shortcut keys in Excel
- DAST black box vulnerability scanner part 4: scanning performance
- 快速学会CAD绘制传输线路图纸
- What is your understanding of interface testing?
- 数字信号处理
- Illumination dependent shader
- MBA-day23 至多至少问题-练习题
猜你喜欢

BSV上的委托合约(2)

Ansible profile
![[Chapter 15 wavelet based image compression technology deep learning machine learning image processing application matlab.]](/img/c3/b30dd7951c747fdd2428b31be3efec.png)
[Chapter 15 wavelet based image compression technology deep learning machine learning image processing application matlab.]

Packet capturing tool: Fiddler, a necessary skill for Software Test Engineer

atguigu----过滤器

DAST 黑盒漏洞扫描器 第四篇:扫描性能
音视频学习路线及学习资料推荐

Leetcode + 46 - 50

Commission contract on BSV (2)

Digital final notes
随机推荐
Intel written test questions DIY
Chapter 03 extraction of anterior segment tissue based on multi-scale morphology - full system matlab intelligent driving in-depth learning
Who will use pyspark to upload filtered local data to spark SQL
[phantom engine UE] package error appears! Solutions to findpin errors
手机app测试方法
[essay] the Expo that studied the RN ecology for one day yesterday is really awesome. It works well from development and construction to deployment.
Pdf to word PDF to picture picture to PDF modifying PDF files is as convenient as operating word (Introduction to acrobat DC)
Mba-day18 elimination method
AHA C language Chapter 5 the good play is later (Lecture 24-25)
Commission contract on BSV (3)
【AMD 綜合求職經驗分享618】
acwing 836. 合并集合 (并查集)
Games-101 personal summary rasterization
How to gain freedom and wealth
Illumination dependent shader
Mathematical knowledge of Sinorgchem in the first round of noip preliminary csp-j1 csp-s1 (I)
阿里,腾讯,百度软件测试工程师推荐——软件测试模型之瀑布模型
Right alignment of MathType formula right number in word
pdf转word pdf转图片 图片转pdf 修改pdf文件就像操作Word一样方便(Acrobat DC使用介绍)
[amd comprehensive job search experience sharing 618]