Behavior consists of the interaction between an organism and its environment, and is controlled by the brain. However, while brain activity varies at fast, sub-seconds time scales, behavioral measures tend to be temporally coarse, often limited just to the success or failure in a trial. The large gap between the temporal resolutions at which brain and behavior are observed likely impedes our understanding of the neural mechanisms underlying behavior. To overcome this problem, we developed the RIFF: an interactive arena for rats that has multiple feeding areas, multiple sound sources, and high-resolution tracking of behavior, with concomitant wireless electrophysiological recordings. The RIFF can be flexibly programmed to create arbitrarily complex tasks that the rats have to solve. It records unrestrained rat behavior together with neuronal data from chronically implanted electrodes. We present here a detailed description of the RIFF. We illustrate its power with results from two exemplary tasks. Rats learned within two days a complex task that required timed movement, and developed anticipatory behavior. Rats found solution strategies that differed between animals but were stable within each animal. We report auditory responses in and around primary auditory cortex as well as in the posterior insular cortex, but show that often the same neurons were also sensitive to non-auditory parameters such as rat location and body orientation. These parameters are crucial for state assessment and the selection of future actions. Our findings show that the complex, unrestrained behavior of rats can be studied in a controlled environment, enabling novel insights into the cognitive capabilities and learning mechanisms of rats. This combination of electrophysiology and detailed behavioral observation opens the way to a better understanding of how the brain controls behavior.