def seek(self, offset, whence=0, mode='rw'):
        """similar to python seek function, taking only in account audio data.

        :Parameters:
            offset : int
                the number of frames (eg two samples for stereo files) to move
                relatively to position set by whence.
            whence : int
                only 0 (beginning), 1 (current) and 2 (end of the file) are
                valid.
            mode : string
                If set to 'rw', both read and write pointers are updated. If
                'r' is given, only read pointer is updated, if 'w', only the
                write one is (this may of course make sense only if you open
                the file in a certain mode).

        Notes
        -----

        - one only takes into accound audio data.
        - if an invalid seek is given (beyond or before the file), a
          PyaudioIOError is launched."""
        try:
            st = self._sndfile.seek(offset, whence, mode)
        except IOError, e:
            raise PyaudioIOError(str(e))
        return st