custom loop issue

Try to pass the Id of the post type.

Change

 $file = get_attached_media('audio'); To
 $file = get_attached_media('audio',get_the_ID());

Source

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)