diff --git a/README.md b/README.md index d3f60e0..e54ca05 100644 --- a/README.md +++ b/README.md @@ -73,7 +73,7 @@ These are all the options you can change when creating a metronome. Only the `bp | `muted` | `yes` or `no` | Whether or not the metronome's audio starts muted. | `yes` | | `autoStart` | `yes` or `no` | Whether or not the metronome starts flashing visually right away. If `autoStart` is `yes` and `muted` is `no`, then the metronome's sound will also start playing immediately. | `yes` | | `size` | `small`, `medium`, `large`, or `xlarge` | Control the size of the metronome in the note. | `small` | -| `style` | `pulse`, `pendulum`, `line` | Control the style of the metronome. `pulse` makes the whole area flash color. `pendulum` shows an illustration of a metronome with a swinging pendulum (works best with `large` and up sizes). `line` shows a vertical line moving left and right (works best with `large` and up sizes). | `pulse` | +| `style` | `pulse`, `pendulum`, `line`, `dots` | Control the style of the metronome. `pulse` makes the whole area flash color. `pendulum` shows an illustration of a metronome with a swinging pendulum. `line` shows a vertical line moving left and right. `dots` shows dots. Only `pulse` is available when `size` is `small`. The other styles are only available on `size` = `medium` and up. | `pulse` | | `instrument` | `click`, `beep`, `AMSynth`, `DuoSynth`, `FMSynth`, `MembraneSynth`, `MetalSynth`, `MonoSynth`, or `PluckSynth` | Change the metronome's instrument. | `click` | | `tickNotes` | string | This determines the note(s) played on the **downbeat**, specified in [scientific pitch notation](https://en.wikipedia.org/wiki/Scientific_pitch_notation). (For example, middle C is C4.) Multiple tones can be played at the same time by providing a comma-separated list of tones. If there is no meter, every beat is considered a downbeat. Has no effect when `instrument` is `click`. | `C6`
`F5,A5,C5` | | `tockNotes` | string | This determines the note(s) played on the **upbeat**, specified in [scientific pitch notation](https://en.wikipedia.org/wiki/Scientific_pitch_notation). (For example, middle C is C4.) Multiple tones can be played at the same time by providing a comma-separated list of tones. If there is no meter, every beat is considered a downbeat. Has no effect when `instrument` is `click`. | `C5`
`F4,A4,C4 ` | @@ -219,6 +219,21 @@ style: line ![](images/demo-8.gif) +### `dots` style + +````markdown +```metronome +bpm: 86 +meter: 3/4 +size: large +style: dots +``` +```` + +_Theme: [Solarized](https://github.com/Slowbad/obsidian-solarized) (dark)_ + +![](images/demo-style-dots.gif) + ### Works with themes The metronome works great with Obsidian's community themes in light or dark mode. diff --git a/images/demo-style-dots.gif b/images/demo-style-dots.gif new file mode 100644 index 0000000..c2c80b4 Binary files /dev/null and b/images/demo-style-dots.gif differ diff --git a/package.json b/package.json index 555bc46..679bdf7 100644 --- a/package.json +++ b/package.json @@ -33,4 +33,4 @@ "typescript": "4.4.4", "vue": "^3.2.26" } -} +} \ No newline at end of file diff --git a/src/components/Controls.vue b/src/components/Controls.vue index 6ea5ff8..3f05265 100644 --- a/src/components/Controls.vue +++ b/src/components/Controls.vue @@ -1,5 +1,25 @@ + + diff --git a/src/components/visualizations/PulseVisualization.vue b/src/components/visualizations/PulseVisualization.vue new file mode 100644 index 0000000..fd2dd75 --- /dev/null +++ b/src/components/visualizations/PulseVisualization.vue @@ -0,0 +1,63 @@ + + + + + diff --git a/src/components/visualizations/Visualization.vue b/src/components/visualizations/Visualization.vue index ff5c824..b2526dd 100644 --- a/src/components/visualizations/Visualization.vue +++ b/src/components/visualizations/Visualization.vue @@ -1,13 +1,38 @@ diff --git a/src/hooks/useTick.ts b/src/hooks/useTick.ts index 28b4a21..0f98739 100644 --- a/src/hooks/useTick.ts +++ b/src/hooks/useTick.ts @@ -8,12 +8,16 @@ export function useTick(meter: Ref) { const resetTick = () => (resetAfterNextBeat.value = true); + const currentBeat = computed(() => + meter.value?.isValid() + ? beatCount.value % meter.value.upper + : beatCount.value % 2 + ); + const currentBeatIsTick = computed( () => // Every beat is a tick if we don't have a valid meter - !meter.value || - !meter.value.isValid() || - beatCount.value % meter.value.upper === 0 + !meter.value || !meter.value.isValid() || currentBeat.value === 0 ); const currentBeatIsTickAlternate = computed( @@ -110,5 +114,6 @@ export function useTick(meter: Ref) { onTickAlternate, onTock, resetTick, + currentBeat, }; } diff --git a/src/models/MetronomeStyle.ts b/src/models/MetronomeStyle.ts index 1c785db..cf0e825 100644 --- a/src/models/MetronomeStyle.ts +++ b/src/models/MetronomeStyle.ts @@ -1,7 +1,7 @@ -export type MetronomeStyle = "pulse" | "pendulum" | "line"; +export type MetronomeStyle = "pulse" | "pendulum" | "line" | "dots"; export function isMetronomeStyle( inputStyle: string ): inputStyle is MetronomeStyle { - return ["pulse", "pendulum", "line"].includes(inputStyle); + return ["pulse", "pendulum", "line", "dots"].includes(inputStyle); }