Automatically Add Specified Value to Attachment Metadata upon Upload

You’re close! Try using these hooks instead.

// Add post meta to new audio uploads.
function auto_update_audio_meta( $post_ID ) {
  if ( wp_attachment_is( 'audio', $post_ID ) ) {
    add_post_meta( $post_ID, 'artist', 'test' );
  }
}
add_action( 'add_attachment', 'auto_update_audio_meta' );

For attachment updates

// Update post meta to updated audio uploads.
function auto_update_audio_meta( $post_ID, $post_after, $post_before ) {
  if ( wp_attachment_is( 'audio', $post_ID ) ) {
    update_post_meta( $post_ID, 'artist', 'test' );
  }
}
add_action( 'attachment_updated', 'auto_update_audio_meta', 10, 3 );