This page is hosted by:
Get Dual N-Back Lite at Fast, secure and Free Open Source software downloads

Dual N-Back Lite

Basic training for your working memory

Why the hubub, Bub?
Trainers like Dual N-Back Lite have become popular lately because the research of Susanne Jaeggi and Martin Buschkuehl indicated a link between a working memory training task (the dual n-back exercise) and fluid intelligence, as measured by a German IQ test. The hope is that training with such exercises as dual n-back serves to produce a temporary increase in the cognitive capabilities of the trainee. (Note that though most people in the cognitive sciences believe the team's research is of importance, they caution more research is needed to corroborate the results.)

What is working memory?
Working memory is the active "storage space" we use when working on a problem, allowing us to manipulate the information while we work towards a solution. Working memory is used, for example, when we recall something from long-term memory—it gets stored in working memory, ready for us to use. Short term memory on the other hand is considered by some as a subset of working memory—working memory includes not only the memory storage of short term memory but also information processing features.

Why did you write this program?
A lot of evidence suggests that cognitive, not just physical, exercise is good for us. This project resulted from my wanting to see more (free!) choices out there in cognitive training tasks (and it doesn't hurt a resume). The dual n-back trainers I've seen have had drawbacks I didn't like so I wrote this one (what can I say—I'm picky).

But it's so simple, so plain looking.
I could have glammed it up but I didn't. I wanted to keep the design basic, to provide a lean, distraction-free trainer like the one used in the study.

Features Screenshots Instructions What's needed Compiling Troubleshooting Provide feedback



The start screen
[A picture of the start screen]
Training without keypress feedback Training with right/wrong keypress feedback
[A simple training session without keypress feedback] [A training session with right/wrong keypress feedback]


The trainer can be downloaded from its home at SourceForge: Dual N-Back Lite.

Basis for Dual N-Back Lite and instructions:

Dual N-Back Lite attempts to mimic the trainer used in the paper: "Improving fluid intelligence with training on working memory"1 by Susanne Jaeggi et al. The interface has been kept simple and allows removing any keypress or right/wrong feedback (see screenshots) from the training screen for fewer distractions (see below for instructions on this feature).

The object is to correctly identify targets, both visual and audio, which occurred n steps back in the sequence in which you see and hear them.

dual 2-back example:
time (seconds): 0 3 6 9 12 15 18 21 ...
spoken letter: "x" "y" "r" "h" "r" "w" "c" "w" ...
audio target: NO NO NO NO YES NO NO YES ...
visual position: 1 3 1 2 8 3 8 2 ...
visual target: NO NO YES NO NO NO YES NO ...

In training, if you see a visual target, press "a"; while for an audio target, press "l", before the next targets appear/are spoken (—this choice of which-keys-to-press is somewhat unfortunate for English speakers as one would like "a" to represent an "a"udio target but I'm keeping to the paper).

Blocks, sessions and n-levels:

The n-level:

  • Your n-level is shown in the lower right corner of the screen.
  • The n-level refers to how many steps "back" you need to remember the spoken letter and visual square position in order to compare it to the current letter or square. If the letter or square MATCH what you heard or saw n steps ago, this counts as a "target" and you should press the appropriate key ("a" for a spoken letter match and "l" for a visual square match).

A block:

  • Your block number is shown in the lower left corner of the screen.
  • A BLOCK consists of a sequence of 20+n spoken letters and visual targets.
  • Each block has 6 visual and 6 audio targets.
  • In each block, there are exactly 2 "simultaneous" targets where BOTH a spoken letter will match the letter spoken n steps ago AND a visual square position will match that of a visual square n steps ago.

A session:

  • The session length defaults to 20 blocks (this is the number used in the study cited in the paper, but this can be adjusted in the (o)ptions screen).

Scoring follows the description in the paper:

  • if a user either presses a target key when there is no target or doesn't press a key when there is one, it is counted as a MISTAKE
  • if the user makes less than 3 mistakes in EACH mode (audio AND visual), then the n-level increases by one
  • if the user makes more than 5 mistakes in EITHER mode (audio OR visual), then the n-level decreases by one (note: there is some ambiguity about whether more than 5 mistakes were required in only ONE mode or BOTH modes to decrease the n-level—I have chosen the more restrictive version).
  • in all other cases, the n-level stays the same

Keypress and right/wrong feedback:

  • The default is for no feedback.
  • In the (o)ptions screen, you can turn on keypress feedback (white markers appear at the bottom of the display window whenever an "a" or "l" key is pressed) and you can turn on right/wrong feedback (a red "x" appears for a mistake while a green check appears when you correctly press a key for a target match). Note that both the white markers and the "x"/check-marks cannot be turned on simultaneously.

Stopping training:

  • The (esc) key will stop any training session, returning you to the start screen.

What you need to run Dual N-Back Lite:

  1. for Windows: nothing extra is needed, other than,
    1. ensuring the executable is in the same directory as the "data" folder
    2. the included SDL.dll and SDL_Mixer.dll libraries are either in the same folder as the executable OR the SDL.dll and SDL_Mixer.dll libraries are in your windows/system directory
  2. for Linux: you'll need to compile* it (see below for details—a g++ specific makefile is given, to make the process easy and g++ can be downloaded if you don't have it) and you'll need to have SDL installed (just the basic SDL package—no additional add-ons like the SDL mixer (the mixer is only used in the Windows version), etc...) and, as with Windows, you'll need to ensure the "data" folder is in the same directory as your executable
  3. (*a note on Linux and compiling: why do I need to compile it? (you may ask)—different flavors of Linux are often different enough to require compiling the code in the particular Linux OS (vs. simply distributing an executable file as is often possible with Windows))
Once you have the executable, either launch from the command line or, most desktop managers let you double-click on the icon of an executable to launch it. (NOTE: the Dual N-Back Lite window must be ACTIVE to receive keyboard input; if it's not already active, a mouse click on the window will make it active)

Compiling on Your Own (for beginners):


To install under Linux, you can use the included makefile if you have g++ (if not, g++ is an easy download). You'll also need to download SDL (you'll need BOTH the SDL-develop package to compile and the SDL package to run the program) if you don't already have them. Then, extract the source archive called src_linux (this can be done, for example, from the GNOME or KDE desktop). Open a shell (Applications>System Tools>Terminal, for example, in GNOME) and navigate to the (extracted) directory labeled "src_linux". Once there, type in the command "make" at the shell prompt. After the compiler is done (you may get several "linker input file unused because linking not done" messages during the compile—ignore them), an executable file called "DualNBack" should appear in the "src" directory's PARENT directory. Ensure the exracted Data folder is in the same folder as the "DualNBack" executable and then, while in that directory in the shell, type: "./DualNBack" (adding any audio command line switches if desired) and play.

What's a make file?

This is the conductor (as in orchestra) to get everything compiled easily (you COULD, for example with g++, type in a (really) long line at the command prompt to get things to compile; the make file just reduces the workload). The "make" utility is smart in that it will automatically look for a file called "Makefile" (with one or two variations) in the directory from which it's run and execute the instructions it finds in this file (there is an option, though, to specifiy which counductor-file to use for the "make" utility—eg "$make -f [filename]").

Why won't it compile under Linux?

So you've run "make" and you don't get a successful compile? I can say at least, it compiles on a (normal?) version of Fedora Core 8 (as mentioned, you need to have g++ and SDL installed for the included makefile to work). Beyond that, it's probably up to Google to find out why it won't compile. (Every effort has been made to reduce peripheral libraries and to keep the code to platform independent C/C++ standards. However, I'm told that what compiles on one machine may need some tweaking to compile on another.)


If you want to (or need to) compile the code on your own, you can use VC++, adding all files in the extracted "src" directory into a VC++ project (just add them in one big group into a new VC++ console application). If you haven't already done so, you'll need to download the SDL developer libraries (be sure to get the mixer library and include files too) from the SDL site and inform Visual C++ about SDL (there are several good resources online for how to get VC++ to compile with SDL (for example this tutorial)—BRIEFLY, it involves

  1. telling VC++'s "include directories list" about the "include" folder in the SDL developer downloads
  2. telling VC++'s "lib directories list" about the "lib" folder in the extracted download*
  3. setting VC++ to "multithreaded DLL" in the C++ code generation menu (this is important since the SDL.dll itself has been compiled with this option "selected" and mixing and matching compiled code with different threading options can create problems)
  4. putting the SDL.dll and SDL_mixer.dll in a spot where your compiled program can find it (either in the same directory as your executable or in your Windows/System folder)
  5. also, building the RELEASE version seemed to work better than building the DEBUG version.
  6. ( *NOTE: at least in Windows 98, it seemed necessary, in addition to the above, to add (Project>Add to Project) the SDLmain.lib and SDL.lib files to the project itself (so they appear with all the other source and header files in the project); not adding the SDL_mixer.lib didn't seem to produce problems)

In more DETAIL, here are the steps I used on an older version of VC++ (6.0) and a Windows 98 machine

  1. download SDL, being sure to get the developer files too
  2. open VC++ and create a new console application—Win32 console app (NOTE: the PROJECT NAME becomes the name of the FOLDER in which Debug and Release folders exist AND the default name of the final executable generated by the Build option)
  3. under Build>Set Active Configuration, set to RELEASE
  4. under Tools>Options>Directories, add the folders: sdl\lib and sdl\include that you downloaded from SDL
  5. in Project>Settings>Link, ADD SDL.lib SDLmain.lib and SDL_mixer.lib
  6. in Project>Settings>C++>Code Generation set it to Multithreaded DLL (release version, not debug)
  7. using Project>Add to Project>Files (this step may or may not be necessary on all PC's) add the sdl.lib, sdlmain.lib and sdl_mixer.lib to the project (these do not actually get put in the project folder, only tells VC++ about them)—on my PC, they are in C:\Program Files\SDL\lib
  8. in the IE file browser (OUTSIDE of VC++), in the created project folder, add the .dll files (sdl.dll and sdl_mixer.dll) (—this step is not needed if they're in the Windows/System folder already)
  9. add all the files in src_windows from the SourceForge download into the created project folder and then Project>Add to Project all the files from src_windows
  10. Build>Build [project name].exe


Problems on Windows

I don't have access to many Windows machines so I can't give much information about that environment. Of four different Windows machines tried,
  1. a Windows 98 machine failed on all SDL video applications (gave a general protection fault on SDL_Init for video)
  2. a Windows 98 machine ran video; sound worked but was low quality
  3. a Windows XP laptop ran Dual N-Back Lite successfully
  4. a Windows XP desktop ran Dual N-Back Lite successfully

Audio (and/or the program freezes when it tries audio in Windows)

(Note: Dual N-Back Lite will try to default to single n-back (visual targets only) if audio doesn't work.)

  • Windows: if your audio is not working in Windows, it appears compiling an SDL application in Windows makes the audio default to DirectX audio, so DirectX audio must be working properly—you can try running "dxdiag" at a DOS prompt ensure DirectX audio works OK and troubleshoot it if need be (though you also might have some luck with the command "set SDL_AUDIODRIVER=waveout" at the DOS command prompt just before running the executable from the same prompt—no promises on latency however...); also, if the program freezes any time before showing the actual splash screen, the audio may be the culprit—run with the switch "-s NONE" to at least get the graphics portion of Dual N-Back Lite running (in single n-back mode)
  • Linux: if your audio is not working in Linux, you can try running Dual N-Back Lite from the command line, using the switches to manually tell SDL which audio system to try. See below for switch syntax.
    (NOTE: for Linux, audio was designed to be robust; it was designed with the novice Linux user in mind; its default mode is to run an auto-find search (by trying different SDL_AUDIODRIVER variables—it tries the SDL "default" audio setting, then the "alsa" system and finally the "dsp" device, all channeled through SDL) to get sound working—the auto-find search though is not exhaustive and/or might not grab the audio application you want it to use—you may still get audio results and/or can set it using the correct device name in the command line switch)

Command line audio switch syntax

  1. switch syntax
    • -s [server name] the possibilities are: "NONE" and "SDL"
    • -d [device name] for SDL, the 'devices' are simply the SDL_AUDIODRIVER environment variable listed below
    • examples
      • example of command line launch—navigate to the game's directory then: [@shell prompt]./DualNBack -s SDL -d dsp
      • example to turn audio OFF, run from the command line with the "-s NONE" switch (sets audio server to NONE): that is, once in the game's directory, type: [@shell prompt]./DualNBack -s NONE
  2. list of SDL supported audio systems (used for the -d switch argument; case sensitive)
    • openbsd (OpenBSD)
    • dsp (OSS /dev/dsp: Linux, Solaris, BSD etc)
    • alsa (Linux)
    • audio (Unix style /dev/audio: SunOS, Solaris etc)
    • AL (Irix)
    • artsc (ARTS audio daemon)
    • esd (esound audio daemon)
    • nas (NAS audio daemon)
    • dma (OSS /dev/dsp, using DMA)
    • dsound (Win32 DirectX)
    • waveout (Win32 WaveOut)
    • baudio (BeOS)
    • sndmgr (MacOS SoundManager)
    • paud (AIX)
    • AHI (Amiga)
    • disk (all; output to file)
    [a user familiar with SDL might realize these to simply be the SDL_AUDIODRIVER environment variable options; this IS what they are; the game will try to set and unset the SDL_AUDIODRIVER environment variable in the program's audio routines (note: if it does make a change, it is not 'exported' and it is designed to restore the environment variable back to its original value on program exit)]

Help improve this project:

You can help improve this project—one of the difficulties in creating cross-platform applications is having little idea about the success or failure of the program on systems the developer doesn't have access to for testing. For example, if you took the time and trouble to download Dual N-Back Lite and it doesn't work right on your system, you can let me know here...

Your operating system:
Windows 98/Me
Windows XP
Windows Vista
Program usability:
worked but no sound
failed with error message
failed with no indication why
Comments (optional):

You can also e-mail comments. Contact me—

  1. Jaeggi, S. M., Buschkuehl, M., Jonides, J., & Perrig, W. J. "Improving Fluid Intelligence With Training on Working Memory". Proceedings of the National Academy of Sciences of the United States of America. April 28, 2008. 105(19), 6829-6833

This page was last updated March 5, 2009.