Matlab Piano
이전 댓글 표시
Hello. I am a freshman student at mechanical engineering. I try to make a piano on matlab gui for final project but I don't know how I make exactly. Only keybord is enough for my project but I need help. I will appreciate if you help me. Thank you in advance.
댓글 수: 4
Walter Roberson
2011년 12월 19일
Whom is this addressed to?
Are you asking about how to make the GUI, or about how to interface a MIDI keyboard, or about how to do sound synthesis in MATLAB?
hckfb
2011년 12월 20일
Jan
2011년 12월 20일
MIDI?! You asked for a GUI ask keyboard at first. MIDI is another story.
hckfb
2011년 12월 20일
답변 (2개)
Jan
2011년 12월 19일
0 개 추천
As I've answered in your former question: If you ask Google, you find some very well implementations of piano keyboards in Matlab. You can also search in the FileExchange pages.
I did not post the links directly, to give you a chance to find them by your own.
댓글 수: 8
hckfb
2011년 12월 20일
Jan
2011년 12월 20일
What exactly is your question?
hckfb
2011년 12월 20일
Walter Roberson
2011년 12월 20일
If you are using GUIDE, the callback function will be created automatically and you will merely (!) need to add the calls to the sound synthesis routines to those callbacks.
If you are not using GUIDE, then when you create the uicontrol, specify the name of a routine in the 'Callback' parameter, such as
blackkey5 = uicontrol('Style','pushbutton','Callback', {@keypushed,'b5'}, 'Position', [....]);
and
function keypushed(src, evt, keyid)
[...]
end
hckfb
2011년 12월 20일
Walter Roberson
2011년 12월 20일
You could start by creating the GUI and setting the callbacks to things like
pianokey(w11)
and have
function pianokey(keyid)
keyname = keyname(keyid);
note = keynote(keyid);
fprintf(1, 'Pressed key #%d, %s, note %s\n', keyid, keyname, note);
end
This will allow you to get your GUI all nicely arranged and will allow you to test the callbacks to be sure that each pushbutton connects to the proper note.
(You would have to build the keyname() and keynote() functions.)
hckfb
2011년 12월 20일
Walter Roberson
2011년 12월 20일
Might as well start with your GUI, and use dummy callback routines like I show above.
Sound synthesis is not a small topic; if you want to do it, you will need to research it and figure out what you want to implement. Keeping in mind, of course, that imitating force or velocity sensitive keys, or even just figuring out when a key is released, is going to require some cleverness on your part.
Walter Roberson
2011년 12월 20일
0 개 추천
MIDI: see
Sound synthesis: see
카테고리
도움말 센터 및 File Exchange에서 Just for fun에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!