On the generation of magnetohydrodynamic waves at the onset of a substorm