Skip to content

Commit

Permalink
gofumpt -l -w .
Browse files Browse the repository at this point in the history
  • Loading branch information
pablodz committed Jan 11, 2023
1 parent cd2f13d commit 1b47a51
Show file tree
Hide file tree
Showing 12 changed files with 5 additions and 25 deletions.
4 changes: 1 addition & 3 deletions examples/bytesulaw2wav/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ import (
)

func main() {

data := []byte{0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 4, 2, 3, 3, 5, 01, 7, 8, 1, 4, 0}
data := []byte{0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 4, 2, 3, 3, 5, 1, 7, 8, 1, 4, 0}
// Open the input file
in := bytes.NewBuffer(data)

Expand Down Expand Up @@ -69,5 +68,4 @@ func main() {
if err != nil {
panic(err)
}

}
2 changes: 0 additions & 2 deletions examples/linear_resampler/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import (
)

func main() {

// Open the input file
in, err := os.Open("./internal/samples/v1_16b_16000.wav")
if err != nil {
Expand Down Expand Up @@ -71,5 +70,4 @@ func main() {
if err != nil {
panic(err)
}

}
2 changes: 0 additions & 2 deletions examples/ulaw2wav_logpcm/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import (
)

func main() {

// Open the input file
in, err := os.Open("./internal/samples/recording.ulaw")
if err != nil {
Expand Down Expand Up @@ -71,5 +70,4 @@ func main() {
if err != nil {
panic(err)
}

}
2 changes: 0 additions & 2 deletions examples/ulaw2wav_lpcm/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import (
)

func main() {

// Open the input file
in, err := os.Open("./internal/samples/recording.ulaw")
if err != nil {
Expand Down Expand Up @@ -71,5 +70,4 @@ func main() {
if err != nil {
panic(err)
}

}
1 change: 0 additions & 1 deletion pkg/resampler/linear.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package resampler

func LinearInterpolation[T int16 | int32 | int64 | int | byte](data []T, ratio float64) ([]T, error) {

// Calculate the length of the resampled data slice.
resampledLength := int(float64(len(data)) / ratio)

Expand Down
3 changes: 0 additions & 3 deletions pkg/transcoder/mulaw2wav.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import (
)

func init() {

err := error(nil)
WIDTH_TERMINAL, HEIGHT_TERMINAL, err = term.GetSize(0)
if err != nil {
Expand All @@ -29,7 +28,6 @@ func init() {
// https://raw.githubusercontent.com/corkami/pics/master/binary/WAV.png
// http://www.topherlee.com/software/pcm-tut-wavformat.html
func mulaw2WavLpcm(in *AudioFileIn, out *AudioFileOut, transcoder *Transcoder) (err error) {

// read all the file
if transcoder.Verbose {
graphIn(in)
Expand Down Expand Up @@ -144,7 +142,6 @@ func mulaw2WavLpcm(in *AudioFileIn, out *AudioFileOut, transcoder *Transcoder) (
}

return nil

}

func graphIn(in *AudioFileIn) {
Expand Down
3 changes: 0 additions & 3 deletions pkg/transcoder/mulaw2wavlogpcm.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import (
)

func init() {

err := error(nil)
WIDTH_TERMINAL, HEIGHT_TERMINAL, err = term.GetSize(0)
if err != nil {
Expand All @@ -26,7 +25,6 @@ func init() {
// https://raw.githubusercontent.com/corkami/pics/master/binary/WAV.png
// http://www.topherlee.com/software/pcm-tut-wavformat.html
func mulaw2WavLogpcm(in *AudioFileIn, out *AudioFileOut, transcoder *Transcoder) (err error) {

// read all the file
if transcoder.Verbose {
graphIn(in)
Expand Down Expand Up @@ -141,5 +139,4 @@ func mulaw2WavLogpcm(in *AudioFileIn, out *AudioFileOut, transcoder *Transcoder)
}

return nil

}
1 change: 0 additions & 1 deletion pkg/transcoder/resampling_general.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import (
var doOnceResampling sync.Once

func ResampleBytes(in *AudioFileIn, out *AudioFileOut, transcoder *Transcoder) error {

bitsProcessed, err := differentSampleRate(in, out, transcoder)
if err != nil {
return err
Expand Down
8 changes: 4 additions & 4 deletions pkg/transcoder/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,14 @@ import (
"github.com/pablodz/sopro/pkg/resampler"
)

var WIDTH_TERMINAL = 80
var HEIGHT_TERMINAL = 30
var (
WIDTH_TERMINAL = 80
HEIGHT_TERMINAL = 30
)

const ErrUnsupportedConversion = "unsupported conversion"

func (t *Transcoder) Mulaw2Wav(in *AudioFileIn, out *AudioFileOut) error {

inSpace := in.Config.(audioconfig.MulawConfig).Encoding
outSpace := out.Config.(audioconfig.WavConfig).Encoding

Expand All @@ -41,7 +42,6 @@ func (t *Transcoder) Mulaw2Wav(in *AudioFileIn, out *AudioFileOut) error {
}

func (t *Transcoder) Wav2Wav(in *AudioFileIn, out *AudioFileOut) error {

inSpace := in.Config.(audioconfig.WavConfig).Encoding
outSpace := out.Config.(audioconfig.WavConfig).Encoding

Expand Down
1 change: 0 additions & 1 deletion pkg/transcoder/transcoding_general.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import (
var doOnceTranscoding sync.Once

func TranscodeBytes(in *AudioFileIn, out *AudioFileOut, transcoder *Transcoder) error {

equalEncod := (transcoder.SourceConfigs.Encoding == transcoder.TargetConfigs.Encoding)
bitsProcessed := 0
err := error(nil)
Expand Down
2 changes: 0 additions & 2 deletions pkg/transcoder/wavlpcm2wavlpcm.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import (
)

func wavLpcm2wavLpcm(in *AudioFileIn, out *AudioFileOut, transcoder *Transcoder) (err error) {

// read all the file
if transcoder.Verbose {
graphIn(in)
Expand Down Expand Up @@ -129,5 +128,4 @@ func wavLpcm2wavLpcm(in *AudioFileIn, out *AudioFileOut, transcoder *Transcoder)
}

return nil

}
1 change: 0 additions & 1 deletion utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ func PrintGraphInt16(items []int16) {
fmt.Println("MaxX: ", len(stringSlice))
fmt.Println("DeltaX: ", (len(stringSlice) - 0))
fmt.Println()

}

func PrintTableInt16(items []int16, numPerRow int) {
Expand Down

0 comments on commit 1b47a51

Please sign in to comment.