refactored so that functions and samples can be played via a similar interface.