www.gusucode.com > GUI界面的语音采集,变声处理,并附有变对应人声的图像 > GUI界面的语音采集,变声处理,并附有变对应人声的图像/code/jiemiantu.m

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

% Last Modified by GUIDE v2.5 23-Jun-2018 15:23:43

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

% Choose default command line output for jiemiantu
handles.output = hObject;

% Update handles structure
guidata(hObject, handles);

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


% --- Outputs from this function are returned to the command line.
function varargout = jiemiantu_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 load_wav.
function load_wav_Callback(hObject, eventdata, handles)
% hObject    handle to load_wav (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
 global  x t;
    [FileName,PathName] = uigetfile('1234.wav');
    pathall=strcat(PathName,FileName);%获得wav路径
    
    [x,FS]=audioread(pathall);%读取wav文件的数据和频率
    t=(0:length(x)-1)/FS;%变换得到播放时间

% --- Executes on button press in uncle_wav.
function uncle_wav_Callback(hObject, eventdata, handles)
% hObject    handle to uncle_wav (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
  global x t;
    a=imread('1.JPG');%读取图片
    axes(handles.axes1);
    imshow(a);%显示图片
    %wav处理
    x3=x*2;%低沉~闷
    t3=t*1.5;
    FS3=(0:length(x)-1)/t3;
    sound(x3,FS3);%播放处理后的音频数据


% --- Executes on button press in sister_wav.
function sister_wav_Callback(hObject, eventdata, handles)
% hObject    handle to sister_wav (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
  global x t;
    a=imread('2.JPG');
    axes(handles.axes1);
    imshow(a);
    x2=x;%还可以~汤姆猫style,尖锐亢奋,papi酱
    t2=t/1.5;
    FS2=(0:length(x)-1)/t2;
    sound(x2,FS2)

% --- Executes on button press in whimsy_wav.
function whimsy_wav_Callback(hObject, eventdata, handles)
% hObject    handle to whimsy_wav (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
  global x t;
    a=imread('3.JPG');
    axes(handles.axes1);
    imshow(a);
    x1=x;%还可以~汤姆猫style,尖锐亢奋,papi酱
    t1=t/2;
    FS1=(0:length(x)-1)/t1;
    sound(x1,FS1);

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

% Hint: place code in OpeningFcn to populate axes1
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end