Created
June 20, 2014 16:17
-
-
Save r9y9/d3ce3ddd1299660bb42a to your computer and use it in GitHub Desktop.
Inverse short time fourier transform using gossp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"flag" | |
"fmt" | |
"github.com/r9y9/gossp/io" | |
"github.com/r9y9/gossp/stft" | |
"github.com/r9y9/gossp/window" | |
"log" | |
) | |
func main() { | |
filename := flag.String("i", "input.wav", "Input filename") | |
flag.Parse() | |
w, werr := io.ReadWav(*filename) | |
if werr != nil { | |
log.Fatal(werr) | |
} | |
data := w.GetMonoData() | |
s := &stft.STFT{ | |
FrameShift: int(float64(w.SampleRate) / 100.0), // 0.01 sec, | |
FrameLen: 2048, | |
Window: window.CreateHanning(2048), | |
} | |
reconstructed := s.ISTFT(s.STFT(data)) | |
for i := range data { | |
fmt.Println(data[i], reconstructed[i]) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment