I just finished the fourth dungeon (Angler's Cave). After exiting, I went west, entered a cave, and was asked by a giant fish if I had an ocarina. Unfortunately I don't. Where do I get the ocarina?
In Link's Awakening, the Ocarina can be found in the Dream Shrine, which can only be completed if Link has the Power Bracelet and the Pegasus Boots. The Ocarina can be played before learning any songs, but all that comes out are random notes which have no effect.
Yet again from zeldawiki.org:
The Dream Shrine is a strange building located in Link's Awakening's Mabe Village. It is unknown if Dream Shrine's main chamber is a real place or not, even by Koholint Island's standards. The doorway to the shrine is blocked by three large stones, and Link will be unable to enter until he has claimed the Power Bracelet. When he enters the shrine, it appears to be a small room with a single bed. However, if he goes to sleep, he will wake up in a large room. This room is guarded by large groups of Arm-Mimics, which act as part of a puzzle. Fifty Rupees can be found here, but the real prize of the shrine is the legendary Ocarina. Getting this item requires use of the Pegasus Boots. After leaving the room, Link will wake up in the bed found in the first room.
In Mabe Village, the Dream Shrine is located in the north east corner. This image from zeldaelements.net (edited by me) shows exactly where is it.
You can't really do anything with the ocarina unless you have songs, so here they are (information from Zelda Wikia):
Ballad of the Wind Fish
The first song that Link can learn is the "Ballad of the Wind Fish", which is taught by Marin. This mysterious song has the power to awaken the Wind Fish if played in conjunction with all eight Instruments of the Sirens.
The second song is "Manbo's Mambo", learned from Manbo, a talking fish who lives in a cave near Angler's Tunnel. In the overworld, this song transports Link to Manbo's Pond, located directly outside Crazy Tracy's Health Spa near Tabahl Wasteland. When played inside dungeons, it transports Link back to the entrance of the current dungeon.
Frog's Song of Soul
The third and final song is the "Frog's Song of Soul", learned from Mamu the frog singer after Link successfully navigates the Signpost Maze near Mabe Village. This song brings certain dead or inanimate objects to life.
To get the ocarina, you'll need to head to Mabe Village and enter the Dream Shrine (the building in the north-east corner blocked by three large stones you can lift with the power bracelet; above the shop) and sleep in the bed.
When you wake up, you will be in a much larger room with cracked floors, and enemies that mirror your movement. Completing the puzzle of the Dream Shrine requires the use of the Pegasus Boots and the Roc's Feather. At the end of the jumping puzzle are two chests, one contains 50 Rupees, the other the Ocarina you seek.