<!-- PDF page 151 -->

### The N Command

In some of the examples you will see the letter **N** used to introduce a series of notes within the string:

```
PLAY "O7N1CDE"
```

**N** is used in cases where two sets of numbers would otherwise clash. In the example above, **O** is set to octave **7**, then a series of notes is given, starting with the duration code **1**. Without the **N** code, *NextBASIC* would read the octave code as **71** – obviously not what was intended!

### Note volume

The overall volume of the sound is controlled by the volume setting of your display or amplifier. You can control, however, the volume of individual notes and phrases within the tune by using the **V** command. **V** followed by a number from **0** to **15** sets the note(s) that follow to a constant volume level. The lower the number, the *quieter* the sound, with **V0** being completely silent (**V0** is a useful way of stopping one *channel* playing while others continue). **V15** is the maximum possible value and will be used automatically by *NextBASIC* if you do not specify a level.

The low volumes are very quiet and you will normally use **10** to **15** unless you are outputting to an amplification system. Try running this program:

```
10 a$="V10cdefgabCDEFGAB"
20 PLAY a$
```

Now try changing the number after the **V** to a new value to hear the difference.

### Volume effects

Instead of you just setting each note to a fixed volume, **PLAY** also lets you change the volume of the sound while it is playing. For example, you can make a note start suddenly and then die away (like a piano) or make a sound effect rise and fall in volume (like a steam train).

This effect is controlled by the letter **W** which can be included in any of the strings controlled by the **PLAY** command. You must also include the letter **U** in each string where you want to use the effect. You cannot use it if the string already has a volume setting (if it contains a **V**) – the volume command will override the effect.

The **W** must be followed by a number from **0** to **7** which controls how the sound builds up (called *attack*) or falls off (called *decay*). *Table 13* that follows, shows the full range of numbers and what they do together with a visual representation of the volume effect applied to the sound playing:

This program plays the same note with each effect in turn to let you hear what they sound like:

```
10 a$="UX1000W0C&W1C&W2C&
   W3C&W4C&W5C&W6C&W7C"
20 PLAY a$
```

Notice the **U** to turn on the effect, then the series of **W** numbers.

There is one other new command used here, the letter **X**. This can be followed by a number from **0** to **65535** to set the length of the sound effect – the larger the number, the longer the effect lasts.

The **X** command is not mandatory. If you choose not to include one, *NextBASIC* will automatically choose the longest. In general, repetitive effects (**W4** to **W7**) are more effective

