Activity

Deelan

Better Midi Note Processing

Today I finally finished the conversion of the midi notes to a more readable format! The midi standard uses delta time or the time since the last event which can make the editing logic for this program a bit complicated so I decided to convert all of the events to use an “absolute” time relative to the beginning of the track. I also added most properties of each of the notes such as starting time, velocity, the length, and the key.

Then I just need to convert this new format back…

Attachment
0
Deelan

More Editing Logic

Today, I started rewritting the midi editing logic for my program. It turns out that editing the midi messages directly isn’t the most optimal… :/
I’ve came back to work on this project after around just over a week, since I was kinda stuck on the problem. Though my new implementation isn’t completely functional with my existing transposition and scaling commands yet, it will be able to speed up development and midi editing once fully implemented! The program will try its best to convert the midi messages (which have NoteOn and NoteOff events in separate places, relative to a delta time) and take these messages to be converted into a more useful format, which can include whole notes over a fixed time. This format can then later be converted back to midi events and then saved back into a midi file, or can be played. This can then lead to note length and position editing!

Attachment
0
Deelan

Tui

Today I took a break from the internal midi editing of the program to focus a bit on making the layout of the tui. I am currently using the Ratatui package to make development of the tui a bit easier. The values in this interface are placeholders for now and this is a really simple prototype. I plan to eventually have this interface work alongside my currently existing editing logic later.

Attachment
0
Deelan

Just a bunch of small changes today.
I fixed the range filtering for the midi transformations (shown in the code below). The previous code wouldn’t work if the ranges were not specified. I also added the ability to select specific tracks to apply a command to. Lastly, I just formatted and cleaned up some of the code.

Attachment
0
Deelan

Velocity Scaling

I added velocity scaling today, which can scale the velocity of certian sections in a midi file. It uses three values, center, scale and offset that can modify and give you great control over how the program scales velocity.
This was also built on top of my transpose functionality so it took a lot less time to implement!

Attachment
0
Deelan

Finally fixed transposition ranges!
This definitely took a bit longer that I would have wanted to take. My approach was to record the note on and note off events and try to piece them together. Then, I just check if any segment of a note was overlapping in the region and applied the transposition to the note. Its probably not the best approach as my code is pretty questionable, but at least it works and doesn’t have a bad time complexity!

Attachment
Attachment
Attachment
Attachment
0
Deelan

Region selection kinda works now. I added parameters to select what notes to transposed (and in the future, general transformations) through a range of ticks. It partially works as shown in the image (the 2nd and 3rd bars are transposed up by a semitone). However, it still bugs out the note on and note off events around the edges. I also need to add different input measurements such as quarter notes, seconds, etc.

Attachment
Attachment
0
Deelan

Transposition

I finally got the transposition working today in my program and added it to my cli. Right now, the command transposes the entire file up or down by a specified number of semitones and I’ll try to add modification of specific sections later.

0
Deelan

I figured out how to get a midi track’s starting tempo! It’s definitely not the best method since it only finds the first tempo change event in the metadata of the midi file, so I will likely need to expand across multiple tempo changes in the future.

Attachment
0
Deelan

Reading Midi Tracks

Finally, after a while and a lot of debugging, I made my program able to read the number of tracks in the midi file through a separate subcommand! I also kinda figured out how to use anyhow to write better error messages. From the tracks that I can extract, I hope to find and display the project tempo next.

Attachment
Attachment
0
Deelan

Currently, I’ve been following the Rust-Cli Book to learn the basic parts of creating a command line appllication and it’s been pretty simple. I’ve learned how to accept arguments I have a simple program in place to read a text file and print it line by line (I’ll eventually move to parsing midi files later).
Additionally, I’ve created some simple and cool ASCII art for the program that I’ll find a place to put later, probably somewhere in the TUI. Eventually, I might make the art colored or just overhaul the design entirely.

Attachment
Attachment
0
Deelan

I’ve finally got an idea!

I have decided on making a modern-ish midi editor using a TUI using Rust. Today I’ve set up the basic file structure for what my program probably needs and built my first hello world program.
I’m extremely new to Rust so this will be a fun learning experience for me…

Attachment
0
Deelan

I’m working on my first project! This is so exciting. I can’t wait to share more updates as I build.

Attachment
0