mirror of
https://github.com/cgzirim/seek-tune.git
synced 2025-12-18 09:24:19 +00:00
Delete function
This commit is contained in:
parent
8d9608c3cb
commit
6135c55d3e
1 changed files with 0 additions and 21 deletions
21
wav/wav.go
21
wav/wav.go
|
|
@ -7,7 +7,6 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// WavHeader defines the structure of a WAV header
|
// WavHeader defines the structure of a WAV header
|
||||||
|
|
@ -149,23 +148,3 @@ func WavBytesToSamples(input []byte) ([]float64, error) {
|
||||||
|
|
||||||
return output, nil
|
return output, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// FFmpegConvertWAV converts a WAV file using ffmpeg.
|
|
||||||
// It can change the sample rate and optionally convert to mono.
|
|
||||||
func FFmpegConvertWAV(inputFile, outputFile string, targetSampleRate int, toMono bool) error {
|
|
||||||
cmdArgs := []string{
|
|
||||||
"-i", inputFile,
|
|
||||||
"-ar", fmt.Sprintf("%d", targetSampleRate),
|
|
||||||
"-y",
|
|
||||||
}
|
|
||||||
|
|
||||||
if toMono {
|
|
||||||
outputFile = "mono_" + outputFile
|
|
||||||
cmdArgs = append(cmdArgs, "-ac", "1", "-c:a", "pcm_s16le")
|
|
||||||
}
|
|
||||||
|
|
||||||
cmdArgs = append(cmdArgs, outputFile)
|
|
||||||
|
|
||||||
cmd := exec.Command("ffmpeg", cmdArgs...)
|
|
||||||
return cmd.Run()
|
|
||||||
}
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue