下载本文档
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
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. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 中学学生社团活动经费管理制度
- 信息保密制度
- 企业奖惩制度
- 2026年软件测试工程师全攻略测试方法与流程
- 2026年文学创作与编辑专业试题集及答案
- 2026年金融投资理论及实务试题库
- 2025年联邦学习模型横向分割数据安全对齐协议
- 2025年电动自行车集中充电设施智能断电系统技术标准协议
- 古词课件内容
- 急诊护理中脑出血的急救处理流程及制度
- 广东省东莞市2024-2025学年高一上学期1月期末英语试题【含答案解析】
- (一模)2025年合肥市2025届高三第一次教学质量检测 物理试卷 (含官方答案)
- QC080000体系文件手册
- GB/T 44233.2-2024蓄电池和蓄电池组安装的安全要求第2部分:固定型电池
- DL∕T 612-2017 电力行业锅炉压力容器安全监督规程
- 2024年国企行测题库
- 烟囱技术在血管腔内修复术中的应用
- 岗位聘用登记表
- 2023年高铁信号车间副主任述职报告
- GB/T 5762-2012建材用石灰石、生石灰和熟石灰化学分析方法
- 第3章 圆锥曲线的方程【精简思维导图梳理】高考数学高效备考 人教A版2019选择性必修第一册
评论
0/150
提交评论