I'm wondering if I flash a custom ROM onto my Samsung Galaxy Nexus device, will it erase all my data (musics, pictures, etc.) due to its memory singularity?
Flashing a CustomROM (usually any ROM different to the one you're currently running) requires you to do a complete Wipe (well, at least it is strongly recommended for stability reasons) -- so the answer is probably: Yes. Data on an external SD card usually is not affected -- but as far as I remember, the GN has no such thing.
You might wish to consult the following Q&As for more information:
Just to be more clear: Data on (external|internal) SD-Card (the Nexus uses an internal eMMC instead of the external SD, if I'm correct) -- that is the place where you store your photos, videos, music files, etc. -- are not affected by the wipe. Just all "internal memory" -- i.e. the apps you installed, and all settings plus app data -- will be erased.
My understanding is that you'll need to unlock your bootloader in order to flash, and unlocking your bootloader will indeed wipe everything.