code: func FileFormat(path string) (Format, error) {
  	if !fileExists(path) {
  		return "", ErrInvalidPath
  	}
  	f, err := os.Open(path)
  	if err != nil {
  		return "", err
  	}
  	defer f.Close()
  	var triedWav bool
  	var triedAif bool
  
  	ext := strings.ToLower(filepath.Ext(path))
  	switch ext {
  	case ".wav", ".wave":
  		triedWav = true
  		d := wav.NewDecoder(f)
  		if d.IsValidFile() {
  			return Wav, nil
  		}
  	case ".aif", ".aiff":
  		triedAif = true
  		d := aiff.NewDecoder(f)
  		if d.IsValidFile() {
  			return Aif, nil
  		}
  	}
  	// extension doesn't match, let's try again
  	f.Seek(0, 0)
  	if !triedWav {
  		wd := wav.NewDecoder(f)
  		if wd.IsValidFile() {
  			return Wav, nil
  		}
  		f.Seek(0, 0)
  	}
  	if !triedAif {
  		ad := aiff.NewDecoder(f)
  		if ad.IsValidFile() {
  			return Aif, nil
  		}
  	}
  	return Unknown, nil
  }
docs: // FileFormat returns the known format of the passed path.