code: func (p *Parser) Parse() error {
  	if p == nil {
  		return errors.New("can't calculate the wav duration of a nil pointer")
  	}
  
  	if p.Size == 0 {
  		id, size, err := p.IDnSize()
  		if err != nil {
  			return err
  		}
  		p.ID = id
  		if p.ID != RiffID {
  			return fmt.Errorf("%s - %s", p.ID, ErrFmtNotSupported)
  		}
  		p.Size = size
  		if err := binary.Read(p.r, binary.BigEndian, &p.Format); err != nil {
  			return err
  		}
  	}
  
  	var chunk *Chunk
  	var err error
  	for err == nil {
  		chunk, err = p.NextChunk()
  		if err != nil {
  			break
  		}
  
  		if chunk.ID == FmtID {
  			chunk.DecodeWavHeader(p)
  		} else {
  			if p.Chan != nil {
  				if chunk.Wg == nil {
  					chunk.Wg = p.Wg
  				}
  				chunk.Wg.Add(1)
  				p.Chan <- chunk
  				// the channel has to release otherwise the goroutine is locked
  				chunk.Wg.Wait()
  			}
  		}
  
  		// BFW: bext chunk described here
  		// https://tech.ebu.ch/docs/tech/tech3285.pdf
  
  		if !chunk.IsFullyRead() {
  			chunk.Drain()
  		}
  
  	}
  	if p.Wg != nil {
  		p.Wg.Wait()
  	}
  
  	if p.Chan != nil {
  		close(p.Chan)
  	}
  
  	if err == io.EOF {
  		return nil
  	}
  	return err
  }
docs: // Parse parses the content of the file and populate the useful fields.
  // If the parser has a chan set, chunks are sent to the channel.