# Disk #10: The Internal Speaker



The Speaker collection contains macros and subroutines for outputting sound on the Apple II internal speaker. Currently, this is limited to square wave notes and song playing, as well as as few standard sound effects. Ideally, future updates will include a subroutine using duty-cycling that is capable of producing elemental "instruments" for a variety of timbres. 



| MACRO   | DEPENDENCY           | PARAMETERS | ACTION                                  | DESTROYS | CYCLES | BYTES |
| ------- | -------------------- | ---------- | --------------------------------------- | -------- | ------ | ----- |
| `STMPO` | `SETTEMPO`           |            | Set the tempo                           | NZCV     | 240    | 6     |
| `PNOTE` | `PLAYNOTE` `REDTONE` |            | Play note in song                       | NZCV     | 172+   | 3     |
| `SSONG` | none                 |            | Set song sequence                       | NZCV     | 48     | 36    |
| `NEXTN` | none                 |            | Advance to next note in song            | NZCV     | 24     | 17    |
| `PREVN` | none                 |            | Move to previous note in song           | NZCV     | 28     | 17    |
| `RSTRT` | none                 |            | Restart song index                      | NZCV     | 16     | 12    |
| `FFWRD` | none                 |            | Fast forward a number of notes in song  | NZCV     | 27     | 19    |
| `REWND` | none                 |            | Rewind a number of notes in song        | NZCV     | 35     | 25    |
| `PTONE` | `REDTONE`            |            | Play a non-song tone                    | NZCV     | 220+   | 18    |
| `PFREQ` | `REDTONE`            |            | Play a non-song frequency               | NZCV     | 214+   | 15    |
| `PSONG` | `PNOTE` `NEXTN`      |            | Play an entire song sequence            | NZCV     | 226+   | 42    |
| `SFX`   | `SOUNDFX`            |            | Play a sound effect from the collection | NZCV     | 1962   | 18    |