[pokeruby] What is the algorithm for playing ambient wild cries?

Gens 3 and 5 play ambient cries of local wild Pokémon on routes. Bulbapedia only notes that leading with the Swarm ability increases the frequency in Emerald. I'd like more specific figures to recreate in Gen 2. How long does it wait between cries? What is their volume compared to the BGM? Are they selected with the same probabilities as encounters? Which map types allow them, and are there exceptions? Do they only play while you're standing on a potential encounter tile? Knowing which pokeruby files implement this feature would help me figure it out myself, assuming they've been decompiled to C already.

Edit: I believe it's related to this asm routine, which appears to compare the lead party mon's ability to 0x44 (ABILITY_SWARM). But I can't figure out the answers to my questions from it.