Multimedia Commands

<< Click to Display Table of Contents >>

Navigation:  3. Script Language > Multimedia Commands >

Multimedia Commands

MPS. - Music Play Speaker

Previous Top Next


MiniRobotLanguage (MRL)

 

MPS. Command

Music Play through PC-Speaker

 

 

Intention

 

Note-setting command. Did you ever had the idea to compose a melody on your own?

This is the way you can start.

 

The MPS.-command generates Beep-like Music-Signals, through the PC-Speaker.

Frequency and Duration can be customized using musical symbols.

 

Its also useful for debugging. and to signal errors and system states

without showing a text.

 

You have some sort of musical notation to input the sound.

Here is an example:

 

' Octave 1, Play a note, make a Pause, Play another Note

MPS.O1 A+ P A-

 

' Octave 4, Play a note, make a Pause, Play another Note, Octave 1

MPS.O4 A+ P A-

 

Here is a Beethoven example:

 

' Beethoven
$$TOA=T120O4L4EEFGGFEEDCCDEEDDP4EEFGGFEEDCCDEEDCCP4DDECDEFEDCDEDCD

MPS.$$TOA

ENR.

 

' Twinkle  Twinkle little Star

$$TOA=T120O4L4CCGGAAAGFFEEDEDGGFFEEDEDCCGGAAAGFFEEDED

MPS.$$TOA

 

 

' US National Anthem

$$TOA=T100O4L4

$$TOA+O5G4E4>DC4<BA2G4E4>DC4<BA2E4E4F4G2GA4G4F4E4D4C2

$$TOA+O5G4E4>DC4<BA2G4E4>DC4<BA2E4E4F4G2GA4G4F4E4D4C2

MPS.$$TOA

ENR.

 

 

' Other sample

$$TOA=mnt120o4d7d9g9g9b9b9>d6<b5p9>

$$TOA=$$TOA+d7e9d9c9<b9>d9c6<a5p9d7d9f#9f#9a9a9>c6<a9a5p9

$$TOA=$$TOA+>d7e9d9c9<b9a9g3d9d9d9g6b5d9d9d9g6b5p9g7g9f#9f#

$$TOA=$$TOA+9e9e9d5d9d9d9f#6a7d9d9d9f#6a5p9>d7e9d9c9<b9a9g7p7d

$$TOA=$$TOA+9d9d9g6b7d9d9d9g6b5p9g7g9f#9f#9e9e9d5d9d9d9f#6a7d

$$TOA=$$TOA+9d9d9f#6a5p9>d7e9d 9c9<b9a9g3

MPS.$$TO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a5g5a5b5c6d6e6f6g6e6f6g6a6a5g5f5e5d5e5f5g5a5e5f5g5a5b5c6d6e6f6g6e6f6g6a6g5a5f5e5d5

$$TOA+mnt120o4e5f5g5a5e6d6c6b5a5g5a5b5c6d6e6f6g6e6f6g6a6a5g5f5e5d5e5f5g5a5e5f5g5a5b5c6d6e6f6g6e6f6g6a6a5g5f5e5d5

 

MPS.$$TOA

ENR.

 

Some musical settings (T,O,<,>,L,MN,MS,ML) will stay persistent between multiple calls to the command as long as the script is running.

 

 

Syntax

 

 

MPS.P1

 

 

Parameter Explanation

 

P1 - (optional) - Sequence of musical notes and dates that form a melody.

 

Commands

T<value>: Sets the tempo. <value> should be between 32 and 255.

L<value>: Sets the default note duration. <value> should be between 1 and 64.

O<value>: Sets the default octave. <value> should be between 0 and 6.

MN: Sets the note style to Natural.

MS: Sets the note style to Staccato.

ML: Sets the note style to Legato.

 

Octave Modifiers

<: Decrease the current octave by 1.

>: Increase the current octave by 1.

 

Notes

Notes are represented by their letter names (A to G) and can include sharp (#) or flat (-) modifiers. Each note may have an optional duration value following it.

 

A, B, C, D, E, F, G: Note names.

#, -: Sharp or flat.

P: Pause or rest.

 

Duration

A number following a note or command changes its duration.
If the duration is not specified, it defaults to the last set duration.

Dot .: Increases the duration of the note by half.

 

Note Style

ML: Legato (smooth transition between notes)

MN: Natural (no special style)

MS: Staccato (notes are played shortly, creating a detached effect)

 

Example Encodings

T120: Sets tempo to 120.

O4: Sets default octave to 4.

L8: Sets default duration to 8.

A#8: Plays A# with a duration of 8.

P16: A rest or pause for a duration of 16.

 

Sample Music String

For example, the string T120O4L8A#8P16 will:

 

Set the tempo to 120.

Set the default octave to 4.

Set the default note duration to 8.

Play the note A# with a duration of 8.

Pause for a duration of 16.

 

Use these letters:

 

A,A+,A#

B-,B

C, C+, C#

D-, D, D+,D#

E-,E

F,F+,F#

G,G+,G#

 

P - fixed Pause

 

and the special letters

 

N - followed by value between 1 and 90 (Note)

T - followed by value between 32 and 255 (Takt)

L - followed by value between 1 and 64 (Length)

O - followed by value between 0 and 6 (Oct)

< - decrease Oct by following number

> - increase Oct by following number

 

and these symbols

 

MN,MS,ML

 

to write you own compositions.

 

Some musical settings (T,O,<,>,L,MN,MS,ML) will stay persistent between multiple calls to the command as long as the script is running.

 

 

 

Example

 

'***********************************

' MPS. Sample "Joy to the world"

'***********************************

$$TAO=mst255O2L2>DL4C#.L8<BL2A.L4GL2F#ED.

$$TAO=$$TAO+L4AL2B.L4B>L2C#.L4C#L2D.L4DDC#<BAA.

$$TAO=$$TAO+L8GL4F#>DDC#<BAA.L8GL4F#F#F#F#L8F#GL

$$TAO=$$TAO+2A.L8GF#L4EEEL8EF#L2G.

$$TAO=$$TAO+L8F#EL4D>L2DL4<BA.L8GL4F#GL 2F#EL1D

MPS.$$TAO

ENR.

END.

 

 

 

Remarks

 

Use PRR. and PRE. to make your Melody play in the background.

 

 

 

Limitations:

 

-

 

 

 

See also:

 

    MSB. - Message Beep

    SAY. - Say something

    DIT. - Dial Tone MFV

    SVL. - Set Volume

    MPA. - Music Player

    MPB. - Music Play Background

    MPC. - Music Player Command