MCPcopy
hub / github.com/scribbletune/scribbletune / parseProgression

Function parseProgression

src/cli.ts:89–111  ·  view source on GitHub ↗
(
  root: string,
  mode: string,
  progressionInput: string
)

Source from the content-addressed store, hash-verified

87};
88
89const parseProgression = (
90 root: string,
91 mode: string,
92 progressionInput: string
93): string => {
94 if (progressionInput === 'random') {
95 const modeType = mode === 'minor' || mode === 'm' ? 'minor' : 'major';
96 const randomProg = progression(modeType, 4).join(' ');
97 return getChordsByProgression(`${root} ${mode}`, randomProg);
98 }
99
100 if (/^[1-7]+$/.test(progressionInput)) {
101 const converted = romanByDigit(progressionInput, mode);
102 return getChordsByProgression(`${root} ${mode}`, converted.chordDegrees);
103 }
104
105 if (/^[ivIV°+7\s,]+$/.test(progressionInput)) {
106 const normalized = progressionInput.replace(/\s*,+\s*/g, ' ');
107 return getChordsByProgression(`${root} ${mode}`, normalized);
108 }
109
110 return progressionInput.replace(/-/g, ' ');
111};
112
113const normalizeArpOrder = (order: string): string => {
114 if (!/^\d+$/.test(order)) {

Callers 2

makeChordFunction · 0.85
makeArpFunction · 0.85

Calls 3

progressionFunction · 0.90
getChordsByProgressionFunction · 0.90
romanByDigitFunction · 0.85

Tested by

no test coverage detected