nxtprograms.com

Fun Projects for your LEGO® MINDSTORMS® NXT!

Home     Projects     Help     Contacts

Guitar Challenge Game
Building: Expert
Program: Expert

Using the Guitar Challenge Game Project

There are several programs for the Guitar Challenge Game project, and using them is more complex than a normal NXT program, so there are some instructions to read here.

Index to Instructions:

Introduction
Game Mode
     Get the Full Version of the Guitar Challenge Game Available on the CD
     Song Data Files
     Downloading the Game Mode Programs and Sample Songs
     Recording your own Songs on the NXT
     Playing Songs on the NXT
     Recording Songs on the PC
     Editing Songs on the PC
     Access to Additional Song Files and Program Updates
     Program Source Code
Free Play Mode
     Manually Installing the Guitar Chord Sounds and the GuitarFreeChord Program
     Hints for using the Guitar in Free Play mode


Introduction

Overall there are two modes that you can use the guitar in: Game Mode and Free Play mode.  In both modes, you choose a note to play by sliding the flat plate along the neck of the guitar with your left hand to select the note to play, then press the strum lever with your right thumb or fingers to play the note.  The strum lever will trigger on both up and down strokes (down strokes with your thumb are usually the easiest to do).

Important: For best results, be sure to keep your left hand completely behind the sliding plate, so that the ultrasonic sensor sees only the plate and not your fingers, as shown below:

Correct: Keep all fingers behind the sensor plate. Wrong: Fingers interfering with the ultrasonic sensor

Game Mode

In Game Mode, you are challenged to play along with notes that are scrolling downward on the NXT screen, listening to the song synchronized from an external source such as a stereo or iPod.  For the Game Mode programs you will want the NXT brick separated from the body of the guitar as shown in the main building instructions, so that you can see the screen while playing.

 

In Game Mode, the NXT doesn't play the notes of the music.  The game is designed to allow you to listen to the "real" music on your stereo or iPod and play along with it.  The only sound coming from the NXT will be short beeps when you miss notes.  Therefore, the game does not come with any real music, you will use your own music.

Game Mode is designed to allow you to record a note sequence for your own music (that you already own or have access to) and then challenge yourself to play along with it, by duplicating the recorded sequence with the correct note selection and timing.  You can also download sample songs provided here or by other users and then download the matching music songs (via iTunes or whatever) if you don't own them already.

Get the Full Version of the Guitar Challenge Game Available on the CD

For the best experience and the most flexibility using the Guitar Challenge Game, it is recommended that you get the "full version" of the game, which is available on the CD LEGO MINDSTORMS NXT 2.0 By Example

When you buy the CD, you get the following things not available in the web version of the Guitar Challenge Game:

  1. The GuitarRecorder PC (Windows) Song Recording and Editing program, which allows you to:

    • Record your favorite songs by simply pressing keys on your PC keyboard in sync with the music.

    • Pause, rewind, scroll, and restart recording, to record songs in sections.

    • Erase and re-record sections of a song.

    • Graphical editor allows you to add, delete, or change notes by "drawing" with the mouse or keyboard.

    • Label songs with title, artist, and album information.

    • Upload songs that were recorded on the NXT to edit them and set the title/artist/album information.

    • Reset high scores.

  2. Post songs you have recorded on the web, and access songs posted by others.

  3. Access program updates and upgrades on the web.

  4. Full source code for the NXT game and recording programs
    (in NXC), so you can study and learn some NXC programming, and make your own game modifications.

  5. Full source code for the Windows-based recording and editing program (in C/C++) so you can study it and make your own modifications and improvements.

Graphical song editor for PC (Windows)
available on the CD.

Song Data Files

The songs that you play are stored in data files on the NXT, with a separate data file for each song.  You can get song data files onto your NXT in four ways:

  1. You can download the data files for the sample songs provided below to the NXT.

  2. You can record your own songs by "playing along" with your own favorite music using the GuitarRecord NXT song recording program.

  3. Owners of the CD can use the PC (Windows) song recording program to record and edit their own songs on a PC using the keyboard and mouse.  This provides a much easier and more accurate way to record your own songs than using the NXT to record.  This also allows you to label your songs with artist, song, and album titles, reset high scores, and edit/change the recorded notes.

  4. Owners of the CD also have access to additional song files submitted by other owners of the game.  For more information, see Program Upgrades and Accessing Additional Song Files.

Downloading the Game Mode Programs and Sample Songs

The NXT programs for Game Mode were written in NXC, which is a programming language that provides lower-level access to the NXT's capabilities and more speed than the standard NXT-G programming system.   So the programs needed will not load and download in the same way as other programs on nxtprograms.com.  To load the programs and sample songs, do the following:

  1. Make a folder on your computer where you will keep the programs and song data files.  For example, on Windows, you might make a folder under "My Documents" named "NXT Guitar Game".

  2. Download the programs and song files that you want from the table below, and save the downloaded files in the folder you created in step 1.
     

    Downloads (Pick Save to save to the folder you created above)

    Programs:  
    GuitarGame.rxe For playing the guitar game on the NXT (compiled NXT program file)
    GuitarRecord.rxe For recording your own songs on the NXT (compiled NXT program file)
    GuitarRecorder.exe PC/Windows song recorder and editor, available only on the CD
       
    Sample Songs: (All Sample Songs in a zip file)
    Song 1.gcs "Happy Birthday" practice song (no music accompaniment)
    Song 2.gcs "Smoke on the Water" by Deep Purple (first 1 min)
    Song 3.gcs "Hit Me with Your Best Shot" by Pat Benatar (full song)
    Song 4.gcs "It's Not My Time" by 3 Doors Down (full song)
    Song 5.gcs "Back in Black" by AC/DC (full song)
    Song 6.gcs "Carry on Wayward Son" by Kansas (first 1 min)
    Song 7.gcs "Through the Fire and Flames" by Dragonforce (first 1 min)
  3. Start the NXT programming software on your computer, connect your NXT, start a new blank program, then open the "NXT Window" from the controller in the lower right, and select the Memory tab as shown below.

  4. Delete any unneeded programs and sounds from your NXT to free up as much memory as possible by selecting the "Program" and "Sound" categories, selecting items from the list, and pressing the Delete button, or just press the "Delete All" button to remove all programs and sounds from the NXT.

  5. Press the Download button on the Memory tab shown above, then locate the GuitarGame.rxe file that you saved on your computer in step 2 and download it to the NXT.  Repeat for GuitarRecord.rxe.

  6. To download sample songs (the files named "Song xx.gcs"), press the Download button, then in the dialog that locates the file, specify that you want to look for "Files of type" All Files.  Locate the sample song you want (that you saved in step 2) and download it.   The file will appear in the "Other" category on the Memory tab.  Repeat for each sample song that you want.

Note: Remember that the Game Mode is designed to synchronize along with external music, so if you want to hear the music of the sample songs, you will need to download/buy the matching songs from iTunes or wherever, to play on your own audio system, if you don't have them already.

Recording your own Songs on the NXT

To record your own songs on the NXT, run the GuitarRecord program on the NXT.  The song will start recording as soon as you strum the first note, and stop recording when you press the orange Enter button on the NXT. 

In Game Mode there are five note positions corresponding to the five "strings" shown on the screen.  You can "play" whatever notes (positions) you want, and your note selection and timing will be recorded.  No sound will be played by the NXT.  Recording is designed to synchronize along with external music that you are listening to on your stereo or iPod (or you can just play to an imaginary song from memory if you want).

 When listening to music that you want to synchronize the song with, a good strategy is:

  1. Start the GuitarRecord program and get ready to play.

  2. Start the song on your stereo or iPod.

  3. Wait for a logical place near the beginning of the song to start your first note.  It shouldn't be right at the beginning, because this will be too hard to anticipate when playing back.  Give yourself the opportunity to hear the tempo and start the first note in a logical place that will be easy to anticipate when playing back.

  4. Play your first note at the right time, then choose and play more notes in sync with the music.  Hold the strum button down to make long notes.  The whammy bar doesn't do anything in Game Mode.

  5. Press the Enter button on the NXT when done recording.  The song will be given a data file name something like "Song xx".  The Artist and Song title information will be filled in to indicate the NXT recorder.

Playing Songs on the NXT

To play the guitar game on the NXT, run the GuitarGame program on the NXT and choose the song to play using the NXT buttons.  When you get to the game display with the "fret strings", the song will start playing as soon as you strum the first note.  So, if you are playing along with external music:

  1. Get the song ready to play in the GuitarGame program

  2. Start the song on your stereo or iPod.

  3. Play the start of the first note at the correct time.  You will need to know when the first recorded note of the song is in order to anticipate it and play it at the right time.  If you play the first note at the wrong time, all of the notes in the song will be displayed out of synch with the music.  For songs you recorded, you will need to remember where the first note is.  For the sample songs and songs you record on the PC, the song will specify the approximate starting time of the first note in seconds from the beginning of the song.  For example, if the song says to start 0:08, then the first game note will be approximately 8 seconds from the very beginning of the song.  Note that this time is approximate, the exact time will be in sync with a logical/clear guitar note in the song.

  4. Note that you do not need to press the strum lever for every note.  For a fast sequence of notes, you can just press and hold the strum lever at the first note, then move the ultrasonic sensor to follow the note positions (this technique is sometimes called "hammer on/off").

  5. At the end of the recorded notes, your number of missed notes and score (percent correct) will be displayed.  If you beat the best high score for that song so far, the new high score will be saved.

Recording Songs on the PC

Owners of the CD can also record songs on the PC using the keyboard, which is easier and more accurate than recording on the NXT, and you can also edit the result with the keyboard and mouse, and record the song in several stages if you want to.  To record a new song on the PC:

  1. Run the GuitarRecorder program on the PC (requires a PC that can run Windows).

  2. Start the song on your stereo or iPod, and at the same time (the very beginning of the song, not the first game note), press the Space bar on the PC to start the song timer.  Starting the timer at the beginning of the song will allow GuitarRecorder to calculate the estimated time of the first game note.

  3. Record notes using the keys 1-5 on the PC keyboard, starting the first note at a logical time.

  4. (Optional) Edit the song to fix recording mistakes (see below).

  5. Enter artist, song title, and album info using the menu choice File => Edit Song Info.  Here you can also specify the approximate time in seconds for the first game note if it was not automatically calculated.

  6. Save the song.  In order for the NXT game program to find them, all song files must be named
    "Song xx.gcs", where xx is a number from 1 to 99.  To keep your files organized and ensure that you don't overwrite another file, save all of your song files in the same folder (the same folder as the programs and sample songs), and make sure you choose a unique number 1-99 when saving it.

  7. To play the song you recorded, you will need to download it to the NXT, similar to the way you downloaded the sample songs.

Editing Songs on the PC

Owners of the GuitarRecorder PC program on the CD can also edit songs, assign the artist, song title, and album name information, and reset high scores.  Note that you can also edit songs that were recorded on the NXT if you upload them from the NXT to the PC from the Memory Tab in the NXT Window. 

To edit a song using the GuitarRecorder program, open it from the File menu, make your changes, then save it from the File menu.  You can edit artist/song/album/score info with File => Edit Song Info.  See the Help menu for editing operations you can do to edit the notes of the song.  Remember to re-download your edited song to the NXT.

Here are some hints for editing songs on the PC using the GuitarRecorder program:

  • You have five note positions to work with.  Come up with a basic plan for how you will use the five notes for a section in the song and practice it a bit on the keys before recording it.

  • You can record a song in sections if you use reference points in the song for where to restart the recording timer.  This allows you to plan and re-try certain portions until you get them close enough to fine tune edit by hand.  Here is how:

    1. After recording one section, stop the timer with the Space bar.

    2. Scroll back to a reference point in the music graph that you know, using the scroll bar and arrow keys.  For example, in the picture to the right, the song has been stopped and scrolled back to the beginning of a recognizable note at the beginning of a beat, which is at about 2:08 in the song.

    3. Rewind your music player to before the reference point (e.g. a few second before 2:08 in this example).

    4. Listen for the reference point in the music (near 2:08), then press the Space bar exactly at the reference point to restart the timer and start recording again.

  • To erase portions of a song before re-recording them, start the timer, then press and hold the 0 (zero) key to erase notes at the recording point.

  • You can fine tune and fix minor errors in the recording using the mouse when the timer is stopped  Click and drag with the left button to "draw" a note on a string, and click and drag with the right button to erase notes.

  • Remember to save a song after editing it.


Access to Additional Song Files and Program Updates

Owners of the CD have access to additional song files on the web that were contributed by other owners of the game, as well as any future program updates.  More information is available on the CD.
 

Program Source Code

Owners of the CD also have access to a copy of the source code for the GuitarGame and GuitarRecord NXT programs, as well as the GuitarRecorder program for Windows, so that they can learn how they are implemented or make modifications for their own use.  See the CD for more information.


Free Play Mode

In Free Play mode, the NXT’s built-in speaker will make its own musical notes, and you can play the guitar like an instrument by itself.  There are 8 different notes from the "Blues Scale" that correspond to 8 different positions of the fret slider.  The Free Play programs will draw a graph of the tones being playing on the screen that you can watch if you want. 

 

In Free Play mode, you can install the NXT brick into the body of the guitar as shown above to make it more portable (see the Free Play conversion instructions), or you can leave the NXT outside as in Game Mode so that you can see the tone graph drawn by the Free Play mode programs.

There are two Free Play programs that give you two different variations:

  1. The GuitarFreeTones program plays tones for the notes using the NXT's tone generator.  When playing tones, you can hold the strum lever down to hold a long note.  You can also use the "whammy bar" to add whammy effects to a long tone.  To use the whammy bar, position the whammy bar angled against its rubber support, strum and hold a note with your thumb, then push the whammy bar down and up with your fingers or palm (towards the color sensor) after strumming the note.

  2. The GuitarFreeChord program will play some cool recorded guitar “power chord” sounds to make your guitar sound more realistic. This program needs eight special NXT sound files in order to work.  To use this program, you can download the "GuitarFreeChord.rbtx" NXT "Pack-and-Go" package inside this zip file and save it to your computer (don't open it directly from the web), then open it in the NXT 2.0 software.  This will load the GuitarFreeChord program and automatically install the eight sound files needed.  Alternately, you can manually download and install the sounds and program file individually as described in the next section below.

    In addition to needing the guitar sound files, the GuitarFreeChord program has a few other restrictions that you should know about:

    • The recorded guitar chord sounds take a lot of memory on the NXT, so you may need to delete other programs that you have downloaded to your NXT to make room. And when you are done using the guitar and need more memory for other programs, you should delete the sound files from the NXT.

    • Due to memory constraints, the guitar chords will only play for about ½ second for each press, so you can‘t hold long notes. Use it like a “rhythm guitar” and keep strumming!

    • The whammy bar doesn't do anything when playing chords.

Manually Installing the Guitar Chord Sounds and the GuitarFreeChord Program

If you have trouble installing the GuitarFreeChord program and sounds automatically via the "Pack-and-Go"  package above, you can manually download and install the sound files and program as follows:

  1. Locate and open the NXT Sounds folder on your computer. On most computers, this is:

Windows: C:\Program Files\LEGO Software\LEGO MINDSTORMS NXT\engine\Sounds
Mac:
Applications > LEGO MINDSTORMS NXT > engine > Sounds

To locate your Sounds folder on Windows, start by finding out where your NXT software is installed by right-clicking on the icon you use to launch the NXT software, picking Properties, and then pressing Open File Location (or look at the Target path), then open engine\Sounds from there.

  1. Open the package of Guitar Chord Sounds (a .zip file) and open it to locate the eight guitar sound (.rso) files.  If your computer cannot open .zip files, you can download the eight sound files individually from here.

  2. Copy (select and drag) all eight of the guitar chord sound files (.rso) to the NXT Sounds folder on your computer.

  3. Download the GuitarFreeChord program to the NXT after installing the sounds.

Hints for using the Guitar in Free Play mode

Playing music in Free Play mode is tricky and takes some practice.  The ultrasonic sensor is very sensitive to the exact position of the fret slider.  Here are a few tips:

  • Make sure your left hand is positioned behind the slider, so that the ultrasonic sensor sees only the sliding flat plate, not your hand.

  • Slight changes in the angle of the sliding flat plate can cause the note to change.  It helps to apply a slight twisting pressure to the plate in one direction so that its angle does not "chatter" around from side to side.

  • Experiment to find the positions of the 8 notes.  Adjust the slider stopper pegs if necessary.  Then watch the fret board to hit the positions you remember.  Better yet, insert pegs into the neck of the guitar at the right locations or tape paper with marks on it to the neck of the guitar to mark the center of each note position.

  • When playing a note, stop the previous note, then quickly move the slider into position for the next note slightly before the note and get it to stop as fast as possible, then strum the note at the right time.

  • When using the whammy bar, open the palm of your hand to shade the color sensor from too much outside light, and make sure the whammy bar is in the up (relaxed) position when you start a note.

  • You will not be able to play all notes, only the 8 notes from the Blues Scale as shown below.  You will have to experiment to see which tunes this will allow you to play.

  • Practice very easy tunes first and slowly work your way up to harder tunes.


The Free Play Notes

The programs for Free Play mode play a series of notes or chords known as the “blues scale”.
These notes are often used in blues and heavy metal rock music. The notes in this scale are:

A, C, D, D#, E, G, G#, A     (The # means “sharp”, so D# is “D sharp”)

On a piano keyboard, these notes are:

Using these notes, it is easy to improvise or "play around" even if you don't know anything about music.

 

Challenges
  • Can you arrange the pegs in the neck of the guitar to visually mark the different note locations?  The locations are different for Game Mode (5 positions) vs. Free Play mode (8 positions).

  • Can you figure out the notes to some tunes you know in Free Play mode? For example, the main riff of
    the rock song “Smoke on the Water” by the band Deep Purple would be:

A C D A C D# D
  • In Free Play mode, where the NXT is playing the tones or chords, the NXT is not very loud. Can you figure out a way to use the microphone and sound system on your computer as an amplifier for your guitar?

Get nxtprograms.com on CD!
Click here for info

Home     Projects     Help     Contacts

 

Copyright © 2007-2011 by Dave Parker.  All rights reserved. 
All project designs, images, and programs are protected by copyright.  Please see the usage policy.