Hi @thaohoang
Welcome to the Sonos Community!
When using HDMI, Beam must be connected to a TV/projector that provides HDMI-ARC. A direct connection to a graphics card will not work (no graphics cards supply HDMI-ARC, and no soundcard has HDMI, as far as I am aware). Therefore, if connecting Beam to a PC directly, the optical adaptor must be used.
I think the most likely explanation for lack of sound is the incorrect interface selected for use in Windows - please ensure your S/PDIF output is selected in Windows’ sound settings.
Though, if the format is not Dolby Digital, DTS or PCM, you may still have problems getting sound. DTS is supported on all S2-running Home Theatre devices, including Beam Gen 1, but you are only likely to see it if playing a movie and have Passthrough enabled in the codec settings.
I hope this helps.
"Common sense is the collection of prejudices acquired by age eighteen." - Albert Einstein