how to get the duration of a pressed key in MATLAB?

조회 수: 5 (최근 30일)
digital processing
digital processing 2017년 1월 4일
답변: Walter Roberson 2017년 1월 4일
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?

채택된 답변

Walter Roberson
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개)

카테고리

Help CenterFile 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!

Translated by