The original scenario description is below. However, in this version I've
modified the scenario so that the piano works with MIDI instead of sound
files. This makes it quicker to load and easier to alter things like
instruments if the need arises - and in this situation its generally more
flexible. The MidiPlayer class is included, should anyone want to use it
to incorporate Midi into their own scenarios. --mjrb4
-- P I A N O --
This scenario was created as a brief demonstration of some Greenfoot
programming techniques. It demonstrates, among other things, how you
can play sounds.
The sound files are in a subdirectory "sounds" inside the project
directory. There is one file for every note. Each sound file is bound
to one key on the keyboard. I have laid it out for my keyboard (which
is a UK keyboard). Since some keys (especially punctuation keys) are
laid out differently on different keyboard, you might have to adjust
this for your own keybord.
This can be done in the "Piano" class. Look at the top of the class.
There, arrays are defined called "whiteNotes" and "whiteKeys", which define
which note (sound file) is bound to which key (they are bound in the order
in which they are listed). The same for "blackNotes" and "blackKeys".
Edit this if your keyboard is different.
You can, of course, also make entirely different sound files, and bind those
to your keys. Then your piano might make all sorts of funny noises...
Written by: Michael Kolling, Feb 2007
Copyright (c) Michael Kolling
License: Free for any non-commercial use, modification and distribution.
没有合适的资源?快使用搜索试试~ 我知道了~
greenfoot开发素材
共205个文件
java:32个
class:27个
ctxt:26个
需积分: 32 11 下载量 55 浏览量
2015-11-06
16:50:25
上传
评论 1
收藏 45.5MB ZIP 举报
温馨提示
greenfoot小游戏开发的相关素材包,感兴趣的朋友可以进来看看
资源推荐
资源详情
资源评论
收起资源包目录
greenfoot开发素材 (205个子文件)
all-wcprops 115B
JDK_API_1_6_zh_CN.CHM 35.12MB
MidiPlayer.class 5KB
Wombat.class 3KB
Ball.class 3KB
Wombat.class 2KB
Piano.class 2KB
Explosion.class 2KB
Counter.class 2KB
ScoreBoard.class 2KB
Bomb.class 1KB
Drums.class 1KB
BalloonWorld.class 1KB
WombatWorld.class 1KB
WombatWorld.class 1KB
Key.class 1KB
Loop.class 1KB
MidiPlayer$1.class 1KB
Dart.class 1012B
PianoWorld.class 912B
Background.class 896B
Vector.class 825B
Balloon.class 802B
WhiteKey.class 457B
BlackKey.class 457B
BallWorld.class 359B
Leaf.class 303B
Leaf.class 240B
Rock.class 240B
stylesheet.css 1KB
stylesheet.css 1KB
stylesheet.css 1KB
MidiPlayer.ctxt 4KB
Wombat.ctxt 1KB
Wombat.ctxt 1KB
Ball.ctxt 948B
BalloonWorld.ctxt 668B
WombatWorld.ctxt 560B
WombatWorld.ctxt 560B
Bomb.ctxt 540B
ScoreBoard.ctxt 472B
Counter.ctxt 459B
Drums.ctxt 436B
Key.ctxt 427B
Explosion.ctxt 410B
Vector.ctxt 360B
PianoWorld.ctxt 321B
Piano.ctxt 314B
Balloon.ctxt 231B
Loop.ctxt 189B
Dart.ctxt 176B
BallWorld.ctxt 164B
Background.ctxt 136B
BlackKey.ctxt 127B
WhiteKey.ctxt 127B
Leaf.ctxt 126B
Leaf.ctxt 79B
Rock.ctxt 79B
课程设计报告格式要求.docx 23KB
entries 2KB
entries 655B
entries 397B
entries 266B
format 2B
format 2B
format 2B
format 2B
MIDI Piano.gfar 41KB
weave.gif 10KB
bricks2.gif 9KB
rock.gif 3KB
rock.gif 3KB
wombat-left.gif 2KB
wombat-left.gif 2KB
wombat.gif 2KB
wombat.gif 2KB
leaf.gif 846B
leaf.gif 846B
balloon1.gif 636B
inherit.gif 57B
project.greenfoot 4KB
project.greenfoot 4KB
project.greenfoot 2KB
project.greenfoot 2KB
project.greenfoot 2KB
project.greenfoot 1KB
project.greenfoot 1KB
GreenfootImage.html 36KB
Actor.html 31KB
World.html 26KB
UserInfo.html 25KB
Greenfoot.html 22KB
GreenfootSound.html 14KB
MouseInfo.html 12KB
package-summary.html 9KB
package-summary.html 7KB
Counter.html 6KB
allclasses-frame.html 2KB
index.html 1KB
Index.html 1KB
共 205 条
- 1
- 2
- 3
资源评论
qq_32611885
- 粉丝: 0
- 资源: 1
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功