function plot(obj)

%% Plot the time domain signal
s = obj.s;
fs = obj.fs;
figure, plot((1:length(s))/fs,s);
title('Audio signal')
xlabel('time (s)');
axis tight

player = audioplayer(s,fs);
set(player,'StartFcn',@plotTransportBar);
set(player,'TimerFcn',@updateTransportBar);
set(player,'StopFcn',@deleteTransportBar);

%% Add playbaack controls
playButtonH = uicontrol(gcf,'Style','pushbutton','String','play','Units',...
    'Normalized','Position',[0.02 + 0.39 0 0.1 0.05]);
stopButtonH = uicontrol(gcf,'Style','pushbutton','String','stop','Units',...
    'Normalized','Position',[0.12 + 0.39 0 0.1 0.05]);

set(playButtonH,'Callback',@play_callback);
set(stopButtonH,'Callback',@stop_callback);

    function play_callback(~,~)
        if strcmpi(get(playButtonH,'String'),'play')
            play(player,player.CurrentSample);
            set(playButtonH,'String','pause');
        else
            pause(player)
            set(playButtonH,'String','play');
        end
    end

    function stop_callback(~,~)
        stop(player);
    end

%% Transport Bar functions
    function plotTransportBar(~,~)
        global tbH
        xLim = get(gca,'Xlim');
        yLim = get(gca,'YLim');
        tbH = line([xLim(1) xLim(1)],yLim,'Color','k');
    end
        
    function updateTransportBar(hObject,~)
        global tbH
        currentSample = hObject.CurrentSample;
        pos = currentSample/fs;
        set(tbH,'XData',[pos pos]);
    end

    function deleteTransportBar(~,~)
        global tbH
        delete(tbH);
    end
end
