




全文预览已结束
下载本文档
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
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,handles,.) 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% 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 modify 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, . gui_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 made 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 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 returned 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 (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 (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)% 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,defaultUicontrolBackgroundColor) 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=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_Callback(, 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(plotdata), 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 % 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 GCBO)% 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 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 % - Executes on button press in pause.function pause_Callback(hObject, eventdata, handles)global audiopause(audio);% hObject handle 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)% 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. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 两栖动物味觉信号识别-洞察与解读
- 小学五年级写作课教学设计与学案
- 企业年度消防演习计划与实施细则
- 餐饮连锁品牌市场推广策略
- 翻译专业英语词汇专项测试卷
- 公司内部竞聘流程规范
- 2025-2030数字孪生技术在制造业的应用深度与价值创造报告
- 2025-2030数字人民币推广场景测试与支付体系重构战略分析报告
- 2025-2030教育硬件设备市场增长潜力分析
- 2025-2030护肤品消费行为研究与产品创新方向预测报告
- 初三班主任班级管理课件
- 统编版2025二年级语文上册第二单元综合素质达标卷(含答案)
- 2025年保密知识竞赛题库及答案(共80题)
- 2025至2030园林养护产业行业项目调研及市场前景预测评估报告
- 骨科病人全麻术后护理
- 肺栓塞的护理疑难病例讨论
- 2025至2030中国水晶首饰行业发展趋势分析与未来投资战略咨询研究报告
- 绿色示范工厂管理制度
- 日间化疗服务管理制度
- 2025至2030年中国软包电池行业市场供需规模及投资前景预测报告
- 2024-2025学年上海市浦东新区六年级(下)期中数学试卷(五四学制)(含解析)
评论
0/150
提交评论