Teoria: A JavaScript Music Theory Library for Working With Notes, Chords, and More


There have been a lot of music related projects in the JavaScript community lately, some of which I’ve posted about.  Teoria is an interesting library for working with music theory in JavaScript, and would be a good fit for sheet music editors and viewers, and other music composition applications in the browser.

Teoria has several object types: notes, chords, intervals, and scales.  Each one of these objects can be created in various ways through a simple chained interface, and then operated on to get information about them, and transform them in various ways.  For example, you can create a note from a string representing the note name (such as A), or from a frequency, piano key, or MIDI note number and then convert that note to a different one of those representations.  Similar things are possible with scales, chords and intervals.  There is a whole host of methods and operations available, so check out the Github page for a full list.

There is a fun demo of the library as well, which shows an interesting application where the user can enter a chord, and see a visualization of the sound waves it will produce.  You can drag the waveform to move it around and hover over the individual lines to see what the individual notes and frequencies are.  The visualization itself is all SVG based.  It’s an interesting showcase for what information Teoria can extract and produce and it’s pretty fun to play with, so definitely go check it out!

After seeing the MIDI.js sequencer, the VexFlow music notation language, and now the Teoria music theory library, many of the pieces for building a high quality music composition application like Finale or Sibelius in the browser are here, so I wouldn’t be surprised to see one in the coming months.  Other interesting applications that could be built using these tools  and others such as the Web Audio API and the Web MIDI API include smart visualizations that know more about the music being played, music production applications like Logic or Pro Tools, and many more.  We’re only just getting started in the audio space on the web, and it’s great to see more building blocks like Teoria appear on the scene!

You can check out the source code for Teoria on Github and find the demo on their website.



Source link

Leave a Reply

Your email address will not be published. Required fields are marked *