Text this: Stable learning using spiking neural networks equipped with affine encoders and decoders