keydetector

package
v0.0.0-...-74e0192 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 23, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

/home/megalith/megasound/keydetector/keydetector.go

/home/megalith/megasound/keydetector/krumhansl.go

/home/megalith/megasound/keydetector/pcp.go

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ComputePCP

func ComputePCP(streamer megasound.Streamer, sampleRate int) ([]float64, error)

ComputePCP analyzes an audio stream and returns the detected key with Camelot Wheel notation.

func KrumhanslKeyProfiles

func KrumhanslKeyProfiles() map[string][]float64

func PCPKeyProfiles

func PCPKeyProfiles() map[string][]float64

PCPKeyProfiles returns predefined key profiles for all major and minor keys based on music theory principles. These profiles correspond to the harmonic relationships between the 12 notes in the chromatic scale for each key.

Types

type KeyDetector

type KeyDetector struct {
	Streamer   megasound.Streamer
	SampleRate int
}

func NewKeyDetector

func NewKeyDetector(s megasound.Streamer, sampleRate int) *KeyDetector

func (*KeyDetector) DetectKey

func (kd *KeyDetector) DetectKey() (KeyResult, error)

type KeyProfile

type KeyProfile struct {
	Profile []float64
	Norm    float64
}

KeyProfile represents a key profile with its precomputed norm.

type KeyResult

type KeyResult struct {
	Key             string
	CamelotNotation string
	Confidence      float64
}

KeyResult represents the detected key with additional information like Camelot Wheel notation.

func KrumhanslSchmuckler

func KrumhanslSchmuckler(pcp []float64) KeyResult

KrumhanslSchmuckler computes the most likely key based on PCP and includes Camelot Wheel notation.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL