下载本文档
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、function varargout = MP3player(varargin)% MP3player MATLAB code for MP3player.fig% MP3player, by itself, creates a new MP3player or raises the existing% singleton*.% H = MP3player returns the handle to a new MP3player or the handle to% the existing singleton*.% MP3player(CALLBACK,hObject,eventData,h
2、andles,.) calls the local% function named CALLBACK in MP3player.M with the given input arguments.% MP3player(Property,Value,.) creates a new MP3player or raises the% existing singleton*. Starting from the left, property value pairs are% applied to the GUI before MP3player_OpeningFcn gets called. An%
3、 unrecognized property name or invalid value makes property application% stop. All inputs are passed to MP3player_OpeningFcn via varargin.% *See GUI Options on GUIDEs Tools menu. Choose GUI allows only one% instance to run (singleton).% See also: GUIDE, GUIDATA, GUIHANDLES % Edit the above text to m
4、odify the response to help MP3player % Last Modified by GUIDE v2.5 01-Nov-2014 21:41:05 % Begin initialization code - DO NOT EDITgui_Singleton = 1;gui_State = struct(gui_Name, mfilename, . gui_Singleton, gui_Singleton, . gui_OpeningFcn, MP3player_OpeningFcn, . gui_OutputFcn, MP3player_OutputFcn, . g
5、ui_LayoutFcn, , . gui_Callback, );if nargin & ischar(varargin1) gui_State.gui_Callback = str2func(varargin1);end if nargout varargout1:nargout = gui_mainfcn(gui_State, varargin:);else gui_mainfcn(gui_State, varargin:);end% End initialization code - DO NOT EDIT % - Executes just before MP3player is m
6、ade visible.function MP3player_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
7、 line arguments to MP3player (see VARARGIN) % Choose default command line output for MP3playerhandles.output = hObject; % Update handles structureguidata(hObject, handles); % UIWAIT makes MP3player wait for user response (see UIRESUME)% uiwait(handles.figure1); % - Outputs from this function are ret
8、urned to the command line.function varargout = MP3player_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
9、(see GUIDATA) % Get default command line output from handles structurevarargout1 = handles.output; function Path_Callback(hObject, eventdata, handles) % hObject handle to Path (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (
10、see GUIDATA) % Hints: get(hObject,String) returns contents of Path as text% str2double(get(hObject,String) returns contents of Path as a double % - Executes during object creation, after setting all properties.function Path_CreateFcn(hObject, eventdata, handles) % hObject handle to Path (see GCBO)%
11、eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns called % Hint: edit controls usually have a white background on Windows.% See ISPC and COMPUTER.if ispc & isequal(get(hObject,BackgroundColor), get(0,defaultUicontrolBackg
12、roundColor) set(hObject,BackgroundColor,white);end % - Executes on button press in browse.function browse_Callback(hObject, eventdata, handles)global audio Y FSFileName,FilePath=uigetfile(*.MP3,Select the M-File);PathName=sprintf(%s%s,FilePath,FileName);set(handles.Path,string,PathName);mp3PathName=
13、get(handles.Path,string);Y,FS=audioread(mp3PathName);audio=audioplayer(Y,FS); % hObject handle to browse (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 play.function play_Callbac
14、k(, eventdata, handles)global audio FS Yaxes(handles.axes1);hold on;plot(Y, b); % plot audio datatitle(Audio Data);xlabel(strcat(Sample Number (fs = , num2str(FS), );ylabel(Amplitude);ylimits = get(gca, YLim); % get the y-axis limitsplotdata = ylimits(1):0.1:ylimits(2);hline = plot(repmat(0, size(pl
15、otdata), plotdata, r); % plot the marker% instantiate the audioplayer objectaudio = audioplayer(Y, FS); % setup the timer for the audioplayer objectaudio.TimerFcn = plotMarker, audio, gcf, plotdata; % timer callback function (defined below)audio.TimerPeriod = 0.01; % period of the timer in seconds %
16、 start playing the audio% this will move the marker over the audio plot at intervals of 0.01 splay(audio);% play(audio);% axes(handles.axes1);% plot(Y, b); % plot audio data% title(Audio Data);% xlabel(strcat(Sample Number (fs = , num2str(Fs), );% ylabel(Amplitude); % hObject handle to play (see GCB
17、O)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA) % - Executes during object creation, after setting all properties.function axes1_CreateFcn(hObject, eventdata, handles) % hObject handle to axes1 (see GCBO)% eventdata res
18、erved - 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 % - Executes on button press in pause.function pause_Callback(hObject, eventdata, handles)global audiopause(audio);% hObject h
19、andle to pause (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 stop.function stop_Callback(hObject, eventdata, handles)global audiostop(audio);% hObject handle to stop (see GCBO)%
20、 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 resume.function resume_Callback(hObject, eventdata, handles)global audioresume(audio);% hObject handle to resume (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)function plotMarker(. h0bject, . % refers to the object that called this function (necessary parameter for all callback functions) eventdata,
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 汽车事故鉴定学 第3版 习题及解答 第七章 汽车事故再现 试题
- 2026lgd面试题及答案
- 2026mysql面试题及答案
- 小学三年级数学《认识几分之一》核心素养教学设计
- 2026年熔化焊接与热切割作业模拟考试题库(附答案)
- 九年级化学·物质组成的定量与表征-化学式与化合价融合式教学导学案
- 盲校七年级生物学下册(低视力版)第四单元知识清单
- 初中九年级英语《汤姆·索亚历险记》单元词汇深度解析与词根词缀派生法高阶应用教案
- 2026年建筑行业安全员A证(四川地区)模拟考试题库试卷(附答案)
- 2026年化工危废台账填写试题及答案
- 摩根大通-第一性原理:AI电力基础设施:追踪电力需求-First Principles-AI Power Infrastructure:Following the Power-20260625
- 中医全科(副高)高级职称考试题库及答案
- 2024年4月自考00067财务管理学答案及评分参考
- 中专《数学》(基础模块)上册80张课件
- 建筑设计公司绩效总方案
- 无菌模拟灌装工艺验证
- 护理技能竞赛的方案
- XX地区负荷预测项目负荷预测模型训练模块详细设计
- WB/T 1019-2002菱镁制品用轻烧氧化镁
- GB/T 1401-1998化学试剂乙二胺四乙酸二钠
- (禽生产学课件) 绪论
评论
0/150
提交评论