BLACK MIDI - Attack of the Killer Queen

Published 2022-02-09
Black MIDI - Attack of the Killer Queen
YouTube Link:
Notecount: 123,456

PFA in Scratch, or at least a concept of it.
Turbowarp is REQUIRED to run:
https://turbowarp.org/633610677?fps=120&clones=Infinity&limitless&hqpen&turbo&offscreen&stuck

Controls:
Some controls are shown inside the project.
1~4: Render Speed, with 1 being the slowest and 3 the highest.
5: Disable falling notes
Up/Down Arrows: Change volume
F: Show Framerate (Cycle Framerate viewing modes)
SPACE: Pause Renderer

IMPORT RULES:
1. MIDI must contain 5 million notes or less
2. MIDI must not have sustained polyphony, or overlapping notes. 200 thousand overlapping notes can take over an hour to prerender.
3. MIDI cannot have a keyrange above 128. I intended the keys above 128 for program controls, such as tempo events.
NOTE: If you wish to save a MIDI and upload to scratch.mit.edu, the notecount limit is around 400k notes.

Get the MIDI Importer Tool here: https://github.com/Edenathan256/MidiParser

Credits:
K9ShyGuy for their beautiful MIDI Converter tool.
Brian Pantano for the concept of PFA.
MBMS for the soundfont used.

External Links:
K9ShyGuy's MIDI Program:
https://scratch.mit.edu/projects/406337184/
Black MIDI:
https://www.youtube.com/watch?v=-h7W-vkyi3s
Piano From Above (PFA):
https://kaleidonkep99.altervista.org/pfamirror/download.html
CFaz Keys IV:
https://www.youtube.com/@MBMS/about

Copyright Notice: This program is intended for Educational Use. No Copyright Infringement Intended.

=====

Changelog

(Only shows major changes)

1.0

- Added Font Generator and GUI

1.1

- More zoom options
- More data on GUI
- More realistic keys

1.2

- Tempo Support
- Now requires Scratch PFA File Format
- Can still open K9ShyGuy's File Format
- Volume Control
- Synth limit and resolution control

1.3

- Better Audio System using a single sample per key
- Visual and Audio Thread separation

1.4

- Added tracks for better color
- Tweaks to tickrate and tempo
- Now requires Scratch PFA updated File Format
- Can no longer open K9ShyGuy's File Format
- Added new themes
- All tiles will render, causing major slowdowns yet consistent framerates

1.5

- Now uses an even more optimized version of Scratch PFA File Format
- Compatible with older file format versions including K9ShyGuy's File Format
- Revamped Menus and Settings
- Added Glow Aura
- Tweaked Tickrate and Framerate
- Tweaked Loop and Volume icons
- Added scaling support

1.6

- Now uses time-based tick positioning
- Optimized tile-rendering systems

Known issues:

- Does not support MIDI CC / MIDI PC
- Longer notes tend to create more tiles, causing lag
- Does not load MIDIs larger than 5 million notes

=====

How does this work?

Summary:

Basically, this program renders a MIDI file which has been formatted in a way that Scratch can easily read. First, a MIDI is converted using a modded version of K9ShyGuy's MIDI conversion tool, which includes tempo events. Then the output code is converted into a list of notes with their times, velocities, and lengths. Tempo events are sorted into their own list while the rest is then reformatted to be read by my own MIDI player system. The program then splits the MIDI code in half, one for audio and the other for visual, to reduce playback lag. The visual code takes a long time to parse in order to get a tilemap which, when rendered, can produce decent graphics at ANY note intensity without that much lag compared to simply using clones. The audio code instead uses clones but it is limited and only audible notes are played. The limit is 128 audio events per tick, and while clones are removed the moment they're made, this MIDI runs at 96 ticks per second at 120 BPM. This means each second can have more than 11 thousand note events. There are three classes of audio samples based on length to minimize reverberation.