sammy

package module
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2021 License: MIT Imports: 7 Imported by: 0

README

sammy

Sammy is a simple tool for normalizing audio sample filenames.

Functionality

Sammy tries to normalize filenames by following a few simple rules:

  • Naked keys are assumed to be major and will be suffixed with "maj" (A becomes Amaj).
  • Minor keys on the format Am will have their suffix changed to "min" (Am becomes Amin).
  • Keys with flat key signatures will be converted into the corresponding sharp keys (Eb becomes D#).

Below are a few examples of normalizations that sammy performs.

Original Normalized
Chords_A_120.wav Chords_Amaj_120.wav
Chords_Am_120.wav Chords_Amin_120.wav
CHORDS-AM-120.wav CHORDS-Amin-120.wav
Chords_Db_120.wav Chords_C#maj_120.wav
Chords_Ebmin_120.wav Chords_D#min_120.wav

Building

./build.sh

To enable the debug console, build using

./build.sh debug

Supported file extensions

  • .wav, .wave
  • .flac
  • .mp3, .mp4
  • .aiff
  • .ogg, .ogv, .oga, .ogx, .ogm, .spx, .opus

Documentation

Index

Constants

This section is empty.

Variables

View Source
var SupportedFileExtensions []string = []string{".wav", ".wave", ".flac", ".mp3", ".mp4", ".aiff", ".ogg", ".ogv", ".oga", ".ogx", ".ogm", ".spx", ".opus"}

SupportedFileExtensions is a list over file extensions that are considered audio samples.

Functions

func ExtendMajor

func ExtendMajor(s string) string

func ExtendMinor

func ExtendMinor(s string) string

func GenerateChangeSet

func GenerateChangeSet(l *log.Logger, dir string, tfs ...Normalizer) (map[string]string, error)

GenerateChangeSet returns a map of filenames and their transformed counterparts after applying the transformers in tfs recursively to all files in dir.

func NormalizeAccidentals

func NormalizeAccidentals(s string) string

func StrSamples

func StrSamples(count int) string

StrSamples returns the word "sample" pluralized according to count.

Types

type Normalizer

type Normalizer func(string) string

type RenameError

type RenameError struct {
	NewPath string
	Err     error
}

func (RenameError) Error

func (re RenameError) Error() string

type RenameErrors

type RenameErrors map[string]RenameError

func Rename

func Rename(l *log.Logger, cs map[string]string) RenameErrors

func (RenameErrors) Check

func (re RenameErrors) Check() bool

func (RenameErrors) Error

func (re RenameErrors) Error() string

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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