Fix length operator error

With the new LuaJIT version, `#self` generates an error except if the
`__len` method is defined for the class. This commit adds a new field
`n_channels` to the class that allows to compute the number of
channels without calling `#self`.