The Programmable Sound Generator (PSG) is a sound chip designed by General Instrument (GI) in 1978. The specific model used in the CPC is the AY-3-8912 chip.
The PSG is quite primitive. It is able to output a square wave and/or white noise in three separate sound channels (named Channel A, B and C). Each channel can be Some other 8-bit systems used to output tones more sophisticated soundchips such as the [https://youtu.be/7pONRbIHT_w C64 SID], the [https://youtu.be/BANwL2sQ0DM NES APU] andthe [https:/or white noise/youtu.be/-mdjiWBYIqU Gameboy soundchip].
== PSG Part numbers used in the CPC during its lifetime ==
| 1010 || 0Ah || <code>\/\/\/\/\/</code> ||
|-
| 1011 || 0Bh || <code>\‾‾‾‾‾‾‾‾‾¯¯¯¯¯¯¯¯¯</code> || volume remains high
|-
| 1100 || 0Ch || <code>//////////</code> ||
|-
| 1101 || 0Dh || <code>/‾‾‾‾‾‾‾‾‾¯¯¯¯¯¯¯¯¯</code> || volume remains high
|-
| 1110 || 0Eh || <code>/\/\/\/\/\</code> ||
|}
==== Bit 3 When using the volume envelope generator, the volume is always increased from 00h to 0Fh (Continueor vice versa) ====, it is not possible to specify a starting/ending point (like from 00h to 07h).
We can observe that there are only 8 resulting shapes even though they are selected by using a 4-bit value. The continue bit does not exist internally.==== Bit 2 (Attack) ====
In other words, we This bit is only responsible for the starting point of the envelope and the direction. We have: shape = 1 if (ves >> 2 =volume = 0) else 7 if (ves >> 2 =attack else 15 # Start at 0 for attack, 15 for decay direction = 1) if attack else ves & 7-1 # Upward for attack, downward for decay
==== Bit 2 3 (AttackContinue), Bit 1 (Alternate) and Bit 0 (Hold) ====
This bit is only responsible for When bit3 = 0, volume and direction at the starting point end of the envelope and the directiona period are always 0.
On other wordsWhen bit3 = 1, we have: bit1 and bit0 determine what happens to volume = 0 if attack else 15 # Start and direction at 0 for attack, 15 for decay direction = 1 if attack else -1 # Upward for attack, downward for decaythe end of a period.
When using the ==== Algorithm ==== def envelope_step(volume envelope generator, the direction, shape): volume is always increased from 00h to 0Fh (+= direction if volume > 15 or vice versa), it volume < 0: match shape: case 8 | 12: volume &= 0x0f # direction is not possible to specify a starting/ending point (like from 00h to 07h).unchanged case 10 | 14: direction *= -1 volume += direction case 11 | 13: direction = 0 volume = 15 case _: direction = 0 volume = 0 return volume, direction
=== 0Eh - External Dataregister Port A ===
* The noise tone can be changed by applying an AND and OR mask to the output
<br>=== Replacing the AY-3-8912 in the CPC with an AY-3-8910(A) === In case that the AY-3-8912 needs to be replaced in the CPC it can become a hurdle these days to get a real AY-3-8912 especially for an acceptable price. Instead of the original AY-3-8912 it's possible to use an AY-3-8910(A) instead with the help of a small adapter board. An open source adapter board can be found here: https://github.com/etomuc/CPC-AY-3-8910-to-8912-adapter
== Datasheets ==* [[MediaFor tips regarding the desoldering of ICs see this Wiki page:Ay3-891x.pdf|AY-3-891x datasheet]]* [[Media:Ym2149 datasheet.pdf|YM2149 datasheetIC Repair]]
== Links ==
*[http://en.wikipedia.org/wiki/General_Instrument_AY-3-8910 Wikipedia on the PSG]
*[[Media:Ay3-891x.pdf|AY-3-891x datasheet]] [[Media:Ym2149 datasheet.pdf|YM2149 datasheet]]
*[http://quasar.cpcscene.net/doku.php?id=assem:psg Quasar PSG documentation (in french)]
*[https://youtu.be/C4ezcX1W2_Y Mix I] [https://youtu.be/gH57xU9c7dE Mix II] [https://youtu.be/e7V3EMXF97g Mix III] AMSTRAD CPC MUSIC 1 hour
*[https://youtu.be/AhgUwqv2yAE Space Debris - Amstrad CPC Soundtrakker cover] [https://youtu.be/E_plcHyOC_8 RUN! - SID emulation on Amstrad CPC] by [[BSC]]
*[https://nguillaumin.github.io/ym-jukebox/ YM Jukebox] [https://ym.mmcm.ru/ AY Music Collection]
[[Category:Hardware]]
[[Category:Music and sound| ]][[Category:Video contents]][[Category:CPC Internal Components]]