Audio code refactor