Âè 1 ¾Ï: Java Sound API ¤Î¾Ò²ð


 

Àß·×ÌÜɸ

JavaTM Sound API ¤Ï¡¢¥ª¡¼¥Ç¥£¥ª¥Ç¡¼¥¿¤È Musical Instrument Digital Interface (MIDI) ¥Ç¡¼¥¿¤ÎξÊý¤ò´Þ¤à²»À¼¥á¥Ç¥£¥¢¤ÎÆþ½ÐÎϤؤθú²Ì¤ÈÀ©¸æ¤Î¤¿¤á¤ÎÄã¥ì¥Ù¥ë API ¤Ç¤¹¡£Java Sound API ¤Ï¡¢³ÈÄ¥À­¤È½ÀÆðÀ­¤ò¸þ¾å¤µ¤»¤ë¥Õ¥ì¡¼¥à¥ï¡¼¥¯¤Ë¤è¤Ã¤Æ¡¢¥µ¥¦¥ó¥ÉÆþ½ÐÎϤËÄ̾ïɬÍפʵ¡Ç½¤ËÂФ¹¤ëÌÀ¼¨Åª¤ÊÀ©¸æ¤òÄ󶡤·¤Þ¤¹¡£

Java Sound API ¤ÎÂоݼÔ

¥µ¥¦¥ó¥É¤Ï¤â¤Ã¤È¤â´ðËÜŪ¤ÊÍ×ÁǤǤ¢¤ë¤¿¤á¡¢Java Sound API ¤Ï¹­ÈϤʥ¢¥×¥ê¥±¡¼¥·¥ç¥ó³«È¯¼Ô¤Î¥Ë¡¼¥º¤ËÂбþ¤·¤Æ¤¤¤Þ¤¹¡£Java Sound API ¤Ï¡¢¤¿¤È¤¨¤Ð¼¡¤Î¤è¤¦¤ÊÎΰè¤Î¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤ËŬÍѤµ¤ì¤Þ¤¹¡£

Java Sound API ¤È¤Û¤«¤Î¥¤¥ó¥¿¥Õ¥§¡¼¥¹¤Î´Ø·¸

Java Sound API ¤Ï¡¢Java ¥×¥é¥Ã¥È¥Õ¥©¡¼¥à¤Ç¤â¤Ã¤È¤âÄã¥ì¥Ù¥ë¤Î¥µ¥¦¥ó¥Éµ¡Ç½¤òÄ󶡤·¤Þ¤¹¡£¤½¤·¤Æ¡¢¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¥×¥í¥°¥é¥à¤Ë¥µ¥¦¥ó¥ÉÁàºî¤Î¤¿¤á¤ÎÈó¾ï¤Ë¿¤¯¤ÎÀ©¸æ¤òÄ󶡤¹¤ë¤È¤È¤â¤Ë¡¢³ÈÄ¥À­¤âÈ÷¤¨¤Æ¤¤¤Þ¤¹¡£Java Sound API ¤Ï¡¢¥·¥¹¥Æ¥à¥ê¥½¡¼¥¹ (¥ª¡¼¥Ç¥£¥ª¥ß¥­¥µ¡¼¡¢MIDI ¥·¥ó¥»¥µ¥¤¥¶¡¢¤Û¤«¤Î¥ª¡¼¥Ç¥£¥ª¥Ç¥Ð¥¤¥¹¤Þ¤¿¤Ï MIDI ¥Ç¥Ð¥¤¥¹¡¢¥Õ¥¡¥¤¥ë¥ê¡¼¥À¤ª¤è¤Ó¥é¥¤¥¿¡¼¡¢¥µ¥¦¥ó¥É·Á¼°¥³¥ó¥Ð¡¼¥¿¤Ê¤É) ¤ËÂФ¹¤ë¥¤¥ó¥¹¥È¡¼¥ë¡¢¥¢¥¯¥»¥¹¡¢Áàºî¤Î³Æµ¡Ç½¤òÈ÷¤¨¤Æ¤¤¤Þ¤¹¡£Java Sound API ¤Ë¤Ï¡¢¹âÅ٤ʥµ¥¦¥ó¥É¥¨¥Ç¥£¥¿¤ä¥°¥é¥Õ¥£¥Ã¥¯¥Ä¡¼¥ë¤Ï¤¢¤ê¤Þ¤»¤ó¤¬¡¢¤½¤ì¤é¤Î¥×¥í¥°¥é¥à¤òºîÀ®¤¹¤ë¤¿¤á¤Ë»ÈÍѤǤ­¤ëµ¡Ç½¤òÄ󶡤·¤Þ¤¹¡£¤Þ¤¿¡¢¤³¤Î API ¤ÎÈ÷¤¨¤ëÄã¥ì¥Ù¥ëÀ©¸æµ¡Ç½¤Ï¡¢°ìÈÌŪ¤Ë¥¨¥ó¥É¥æ¡¼¥¶¤¬´üÂÔ¤¹¤ë°Ê¾å¤Î¤â¤Î¤Ç¤¹¡£

¥µ¥¦¥ó¥É´ØÏ¢¤ÎÍ×ÁǤò»ý¤Ä Java ¥×¥é¥Ã¥È¥Õ¥©¡¼¥à API ¤Ï¤Û¤«¤Ë¤â¤¢¤ê¤Þ¤¹¡£Java Media Framework (JMF) ¤Ï¤µ¤é¤Ë¹â¥ì¥Ù¥ë¤Î API ¤Ç¡¢¸½ºß¤Ï Java ¥×¥é¥Ã¥È¥Õ¥©¡¼¥à¤Îɸ½à³ÈÄ¥¤È¤·¤ÆÆþ¼ê²Äǽ¤Ç¤¹¡£JMF ¤Ï¡¢»þ´Ö¥Ù¡¼¥¹¥á¥Ç¥£¥¢¤Î¼è¤ê¹þ¤ß¤ÈºÆÀ¸¤Î¤¿¤á¤ÎÅý¹ç¥¢¡¼¥­¥Æ¥¯¥Á¥ã¡¢¥á¥Ã¥»¡¼¥¸¸ò´¹¥×¥í¥È¥³¥ë¡¢¥×¥í¥°¥é¥ß¥ó¥°¥¤¥ó¥¿¥Õ¥§¡¼¥¹¤òÄê¤á¤Æ¤¤¤Þ¤¹¡£´ðËÜŪ¤Ê¥á¥Ç¥£¥¢ºÆÀ¸¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¥×¥í¥°¥é¥à¤Ë¡¢¤è¤ê´Êñ¤Ê¥½¥ê¥å¡¼¥·¥ç¥ó¤òÄ󶡤·¤Þ¤¹¡£¤Þ¤¿¡¢JMF ¤ò»ÈÍѤ¹¤ë¤È¡¢¥ª¡¼¥Ç¥£¥ª¤È¥Ó¥Ç¥ª´Ö¤Ê¤É°Û¼ï¤Î¥á¥Ç¥£¥¢´Ö¤ÎƱ´ü²½¤¬²Äǽ¤Ë¤Ê¤ê¤Þ¤¹¡£°ìÊý¡¢¥µ¥¦¥ó¥É¤ò½Å»ë¤¹¤ë¥×¥í¥°¥é¥à¡¢Æä˥Хåե¡¥ê¥ó¥°¤µ¤ì¤¿¥ª¡¼¥Ç¥£¥ª¤ÎºÆÀ¸¤òºÙ¤«¤¯À©¸æ¤¹¤ëǽÎϤä MIDI ¥·¥ó¥»¥µ¥¤¥¶¤òľÀÜÁàºî¤¹¤ëǽÎϤʤɡ¢¹âÅ٤ʵ¡Ç½¤òɬÍפȤ¹¤ë¥×¥í¥°¥é¥à¤Ç¤Ï¡¢Java Sound API ¤¬ÌòΩ¤Á¤Þ¤¹¡£¥µ¥¦¥ó¥Éµ¡Ç½¤Ë´ØÏ¢¤¹¤ë Java API ¤È¤·¤Æ¤Ï¡¢¤³¤Î¤Û¤«¤Ë¡¢Java 3D ¤ª¤è¤Ó¡¢ÅÅÏäÈȯÏäΤ¿¤á¤Î API ¤¬¤¢¤ê¤Þ¤¹¡£¤³¤ì¤é¤Î API ¤Ï¡¢Java Sound API ¤Î¼ÂÁõ¤òÆâÉôŪ¤Ë»ÈÍѤ·¤Æ¼ÂÁõ¤Ç¤­¤Þ¤¹¤¬¡¢»ÈÍѤ·¤Ê¤¯¤Æ¤â¹½¤¤¤Þ¤»¤ó¡£

¥Ñ¥Ã¥±¡¼¥¸

Java Sound API ¤Ë¤Ï¡¢¥Ç¥¸¥¿¥ë¥ª¡¼¥Ç¥£¥ª¥Ç¡¼¥¿¤È MIDI ¥Ç¡¼¥¿¤ÎξÊý¤ò¥µ¥Ý¡¼¥È¤¹¤ëµ¡Ç½¤¬¤¢¤ê¤Þ¤¹¡£¤³¤ì¤é¤Î¼ç¤Ê 2 ¤Ä¤Îµ¡Ç½¤Î¥â¥¸¥å¡¼¥ë¤Ï¡¢ÊÌ¡¹¤Î¥Ñ¥Ã¥±¡¼¥¸¤ÇÄ󶡤µ¤ì¤Þ¤¹¡£

¤³¤Î¤Û¤«¤Ë¡¢¼¡¤Î 2 ¤Ä¤Î¥Ñ¥Ã¥±¡¼¥¸¤Ë¤è¤Ã¤Æ¡¢¥µ¡¼¥Ó¥¹¥×¥í¥Ð¥¤¥À (¥¢¥×¥ê¥±¡¼¥·¥ç¥ó³«È¯¼Ô¤ÈÂÐΩ¤¹¤ëΩ¾ì) ¤¬¡¢Java Sound API ¤Î¼ÂÁõ¤Îµ¡Ç½¤ò³ÈÄ¥¤¹¤ë¥«¥¹¥¿¥à¥½¥Õ¥È¥¦¥§¥¢¤òºîÀ®¤Ç¤­¤ë¤è¤¦¤Ë¤Ê¤ê¤Þ¤¹¡£

¤³¤Î¾Ï¤Î¸åȾ¤Ç¤Ï¡¢¥µ¥ó¥×¥ê¥ó¥°¥ª¡¼¥Ç¥£¥ª¥·¥¹¥Æ¥à¡¢MIDI ¥·¥¹¥Æ¥à¡¢SPI ¥Ñ¥Ã¥±¡¼¥¸¤Ë¤Ä¤¤¤Æ´Êñ¤ËÀâÌÀ¤·¤Þ¤¹¡£¤½¤ì¤¾¤ì¤Î¾ÜºÙ¤Ë¤Ä¤¤¤Æ¤Ï¡¢¤½¤Î¤¢¤ÈÀâÌÀ¤·¤Þ¤¹¡£

¥µ¥ó¥×¥ê¥ó¥°¥ª¡¼¥Ç¥£¥ª

¥µ¥ó¥×¥ê¥ó¥°¥ª¡¼¥Ç¥£¥ª¤È¤Ï

javax.sound.sampled ¥Ñ¥Ã¥±¡¼¥¸¤¬½èÍý¤¹¤ë¥Ç¥¸¥¿¥ë¥ª¡¼¥Ç¥£¥ª¥Ç¡¼¥¿¤ò¡¢Java Sound API ¤Ç¤Ï¡Ö¥µ¥ó¥×¥ê¥ó¥°¥ª¡¼¥Ç¥£¥ª¡×¤È¸Æ¤Ó¤Þ¤¹¡£¡Ö¥µ¥ó¥×¥ë¡×¤È¤Ï¡¢¿®¹æ¤ÎϢ³¤¹¤ë¥¹¥Ê¥Ã¥×¥·¥ç¥Ã¥È¤Î¤³¤È¤Ç¤¹¡£¥ª¡¼¥Ç¥£¥ª¤Î¾ì¹ç¡¢¤½¤Î¿®¹æ¤Ï²»ÇȤǤ¹¡£¥Þ¥¤¥¯¥í¥Õ¥©¥ó¤¬¥¢¥³¡¼¥¹¥Æ¥£¥Ã¥¯¿®¹æ¤ò¥¢¥Ê¥í¥°¤ÎÅŵ¤¿®¹æ¤ËÊÑ´¹¤·¡¢¤½¤Î¥¢¥Ê¥í¥°¿®¹æ¤ò AD ¥³¥ó¥Ð¡¼¥¿¤¬¥µ¥ó¥×¥ê¥ó¥°¥Ç¥¸¥¿¥ë·Á¼°¤ËÊÑ´¹¤·¤Þ¤¹¡£¼¡¤Î¿Þ¤Ë¡¢Ï¿²»¤Î°ìÉô¤ò¼¨¤·¤Þ¤¹¡£

²»ÇȤΥµ¥ó¥×¥ê¥ó¥°
²»ÇȤΥµ¥ó¥×¥ê¥ó¥°

¥°¥é¥Õ¤Î½Ä¼´¤Ï²»°µ (¿¶Éý) ¤ò¼¨¤·¡¢²£¼´¤Ï»þ´Ö¤ò¼¨¤·¤Þ¤¹¡£¥¢¥Ê¥í¥°²»ÇȤο¶Éý¤Ï°ìÄê¤Î´Ö³Ö¤Ç¼þ´üŪ¤Ë¬Äꤹ¤ë¤È¡¢¥Ç¥¸¥¿¥ë¥ª¡¼¥Ç¥£¥ª¿®¹æ¤ò¹½À®¤¹¤ëÎ¥»¶Åª¤Ê¥µ¥ó¥×¥ë (¿Þ¤ÎÀÖ¤¤¥Ç¡¼¥¿¥Ý¥¤¥ó¥È) ¤Ë¤Ê¤ê¤Þ¤¹¡£Ãæ±û¤Î¿åÊ¿Àþ¤Ï¿¶Éý 0 ¤ò¼¨¤·¡¢¤³¤ì¤è¤ê¾å¤ÎÅÀ¤ÏÀµ¤ÎÃͤΥµ¥ó¥×¥ë¡¢¤³¤ì¤è¤ê²¼¤ÎÅÀ¤ÏÉé¤ÎÃͤǤ¹¡£¥¢¥Ê¥í¥°¿®¹æ¤Î¥Ç¥¸¥¿¥ë¶á»÷¤ÎÀºÅ٤ϡ¢»þ´Ö¤Îʬ²òǽ (¥µ¥ó¥×¥ê¥ó¥°¥ì¡¼¥È) ¤È Î̻Ҳ½¤Ä¤Þ¤ê¿¶Éý¤Îʬ²òǽ (³Æ¥µ¥ó¥×¥ë¤òɽ¸½¤¹¤ë¤¿¤á¤Ë»ÈÍѤ¹¤ë¥Ó¥Ã¥È¤Î¿ô) ¤Ë°Í¸¤·¤Þ¤¹¡£»²¹Í´ð½à¤È¤·¤Æ¡¢¥³¥ó¥Ñ¥¯¥È¥Ç¥£¥¹¥¯ÍѤËÏ¿²»¤µ¤ì¤ë¥ª¡¼¥Ç¥£¥ª¤Î¥µ¥ó¥×¥ê¥ó¥°¥ì¡¼¥È¤Ï 44,100 ²ó/Éäǡ¢³Æ¥µ¥ó¥×¥ë¤Î¥Ó¥Ã¥È¿ô¤Ï 16 ¤Ç¤¹¡£

¤³¤³¤Ç¤Ï¡¢¡Ö¥µ¥ó¥ó¥×¥ê¥ó¥°¥ª¡¼¥Ç¥£¥ª¡×¤È¤¤¤¦ÍѸì¤Ï¤¢¤Þ¤ê¸·Ì©¤ËÄêµÁ¤·¤Æ¤¤¤Þ¤»¤ó¡£²»ÇȤϡ¢¥¢¥Ê¥í¥°·Á¼°¤Î¤Þ¤ÞÎ¥»¶´Ö³Ö¤Ç¥µ¥ó¥×¥ê¥ó¥°¤¹¤ë¤³¤È¤â¤Ç¤­¤Þ¤¹¡£¤¿¤À¤·¡¢Java Sound API ¤Ç¤Ï¡¢¡Ö¥µ¥ó¥×¥ê¥ó¥°¥ª¡¼¥Ç¥£¥ª¡×¤Ï¡Ö¥Ç¥¸¥¿¥ë¥ª¡¼¥Ç¥£¥ª¡×¤ÈƱµÁ¤Ç¤¹¡£

°ìÈ̤ˡ¢¥³¥ó¥Ô¥å¡¼¥¿¾å¤Î¥µ¥ó¥×¥ê¥ó¥°¥ª¡¼¥Ç¥£¥ª¤ÏÏ¿²»¤Ë¤è¤Ã¤ÆºîÀ®¤µ¤ì¤Þ¤¹¤¬¡¢¹çÀ®¤·¤ÆÀ¸À®¤¹¤ë¾ì¹ç¤â¤¢¤ê¤Þ¤¹ (¥×¥Ã¥·¥å¥Û¥ó¼°ÅÅÏäβ»À¼¤òºîÀ®¤¹¤ë¾ì¹ç¤Ê¤É)¡£¡Ö¥µ¥ó¥×¥ê¥ó¥°¥ª¡¼¥Ç¥£¥ª¡×¤È¤¤¤¦ÍѸì¤Ï¡¢¥Ç¡¼¥¿¤Î¼ïÎà¤òɽ¤·¡¢¥Ç¡¼¥¿¤Î½Ð½ê¤òɽ¤¹¤â¤Î¤Ç¤Ï¤¢¤ê¤Þ¤»¤ó¡£

¥Ç¥¸¥¿¥ë¥ª¡¼¥Ç¥£¥ª¥Ç¡¼¥¿¤Î¹½Â¤¤Î¾ÜºÙ¤Ï¡¢Âè 2 ¾Ï¡ÖSampled ¥Ñ¥Ã¥±¡¼¥¸¤Î³µÍספΡֽñ¼°ÉÕ¤­¥ª¡¼¥Ç¥£¥ª¥Ç¡¼¥¿¤È¤Ï¡×¤ò»²¾È¤·¤Æ¤¯¤À¤µ¤¤¡£

¥ª¡¼¥Ç¥£¥ª¹½À®

Java Sound API ¤Ï¡¢ÆÃÄê¤Î¥ª¡¼¥Ç¥£¥ª¥Ï¡¼¥É¥¦¥§¥¢¹½À®¤òÁÛÄꤷ¤Æ¤¤¤Þ¤»¤ó¡£¥·¥¹¥Æ¥à¾å¤Ë¤µ¤Þ¤¶¤Þ¤Ê¼ïÎà¤Î¥ª¡¼¥Ç¥£¥ª¥³¥ó¥Ý¡¼¥Í¥ó¥È¤ò¥¤¥ó¥¹¥È¡¼¥ë¤Ç¤­¤ë¤è¤¦¤ËÀ߷פµ¤ì¤Æ¤ª¤ê¡¢¤½¤ì¤é¤Ë¤Ï API ¤ò»È¤Ã¤Æ¥¢¥¯¥»¥¹¤Ç¤­¤Þ¤¹¡£Java Sound API ¤Ï¡¢¥µ¥¦¥ó¥É¥«¡¼¥É¤ËÂФ¹¤ëÆþ½ÐÎÏ (¥µ¥¦¥ó¥É¥Õ¥¡¥¤¥ë¤ÎÏ¿²»¤äºÆÀ¸¤Ê¤É)¡¢¥ª¡¼¥Ç¥£¥ª¤ÎÊ£¿ô¤Î¥¹¥È¥ê¡¼¥à¤Î¥ß¥­¥·¥ó¥°¤Ê¤É¡¢°ìÈÌŪ¤Êµ¡Ç½¤ò¥µ¥Ý¡¼¥È¤·¤Æ¤¤¤Þ¤¹¡£¼¡¤Ë¡¢°ìÈÌŪ¤Ê¥ª¡¼¥Ç¥£¥ª¥¢¡¼¥­¥Æ¥¯¥Á¥ã¤ÎÎã¤ò¼¨¤·¤Þ¤¹¡£

°Ê¸å¤Îʸ¾Ï¤Ç¡¢¤³¤Î¿Þ¤Ë¤Ä¤¤¤ÆÀâÌÀ¤·¤Æ¤¤¤Þ¤¹¡£

°ìÈÌŪ¤Ê¥ª¡¼¥Ç¥£¥ª¥¢¡¼¥­¥Æ¥¯¥Á¥ã

¤³¤ÎÎã¤Ç¤Ï¡¢¥µ¥¦¥ó¥É¥«¡¼¥É¤Ê¤É¤Î¥Ç¥Ð¥¤¥¹¤Ë¤µ¤Þ¤¶¤Þ¤ÊÆþ½ÐÎϥݡ¼¥È¤¬¤¢¤ê¡¢¥ß¥­¥·¥ó¥°¤Ï¥½¥Õ¥È¥¦¥§¥¢Æâ¤Ç¹Ô¤ï¤ì¤Þ¤¹¡£¥ß¥­¥µ¡¼¤¬¼õ¤±¼è¤ë¥Ç¡¼¥¿¤Ï¡¢¥Õ¥¡¥¤¥ë¤«¤éÆɤ߹þ¤ó¤À¤â¤Î¡¢¥Í¥Ã¥È¥ï¡¼¥¯¤«¤é¤Î¥¹¥È¥ê¡¼¥à¡¢¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¥×¥í¥°¥é¥à¤¬¿Ê¹ÔÃæ¤ËÀ¸À®¤·¤¿¤â¤Î¡¢MIDI ¥·¥ó¥»¥µ¥¤¥¶¤¬À¸À®¤·¤¿¤â¤Î¤Ê¤É¤µ¤Þ¤¶¤Þ¤Ç¤¹¡£¼¡¤ËÀâÌÀ¤¹¤ë javax.sound.midi ¥Ñ¥Ã¥±¡¼¥¸¤Ï¡¢¥·¥ó¥»¥µ¥¤¥¶¤Î¤¿¤á¤Î Java ¸À¸ì¥¤¥ó¥¿¥Õ¥§¡¼¥¹¤Ç¤¹¡£¥ß¥­¥µ¡¼¤Ï¤¹¤Ù¤Æ¤Î¥ª¡¼¥Ç¥£¥ªÆþÎϤò 1 ËܤΥ¹¥È¥ê¡¼¥à¤Ë¤Þ¤È¤á¤ë¤Î¤Ç¡¢¤½¤ì¤ò½ÐÎϥǥХ¤¥¹¤ËÁ÷¤Ã¤Æ¥ì¥ó¥À¥ê¥ó¥°¤¹¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£

MIDI

javax.sound.midi ¥Ñ¥Ã¥±¡¼¥¸¤Ë¤Ï¡¢MIDI ¥¤¥Ù¥ó¥È¤ÎžÁ÷¤È¥·¡¼¥±¥ó¥·¥ó¥°¤Î¤¿¤á¤Î API¡¢¤ª¤è¤Ó¤½¤ì¤é¤Î¥¤¥Ù¥ó¥È¤«¤é¤Î¥µ¥¦¥ó¥É¤ò¹çÀ®¤¹¤ë¤¿¤á¤Î API ¤¬¤¢¤ê¤Þ¤¹¡£

MIDI ¤È¤Ï

¥µ¥ó¥×¥ê¥ó¥°¥ª¡¼¥Ç¥£¥ª¤¬¥µ¥¦¥ó¥É¤½¤Î¤â¤Î¤ÎľÀÜɽ¸½¤Ç¤¢¤ë¤Î¤ËÂФ·¡¢MIDI ¥Ç¡¼¥¿¤Ï²»¡¢Æä˲»³Ú¤òºîÀ®¤¹¤ë¤¿¤á¤Î¥ì¥·¥Ô¤È¹Í¤¨¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£MIDI ¥Ç¡¼¥¿¤Ï¡¢¥ª¡¼¥Ç¥£¥ª¥Ç¡¼¥¿¤Î¤è¤¦¤Ë¥µ¥¦¥ó¥É¤òľÀܵ­½Ò¤¹¤ë¤³¤È¤Ï¤¢¤ê¤Þ¤»¤ó¡£Âå¤ï¤ê¤Ë¡¢¥·¥ó¥»¥µ¥¤¥¶¤Ë¤è¤êºîÀ®¤µ¤ì¤ë¥µ¥¦¥ó¥É¤Ë±Æ¶Á¤òÍ¿¤¨¤ë¥¤¥Ù¥ó¥È¤òµ­½Ò¤·¤Þ¤¹¡£MIDI ¥Ç¡¼¥¿¤Ï¡¢GUI (¥°¥é¥Õ¥£¥«¥ë¥æ¡¼¥¶¥¤¥ó¥¿¥Õ¥§¡¼¥¹) ¤Î¥­¡¼¥Ü¡¼¥É¥¤¥Ù¥ó¥È¤È¥Þ¥¦¥¹¥¤¥Ù¥ó¥È¤ËÎà»÷¤·¤Æ¤¤¤Þ¤¹¡£MIDI ¤Î¾ì¹ç¤Ï¡¢¥¤¥Ù¥ó¥È¤Ï¸°ÈפËÂФ¹¤ë¥¢¥¯¥·¥ç¥ó¡¢¤Þ¤¿¤Ï³Ú´ï¤Î¥Ú¥À¥ë¡¢¥¹¥é¥¤¥À¡¢¥¹¥¤¥Ã¥Á¡¢¤Ä¤Þ¤ß¤Ê¤É¤ËÂФ¹¤ë¥¢¥¯¥·¥ç¥ó¤Ç¤¢¤ë¤È¹Í¤¨¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£¤³¤ì¤é¤Î¥¤¥Ù¥ó¥È¤Ï¡¢¼ÂºÝ¤Ë¥Ï¡¼¥É¥¦¥§¥¢¤È¤·¤Æ¤Î³Ú´ï¤Çºî¤é¤ì¤¿¤â¤Î¤Ç¤¢¤ëɬÍפϤ¢¤ê¤Þ¤»¤ó¡£¥½¥Õ¥È¥¦¥§¥¢¤Ç¥·¥ß¥å¥ì¡¼¥·¥ç¥ó¤·¤¿¤â¤Î¤ò MIDI ¥Õ¥¡¥¤¥ë¤ËÊݸ¤¹¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£¤³¤ì¤é¤Î¥Õ¥¡¥¤¥ë¤òºîÀ®¡¢ÊÔ½¸¡¢¼Â¹Ô¤¹¤ë¥×¥í¥°¥é¥à¤ò¥·¡¼¥±¥ó¥µ¤È¸Æ¤Ó¤Þ¤¹¡£¥³¥ó¥Ô¥å¡¼¥¿ÍÑ¥µ¥¦¥ó¥É¥«¡¼¥É¤Ë¤Ï MIDI À©¸æ²Äǽ¤Ê²»³Ú¥·¥ó¥»¥µ¥¤¥¶¥Á¥Ã¥×¤¬ÅëºÜ¤µ¤ì¤Æ¤¤¤ë¤³¤È¤¬Â¿¤¯¡¢¥·¡¼¥±¥ó¥µ¤«¤é MIDI ¥¤¥Ù¥ó¥È¤òÁ÷¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£¥·¡¼¥±¥ó¥µ¤Ï¡¢´°Á´¤Ë¥½¥Õ¥È¥¦¥§¥¢Æâ¤Ë¼ÂÁõ¤¹¤ë¤³¤È¤â¤Ç¤­¤Þ¤¹¡£¥·¥ó¥»¥µ¥¤¥¶¤Ï¡¢¼õ¤±¼è¤Ã¤¿ MIDI ¥¤¥Ù¥ó¥È¤ò²ò¼á¤·¤Æ¥ª¡¼¥Ç¥£¥ª½ÐÎϤòÀ¸À®¤·¤Þ¤¹¡£Ä̾MIDI ¥Ç¡¼¥¿¤«¤é¹çÀ®¤µ¤ì¤ë²»¤Ï¡¢È¯ÏäʤɤǤϤʤ¯¡¢²»³Ú¤Ç¤¹¡£MIDI ¥·¥ó¥»¥µ¥¤¥¶¤Ë¤è¤ê¡¢³Æ¼ï¤Î¥µ¥¦¥ó¥É¥¨¥Õ¥§¥¯¥È¤òÀ¸À®¤¹¤ë¤³¤È¤â¤Ç¤­¤Þ¤¹¡£

°ìÉô¤Î¥µ¥¦¥ó¥É¥«¡¼¥É¤Ë¤Ï MIDI Æþ½ÐÎϥݡ¼¥È¤¬¤¢¤ê¡¢³°Éô¥Ï¡¼¥É¥¦¥§¥¢¥Ç¥Ð¥¤¥¹ (¥­¡¼¥Ü¡¼¥É¥·¥ó¥»¥µ¥¤¥¶¤Ê¤É¤Îµ¡´ï) ¤òÀܳ¤Ç¤­¤Þ¤¹¡£¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¥×¥í¥°¥é¥à¤Ï¡¢³°Éô¤Î MIDI ÅëºÜ³Ú´ï¤¬À¸À®¤·¤¿¥¤¥Ù¥ó¥È¤ò MIDI ÆþÎϥݡ¼¥È¤«¤é¼õ¿®¤Ç¤­¤Þ¤¹¡£¥×¥í¥°¥é¥à¤Ï¡¢¥³¥ó¥Ô¥å¡¼¥¿¤ÎÆâÉô¥·¥ó¥»¥µ¥¤¥¶¤ò»È¤Ã¤Æ²»³Ú¤Î±éÁÕ¤ò¤·¤¿¤ê¡¢MIDI ¥Õ¥¡¥¤¥ë¤È¤·¤Æ¥Ç¥£¥¹¥¯¤ËÊݸ¤·¤¿¤ê¡¢²»Éä¤ËÊÑ´¹¤·¤¿¤ê¤¹¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£¤Þ¤¿¡¢¥×¥í¥°¥é¥à¤Ï MIDI ½ÐÎϥݡ¼¥È¤ò»È¤Ã¤Æ³°Éô¤Î³Ú´ï¤ò±éÁÕ¤·¤¿¤ê¡¢Ï¿²»µ¡´ï¤Ê¤É¤Î³°Éô¥Ç¥Ð¥¤¥¹¤òÀ©¸æ¤¹¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£

MIDI ¥Ç¡¼¥¿¤Ë¤Ä¤¤¤Æ¤Ï¡¢Âè 8 ¾Ï¡ÖMIDI ¥Ñ¥Ã¥±¡¼¥¸¤Î³µÍספËÀâÌÀ¤¬¤¢¤ê¤Þ¤¹¤¬¡¢ÆäˡÖMIDI ¤Ë¤Ä¤¤¤Æ: ¥ï¥¤¥ä¤ª¤è¤Ó¥Õ¥¡¥¤¥ë¡×¤ÎÀá¤Ë¾ÜºÙ¤ÊÀâÌÀ¤¬¤¢¤ê¤Þ¤¹¤Î¤Ç»²¾È¤·¤Æ¤¯¤À¤µ¤¤¡£

MIDI ¤Î¹½À®

²¼¤Î¿Þ¤Ë¡¢Java Sound API ¤ò´ð¤Ë¤·¤¿¡¢MIDI ¹½À®Îã¤ÎÃæ¤Î¼ç¤Ê¥³¥ó¥Ý¡¼¥Í¥ó¥È´Ö¤Îµ¡Ç½¤Î´Ø·¸¤ò¼¨¤·¤Þ¤¹¡£¥ª¡¼¥Ç¥£¥ª¤Î¾ì¹ç¤ÈƱÍͤˡ¢Java Sound API ¤Ç¤Ï¤µ¤Þ¤¶¤Þ¤Ê MIDI ¥½¥Õ¥È¥¦¥§¥¢¥Ç¥Ð¥¤¥¹¤ò¥¤¥ó¥¹¥È¡¼¥ë¤·¤ÆÁê¸ßÀܳ¤¹¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£¤³¤³¤Ç¼¨¤¹¥·¥¹¥Æ¥à¤Ï¡¢°ìÎã¤Ë²á¤®¤Þ¤»¤ó¡£¥³¥ó¥Ý¡¼¥Í¥ó¥È´Ö¤Î¥Ç¡¼¥¿¤Îή¤ì¤Ï¡¢Ìð°õ¤Ç¼¨¤·¤Æ¤¢¤ê¤Þ¤¹¡£¥Ç¡¼¥¿¤Ï¡¢É¸½à¥Õ¥¡¥¤¥ë·Á¼°¤Î¥Ç¡¼¥¿¤Î¾ì¹ç¤â¤¢¤ê¡¢¥ª¡¼¥Ç¥£¥ª¡¢raw MIDI ¥Ð¥¤¥È¡¢»þ¹ï¤Î¥¿¥°¤¬ÉÕ¤¤¤¿ MIDI ¥á¥Ã¥»¡¼¥¸¤Ê¤É¤Î¾ì¹ç¤â¤¢¤ê¤Þ¤¹ (¿Þ¤Î±¦²¼¶ù¤Î key ¤ò»²¾È)¡£

°Ê¸å¤Îʸ¾Ï¤Ç¡¢¤³¤Î¿Þ¤Ë¤Ä¤¤¤ÆÀâÌÀ¤·¤Æ¤¤¤Þ¤¹¡£

MIDI ¹½À®¤ÎÎã

¤³¤ÎÎã¤Ç¤Ï¡¢¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¥×¥í¥°¥é¥à¤Ï¡¢¥Ç¥£¥¹¥¯¾å¤Ëɸ½à MIDI ¥Õ¥¡¥¤¥ë¤È¤·¤ÆÊݸ¤µ¤ì¤Æ¤¤¤ë³ÚÉè¤ò¥í¡¼¥É¤·¤Æ²»³Ú¤Î±éÁդνàÈ÷¤ò¤·¤Þ¤¹ (¿Þ¤Îº¸Â¦)¡£É¸½à MIDI ¥Õ¥¡¥¤¥ë¤Ë¤Ï¡¢¥È¥é¥Ã¥¯¤¬´Þ¤Þ¤ì¤Æ¤¤¤Þ¤¹¡£¤½¤ì¤¾¤ì¤Î¥È¥é¥Ã¥¯¤Ï¡¢»þ¹ï¤Î¥¿¥°¤¬ÉÕ¤¤¤¿ MIDI ¥¤¥Ù¥ó¥È¤Î¥ê¥¹¥È¤Ç¤¹¡£¥¤¥Ù¥ó¥È¤Î¤Û¤È¤ó¤É¤Ï²»Éä (¥Ô¥Ã¥Á¤È¥ê¥º¥à) ¤òɽ¤·¤Þ¤¹¡£¤³¤Î MIDI ¥Õ¥¡¥¤¥ë¤ò¥½¥Õ¥È¥¦¥§¥¢¥·¡¼¥±¥ó¥µ¤¬Æɤ߹þ¤ß¡¢¼¡¤Ë¡Ö±éÁաפ·¤Þ¤¹¡£¥·¡¼¥±¥ó¥µ¤Ï¡¢ÆâÉô¤Þ¤¿¤Ï³°Éô¤Î¥·¥ó¥»¥µ¥¤¥¶¤Ê¤É¤Î¥Ç¥Ð¥¤¥¹¤Ë MIDI ¥¤¥Ù¥ó¥È¤òÁ÷¿®¤¹¤ë¤³¤È¤Ë¤è¤Ã¤Æ²»³Ú¤Î±éÁÕ¤ò¹Ô¤¤¤Þ¤¹¡£¥·¥ó¥»¥µ¥¤¥¶¼«ÂΤ¬¡¢ÆÃÄê¤Î³Ú´ï¤Î¥µ¥¦¥ó¥É¤ò¥¨¥ß¥å¥ì¡¼¥È¤¹¤ë¤¿¤á¤Î»Ø¼¨¤¬´Þ¤Þ¤ì¤Æ¤¤¤ë¥µ¥¦¥ó¥É¥Ð¥ó¥¯¥Õ¥¡¥¤¥ë¤òÆɤ߹þ¤à¤³¤È¤â¤¢¤ê¤Þ¤¹¡£¤½¤ì°Ê³°¤Î¾ì¹ç¤Ï¡¢¥·¥ó¥»¥µ¥¤¥¶¤Ï¤¹¤Ç¤Ë¥·¥ó¥»¥µ¥¤¥¶¤Ë¥í¡¼¥É¤µ¤ì¤Æ¤¤¤ë³Ú´ï¤Î¥µ¥¦¥ó¥É¤ò¤¹¤Ù¤Æ»È¤Ã¤Æ¡¢MIDI ¥Õ¥¡¥¤¥ë¤ÎÃæ¤Î²»¤òºÆÀ¸¤·¤Þ¤¹¡£

¿Þ¤Ë¼¨¤¹¤È¤ª¤ê¡¢MIDI ¥¤¥Ù¥ó¥È¤Ï MIDI ½ÐÎϥݡ¼¥È¤ò»È¤Ã¤Æ³°Éô¤Î¥·¥ó¥»¥µ¥¤¥¶¤ËÁ÷¿®¤¹¤ëÁ°¤Ë¡¢»þ¹ï¤Î¥¿¥°¤¬ÉÕ¤¤¤Æ¤¤¤Ê¤¤ raw MIDI ¤ËÊÑ´¹¤µ¤ì¤ëɬÍפ¬¤¢¤ê¤Þ¤¹¡£Æ±Íͤˡ¢³°Éô MIDI ¥½¡¼¥¹ (¿Þ¤Î¸°È׳ڴï) ¤«¤é¥³¥ó¥Ô¥å¡¼¥¿¤ËÆþÎϤµ¤ì¤ë raw MIDI ¥Ç¡¼¥¿¤Ï»þ¹ï¤Î¥¿¥°¤¬ÉÕ¤¤¤¿ MIDI ¥á¥Ã¥»¡¼¥¸¤ËÊÑ´¹¤µ¤ì¤Þ¤¹¡£¤³¤Î¥á¥Ã¥»¡¼¥¸¤Ë¤è¤ê¥·¥ó¥»¥µ¥¤¥¶¤òÀ©¸æ¤Ç¤­¤Þ¤¹¡£¤Þ¤¿¡¢¤¢¤È¤Ç»ÈÍѤ¹¤ë¤¿¤á¤Ë¥·¡¼¥±¥ó¥µ¤¬¤³¤Î¥á¥Ã¥»¡¼¥¸¤òÊݸ¤·¤Æ¤ª¤¯¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£MIDI ¥Ç¡¼¥¿¤Îή¤ì¤Ë´Ø¤·¤Æ¤Ï¡¢MIDI ¤Ë¤Ä¤¤¤ÆÀâÌÀ¤·¤Æ¤¤¤ë¾Ï¤Ë¾ÜºÙ¤¬¤¢¤ê¤Þ¤¹ (Âè­¶Éô¤ò»²¾È)¡£

¥µ¡¼¥Ó¥¹¥×¥í¥Ð¥¤¥À¥¤¥ó¥¿¥Õ¥§¡¼¥¹

javax.sound.sampled.spi ¥Ñ¥Ã¥±¡¼¥¸¤È javax.sound.midi.spi ¥Ñ¥Ã¥±¡¼¥¸¤Ë¤Ï¡¢¥½¥Õ¥È¥¦¥§¥¢³«È¯¼Ô¤¬¥ª¡¼¥Ç¥£¥ª¤Þ¤¿¤Ï MIDI ¥ê¥½¡¼¥¹¤ò¿·µ¬¤ËºîÀ®¤¹¤ë¤¿¤á¤Ë»ÈÍѤǤ­¤ë API ¤¬´Þ¤Þ¤ì¤Æ¤¤¤Þ¤¹¡£¤³¤ì¤é¤Î¥ê¥½¡¼¥¹¤Ï¡¢¥æ¡¼¥¶¤Ë¸ÄÊ̤ËÇÛÉÛ¤·¤¿¤ê¡¢´û¸¤Î Java Sound API ¼ÂÁõ¤Ë¡Ö¥×¥é¥°¥¤¥ó¡×¤µ¤»¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£¤³¤ÎÊýË¡¤ÇÄɲäǤ­¤ë¥µ¡¼¥Ó¥¹ (¥ê¥½¡¼¥¹) ¤È¤·¤Æ¡¢¼¡¤Î¤è¤¦¤Ê¤â¤Î¤¬¤¢¤ê¤Þ¤¹¡£

¾ì¹ç¤Ë¤è¤Ã¤Æ¤Ï¡¢¥µ¡¼¥Ó¥¹¤¬¡¢¥µ¥¦¥ó¥É¥«¡¼¥É¤Ê¤É¤Î¥Ï¡¼¥É¥¦¥§¥¢¥Ç¥Ð¥¤¥¹µ¡Ç½¤Ø¤Î¥½¥Õ¥È¥¦¥§¥¢¥¤¥ó¥¿¥Õ¥§¡¼¥¹¤Ë¤Ê¤ê¤Þ¤¹¡£¤½¤Î¾ì¹ç¡¢¥µ¡¼¥Ó¥¹¥×¥í¥Ð¥¤¥À¤Ï¡¢¥Ï¡¼¥É¥¦¥§¥¢¤Î¥Ù¥ó¥À¡¼¤ÈƱ¤¸°ÕÌ£¤Ë¤Ê¤ê¤Þ¤¹¡£¤Þ¤¿¡¢½ã¿è¤Ë¥½¥Õ¥È¥¦¥§¥¢Æâ¤Ë¤¢¤ë¥µ¡¼¥Ó¥¹¤â¤¢¤ê¤Þ¤¹¡£¤¿¤È¤¨¤Ð¡¢¥·¥ó¥»¥µ¥¤¥¶¤ä¥ß¥­¥µ¡¼¤¬¥µ¥¦¥ó¥É¥«¡¼¥É¾å¤Î¥Á¥Ã¥×¤Ø¤Î¥¤¥ó¥¿¥Õ¥§¡¼¥¹¤Ë¤Ê¤ë¾ì¹ç¤ä¡¢¥Ï¡¼¥É¥¦¥§¥¢¤ò¤Þ¤Ã¤¿¤¯¥µ¥Ý¡¼¥È¤·¤Ê¤¤¤Ç¼ÂÁõ¤µ¤ì¤Æ¤¤¤ë¾ì¹ç¤Ê¤É¤Ç¤¹¡£

Java Sound API ¤Î¼ÂÁõ¤Ë¤Ï¥µ¡¼¥Ó¥¹¤Î´ðËÜ¥»¥Ã¥È¤¬´Þ¤Þ¤ì¤Æ¤¤¤Þ¤¹¤¬¡¢¥µ¡¼¥Ó¥¹¥×¥í¥Ð¥¤¥À¥¤¥ó¥¿¥Õ¥§¡¼¥¹ (SPI) ¥Ñ¥Ã¥±¡¼¥¸¤ò»È¤Ã¤Æ¥µ¡¼¥É¥Ñ¡¼¥Æ¥£¤Ë¤è¤ë¿·¤·¤¤¥µ¡¼¥Ó¥¹¤ÎºîÀ®¤â²Äǽ¤Ç¤¹¡£¤³¤Î¤è¤¦¤Ê¥µ¡¼¥É¥Ñ¡¼¥Æ¥£¥µ¡¼¥Ó¥¹¤Ï¡¢ÁȤ߹þ¤ß¥µ¡¼¥Ó¥¹¤ÈƱÍͤÎÊýË¡¤Ç¥·¥¹¥Æ¥à¤ËÅý¹ç¤µ¤ì¤Þ¤¹¡£sampled ¥Ñ¥Ã¥±¡¼¥¸Æâ¤Î AudioSystem ¥¯¥é¥¹¤È midi ¥Ñ¥Ã¥±¡¼¥¸Æâ¤Î MidiSystem ¥¯¥é¥¹¤Ï¡¢¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¥×¥í¥°¥é¥à¤¬¥µ¡¼¥Ó¥¹¤ËÌÀ¼¨Åª¤Þ¤¿¤Ï°ÅÌÛŪ¤Ë¥¢¥¯¥»¥¹¤¹¤ë¤¿¤á¤ÎÄ´À°Ìò¤È¤·¤ÆƯ¤­¤Þ¤¹¡£¤¢¤ë¥µ¡¼¥Ó¥¹¤Î¸ºß¤¬¡¢¤½¤Î¥µ¡¼¥Ó¥¹¤ò»ÈÍѤ¹¤ë¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¥×¥í¥°¥é¥à¤Ë¤Ï¸«¤¨¤Ê¤¤¤³¤È¤â¤è¤¯¤¢¤ê¤Þ¤¹¡£¥µ¡¼¥Ó¥¹¥×¥í¥Ð¥¤¥Àµ¡¹½¤Ë¤è¤ê¡¢Java Sound API ¤ò¥Ù¡¼¥¹¤È¤¹¤ë¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¥×¥í¥°¥é¥à¤Î¥æ¡¼¥¶¤Ï¡¢ÊØÍø¤µ¤òµý¼õ¤¹¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£¤½¤ì¤Ï¡¢Java SDK ¤Þ¤¿¤Ï¼Â¹Ô´Ä¶­¤Î¿·¤·¤¤¥ê¥ê¡¼¥¹¡¢¤Þ¤¿Â¿¤¯¤Î¾ì¹ç¡¢¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¥×¥í¥°¥é¥à¤½¤Î¤â¤Î¤Î¿·¤·¤¤¥ê¥ê¡¼¥¹¤µ¤¨¤âɬÍפȤ»¤º¤Ë¡¢¥×¥í¥°¥é¥à¤Ë¿·¤·¤¤¥µ¥¦¥ó¥Éµ¡Ç½¤òÄɲ乤뤳¤È¤¬¤Ç¤­¤ë¤«¤é¤Ç¤¹¡£