Limit file downloads to logged in users (WP + Nginx)

You could do it like this:

location ~ \.(mp3|m4a)$ {
  if ($http_cookie !~ "wordpress_logged_in") {
    return 403;
  }
}

If it is really matters that it is secured (as opposed to just not being “obviously” accessible by the general public), auth should probably also be checked since it’s quite easy to send the WP login cookie with the HTTP request, regardless of auth status.