func NewUlawEncoder(writer io.Writer, input int) (*Encoder, error) {
	if writer == nil {
		return nil, errors.New("io.Writer is nil")
	}
	if input != Alaw && input != Lpcm {
		return nil, errors.New("Invalid input format")
	}
	w := Encoder{
		input:       input,
		encode:      EncodeUlaw,
		transcode:   Alaw2Ulaw,
		destination: writer,
	}
	return &w, nil
}
NewUlawEncoder returns a pointer to an Encoder that implements an io.Writer.
It takes as input the destination data Writer and the input encoding format.
package g711
import (
	"errors"
	"io"
)
const (
	Alaw = iota  
	Ulaw         
	Lpcm         
)
type Decoder struct {
	decode func([]byte) []byte  
	source io.Reader            
}
type Encoder struct {
	input       int                  
	encode      func([]byte) []byte  
	transcode   func([]byte) []byte  
	destination io.Writer            
}
func NewAlawDecoder(reader io.Reader) (*Decoder, error) {
	if reader == nil {
		return nil, errors.New("io.Reader is nil")
	}
	r := Decoder{
		decode: DecodeAlaw,
		source: reader,
	}
	return &r, nil
}
func NewUlawDecoder(reader io.Reader) (*Decoder, error) {
	if reader == nil {
		return nil, errors.New("io.Reader is nil")
	}
	r := Decoder{
		decode: DecodeUlaw,
		source: reader,
	}
	return &r, nil
}
func NewAlawEncoder(writer io.Writer, input int) (*Encoder, error) {
	if writer == nil {
		return nil, errors.New("io.Writer is nil")
	}
	if input != Ulaw && input != Lpcm {
		return nil, errors.New("Invalid input format")
	}
	w := Encoder{
		input:       input,
		encode:      EncodeAlaw,
		transcode:   Ulaw2Alaw,
		destination: writer,
	}
	return &w, nil
}