function varargout = Task704(varargin)
% TASK704 MATLAB code for Task704.fig
% TASK704, by itself, creates a new TASK704 or raises the existing
% singleton*.
%
% H = TASK704 returns the handle to a new TASK704 or the handle to
% the existing singleton*.
%
% TASK704('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in TASK704.M with the given input arguments.
%
% TASK704('Property','Value',...) creates a new TASK704 or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before Task704_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to Task704_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 Task704
% Last Modified by GUIDE v2.5 13-Jun-2020 12:48:08
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @Task704_OpeningFcn, ...
'gui_OutputFcn', @Task704_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 Task704 is made visible.
function Task704_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 Task704 (see VARARGIN)
% Choose default command line output for Task704
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes Task704 wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = Task704_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 pushbutton2.
function pushbutton2_Callback(hObject, eventdata, handles)
global R fs
fs =44100;%采样频率
R=audiorecorder(fs,16,1);%定义存放音频的变量R
record(R);%开始录制音频,直到按下停止录制按钮
% 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)
% --- Executes on button press in pushbutton3.
function pushbutton3_Callback(hObject, eventdata, handles)
global R voice_data fs
stop(R)%停止录制
voice_data = getaudiodata(R);%对音频取样,数字化处理
audiowrite('voice_data.wav',voice_data,fs,'BitsPerSample',24)%保存音频为voice_data.wav
% 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)
% --- Executes on button press in pushbutton4.
function pushbutton4_Callback(hObject, eventdata, handles)
global V0 fs
[V0,fs]= audioread('voice_data.wav');
sound(V0,fs)%播放音频
% 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)
% --- Executes on button press in pushbutton5.
function pushbutton5_Callback(hObject, eventdata, handles)
global data V0 fs t
%画出原音的时域图
data = V0;
t=(1:length(data))/fs;%定义音频时间
axes(handles.axes1);
plot(t,data);
grid on;
set(gca,'fontname','times','fontsize',14,'linewidth',1.1,'box','on')
% 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)
% --- Executes on button press in pushbutton6.
function pushbutton6_Callback(hObject, eventdata, handles)
global V0 fs
sound(flipud(V0),fs)
% hObject handle to pushbutton6 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --- Executes on button press in pushbutton7.
function pushbutton7_Callback(hObject, eventdata, handles)
global V0 t
axes(handles.axes2)
plot(t,flipud(V0))
grid on;
set(gca,'fontname','times','fontsize',14,'linewidth',1.1,'box','on')
% 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)
Zgg1234567898
- 粉丝: 0
- 资源: 1
最新资源
- 2025计量基础知识考试题库及答案.doc
- 2025金属冶炼(炼钢)安全员考试题库(含答案).pptx
- 2025健康管理师三级专业能力考核试卷及答案.doc
- 2025交管12123驾驶证学法减分题库附含答案.doc
- 建筑工程员工工资表.xls
- 工程部薪酬2018年6月.doc
- 工程施工操作员薪酬管理制度.doc
- 2025教育心理学与德育工作基础知识点大全.doc
- 2025教育心理学与德育工作基础知识点整理总复习资料.doc
- 2025基本公共卫生知识考试题及答案.docx
- 2025基本公共卫生知识题库及答案.docx
- 2025基础知识与规范要求技能大赛题库及答案.docx
- 2025脊柱术后脑脊液漏应急预案考试试题(含答案).docx
- 2025计量基础知识题库及答案.docx
- 2025计算机二级考试全真试题库及答案(通用版).docx
- 2025计算机基础理论信息安全基本知识试题及答案.docx
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈