<!-- PDF page 155 -->

- Atari ST SDH files
- MP3 files
- High definition wav files

and many, many more.

The way the system works is as follows: The ZX Spectrum Next communicates with the Accelerator via its secondary *UART*[^p155-2] and sends commands and audio files to the specialised *SUPervisor* software that is running on the *Raspberry Pi Zero*. The *Pi Zero* in turn interprets these files and reproduces the audio contained therein via it's GPIO port onto the ZX Spectrum Next *I²S*[^p155-3] port which in turn mixes it with the rest of its audio output and redirects it to whichever output you have available. In essence when it comes to playback, the ZX Spectrum Next is considered a "sound card" where the accelerator is concerned and two extra DACs where the ZX Spectrum is concerned. As a consequence you can have Digital Audio (on the ZX Spectrum Next), all three PSGs playing AND Digital Audio (on the Pi Zero) all playing simultaneously!

To use the Pi audio facilities you need to first enable the secondary UART and set it to the accelerator. In *NextBASIC* or the *Command Line* you must type:

```
CD "c:/apps/rpi"
```

and press **ENTER**. Then type:

```
LOAD "pi.bas"
```

You'll get a message stating **9 STOP statement, 50:1**indicating the system is now ready to play audio using the Pi Zero. Feel free to poke about the listing of the **PI.BAS** program as it shows you the usage of *Next Registers* (see *Chapter 22* for more).

Playing audio files requires a dot command called **.pisend** which you can find in **c:/dot/** which serves a two-fold purpose: to send files to the *Pi Zero*'s temporary storage *and* send the appropriate command for it to play. Thankfully D. Rimron-Soutter and David Saphier, maintainers of **NextPi2**[^p155-4] and **.pisend** respectively, have packaged all this nicely into little *NextBASIC* programs (located in **c:/nextzxos/**) which you can either call directly or via the *Browser* by selecting a *filetype* already registered. Currently registered *filetypes* include **.SID**, **.MOD**, **.XM**, **.TZX** and **.SDH**.

To illustrate how this works, we shall attempt to play an Atari™ **SDH** file. Assuming you have a **SDH** file named **warhawk.sdh** (search for it and download it on the internet; it's freely available) on the root of your SD card, playing it is as simple as:

```
LOAD "c:/nextzxos/sndplay.bas":
 f$="c:/warhawk.sdh":GO TO 10
```

The screen will read **Playing... c:/warhawk.shd** and the music will start playing from your speakers.

### External Audio Output

If you are interested in doing more with sound from the ZX Spectrum Next, like hearing the sound that **BEEP** and **PLAY** make on something other than the usually limited audio of your display, you will find that the audio signal is also present on the *Audio Out* socket on the back of the machine. You may use this to connect to a pair of headphones or a higher quality amplifier. Note that this will not disrupt audio reproduction on the digital display ca-

[^p155-2]: UART or Universal Asynchronous Receiver-Transmitter is a hardware device that exchanges data sequentially between two systems. In our case this is done between the ZX Spectrum Next hardware and the Pi Zero accelerator via its GPIO port.
[^p155-3]: I²S or Inter-IC Sound is a serial bus interface standard to connect digital audio devices.
[^p155-4]: NextPi/2 is the operating system running on the Pi Zero accelerator that's purposely built to support the Next.

