— Scott McNealy, Sun Microsystems Chairman, President and ceo



Download 40,57 Mb.
Pdf ko'rish
bet322/555
Sana26.05.2022
Hajmi40,57 Mb.
#609235
1   ...   318   319   320   321   322   323   324   325   ...   555
Bog'liq
Head First Java (Kathy Sierra, Bert Bates) (z-lib.org)

344
 
chapter 11
A MIDI message holds the part of the event that says what to do. The actual instruction 
you want the sequencer to execute. The first argument of an instruction is always the type 
of the message.The values you pass to the other three arguments depend on the type of 
message. For example, a message of type 144 means “NOTE ON”. But in order to carry 
out a NOTE ON, the sequencer needs to know a few things. Imagine the sequencer saying, 
“OK, I’ll play a note, but which channel? In other words, do you want me to play a Drum 
note or a Piano note? And which note? Middle-C? D Sharp? And while we’re at it, at which 
velocity should I play the note?
To make a MIDI message, make a ShortMessage instance and invoke setMessage(), passing 
in the four arguments for the message. But remember, the message says only what to do, so 
you still need to stuff the message into an event that adds when that message should ‘fire’.
MIDI message: the heart of a MidiEvent
a.setMessage(144, 1, 44, 100);
message type
channel note to play
velocity
Anatomy of a message
144 means 
NOTE ON 
Channel
Think of a channel like a musician in 
a band. Channel 1 is musician 1 (the 
keyboard player), channel 9 is the 
drummer, etc.
Velocity
How fast and hard 
did 
you press the key? 0 is so soft you 
probably won’t hear anything, but 100 is a 
good default.
128 means 
NOTE OFF
1
1
0
2 3 4
5 6 7
8
127
Note to play
A number from 0 to 127, going 
from low to high notes.
1
Message type
2
3
4
start playing
stop playing
contents of a 
Midi event
The 
first argument to setMessage() always 
represents the message ‘type’, while the 
other 
three arguments represent different things 
depending on the message type. 
The last 3 args vary depending 
on the message 
type. This is a NOTE ON message, so the 
other args are for things the 
Sequencer needs 
to know in order to play a note.

Download 40,57 Mb.

Do'stlaringiz bilan baham:
1   ...   318   319   320   321   322   323   324   325   ...   555




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish