initialize sndfile object at beginning of function for clarity