Ksp reference Manual


Arithmetic Commands & Operators



Download 0,99 Mb.
Pdf ko'rish
bet38/187
Sana10.02.2022
Hajmi0,99 Mb.
#441108
1   ...   34   35   36   37   38   39   40   41   ...   187
Bog'liq
KONTAKT 610 KSP Reference Manual

Arithmetic Commands & Operators
42
KSP Reference Manual


6.4. Rounding Commands
Rounding commands can only be performed on real numbers.
ceil(x)
Ceiling (round up)
ceil(2.3) = 3.0
floor(x)
Floor (round down)
floor(2.8) = 2.0
round(x)
Round (round to nearest)
round(2.3) = 2.0
round(2.8) = 3.0
6.5. Trigonometric Commands
Trigonometric commands can only be performed on real numbers.
cos(x)
cosine function
sin(x)
sine function
tan(x)
tangent function
acos(x)
arccosine (inverse cosine function)
asin(x)
arcsine (inverse sine function)
atan(x)
arctangent (inverse tangent function)
6.6. Bit Operators
The following bit operators can be used:
Bit Operators
x .and. y
Bitwise and
x .or. y
Bitwise or
Arithmetic Commands & Operators
43
KSP Reference Manual


.not. x
Bitwise negation
sh_left(,bits>)
Shifts the bits in 

by the amount of 

to the
left
sh_right(,bits>)
Shifts the bits in 

by the amount of 

to the
right
6.7. random()
random(,)
Generate a random integer in the range 

to 

Examples
on init
declare $rnd_amt
declare $new_vel
end on
on note
$rnd_amt := $EVENT_VELOCITY * 10/100
$new_vel := random($EVENT_VELOCITY-$rnd_amt,$EVENT_VELOCITY+$rnd_amt)
change_velo($EVENT_ID,$new_vel)
end on
Randomly changing velocities in by ±10 percent
6.8. int_to_real()
int_to_real()
Converts an integer value into a real number
Examples
on init
declare ~velocity_disp
end on
on note
~velocity_disp := int_to_real($EVENT_VELOCITY)/127.0
message(~velocity_disp)
end on
Displays the event velocity in the range 0.0 to 1.0
See Also 
real_to_int()
Arithmetic Commands & Operators
44
KSP Reference Manual


6.9. real_to_int()
real_to_int()
Converts a real number into an integer
Remarks
• Using this process without any rounding function will cause the real value to be truncated, so
performing this function both 2.2 and 2.8 will return an integer value of 2
Examples
on init
declare $test_int
declare ~test_real := 2.8
$test_int := real_to_int(~test_real)
message($test_int)
end on
Converting a variable from real to integer and then displaying it
See Also 
int_to_real()
round()
ceil()
floor()
6.10. msb()
msb()
Return the MSB portion (most significant byte) of a 14 bit value
Examples
on rpn
message(msb($RPN_VALUE))
end on
Commonly used when working with rpn and nrpn messages
on init
declare ui_value_edit $Value (0,16383,1)
end on
on ui_control ($Value)

Download 0,99 Mb.

Do'stlaringiz bilan baham:
1   ...   34   35   36   37   38   39   40   41   ...   187




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