Pianotypes Devlog 5

Not many code changes as of late but I’ve been more active on one of the packages I’m using to play sound, smplr. It’s such an amazing package for playing instrument sounds with an incredibly simple and powerful api. Kudos to danigb. A bunch of new changes were made recently that have added some awesome features as well as some bugs I found while using them. Note Scheduling Throughput The first change was a tweak to note scheduling that fixes an issue of the web audio getting overloaded and introducing lot’s of static. ...

October 1, 2023

Useful Linear Algebra

Dot Product Find the interior angle between two vectors $$ A\cdot B = |A||B|cos\theta $$ $$ \theta = \arccos(\dfrac{A\cdot B}{|A||B|}) $$ $$ where\ A\cdot B = A_x \times A_y + B_x \times B_y $$ Cross Product Get perpendicular vector from two vectors Find area created by two vectors (for 2D, parallelogram area, for 3D, parallelepiped area) This is the magnitude of perpendicular vector Matrix Multiplication There is a formula for calculating the resultant matrix from a matrix multiplication. ...

September 25, 2023

Pianotypes Devlog 4

Not too much to report. I had the realization that I can pause the scheduled notes by suspending the AudioContext since they depend on the context’s timer. It’d be pretty easy to add pause functionality. The only caveat is that if I pause the AudioContext, than all sound from the piano is also paused. Perhaps I could code in a notice to resume the timer given the user inputs a key press but I don’t want to resume the context on every key press. Maybe I could write some code to resume on the first user input on pause. ...

August 25, 2023

Reviving Tabby Sort

A couple years ago I made a little extension for chrome to organize and sort tabs by url domains. It was really quick and crudely designed and since I wasn’t even a Chrome user, I didn’t think too much about improving it. Fast forward to now, I decided to do exactly that. Looking at old code Actually the code was mostly better than I expected, other than some variable naming and redundant lines, I didn’t see much need to rewrite it. The html on the other hand needed some tuning and was pretty messily put together. There was lot’s of redundant styling and a disappaering timeout on the buttons that I wonder why I even thought was a good idea in the first place. ...

August 23, 2023

Pianotypes Devlog 3

Today I spent some time working on getting the instructions dialogues up. I originally planned on creating a secondary overlay window that pops up given a trigger. Very similar to how to the toast notifications work but instead with a much larger area. The only problem with that is I wanted a clean way to inject custom html into the dialogue box depending on who triggers it. In the case of the toast notification I just pass it a string which is fine given it’s only suppose to be a sure notifier anyways. For the instructions, I may need to add bullets or text stylings depending on what the instructions are for. Strings aren’t going to cut it. ...

August 23, 2023

Pianotypes Devlog 2

I’m a bit more than late for a second devlog but I figured there’s no better thing to call this. I originally made this blog for the purposes of short and sweet devlogs but my recent posts have been bit larger than what I originally intended. I’m hoping with this log to bring that focus back down to just that. Since my previous post, I’ve done a lot of fine tuning of the UI and functionality of the site. One I’m quite happy with was adding draggability to the inputs simialr to other software like Blender. It’s a lot more convenient than typing and allows you to set options easily using mouse only. ...

August 21, 2023

Revisting Pianotypes

I recently finished a course in deep learning and wanted to took a look at a few ways I could apply my knowledge to. The idea the came to me was to create an ai music generation model and feed it into my old pianotypes app. Simple right! It’s all broken So I booted up my old, dusty, untouched, forgotten, delapidated, abused, ramshackled, repository, and lo and behold, I can’t get it to run. I tried updating packages, my nodeJS version, moving around code, but nothing worked. In fact, I think updating anything at all just made it worse. Mind you, this project has been mostly untouched for a couple years so it was prone to deprecated libaries and syntax that made it very difficult to remedy. At this point I’ve all but given up on trying to polish a giant heaping pile of rust. ...

August 18, 2023

Svelte Reactive Classes

I’ve been working on migrating my old PianoTypes project over from Vue to Svelte. So far the syntax has been much cleaner to use and has been an overall a great experience. My first and primary pain point thus far has been implementing a global reactive state for the piano. The Problem In Vue, it’s possible to add a reactive wrapper to any object. In my case, I had created a class containing all of the piano data and property methods so all I had to do was wrap this class in the wrapper and state is maintained across all instances of my piano class. ...

August 12, 2023

JS Modules in Hugo

While writing this blog, I’ve been constantly finding a need to include various JavaScript libraries such as graphics libraries or text processors. I love the simplicity of Markdown but sometimes it can be really helpful to include more meaningful content and visuals to better illustrate a certain topic or idea. My most recent endeavor was adding an easy way to render shaders within each of posts which turned out to be a more painful task than I originally anticipated. Here, I hope to document some of my process of importing modules and hopefully make it easier for whoever is reading to import modules into their own Hugo blog. ...

July 14, 2023

3D Matrix Rotations

Intuition of 3x3Matrix Transformations Rotations can be achieved by locking the desired axes of rotation and transforming the rest of the axes by \(sin\) and \(cos\). 3x3 matrices can be used to bend the coordinate space in 3 dimensions, effectively allowing any desired transformations to objects in that space. As the coordinate space is being transformed, it’s helpful breaking up the matrix into its unit vectors $$ \vec{a} = x\begin{bmatrix}1\\0\\0\end{bmatrix} + y\begin{bmatrix}0\\1\\0\end{bmatrix} + z\begin{bmatrix}0\\0\\1\end{bmatrix} $$ ...

June 15, 2023