<?xml version="1.0" encoding="utf-8" standalone="no"?>
<!DOCTYPE document PUBLIC "-//CNX//DTD CNXML 0.5//EN" "http://cnx.rice.edu/technology/cnxml/schema/dtd/0.5/cnxml_plain.dtd">
<document xmlns="http://cnx.rice.edu/cnxml" xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:bib="http://bibtexml.sf.net/" id="new">
  <name>[ LabVIEW application ] MIDI_JamSession</name>
  <metadata>
  <md:version>1.2</md:version>
  <md:created>2007/08/17 12:20:57 GMT-5</md:created>
  <md:revised>2008/03/17 17:32:50.962 GMT-5</md:revised>
  <md:authorlist>
      <md:author id="doering">
      <md:firstname>Ed</md:firstname>
      
      <md:surname>Doering</md:surname>
      <md:email>doering@rose-hulman.edu</md:email>
    </md:author>
  </md:authorlist>

  <md:maintainerlist>
    <md:maintainer id="doering">
      <md:firstname>Ed</md:firstname>
      
      <md:surname>Doering</md:surname>
      <md:email>doering@rose-hulman.edu</md:email>
    </md:maintainer>
    <md:maintainer id="eluther">
      <md:firstname>Erik</md:firstname>
      <md:othername>B</md:othername>
      <md:surname>Luther</md:surname>
      <md:email>erik.luther@ni.com</md:email>
    </md:maintainer>
    <md:maintainer id="SShearman">
      <md:firstname>Sam</md:firstname>
      <md:othername>D.</md:othername>
      <md:surname>Shearman</md:surname>
      <md:email>sam.shearman@ni.com</md:email>
    </md:maintainer>
  </md:maintainerlist>
  
  <md:keywordlist>
    <md:keyword>audio</md:keyword>
    <md:keyword>LabVIEW</md:keyword>
    <md:keyword>MIDI</md:keyword>
    <md:keyword>rendering</md:keyword>
    <md:keyword>standard MIDI file</md:keyword>
  </md:keywordlist>

  <md:abstract>MIDI_JamSession is a LabVIEW application VI that reads a standard MIDI file (.mid format) and renders it to audio using subVIs called "virtual musical instruments" (VMIs) that you design.</md:abstract>
</metadata>

<content>
<section id="sec1">
<name>Introduction</name>

<para id="par2"><term>MIDI_JamSession</term> is a LabVIEW application VI that reads a standard MIDI file (.mid format) and renders it to a audio using "instrument" subVIs of your own design. Following are the key features of <term>MIDI_JamSession</term>:</para>

<list id="list3" type="bulleted"><item> Reads standard MIDI files (.mid) </item>
<item> Renders note events to stereo audio using user-defined subVIs called "virtual musical instruments" (VMIs) or built-in preview instruments </item>
<item> Displays relevant MIDI file information to help determine how to assign instruments to MIDI channels </item>
<item> Includes basic "mixing board" with controls for instrument type, mute, and stereo pan </item>
<item> Creates files for rendered audio (.wav format) and note events (.csv spreadsheet format) </item>

</list>

<para id="par4">A MIDI file contains note and timing information (see <cnxn document="m15049">MIDI Messages</cnxn> and <cnxn document="m15051">Standard MIDI Files</cnxn> for full details). Notes are associated with <term>channels</term> (up to 16 channels possible). A single channel is almost always associated with a single instrument sound. <term>MIDI_JamSession.vi</term> uses all of this information to repeatedly call your <term>virtual musical instrument</term> (<term>VMI</term>) which creates a single note (an audio fragment) according to the requested duration, frequency, and amplitude; the audio fragment is then superimposed on  the output audio stream at the correct time.</para>

<para id="par5">The following screencast video demonstrates how to use <term>MIDI_JamSession</term>
to render MIDI files using the default preview instruments, and how to get started creating
subVIs to render audio according to your own algorithms.  </para>

<figure id="video6"><media type="image/png" src="midi_APP-MIDI_JamSession-demo.html">
   <param name="thumbnail" value="midi_APP-MIDI_JamSession-demo.png"/>
   </media>
<caption>
   [video] Demonstration of the <term>MIDI_JamSession</term> application
</caption>
</figure>

</section>

<section id="sec7">
<name>Source Distribution</name>

<para id="par8"><term>MIDI_JamSession.vi</term> is available in this .zip archive: <link src="MIDI_JamSession_v0.92.zip">MIDI_JamSession_v0.92.zip</link>. Right-click and choose "Save As" to download the .zip file, unpack the archive into its own folder, and double-click "MIDI_JamSession_run-me.vi" to start the application.</para>

</section>

<section id="sec9">
<name>Instructions</name>

<list id="list10" type="bulleted"><item> Start "MIDI_JamSession.vi" and choose a source MIDI file (.mid format); several MIDI files are included in 
   the .zip distribution archive (see 'readme_midi-files.txt' for details). Click the 
   folder icon to the right of the text entry browse to browse for a file. 
   Once you select a file, "MIDI_JamSession" immediately reads the file and
   updates the MIDI information display panels. If you enter a filename in the
   "note events output file" field, a spreadsheet (in comma-separated values
   format) will be created that contains all of the note events extracted from
   the MIDI file. The columns are: channel number (1 to 16), start time (in 
   seconds), duration (in seconds), note number (0 to 127), and velocity (0 to 
   127). The .csv file will be updated each time you load a new MIDI file.
 </item>
<item> Leave all of the audio rendering controls at their default settings at first
   in order to use the built-in preview instruments, and to render only the 
   first 10 percent of the song to audio. The relatively low sampling frequency
   and the simple algorithm for the preview instruments ensure quick rendering
   when you are exploring different MIDI files. Click "Render Audio" to listen
   to your MIDI file.
 </item>
<item> If you have not done so already, double-click on your MIDI file to hear it 
   played by your default media player using the built-in synthesizer on your 
   computer's soundcard. "MIDI_JamSession" may not work properly for some 
   types of MIDI files, so please compare the rendered audio to your media 
   player's rendition before you continue.
 </item>
<item> Look at the information text panels on the lower left, especially the track
   listing. Each channel number (inside square brackets) is typically 
   associated with a unique instrument, and will often be labeled as such. The 
   text entry boxes labeled "The Band" are where you assign your "virtual musical instrument" (VMI) to render notes for a given channel. Note that Channel 10 is 
   reserved for percussion. The preview drum instrument renders all note 
   events on Channel 10 the same way, regardless of note number or note 
   velocity (it sounds a bit like a snare drum).
 </item>
<item> Experiment with the pan controls to position each instrument in the
   stereo sound field; click "random pan" to make a random assignment for each
   instrument. You can also mute selected channels in order to 
   isolate certain instruments, or to create a solo. Click the "Lock to 1"
   button to cause all controls to track those of Channel 1; this is an easy
   way to mute or unmute all channels, for example. Adjust the two sliders
   on the "time range to render" control to pick the start and stop times
   to render. You can quickly preview sections in the middle or end of the
   song this way. Set the controls to 0 and 100 percent to render the entire
   song.
 </item>
<item> You will eventually find it more convenient to turn off the "Listen to audio"
   option and enter a filename in the "audio output file (.wav)" field. Each
   time you click "Render Audio" the .wav file will update, and you can use
   your own media player to listen to the .wav file. There is presently no
   way to interrupt the built-in audio player, and this can be a nuisance when
   you render long pieces. The yellow LED indicator at the upper right corner indicates when the built-in audio player is active.
 </item>
<item> Once you are ready to create your own instrument sounds, open
   "vmi_Prototype.vi" and carefully follow the instructions inside.
   Eventually you will create a number of different VMIs, with each
   having the ability to generate an audio fragment that renders a single note.
 </item>
<item> De-select the "Preview only" button, and select the VMI you wish to use
   for each channel in the vertical array of folders called "The Band." Blank 
   entries will render as silence. Remember to adjust your sampling frequency
   as needed, bearing in mind that CD-quality (44.1 kHz) will increase the
   rendering time and increase the size of the .wav file. 
 </item>
<item> Render your new audio file. </item>
<item> Enjoy listening! </item>

</list>

<note type="Important">Once you have invested a lot of effort to adjust the front panel
settings, exit the application (click "Exit" just under the "MIDI Jam Session"
logo), select "Edit | Make Current Values Default," and press Ctrl+S to
save "MIDI_JamSession.vi" with your own settings.
</note>

</section>

</content>
</document>
