To emit a simple sound each time a video is labeled
    조회 수: 3 (최근 30일)
  
       이전 댓글 표시
    
Hi 
I want to make sound whenever the title is attached to the  figure video.
camera = VideoReader('slow.mp4');
nnet = alexnet;  % Load the neural net
pic = image([]);
while hasFrame(camera)  
    picture = readFrame(camera);              % Take a picture    
    picture = imresize(picture,[227,227]);  % Resize the picture
    label = classify(nnet, picture);        % Classify the picture
    pic.CData = picture;     % Show the picture
    title(char(label)); % Show the label
    if title(char(label))
        beep on
    if else title(char(label))
            beep off
    end
    drawnow limitrate;   
end
delete(camera);
I've changed the source code but it doesn't work.
Not only does it not sound, but it also happens that the video stops.
I want to make a sound whenever the label is attached to the video.
It's the source code I changed.
댓글 수: 0
답변 (1개)
  Max Murphy
      
 2019년 12월 8일
        
      편집: Max Murphy
      
 2019년 12월 8일
  
      To produce the dreaded error sound, syntax is just beep; (beep on or off just toggles whether the error sound is on or muted). 
Depending on the current state of your Matlab environment due to use of beep off, you may need to make a single call to the command window before running your code:
beep on; % Ensures it is toggled to "on" state
Your code will not run because the second conditional statement syntax should be 
else 
not 
if else title(char(label))
참고 항목
카테고리
				Help Center 및 File Exchange에서 Audio I/O and Waveform Generation에 대해 자세히 알아보기
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
