A RARS tool extension for playing a virtual piano with mini-game mode
Fabian Schneider contact: [email protected]
The project "Virtual Piano" was developed to offer RARS users the oppertunity to play a virtual piano as a tool included in RARS. You'll be able to change values of the MidiOutSync Sycall in runtime leading to different sounds everytime you change something in the GUI.
In addition to the normal mode for making music, the virtual piano offers multiple functionalities, which are listed in the Virtual Piano
section. Besides playing the piano normally there is also an integrated mini-game mode which trains your brain by making you memorize a melody sequence (symbolized through colors). There are multiple difficulties which you can choose from. How the game works and additional information are written in the Mini-Game Mode
section.
GUI of the Virtual Piano
adjust:
volume, duration and select one from multiple instrumentsrecord:
after the record button is pressed, everything you played will be stored in the .data-segmentreset:
the reset button will delete the recording you've made beforesave:
after finishing a recording session, the save button copies an automatically generated assembly code to your clipboard, which you can include in a new .asm file. In runtime the recorded melody will be played with the adjusted volume, duration and instrumentplay:
the play button lets you hear the melody you've played in an recording sessiongame:
the game button colors your piano key buttons to a specific color, as a preparation for the mini-game
There is no ideal way to play a piano. Try out different configurations in the GUI and play around with different instruments.
open src/tool/start.asm
in RARS and execute
- open the bitmap display and the virtual piano in the tool section
- press the game button in the virtual piano tool
- select 32 for
unit width in pixels
andunit height in pixels
- select 512 for
display width in pixels
and 256 fordisplay height in pixels
- select
0x10040000(heap)
as the base address for the display
- Run the program
- Select a difficulty by typing to the console
(easy = 1 / medium = 2 / difficult = 3)
- Get ready in countdown phase
- You have to memorize the pattern of color pieces dropping down
- After all colored pieces dropped down, next step is to press the piano keys in the same sequence as the colored pieces dropped down
- If a green bar appears on the right, you pressed the correct key. A red bar appears if you pressed the wrong key
- After all correct keys have been pressed, your score will appear in the console
INFO: If you want to change the melody for each difficulty, you're able to do so by changing pitch values in draw_pieces.asm. Pay attention to not assign more values than written
open src/main.asm
in RARS and execute
Description of all files (rars extension, mini-game, unit tests)
-
src/tool/VirtualPiano.Java
# File for creating the virtual piano and let it appear in the tool section of RARS -
src/tool/start.asm
# The correct assembly code for playing the virtual piano -
src/tool/rars.jar
# Application,JDK 17!!
-
src/tool/rars.zip
# Contains all files and classes of the newest RARS version (including the Virtual Piano)
-
src/main.asm
# Main class of mini-game (launches the game) -
src/song_difficulties
# Sets the game difficulty (melody difficulty and movement speed of pixels) -
src/draw_countdown.asm
# Draws a five second countdown before memorizig phase begins -
src/draw_pieces.asm
# moves the pixels down and listens in second phase for a pressed keys by the user
-
test/utest_countdown.asm
# tests if the countdown appears at the correct position -
test/utest_difficulties.asm
# tests if difficulty value is stored in correct register, after user set a difficulty -
test/utest_highscore.asm
# tests if the correct highscore strings are printed (depending on difficulty) -
test/utest_max_min_config.asm
# tests the maximum and minimum values of the Virtual Piano tool (for e.g value of slider when completely left) -
test/utest_position.asm
# tests if green sidebar, red sidebar and colored topbar appears at correct position -
test/utest_tool.asm
# tests if piano keys return the correct value and tests a random configuration of duration, volume and instrument
-
test/utest_saved.asm
# contains a melody which will be compared withtest/utest_tool.asm
-
test/utest_max_config.asm
# contains the maximum configuration values of the GUI and will be compared withtest/max_min_config.asm
-
test/utest_min_config.asm
# contains the minimum configuration values of the GUI and will be compared withtest/max_min_config.asm