added record and play function
Add record and play functionality to example