Skip to content

Commit fcb6736

Browse files
committed
pre-commit fix
1 parent d5521fb commit fcb6736

34 files changed

+341
-459
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
.DS_Store
22
audio/
33
tmp/
4+
mp3/
5+
vendor/

.idea/libraries/GOPATH__audioBuffer_.xml

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/libraries/GOPATH__audioStream_.xml

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/libraries/GOPATH__audiofingerprint_.xml

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/libraries/GOPATH__bespoksa_.xml

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/libraries/GOPATH__chroma_.xml

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/libraries/GOPATH__fileStream_.xml

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/libraries/GOPATH__fingerprint_.xml

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/libraries/GOPATH__lookup_.xml

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/libraries/GOPATH__microphoneStream_.xml

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/libraries/GOPATH__spectre_.xml

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/misc.xml

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/modules.xml

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/vcs.xml

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/workspace.xml

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.pre-commit-config.yaml

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# See https://pre-commit.com for more information
2+
# See https://pre-commit.com/hooks.html for more hooks
3+
repos:
4+
- repo: https://github.com/pre-commit/pre-commit-hooks
5+
rev: v3.2.0
6+
hooks:
7+
- id: trailing-whitespace
8+
- id: end-of-file-fixer
9+
- id: check-yaml
10+
- id: check-added-large-files
11+
- repo: https://github.com/golangci/golangci-lint
12+
rev: v1.41.1
13+
hooks:
14+
- id: golangci-lint

.vscode/launch.json

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"configurations": []
7+
}

README.md

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# spectre
2-
Audio fingerprinting in Go.
3-
Service side code for both fingerprinting and recognising audio snippets from larger audio files.
2+
Audio fingerprinting in Go.
3+
Service side code for both fingerprinting and recognising audio snippets from larger audio files.
44
Part of a larger project to recognise movie sound tracks to sync subtitles for the hard of hearing. Currently in developemnt.
55

66
There are four commands:
@@ -23,9 +23,8 @@ and use it as input to sp_lookup with the original file as one of the match file
2323
The current state of the project uses simple spectral analysis and peak analysis to generate fingerprints. The stronger signals
2424
in the spectral analysis are pulled out and hashed to form a fingerprint. This technique is actually not as effective as many
2525
articles written on the subect seem to indicate.
26-
Part of the problem is the peaks in the music file that are out of the sensitivity range of either the laptop/mobile microphone or speakers.
26+
Part of the problem is the peaks in the music file that are out of the sensitivity range of either the laptop/mobile microphone or speakers.
2727
A frequency filter was added which improves things and increases hit rate but most of the fingerprints still do not match.
2828

2929
## Next Steps
3030
It seems that fingerprinting a 10ms frame by picking the strongest frequencies is not a good matching strategey, especially for film soundtracks with a lot of voice. Using Dejavu's strategy of picking strong frequencies in a 2d array of multiple slices of time will work better
31-

analysis/interface.go

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
package analysis
22

3-
type SpectralAnalyser interface {
4-
}
3+
import "github.com/developerek/fingerprint/spectral"
4+
5+
type SpectralAnalyser func(samples []float64, silenceThreshold float64) spectral.Spectra
56

7+
type NewSpectralAnalyser interface {
8+
}
69
type ReverseComplexAnalyzer interface {
710
}

ffmpeg/ffmpeg.go

+6-7
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
package ffmpeg
22

33
import (
4-
"os/exec"
54
"fmt"
6-
"strconv"
75
"io"
86
"log"
7+
"os/exec"
8+
"strconv"
99
)
1010

1111
const (
@@ -21,9 +21,9 @@ func Cmd(filename, containerType, pcmDataType string, sampleRate int) (*exec.Cmd
2121
// pcmDataType describes the internal format of the data we want e.g. float32 / signed int 16 etc
2222
// codec indicates (to ffmpeg) a raw format and which (raw) codec to use
2323

24-
codec := "" // indicates (to ffmpeg) how to encode the pcm data
25-
format := "" // indicates (to ffmpeg) how to format the file (wav or raw - with raw format 's16le' etc)
26-
ffmpegDataType := "" // internal data type for ffmpeg to use for PCM data
24+
codec := "" // indicates (to ffmpeg) how to encode the pcm data
25+
format := "" // indicates (to ffmpeg) how to format the file (wav or raw - with raw format 's16le' etc)
26+
ffmpegDataType := "" // internal data type for ffmpeg to use for PCM data
2727

2828
switch pcmDataType {
2929
case FMT_INT16:
@@ -61,7 +61,7 @@ func Cmd(filename, containerType, pcmDataType string, sampleRate int) (*exec.Cmd
6161

6262
args = append(args, inputArgs...)
6363
args = append(args, formatArgs...)
64-
if containerType != "wav" { // for wav containers, use default (int16) codec -otherwise trouble
64+
if containerType != "wav" { // for wav containers, use default (int16) codec -otherwise trouble
6565
args = append(args, codecArgs...)
6666
}
6767
args = append(args, bitRateArgs...)
@@ -87,4 +87,3 @@ func StartStream(cmd *exec.Cmd) (io.ReadCloser, error) {
8787

8888
return audio, nil
8989
}
90-

0 commit comments

Comments
 (0)