Skip to content

Commit

Permalink
feat: guess chord and 8 voices to try
Browse files Browse the repository at this point in the history
  • Loading branch information
davay42 committed Nov 14, 2024
1 parent c44ebf1 commit 9686f79
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
11 changes: 9 additions & 2 deletions components/MidiKeys.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { computed, ref, watch } from 'vue';
import { useGesture } from '@vueuse/gesture';
import { useClamp } from '@vueuse/math'
import { useStorage } from '@vueuse/core'
import { ScaleType } from 'tonal'
import { ScaleType, Chord } from 'tonal'
import { useMidi } from '../composables/useMidi.js'
import { notes, pitchColor } from '../composables/calculations.js';
Expand All @@ -22,7 +22,7 @@ const props = defineProps({
})
const { activeNotes } = useMidi()
const { activeNotes, guessChords } = useMidi()
const { roundBegin: begin, roundEnd: end, beginControl, endControl, range } = useRange()
Expand Down Expand Up @@ -206,6 +206,13 @@ svg.cursor-pointer.select-none.touch-none.shadow-xl.mx-auto(
:y="controlOffset * .75"
) {{ notes[(end + 3) % 12] }}{{ Math.floor((end + 3) / 12) - 1 }}

g.detect(
:transform="`translate(${width * 4 / 5},${controlOffset * .75})`"
)
text.text-3xl.pointer-events-none(
text-anchor="middle"
) {{ guessChords[0] }}


g.range.pointer-events-none(
:transform="`translate(${width * 3 / 5},0)`"
Expand Down
4 changes: 2 additions & 2 deletions composables/useSynth.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export const meters = reactive({})
export const scopes = reactive({})
export const FFTs = reactive({})

export function useSynth() {
export function useSynth(voiceCount = 8) {

const initiated = ref(false)
const started = ref(false)
Expand All @@ -33,7 +33,7 @@ export function useSynth() {

const { controls, cv, groups, initRefs } = useParams(params, 'el')

const { voices, cycleNote, initVoices, getVoiceParams, stopAll } = useVoices()
const { voices, cycleNote, initVoices, getVoiceParams, stopAll } = useVoices(voiceCount)

async function start() {
if (initiated.value) return
Expand Down

0 comments on commit 9686f79

Please sign in to comment.