Skip to content

Instantly share code, notes, and snippets.

@bravecorvus
Created February 5, 2019 02:12
Show Gist options
  • Save bravecorvus/80dc43d97475024ac2c9c9bfa1f3a37e to your computer and use it in GitHub Desktop.
Save bravecorvus/80dc43d97475024ac2c9c9bfa1f3a37e to your computer and use it in GitHub Desktop.
mfcc := exec.Command("mfcc.sh", "/output/"+fileheader.Filename+".raw", strconv.Itoa(frameLength), strconv.Itoa(frameLengthOutput), strconv.Itoa(framePeriod), strconv.Itoa(mgcOrder))
mfccout, mfccerr := mfcc.Output()
if mfccerr != nil {
log.Println("Error executing mfcc.sh")
log.Println("error:", mfccerr)
http.Error(w, http.StatusText(404)+": "+mfccerr.Error(), 404)
return
}
arr := make([]float64, 0)
buf := bytes.NewReader(mfccout)
readerr := binary.Read(buf, binary.LittleEndian, &arr)
if readerr != nil {
log.Println("binary.Read failed:", readerr)
http.Error(w, http.StatusText(404)+": "+readerr.Error(), 404)
}
log.Println("Print arr")
str := "["
for index, elem := range arr {
if index == len(arr)-1 {
str = str + strconv.FormatFloat(elem, 'f', 6, 64)
} else {
str = str + strconv.FormatFloat(elem, 'f', 6, 64)
}
log.Println(elem)
}
str = str + "]"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment