Pärt example (TODO move util functions to separate module)