The Complete Wizard's Handbook1 accessory listed "Five Unusual Sources For Spells" (in a section of the same title), which are:
Dragons. Most dragons are masters of magic. A friendly dragon might teach a wizard a new spell as a reward for helping him or as a bribe to leave him alone.
Monuments. Ancient obelisks, monoliths, and other structures are occasionally inscribed with the formulas of spells. Locating such a monument can be an adventure in itself.
Other Planes. The alternate planes of existence are filled with an unending variety of weird phenomena, strange landmarks, and bizarre entities. A wizard might find a magic formula spelled out in giant runes stretched across an entire plane of the Abyss. Or he might stumble across a horde of ape-like creatures in the plane of Elysium chanting the formula of a spell. The inhabitants of the elemental plane of Fire might know the secrets of a variety of fire-related spells, while the occupants of the elemental plane of Earth might be willing to share the formulas for earth-related spells in exchange for a favor.
Summoned Creatures. A creature summoned as a result of invisible stalker, monster summoning, or a similar spell might negotiate for his freedom by offering to teach the caster a spell or show him where to find a spell formula.
Gems, Crystals, and Mirrors. Magic-using creatures from other planes of existence sometimes use gems, crystals, or mirrors as substitutes for spell books to record the formulas of their spells.
Personally, I found the sections of this accessory of varying quality and interest, but I acknowledge that these ideas spark my imagination with the possibilities for adventures.
These "unusual sources" can basically be reduced to the spell being taught by someone (instead of a wizard of a player character race, a more unusual one, like a dragon, extraplanar creatures [summoned or in their native plane] or the like) or the device from where the spell is being copied from being more unusual than a scroll or book (monuments, alternate version of spell books, etc.).
Nevertheless (and to answer your question with an idea of my own) if I wanted a wizard to learn a new spell from a device but in a non-written form I would make the device dictate or sing the spell (under the appropriate conditions, which may take an adventure of its own to research). This device could be for example:
The talking bust of an old wizard or sage, that might respond questions once a week with some of the lore the sage new. Same for other "talking objects" like magic mirrors, intelligent weapons, etc.
A music box, which after being opened plays a tune that is a "codified" version of a spell (this could be ideal for bards or other categories which base their magic in songs). It is up to the players to decipher this tune into something they can write on a spell book.
The parrot of a wizard might have learned a couple of interesting key-words for a spell (parrots are an unusual familiar for a wizard, but that could change depending on your campaign or setting, like a tropical forest-based adventure). Maybe several of these birds overheard the wizard chanting a spell and a wizard could "reverse engineer" the spell if they were able to catch all relevant birds and put their gibberish in the right order?
1. I'm painfully aware that your question carries the dnd-5e tag, but I think this piece of AD&D / and-2e lore is relevant.