how to get the duration of a pressed key in MATLAB?
조회 수: 5 (최근 30일)
이전 댓글 표시
I want to press a key with a specific frequency to generate a sound, but I want the duration of the sound to depend on how long I press the key, could this be done in MATLAB?
댓글 수: 0
채택된 답변
Walter Roberson
2017년 1월 4일
Figures have WindowKeyPressFcn and WindowKeyReleaseFcn callbacks. You could start a timer on the key press and stop it on the key release. But be careful about this because you are permitted to press multiple keys so you have to track which key is pressed and released.
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
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!