Music needs the equivalent of plain-text files

October 3, 2015 Leave a comment

Here’s a small rant:

In software development, the source code (the instructions that define how a program works) is written in what’s called “plain text”. Plain text is basically just a document with human-readable text.

Since software is written in this fashion, software developers have created things such as version control systems. These allow developers to create a project, track how that project has changed over time, review each others’ work, and collaborate very easily. This allows people all over the world to easily work together to make computer programs.

Plain text also allows users to search for keywords throughout documents. For example: open Notepad, type some text, and then press Ctrl+F. Since you can search for text, you can navigate through documents quickly. Other, more complex, searching tools exist as well, such as regular expressions.

Music is an area that would benefit greatly from an increased ability to collaborate. When writing music in a DAW (Digital Audio Workstation), the only method I know of for sharing my work with other users is to email them a project, which they open and edit. This causes a lot of issues when collaborating. For example, if you want to work on multiple versions of a song, the main option is to save two copies of a project with different names. Every time you make a change that you might want to reverse later, you have to save a new version of your project. This is a gigantic, messy hassle. Contrast this to version control: In version control, every change that’s ever been made to a project, along with who made the change and when, is stored for later browsing.

The above is just the tip of the iceberg, in terms of the benefits of switching DAWs to a standard file format. Other benefits include the ability of different musicians to use different DAWs, and still work together. This is a topic for another post, but: if standard libraries of electronic instruments were freely published, and used by music producers, then the libraries could then be distributed to users’ computers, like software libraries. At that point, to listen to a song, you would only need to know the collection of notes and effects to play, at specific times. I’m betting this would vastly reduce the size required to download and play songs, and as a result less storage would be required for music.

How does this need to happen? I’m not sure yet. I’m betting that MIDI messages could be stored in a human-readable way. It’s a tough problem. The benefits from solving it would be great, though.

Categories: Uncategorized

Using the toe rather than the ball of the foot when climbing

Disclaimer: I’m still a noob, so take the below with a grain of salt.

In the self-coached climber book, it’s mentioned that “For newer climbers, learning to get onto the big toe is important, as this provides the greatest range of motion.” After thinking about this, this makes total sense. So I drew up a quick diagram of what this means.


Click for full-size version

As shown here, when you stand on the ball of your foot, the protruding toe and heel limit the foot’s range of rotation. Also, basically the only way to place your foot is with the inside of the foot facing into the wall. However, when standing on the toe, you get an extra +/- ~1 inch of height that you can adjust, and you can rotate your foot a larger amount around the hold.

The cool thing about this technique is that it’s extremely simple to do – just use your toe rather than the ball of your foot when stepping on holds – and it provides obvious, consistent benefits (extra, adjustable height, and a larger ability to rotate). Hopefully this helps someone – I’m off to start trying this out.

Categories: Uncategorized

Possible language feature: View Classes

January 21, 2015 Leave a comment

Note: The below post is something I haven’t really thought about a lot. Needs further development and thought before it could be useful probably.

In relational databases, we often work with views. Simply put, a view is a way of representing data that you’re interested in, without directly showing the data’s underlying structure.

In object-oriented programming languages (my experience is mainly in Visual Basic/C#), I can think of no analogous concept for classes. For example, consider this class:

class Customer
    public DateTime DOB;
    public string FirstName;
    public string LastName;
    public string MiddleName;
    public string EmailAddress;
    public string PhoneNumber;

In my application, I will use this class in multiple places. For example, a screen to add Customers would let me create Customers and set all the above fields. Another screen might let me search Customers by name or DOB.

The problem: Everywhere in my application that I deal with Customers, I use the Customer class. However, in most places, I’m only interested in a sub-set of the Customer class (IE: just names and DOB). So areas of my application that don’t care about EmailAddress and PhoneNumber have to retrieve that data from the database, have access to those properties, etc.

A solution: The first solution I could think of would be to make classes that are specific to the problem you’re solving now. For example, if you’re making a Customer searching screen, the model for the screen could be:

class SearchableCustomer
    public DateTime DOB;
    public string FirstName;
    public string LastName;
    public string MiddleName;

However, this is tedious and messy. For every area of the application, you could need a separate model class, where all of the models actually are parts of the same thing.

A (possibly) better solution: Implement a language feature called view classes. Something like this (the syntax is kind of nasty):

class view SearchableCustomer { Customer.DOB, Customer.FirstName, Customer.LastName, Customer.MiddleName }

The “class” can be created in-line, saving you from having to declare a bunch of classes that are only used in one place. This lets you work with classes in a way that’s specific to your problem, without having to declare and maintain multiple classes. There’s one canonical definition of what a Customer is, and multiple ways of looking at that class.

EDIT: A redditor pointed out that this is a case of the MVP pattern. I wasn’t too familiar with the pattern beforehand, but it seems to work for this. Customer is the model. The presenter converts customer into objects that are useful for particular views. I’m still wondering if this could be done on a language level, rather than in code, though.

Fixing ContentLoadExceptions in MonoGame with the new content pipeline.

December 28, 2014 Leave a comment

Just a quick note for future reference/anyone having this problem: If you’re using MonoGame’s new content pipeline tool, and you’re getting a ContentLoadException when attempting to load content generated from the pipeline tool into your game, try the following:

1) In explorer, navigate to the startup project of your solution.
2) Go into the bin/Windows/Debug/Content/ folder (or whichever folder corresponds to your Content directory).
3) Verify that the folder/file structure in this directory matches the structure of your files/folders in your MonoGame content project. If it doesn’t, there’s a good chance that the content files aren’t getting copied to the output directory when the solution is built.

If this problem happens, I’ve usually been able to fix it by adding files to my solution, and/or changing the “Build Action” of those files in Visual Studio to Copy if newer or Copy always.

Categories: computers, gamedev Tags:

MonoGame – importing FBX files from Blender

December 9, 2014 Leave a comment

I’ve been working on a game in MonoGame recently, and had some issues getting FBX files exported from Blender to display correctly in my game. MonoGame would load the Models without throwing any exceptions, but nothing would appear on-screen when the Model was drawn. The below steps are how I fixed this problem:

1) Exporting the model.

In Blender, when you export the model, make sure to do this: File->Export->FBX. Under the “Export FBX” pane, make sure to select “FBX 6.1 ASCII”. Then export the file as usual.

2) Adding the model to your project.

In Visual Studio, go to your MonoGame Content project and Add->Existing Item the FBX file that was just exported.

After doing the above steps, Models should now be viewable in MonoGame.

Categories: Uncategorized Tags: , ,

A couple useful emacs lisp functions

September 16, 2014 Leave a comment

Here are a couple functions I recently added to my .emacs file that I figured I’d share in case they’re useful to someone.

new-scratch-buffer: Creates a brand new scratch buffer, without you giving it a name.

A lot of times I will want to quickly take notes on something. Thinking of a file name and creating a file is cumbersome. Switching to a buffer named *scratch22*, for example, is cumbersome as well. Thus, I wanted a single command to create a new buffer with an automatically-picked name, that I can type into. new-scratch-buffer is working well for this, so far.

Here’s the code:

(defun new-scratch-buffer ()
  "Creates and switches to a new scratch buffer"
  (switch-to-buffer (concat "*scratch " (current-time-string) "*")))

avg: Gets a rough average of a list of numbers

This one’s probably about as basic as it gets, but I found it useful when processing a bit of data.

It’s used like this:

(avg 0 5 10 15 20 25)    ... should return 12 (it should ignore remainders)
(defun avg (&rest number-list)
  "Averages a list of numbers"
  (setq sum (apply '+ number-list))
  (/ sum (length number-list)))
Categories: Uncategorized Tags: , ,

A reason to have “faith in humanity”

August 21, 2014 Leave a comment

A lot of people say they’ve “lost their faith in humanity” when another person/group does something particularly unagreeable. Here’s a thought to counteract the notion that humans are beyond the point of hope as a species, or that the species is doomed to harm the world/themselves for eternity.

When humans first evolved from other organisms (over a long period of time, yes), there was no civlization. No towns, no roads, no electricity, no mathematicians, no artists, etc, etc. Over time, these things developed and are now commonplace. Each of these professions/advances make the world better for humans to live in.

If there was something fundamentally wrong with humans (read: humans really only end up destroying the world/each other), one would think the world would look a lot different. Instead of a gigantic civilization with a majority people working to better themselves and the world, everyone would be robbing every other person/making the world worse. This does not seem to be the case.

My argument boils down to: If humans are fundamentally “bad”, why does the vast majority of humanity spend the vast majority of their time doing things that are “good”? Learning, entertaining themselves, socializing, improving in a discipline, etc. If humans were fundamentally “bad”, you would expect to see the majority of people stealing from other people, damaging the infrastructure set up by others, and making the world a less friendly place for humans to live in.

The reason to have faith in humanity then, is that if humans overall try to make the world a better place more often than not, over time the world should become a better place to live in for humans.

Categories: Uncategorized

Get every new post delivered to your Inbox.