1 简介

说话人的情感研究是指从说话人的语音信号中提取各种情感因素和情感特征, 判断说话人的 喜怒哀乐, 能够反映出情感特征的物理参数主要反映在发音速度, 振幅, 基频, 频谱变化等方面 变换系统通过 方法提取出基音周期, 然后通过分析得出调整的规则后实行的基音周 期及幅度的修正 , 最终完成男女声情感变换​。

2 部分代码

function varargout = sound_process(varargin)
% SOUND_PROCESS MATLAB code for sound_process.fig
%     SOUND_PROCESS, by itself, creates a new SOUND_PROCESS or raises the existing
%     singleton*.
%
%     H = SOUND_PROCESS returns the handle to a new SOUND_PROCESS or the handle to
%     the existing singleton*.
%
%     SOUND_PROCESS('CALLBACK',hObject,eventData,handles,...) calls the local
%     function named CALLBACK in SOUND_PROCESS.M with the given input arguments.
%
%     SOUND_PROCESS('Property','Value',...) creates a new SOUND_PROCESS or raises the
%     existing singleton*. Starting from the left, property value pairs are
%     applied to the GUI before sound_process_OpeningFcn gets called. An
%     unrecognized property name or invalid value makes property application
%     stop. All inputs are passed to sound_process_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 sound_process

% Last Modified by GUIDE v2.5 03-Sep-2019 22:07:30

% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
                  'gui_Singleton',  gui_Singleton, ...
                  'gui_OpeningFcn', @sound_process_OpeningFcn, ...
                  'gui_OutputFcn',  @sound_process_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 sound_process is made visible.
function sound_process_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 sound_process (see VARARGIN)

% Choose default command line output for sound_process
handles.output = hObject;
handles.h1 = [handles.voice_change,handles.voice_code,handles.exit,handles.func_choose];%功能选择界面句柄
handles.h2 = [handles.file_choose1,handles.back1,handles.stop1,handles.panel1, ...
             handles.play_origin,handles.play_woman,handles.play_fast,handles.play_slow];%变声器界面
handles.h3 = [handles.file_choose2,handles.back2,handles.figure,handles.play_origin2,...
              handles.play_code,handles.draw_origin,handles.draw_code];%语音加密界面
global a1 b1 c1 a2 b2 c2;%文件打开的状态参量
c1 = 0;
c2 = 0;
global origin_voice1 origin_voice2 man_voice woman_voice ;%
% Update handles structure
guidata(hObject, handles);

% UIWAIT makes sound_process wait for user response (see UIRESUME)
% uiwait(handles.figure1);


% --- Outputs from this function are returned to the command line.
function varargout = sound_process_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 voice_change.
function voice_change_Callback(hObject, eventdata, handles)
% hObject   handle to voice_change (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles   structure with handles and user data (see GUIDATA)
set(handles.h1,'Visible','off');
set(handles.h2,'Visible','on');

% --- Executes on button press in voice_code.
function voice_code_Callback(hObject, eventdata, handles)
% hObject   handle to voice_code (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles   structure with handles and user data (see GUIDATA)
set(handles.h1,'Visible','off');
set(handles.h3,'Visible','on');

% --- Executes on button press in exit.
function exit_Callback(hObject, eventdata, handles)
% hObject   handle to exit (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles   structure with handles and user data (see GUIDATA)
%按退出键退出当前程序
clear sound;
try
   delete(sound_process);
end


% --- Executes on button press in file_choose1.
function file_choose1_Callback(hObject, eventdata, handles)
% hObject   handle to file_choose1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles   structure with handles and user data (see GUIDATA)
clear sound;
global a1 b1 c1 ;
[a1,b1,c1] = uigetfile('.wav','选择原始声音文件');
if c1 == 0
   warndlg('请选择音频文件','警告');
end

% --- Executes during object creation, after setting all properties.
function func_choose_CreateFcn(hObject, eventdata, handles)
% hObject   handle to func_choose (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles   empty - handles not created until after all CreateFcns called


% --- Executes on button press in back1.
function back1_Callback(hObject, eventdata, handles)
% hObject   handle to back1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles   structure with handles and user data (see GUIDATA)
clear sound;
set(handles.h1,'Visible','on');
set(handles.h2,'Visible','off');
set(handles.h2,'Visible','off');
c1 = 0;
try
   delete(allchild(handles.h2));
end

% --- Executes on button press in file_choose2.
function file_choose2_Callback(hObject, eventdata, handles)
% hObject   handle to file_choose2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles   structure with handles and user data (see GUIDATA)
clear sound;
global a2 b2 c2;
[a2,b2,c2] = uigetfile('.wav','选择原始声音文件');
if c2 == 0
   warndlg('请选择音频文件','警告');
end

3 仿真结果

4 参考文献

[1]颜祥, 俞一彪, 戴志强,等. 基于均值算法的男女声与情感的同步变换[C]// 2006和谐开发中国西部声学学术会议. 0.

Logo

开放原子开发者工作坊旨在鼓励更多人参与开源活动,与志同道合的开发者们相互交流开发经验、分享开发心得、获取前沿技术趋势。工作坊有多种形式的开发者活动,如meetup、训练营等,主打技术交流,干货满满,真诚地邀请各位开发者共同参与!

更多推荐