Skip to content

Peek: support previewing midi file - #44494

Closed
oxygen dioxide (oxygen-dioxide) wants to merge 5 commits into
microsoft:mainfrom
oxygen-dioxide:pianoroll
Closed

Peek: support previewing midi file#44494
oxygen dioxide (oxygen-dioxide) wants to merge 5 commits into
microsoft:mainfrom
oxygen-dioxide:pianoroll

Conversation

@oxygen-dioxide

@oxygen-dioxide oxygen dioxide (oxygen-dioxide) commented Jan 1, 2026

Copy link
Copy Markdown
Contributor

Summary of the Pull Request

After this PR, users can preview midi (.mid) files as piano roll with peek.

PR Checklist

Detailed Description of the Pull Request / Additional comments

When the user previews a midi file with peek, it will parse the midi file to get the positions, durations and pitches of musical notes, and plot them into a svg graph, where the X axis represents time, the Y axis represents pitch, and different colors represents different tracks. It will be shown in a webview2 where user can zoom and scroll.

Validation Steps Performed

Download this file and extract:
Oh_My_Darling_Clementine.mid.zip

Launch powertoys. Turn on peek. press Ctrl+Space on the midi file, and peek will show a window like this:

图片

Comment thread src/common/FilePreviewCommon/PianoRoll/PianoRollHelper.cs Fixed
@github-actions

This comment has been minimized.

@oxygen-dioxide
oxygen dioxide (oxygen-dioxide) marked this pull request as ready for review January 1, 2026 07:45
@lei9444

Copy link
Copy Markdown
Contributor

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@yeelam-gordon

Copy link
Copy Markdown
Contributor

Thanks oxygen dioxide (@oxygen-dioxide) for the PR.
Since we use WebView2 for preview, we’re considering whether it would be simpler to create a miniView.html with a well-known JavaScript bundle that handles MIDI well, rather than implementing most of the logic in C#. This would also be the preferred direction for adding new file types.

leileizhang (@lei9444) and Niels Laute (@niels9001) here.

@oxygen-dioxide

Copy link
Copy Markdown
Contributor Author

Sorry, I'm not farmiliar with html and js, so I'm not able to develop midi functionality on them

@yeelam-gordon

Copy link
Copy Markdown
Contributor

🔍 Automated PR Review Summary

Step Severity Finding
01-functionality 🟡 medium CalculateRange() calls Min/Max on note collections without handling emp...
03-performance 🟡 medium The new MIDI branch calls PianoRollHelper.PreviewTempFile(...) inside `Disp...
05-security 🟢 low The MIDI parser is invoked directly on untrusted file content without an expl...
10-repo-patterns 🟡 medium This PR introduces a new third-party dependency (Melanchall.DryWetMidi) but...
11-docs-automation 🟡 medium A new third-party dependency (Melanchall.DryWetMidi) was added, but this PR...
12-code-comments 🟢 low PianoRollHelper introduces public members (PianoRollHelper, MidiSvg) wi...

Review generated by pr-review skill. See Generated Files/prReview/44494/ for full details.

@niels9001

Copy link
Copy Markdown
Collaborator

Thanks oxygen dioxide (@oxygen-dioxide) for the PR. Since we use WebView2 for preview, we’re considering whether it would be simpler to create a miniView.html with a well-known JavaScript bundle that handles MIDI well, rather than implementing most of the logic in C#. This would also be the preferred direction for adding new file types.

leileizhang (@lei9444) and Niels Laute (@niels9001) here.

oxygen dioxide (@oxygen-dioxide) I agree with Gordon Lam (@yeelam-gordon); we want to keep Peek as light-weight as possible and would ideally like to use WebView2 to be the renderer of certain file previews so we don't need to maintain a lot.

I'm therefore closing this PR. We do very much appreciate the work - and thanks for taking the time! If we can support you in porting some of these things to the WebView2 approach please let us know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Peek: Support previewing midi (and other symbolic music formats)

5 participants