Pronouncing 何Xか: なん or なに?


For example, in 何曲か歌った (I sang several songs), is it なに or なん?

IIUC from [here](https://www.easyjapanesee.com/what-nani-or-nan) (I hope it's
correct?), it is なに before nouns (except 何曜日、何日、何月), and なん before counters.
But 曲 can be either, so I'm not sure.

A couple other links I found are [this one](https://www.wasabi-
jpn.com/japanese-lessons/japanese-kanji/how-to-identify-the-proper-
pronunciation-of-nani-nan/) and
[SE](https://japanese.stackexchange.com/questions/3506/pronunciation-
of-%e4%bd%95-as-%e3%81%aa%e3%82%93-or-%e3%81%aa%e3%81%ab), but they don't seem
to cover this case.




何曲 is always read なんきょく. 曲 here is a counter - _how many songs_. _What song_
would be [何]{なん}の曲 or どの曲.

A case where both are possible: 何色 is read なにいろ/なんしょく.

  * 空は[何色]{なにいろ}？ _What color is the sky?_
  * 虹は[何色]{なんしょく}？ _How many colors are there in a rainbow?_

Further explanations [here](https://jn1et.com/nani-and-nan/).




何曲 is always read なんきょく. 曲 here is a counter - _how many songs_. _What song_
would be [何]{なん}の曲 or どの曲.

A case where both are possible: 何色 is read なにいろ/なんしょく.

  * 空は[何色]{なにいろ}？ _What color is the sky?_
  * 虹は[何色]{なんしょく}？ _How many colors are there in a rainbow?_

Further explanations [here](https://jn1et.com/nani-and-nan/).

