Thanks to visit codestin.com
Credit goes to github.com

Skip to content

anonymous5l/silk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Description

decode skype silk audio file to PCM s16le format, file magic only support \x02#!SILK_V3 for now. pure go implement not test all functions. do not use in product environment.

less golang version 1.18 for generic

Example

Encode

import "githubs.com/anonymous5l/silk"

const PacketSizeMS = 20

func main() {
    input, err := os.Open("voice.pcm")
    if err != nil {
        return
    }
    defer input.Close()
    
    outFile, err := os.Create("out.silk")
    if err != nil {
        return
    }
    defer outFile.Close()
    
    opts := &silk.EncoderOption{}
    
    opts.SampleRate = 16000
    opts.MaxInternalSampleRate = 16000
    opts.PacketSize = int32(PacketSizeMS*opts.SampleRate) / 1000
    opts.Complexity = 2
    opts.BitRate = 16000
    
    if err = silk.Encode(opts, input, outFile); err != nil {
        panic(err)
    }
}

Decode

import "githubs.com/anonymous5l/silk"

func main() {
	input, err := os.Open("input.silk")
	if err != nil {
		return
	}
	defer input.Close()

	outFile, err := os.Create("out.pcm")
	if err != nil {
		return
	}
	defer outFile.Close()

	if err = silk.Decode(16000, input, outFile); err != nil {
		panic(err)
	}
}

About

pure go implement silk audio file decode

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages