At first I thought I was hearing the same kind of rule that I'm familiar with from French and which is common in English: 'g' before an 'e' or an 'i' is /j/, 'g' before an 'a', 'o', or 'u' is /g/, however those two phonemes are pronounced in the language. 'G' before another consonant is probably /g/ but more confusing. So, 'gente' and 'general' have that breathy /j/ sound, while 'oigo' and 'gato' and 'agua' all have /g/ sounds.
Then I paid attention 'Guantanamera,' which in most recordings seems to have more of the /j/ sound.
As a native speaker of English, I am never shocked to find out that there are just exceptions to rules, or even that there aren't really rules about something, but I like to ask:
1. Is there a rule I'm missing?
2. Have I just been hearing the wrong recordings of "Guantanamera"?
3. Is it regional? If so, can anyone tell me anything about the regional differences?
4. Sometimes it seems to me that there's a hint of /ŋ/ and an overall lightness to the /g/ in some words which have an internal /g/ - mostly 'agua.' Am I hallucinating this? Do questions 1-3 apply to this at all, or does it not happen and therefore not need any more discussion?
Finally, is 'x' the same consonant sounds as /j/? In, for instance, "México"?