Supposedly knowledge of firearms and gunpowder were transmitted along the Silk Road from China to Europe. Did it spread along the trade routes to India and Africa as well?
Yes they were. Gunpowder was adopted by the Arabs early on and since they had conquered North Africa it spread throughout that region.
India was much closer to the Chinese who most likely came up with gunpowder in the first place, and either got access to it themselves through trading or something, or when they got conquered by the Mongols. (The Mongols are also one way gunpowder might have been introduced to Europe).
Certainly both India and the Muslim world were familiar with gunpowder by the 14th, mid-14th centuries. Now for the rest of Africa it gets murky for me, perhaps someone can illustrate me, certainly several regions like the Ghana Empire or the Mali Empire had contact with Muslim traders and slavers and religious proselytizers so they at least knew of guns, and most likely had access to some amount of them, but other more isolated, less developed areas, I'd assume they didn't learn of the existence of such things until centuries later.