Skip to content

How nori saves battery

A phone uses battery each time its processor wakes up. So nori plays music with as few wake-ups as it can: it does a lot of work at once, then sleeps.

One burst, again and again

Many players decode a few milliseconds of audio at a time, so the processor never sleeps. nori’s player fills a buffer that holds about ten seconds of music. Then it sleeps until about two seconds are left, and fills it again. Decoding ten seconds of music is quick work, so the processor is idle for most of each burst. Every nori app plays this way.

The network radio uses battery too, each time it wakes up. So nori fetches each song whole, in one go, and fetches the next song before it is due.

Other work waits for the same moment: AutoMix measures a song as its bytes arrive. Requests to your server, covers and the music share one connection.

On Android, the phone’s audio chip can decode MP3, AAC and Opus itself. When nothing needs to change the sound, nori hands the chip the song as it is. The chip plays from its own buffer and asks for more when it runs low. Meanwhile the whole phone can sleep.

Offload works only while the music stays as it is in the file. Anything that changes the sound turns it off: the equalizer, effects, AutoMix, a crossfade, volume leveling. So does a format the chip cannot decode, such as FLAC, or a USB output. nori then decodes on the processor, in bursts. Offload and processing has the full list.

While music plays with the screen off, nothing in nori runs on a timer. The seek bar moves only while the player is on screen. Two things can still wake the phone:

  • With Remote control and jams on and octo-fiesta on your server, a device you can control keeps one request open to the relay. A quiet device renews it about once a minute.
  • A plugin that wakes the phone at each lyric line says so before you install it.

No. When a feature’s switch is off, nothing of it runs: no thread, no listener, no connection. With no plugin on, nori does not start its plugin engine. With Remote control and jams off, nori does not look for devices.

Performance has the measurements: nori’s CPU use and wake-ups beside other players, on a real phone.