• 【纯音听力测试】基于MATLAB的纯音听力测试系统


    1.软件版本

    matlab2017b

    2.系统原理

           语音是人类进行交流沟通的最基本方式,而人类的耳朵则是接收语音信号的唯一器官,但是对于听力障碍患者来讲,由于无法正常接收来自他人的语音信号,其无法进行正常的交流和沟通,严重影响了他们的日常生活[01]。早期,由于各种条件的限制,他们往往被社会忽略,而随着经济的不断发展,社会的不断进步,听力问题则受到了人们越来越多的重视,通过研究发现,导致听力问题的主要原因有有长时间生活在噪声环境中,导致听力逐渐受到损伤,先天性的听力障碍,外界影响受伤受损等[02]。到目前为止,我国听力障碍人士超过3000万,一种大部分是老年人,还有一部分是新生儿。而在全世界,听力障碍人士则超过6亿人,听力障碍正成为影响全人类健康的一个重要疾病,如果不采取正确的措施,在未来将会导致更加严重的问题。而其中大部分人则可以通过早期听力测试及早发现问题进行治疗来避免的,但是长期以来,由于缺乏各种有效的测试方法,导致很多人成为听力障碍患者。因此,开发一种行之有效的听力测试方法是一个十分重要的研究方向。目前,关于听力测试主要可以分为纯音听力测试,言语测听以及听力分辨能力测试等。通过这些测试,然后根据相关标准对测试结果进行打分,从而对患者的听力水平给出一个客观准确的评价指标,为后期患者的听力康复工作起到指导性工作。其中纯音听力测试是一个重要的听力测试项目,在临床应用中处于举足轻重的地位。其主要测试方法是通过观测、记录患者对不同频率,声强的声音信号的自然反应来了解患者的实际听力情况。

        基于纯音听力测试的测听系统。整个系统具备如下几个方面的功能:

        第一、系统可以产生不同频率,不同声强以及不同持续时间的纯音信号;

        第二、对于同一频率的纯音信号,可以改变其声强,得到多个不同声强的纯音信号;

        第三、可以记录不同受试者的测试记录;

        第四、具有良好的用户使用人机交互界面;

        根据国家标准GB-16403,本文制定如下的纯音听力阈值测试的整体步骤:

        第一、设置纯音信号的起始频率为1000Hz,初始的声压设置为0dB作为初始声压级,并且以5dB为间隔进行等间隔逐渐增大声压,直到受试者听到声音为止,并记录不同声压下对应的受试者的听力反馈结果。

        第二、然后在以5dB为间隔降低声压级,直到受试者听不到声音为止,然后再以5dB为间隔进行等间隔逐渐增大声压,直到受试者听到声音为止,如此发反复测试3次以上,记录每次一次受试者可以听见声音的阈值。

        第三、改变频率测试点,变为2kHz,然后重复步骤一和步骤二结果,并记录相关测试结果;然后再增加频率测试点,重复步骤一和步骤二,直到频率测试点增加到20000Hz为止。

        然后在纯音频率分辨率测试方面,根据国际通用标准,我们设置11个频率点:125Hz,250Hz,500Hz,,750Hz,1000Hz,1500Hz,2000Hz,3000Hz,4000Hz,6000Hz,8000Hz,其具体测试步骤如下所示:

        第一、选择第一个频率测试点,产生频率为125Hz的纯音信号;

        第二、然后选择10个受试者,分别对其进行测试,记录各个受试者的听力反馈情况。然后将频率点设置为第二个频率值250H在,重复对10个受试者进行测试,记录各个受试者的听力反馈情况。通过这种方法,依次将11个频率点进行测试,直到完成所有频率点的测试。

    3.核心源码

      ·声音录制模块

        声音录制模块的MATLAB基本GUI界面如下图所示:

    图1声音录制模块

        从图1可知,声音录制模块包括开始录制、停止录制、播放、保存以及音量控制等功能,同时在播放过程中,可以自动显示语速(Speed X)。该模块的主要功能是录制一些需要进行语言类测试的语音样本。

      ·音乐测试模块

        音乐测试模块的MATLAB基本GUI界面如下图所示:

    图2音乐测试模块

      ·纯音信号产生模块

        纯音信号产生模块的MATLAB基本GUI界面如下图所示:

    图3纯音信号产生模块

        从图3可知,纯音信号产生模块包括纯音信号采样率设置,持续时间设置,纯音信号频率设置(250Hz,500Hz,,750Hz,1000Hz,1500Hz,2000Hz,3000Hz,4000Hz,6000Hz,8000Hz),声强设置(10dB HL,15 dB HL,25 dB HL,35 dB HL,45 dB HL,50 dB HL,60 dB HL,70 dB HL,75 dB HL,85 dB HL),产生纯音,播放纯音,保存纯音以及伸到设置(双声道、左声道、右声道)。纯音信号产生模块同时可以显示纯音信号的时域波形,频域波形以及声强特征曲线。

        纯音信号产生模块也是本系统的核心模块,通过该模块,我们可以测试得到受试者的听力阈值,即可以感知的听力频率范围和声强大小范围。为后期对听力障碍者的治疗康复提供治疗依据。

      ·测试结果分析模块

        测试结果分析模块的MATLAB基本GUI界面如下图所示:

    图4测试结果分析模块

        从图4可知,测试结果分析模块包括左耳曲线、右耳曲线以及双耳曲线的测试结果数据。该模块的主要功能主要是对受试者的测试结果以数据曲线的形式进行显示。

    1. function varargout = tops(varargin)
    2. % TOPS MATLAB code for tops.fig
    3. % TOPS, by itself, creates a new TOPS or raises the existing
    4. % singleton*.
    5. %
    6. % H = TOPS returns the handle to a new TOPS or the handle to
    7. % the existing singleton*.
    8. %
    9. % TOPS('CALLBACK',hObject,eventData,handles,...) calls the local
    10. % function named CALLBACK in TOPS.M with the given input arguments.
    11. %
    12. % TOPS('Property','Value',...) creates a new TOPS or raises the
    13. % existing singleton*. Starting from the left, property value pairs are
    14. % applied to the GUI before tops_OpeningFcn gets called. An
    15. % unrecognized property name or invalid value makes property application
    16. % stop. All inputs are passed to tops_OpeningFcn via varargin.
    17. %
    18. % *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one
    19. % instance to run (singleton)".
    20. %
    21. % See also: GUIDE, GUIDATA, GUIHANDLES
    22. % Edit the above text to modify the response to help tops
    23. % Last Modified by GUIDE v2.5 26-Apr-2019 22:46:55
    24. % Begin initialization code - DO NOT EDIT
    25. gui_Singleton = 1;
    26. gui_State = struct('gui_Name', mfilename, ...
    27. 'gui_Singleton', gui_Singleton, ...
    28. 'gui_OpeningFcn', @tops_OpeningFcn, ...
    29. 'gui_OutputFcn', @tops_OutputFcn, ...
    30. 'gui_LayoutFcn', [] , ...
    31. 'gui_Callback', []);
    32. if nargin && ischar(varargin{1})
    33. gui_State.gui_Callback = str2func(varargin{1});
    34. end
    35. if nargout
    36. [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
    37. else
    38. gui_mainfcn(gui_State, varargin{:});
    39. end
    40. % End initialization code - DO NOT EDIT
    41. % --- Executes just before tops is made visible.
    42. function tops_OpeningFcn(hObject, eventdata, handles, varargin)
    43. % This function has no output args, see OutputFcn.
    44. % hObject handle to figure
    45. % eventdata reserved - to be defined in a future version of MATLAB
    46. % handles structure with handles and user data (see GUIDATA)
    47. % varargin command line arguments to tops (see VARARGIN)
    48. % Choose default command line output for tops
    49. handles.output = hObject;
    50. % Update handles structure
    51. guidata(hObject, handles);
    52. % UIWAIT makes tops wait for user response (see UIRESUME)
    53. % uiwait(handles.figure1);
    54. % --- Outputs from this function are returned to the command line.
    55. function varargout = tops_OutputFcn(hObject, eventdata, handles)
    56. % varargout cell array for returning output args (see VARARGOUT);
    57. % hObject handle to figure
    58. % eventdata reserved - to be defined in a future version of MATLAB
    59. % handles structure with handles and user data (see GUIDATA)
    60. % Get default command line output from handles structure
    61. varargout{1} = handles.output;
    62. function edit1_Callback(hObject, eventdata, handles)
    63. % hObject handle to edit1 (see GCBO)
    64. % eventdata reserved - to be defined in a future version of MATLAB
    65. % handles structure with handles and user data (see GUIDATA)
    66. % Hints: get(hObject,'String') returns contents of edit1 as text
    67. % str2double(get(hObject,'String')) returns contents of edit1 as a double
    68. % --- Executes during object creation, after setting all properties.
    69. function edit1_CreateFcn(hObject, eventdata, handles)
    70. % hObject handle to edit1 (see GCBO)
    71. % eventdata reserved - to be defined in a future version of MATLAB
    72. % handles empty - handles not created until after all CreateFcns called
    73. % Hint: edit controls usually have a white background on Windows.
    74. % See ISPC and COMPUTER.
    75. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    76. set(hObject,'BackgroundColor','white');
    77. end
    78. function edit2_Callback(hObject, eventdata, handles)
    79. % hObject handle to edit2 (see GCBO)
    80. % eventdata reserved - to be defined in a future version of MATLAB
    81. % handles structure with handles and user data (see GUIDATA)
    82. % Hints: get(hObject,'String') returns contents of edit2 as text
    83. % str2double(get(hObject,'String')) returns contents of edit2 as a double
    84. % --- Executes during object creation, after setting all properties.
    85. function edit2_CreateFcn(hObject, eventdata, handles)
    86. % hObject handle to edit2 (see GCBO)
    87. % eventdata reserved - to be defined in a future version of MATLAB
    88. % handles empty - handles not created until after all CreateFcns called
    89. % Hint: edit controls usually have a white background on Windows.
    90. % See ISPC and COMPUTER.
    91. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    92. set(hObject,'BackgroundColor','white');
    93. end
    94. function edit3_Callback(hObject, eventdata, handles)
    95. % hObject handle to edit3 (see GCBO)
    96. % eventdata reserved - to be defined in a future version of MATLAB
    97. % handles structure with handles and user data (see GUIDATA)
    98. % Hints: get(hObject,'String') returns contents of edit3 as text
    99. % str2double(get(hObject,'String')) returns contents of edit3 as a double
    100. % --- Executes during object creation, after setting all properties.
    101. function edit3_CreateFcn(hObject, eventdata, handles)
    102. % hObject handle to edit3 (see GCBO)
    103. % eventdata reserved - to be defined in a future version of MATLAB
    104. % handles empty - handles not created until after all CreateFcns called
    105. % Hint: edit controls usually have a white background on Windows.
    106. % See ISPC and COMPUTER.
    107. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    108. set(hObject,'BackgroundColor','white');
    109. end
    110. % --- Executes on button press in pushbutton1.
    111. function pushbutton1_Callback(hObject, eventdata, handles)
    112. % hObject handle to pushbutton1 (see GCBO)
    113. % eventdata reserved - to be defined in a future version of MATLAB
    114. % handles structure with handles and user data (see GUIDATA)
    115. cla(handles.axes1);
    116. cla(handles.axes2);
    117. global Fs;
    118. global T;
    119. global fc;
    120. global tt;
    121. global y;
    122. global sy;
    123. global LIMIT;
    124. Fs = str2num(get(handles.edit1, 'string'));
    125. T = str2num(get(handles.edit2, 'string'));
    126. sy = LIMIT;
    127. tt = [1/Fs:1/Fs:T];
    128. y = 10^(sy/20)*sin(2*pi*fc*tt);
    129. yfft = abs(fftshift(fft(y)));
    130. N = length(yfft);
    131. ff = Fs*[-N/2:1:N/2-1]/N;
    132. axes(handles.axes1);
    133. plot(tt,y);
    134. xlim([0,0.002]);
    135. xlabel('时间(s)');
    136. ylabel('幅度(m)');
    137. axes(handles.axes2);
    138. plot(ff,yfft)
    139. xlim([-2*fc,2*fc]);
    140. xlabel('频率(Hz)');
    141. ylabel('幅度(m)');
    142. %取x的一个通道
    143. x=y';
    144. fs=Fs;
    145. %将x从列向量转为行向量
    146. x=x';
    147. LL=length(x);
    148. %语音分帧
    149. framlen = 10;
    150. M = fs*framlen/1000;
    151. %m为Length/M后得到的余数
    152. m = mod(LL,M);
    153. if m >= M/2
    154. x = [x,zeros(1,M-m)];
    155. LL = length(x);
    156. else
    157. l = floor(LL/M);
    158. x = x(1,1:M*l);
    159. LL = length(x);
    160. end
    161. N = LL/M;
    162. %计算声压级
    163. s = zeros(1,M);
    164. spl = zeros(1,N);
    165. for k = 1:N
    166. s = x((k-1)*M + 1:k*M);
    167. spl(1,k) = SPLCal(s,fs,framlen);
    168. end
    169. t = 1:LL;
    170. SPL = zeros(1,LL);
    171. for r = 1:N
    172. SPL(1,(r-1)*M+1:r*M) = spl(r);
    173. end
    174. axes(handles.axes3);
    175. stairs(t/Fs,round(100*SPL)/100,'r');
    176. xlabel('时间(s)');
    177. ylabel('声强(db)');
    178. % --- Executes on button press in pushbutton2.
    179. function pushbutton2_Callback(hObject, eventdata, handles)
    180. % hObject handle to pushbutton2 (see GCBO)
    181. % eventdata reserved - to be defined in a future version of MATLAB
    182. % handles structure with handles and user data (see GUIDATA)
    183. global Fs;
    184. global T;
    185. global fc;
    186. global tt;
    187. global y;
    188. global sy;
    189. global LIMIT;
    190. sound(y,Fs)
    191. % --- Executes on button press in pushbutton3.
    192. function pushbutton3_Callback(hObject, eventdata, handles)
    193. % hObject handle to pushbutton3 (see GCBO)
    194. % eventdata reserved - to be defined in a future version of MATLAB
    195. % handles structure with handles and user data (see GUIDATA)
    196. global Fs;
    197. global T;
    198. global fc;
    199. global tt;
    200. global y;
    201. global sy;
    202. global LIMIT;
    203. tmps = clock;
    204. Names = ['savewav','---',num2str(Fs),'---',num2str(fc),'---',num2str(tmps(1)),num2str(tmps(2)),num2str(tmps(3)),num2str(tmps(4)),num2str(tmps(5)),num2str(tmps(6)),'.wav'];
    205. wavwrite(y,Fs,Names)
    206. % --- Executes on button press in pushbutton4.
    207. function pushbutton4_Callback(hObject, eventdata, handles)
    208. % hObject handle to pushbutton4 (see GCBO)
    209. % eventdata reserved - to be defined in a future version of MATLAB
    210. % handles structure with handles and user data (see GUIDATA)
    211. clc;
    212. clear;
    213. close all;
    214. function edit4_Callback(hObject, eventdata, handles)
    215. % hObject handle to edit4 (see GCBO)
    216. % eventdata reserved - to be defined in a future version of MATLAB
    217. % handles structure with handles and user data (see GUIDATA)
    218. % Hints: get(hObject,'String') returns contents of edit4 as text
    219. % str2double(get(hObject,'String')) returns contents of edit4 as a double
    220. % --- Executes during object creation, after setting all properties.
    221. function edit4_CreateFcn(hObject, eventdata, handles)
    222. % hObject handle to edit4 (see GCBO)
    223. % eventdata reserved - to be defined in a future version of MATLAB
    224. % handles empty - handles not created until after all CreateFcns called
    225. % Hint: edit controls usually have a white background on Windows.
    226. % See ISPC and COMPUTER.
    227. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    228. set(hObject,'BackgroundColor','white');
    229. end
    230. % --- Executes on slider movement.
    231. function slider1_Callback(hObject, eventdata, handles)
    232. % hObject handle to slider1 (see GCBO)
    233. % eventdata reserved - to be defined in a future version of MATLAB
    234. % handles structure with handles and user data (see GUIDATA)
    235. % Hints: get(hObject,'Value') returns position of slider
    236. % get(hObject,'Min') and get(hObject,'Max') to determine range of slider
    237. global Fs;
    238. global T;
    239. global fc;
    240. global tt;
    241. global y;
    242. global sy;
    243. global LIMIT;
    244. t=(get(handles.slider1,'value'));
    245. LIMIT = 5*round(t*17);
    246. set(handles.text5,'String',num2str(LIMIT));
    247. % --- Executes during object creation, after setting all properties.
    248. function slider1_CreateFcn(hObject, eventdata, handles)
    249. % hObject handle to slider1 (see GCBO)
    250. % eventdata reserved - to be defined in a future version of MATLAB
    251. % handles empty - handles not created until after all CreateFcns called
    252. % Hint: slider controls usually have a light gray background.
    253. if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    254. set(hObject,'BackgroundColor',[.9 .9 .9]);
    255. end
    256. % --- Executes on slider movement.
    257. function slider2_Callback(hObject, eventdata, handles)
    258. % hObject handle to slider2 (see GCBO)
    259. % eventdata reserved - to be defined in a future version of MATLAB
    260. % handles structure with handles and user data (see GUIDATA)
    261. % Hints: get(hObject,'Value') returns position of slider
    262. % get(hObject,'Min') and get(hObject,'Max') to determine range of slider
    263. % --- Executes during object creation, after setting all properties.
    264. function slider2_CreateFcn(hObject, eventdata, handles)
    265. % hObject handle to slider2 (see GCBO)
    266. % eventdata reserved - to be defined in a future version of MATLAB
    267. % handles empty - handles not created until after all CreateFcns called
    268. % Hint: slider controls usually have a light gray background.
    269. if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    270. set(hObject,'BackgroundColor',[.9 .9 .9]);
    271. end
    272. % --- Executes on slider movement.
    273. function slider3_Callback(hObject, eventdata, handles)
    274. % hObject handle to slider3 (see GCBO)
    275. % eventdata reserved - to be defined in a future version of MATLAB
    276. % handles structure with handles and user data (see GUIDATA)
    277. % Hints: get(hObject,'Value') returns position of slider
    278. % get(hObject,'Min') and get(hObject,'Max') to determine range of slider
    279. global Fs;
    280. global T;
    281. global fc;
    282. global tt;
    283. global y;
    284. global sy;
    285. global LIMIT;
    286. t=(get(handles.slider3,'value'));
    287. t2=floor(8*t)+1;t2
    288. if t2==1
    289. fc = 250;
    290. end
    291. if t2==2
    292. fc = 500;
    293. end
    294. if t2==3
    295. fc = 1000;
    296. end
    297. if t2==4
    298. fc = 2000;
    299. end
    300. if t2==5
    301. fc = 3000;
    302. end
    303. if t2==6
    304. fc = 4000;
    305. end
    306. if t2==7
    307. fc = 6000;
    308. end
    309. if t2==8
    310. fc = 8000;
    311. end
    312. set(handles.text6,'String',num2str(fc));
    313. % --- Executes during object creation, after setting all properties.
    314. function slider3_CreateFcn(hObject, eventdata, handles)
    315. % hObject handle to slider3 (see GCBO)
    316. % eventdata reserved - to be defined in a future version of MATLAB
    317. % handles empty - handles not created until after all CreateFcns called
    318. % Hint: slider controls usually have a light gray background.
    319. if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    320. set(hObject,'BackgroundColor',[.9 .9 .9]);
    321. end

    4.测试结果 

        通过纯音信号产生模块产生需要测试的纯音信号,其结果如下图所示:

    A03-23

  • 相关阅读:
    nginx(四十八)HTTP框架提供的变量
    (Apache) Commons Lang3 Bridge For Scala 0.0.1 发布
    评估睡眠阶段分类:年龄和早晚睡眠对分类性能的影响
    Day8:寻路算法---深度寻路
    基于yolov2深度学习网络的猫脸检测识别matlab仿真
    ubuntu网络配置
    表格集算表高性能原理:揭秘纯前端百万行数据秒级响应的魔法
    网络编程学习part1
    Linux的iproute2 : ip address ip route ip link 笔记221103
    UDP主要丢包原因及具体问题分析
  • 原文地址:https://blog.csdn.net/ccsss22/article/details/125610531