![matlab-mp3播放器源代码(共5页)_第1页](http://file2.renrendoc.com/fileroot_temp3/2021-8/22/2062161f-797d-4fbb-a819-e4810b1f57b5/2062161f-797d-4fbb-a819-e4810b1f57b51.gif)
![matlab-mp3播放器源代码(共5页)_第2页](http://file2.renrendoc.com/fileroot_temp3/2021-8/22/2062161f-797d-4fbb-a819-e4810b1f57b5/2062161f-797d-4fbb-a819-e4810b1f57b52.gif)
![matlab-mp3播放器源代码(共5页)_第3页](http://file2.renrendoc.com/fileroot_temp3/2021-8/22/2062161f-797d-4fbb-a819-e4810b1f57b5/2062161f-797d-4fbb-a819-e4810b1f57b53.gif)
![matlab-mp3播放器源代码(共5页)_第4页](http://file2.renrendoc.com/fileroot_temp3/2021-8/22/2062161f-797d-4fbb-a819-e4810b1f57b5/2062161f-797d-4fbb-a819-e4810b1f57b54.gif)
![matlab-mp3播放器源代码(共5页)_第5页](http://file2.renrendoc.com/fileroot_temp3/2021-8/22/2062161f-797d-4fbb-a819-e4810b1f57b5/2062161f-797d-4fbb-a819-e4810b1f57b55.gif)
下载本文档
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
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. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 仓库保管员必须知道的31条知识-仓管员最基础理论知识
- 松浦弥太郎:日式生活美学的诗意
- 中职教育二年级下学期《机器人M.C 1类别指令及编程》教学设计
- 高中二年级下学期地理《黄河沙患的治理措施》教学设计
- 人教新目标八年级下册英语全册导学案
- 贵州铜仁松桃县2025届初三下学期总复习阶段测试化学试题试卷含解析
- 贵州省遵义市凤冈县2024届四年级数学第二学期期末统考试题含解析
- 离子敏传感器产品相关项目建议书
- 竹藤家具机械项目可行性实施报告
- 直播芯片射频芯片项目创业计划书
- 中国古地理图集(王鸿祯)
- 闭式整体叶盘通道五坐标插铣加工方法
- 2023上海黄浦区初三二模数学试题及答案
- 足球俱乐部试训个人简历
- 北京市大中型商场超市治安防范系统规范
- 二年级上册美术教学设计- 第十一课 点点聚会 ︳湘美版
- ( 心包穿刺术 )评分标准
- 《班组长实战操作手册:从理论到实战》读书笔记模板
- 青盲(视神经萎缩)课件
- DASK上颌窦提升工具盒培训课件
- 2023年高考全国甲卷理科综合物理真题试卷+答案
评论
0/150
提交评论