Damian Evans33 downloadsAudio player for practising music: loop sections, slow down without changing pitch, and shift pitch.
Practise music from audio files inside Obsidian. Loop named A–B sections, slow
a tune down or speed it up without changing its pitch, and shift the pitch
independently to change key or match a slightly off-tuning recording. Works on
audio embedded in notes (![[tune.mp3]]) and on audio files opened in their
own tab. Supports mp3, m4a and wav.
1:05.5 or plain seconds).loops code block)A note can list sections for an audio file, e.g. as written by trad-split under each embed:
![[Sessions/Set 1.m4a]]
```loops
file: Sessions/Set 1.m4a
0:00 - 2:18 | Tune 1
2:18 - 4:34.3 | Tune 2 ?
```
file: is the audio file's vault-relative path. Without it, the closest
audio embed above the block is used.start - end | name. Times count from the start of the
file and may be m:ss, m:ss.s, h:mm:ss or plain seconds. The name and
the end are optional. Names are shown exactly as written.The note's sections are loaded when the file has no saved sections, and are reloaded whenever the note changes as long as the player's sections haven't been edited since the last load. Once you edit sections in the player, the note never overwrites them silently: the block says they differ and offers a Use the note's sections button. The plugin never writes to the note.
select:)When a note is about one tune in a longer file, add a select: line so the
player is ready on that tune when you open the note. Nothing plays until you
press play.
```loops
file: Sessions/Set 1.m4a
select: 2
0:00 - 2:18 | Tune 1
2:18 - 4:34.3 | Tune 2
4:34.3 - 6:50 | Tune 3
```
select: 2 selects section 2, moves the playhead to its start, plays it
once and stops at its end, back at its start, so play repeats it.select: 2 loop turns Loop on, so section 2 repeats.select: 2 continue starts at section 2 and plays on through the rest of
the file.The selection is applied each time you arrive at the note, not while you edit
it, and never while the audio is playing. Clicking another section, turning
Loop on or dragging the playhead out of the section ends the play-once
behaviour. Selection is saved per audio file, so a note without select:
shows whatever was last selected. once and loop need the section to have
an end time. An unreadable select: line counts as a problem like any other,
so nothing in the block is loaded until it is fixed.
An embed can say where to start, in place of an alias:
![[Sessions/Set 1.m4a|1:23]] start at 1:23
![[Sessions/Set 1.m4a|83]] plain number is seconds
![[Sessions/Set 1.m4a|t=1:23]] t= is accepted too
![[Sessions/Set 1.m4a|1:23-1:45]] section 1:23 to 1:45, selected, Loop on
![[Sessions/Set 1.m4a|1:23 to 1:45]] same (an en dash works as well)
Nothing plays until you press play, and nothing happens if the audio is already
playing. A range is added to the file's sections the first time (or matched to an
existing section within a quarter of a second), so opening the note again does not
add another. Any alias that isn't a time, such as a name, is ignored, so existing
embeds are unaffected. Use either this or a loops block's select: for one embed,
not both.
All commands act on the player you most recently used: Play / pause · Set loop start (A) · Set loop end (B) · Toggle loop · Jump to loop start · Jump to loop end · Add loop section · Sort loop sections by time · Select next / previous section · Raise / lower pitch by a tone · Raise / lower pitch by 5 cents · Reset pitch.
Default playback speed, whether to enhance audio at all, whether players start collapsed as mini-players, the default pause between loops, and a button to forget all saved sections.
npm install
npm run dev # rebuild on change
npm run build # type-check and produce main.js
Copy main.js, manifest.json and styles.css into
<vault>/.obsidian/plugins/audio-loop-player/ and reload Obsidian.