东拼西凑的介绍

MIDI which means Musical Instrument Digital Interface, introduced in 1980's provided a interface for digital music tool to comunicate with each other.The information carried by midi data is some signal like "note on", "note off", "note\pitch ", "pitch bend",etc.A midi instrument may be a piece of hardware(electronic keyboard, synthesizer) or software enviroment like ableton, garageband, digital performer, logic.The advantages are:

compact -an entire song can be stored within a few hundred MIDI messages (compared to audio data which is sampled thousands of times a second)
easy to modify/manipulate notes -change pitch, duration, and other parameters without having to rerecord
change instruments
-remember, MIDI only describes which notes to play, you can send these
notes to any instrument to change the overall sound of the composition.

MIDI keyboard is the most common instrument to create MIDI(or use your keyboard instead of it).When a key in the board is starting to press ,the message "note on" is send with attributes which key is pressed(note,between the value 0~127,like value 60 means the middel c,c4) and how fast this happens(velocity,value beween 0~127,the higer value means the louder voice).Unfortunately,computer keyboard has no ability to send velocity information,the value of this attribute will be a constant igore your strength of speed of pressing.When a pressed key is released,the message "note off " is created also contains the velocity information. "Aftertouch" is created when a key is in the state of "note on",and you may change the power of pressing.Most times you may use "Pichbend" slider(or other tools) to modify the tone in a distance of a semitone(half-step), this mesage is applied to all the notes played.And all the notes can be send to different "Channel" to compose a multi-track song.

The most easy way to manage MIDI through python is using the open-source library python-midi,address :https://github.com/vishnubob/python-midi#Installation

python-midi格式解析:

首先是head_chunk中

  • format-- midi文件类型,有效值0(所有音符都在1个track中,单轨文件) 1(多轨 同步并行 常用) 2(多轨 独立)
  • resolution --  ticks per quarter note 一个四分音符的ticks,tick是midi中计算时间长短的最小单位。在cakewalk中,默认是1个四分音符等于120tick,根据需要在工程选项里可以将设置改为48、72、96、120、144、168、192、216、240、360、384或480个tick。这里有个例子,可以计算出1个ticks的具体时间:在每个四分音符等于120tick的情况下,拍速120,4/4拍的曲子

      1)4/4拍的曲子是以四分音符为一拍,那么一拍就是120tick;
      2)拍速120也就是说每分钟120拍,即一拍为0.5秒,也就是30毫秒。
      根据1)和2)可知,一拍=120tick=30毫秒,所以1tick=1/4毫秒

当format为1时,Track0比较特殊,记录了一些meta-events,如 :NameEvent(记录歌名),TextMetaEvent(如歌曲信息 作者),版权,还有:

SetTempoEvent(重要)----格式为tt tt tt,一分钟多少拍

TimeSignatureEvent(重要)-----格式为nn dd cc bb nn和dd合起来代表了歌曲拍号nn/dd拍 ,注意dd是记录的是2的指数,如2,代表$2^2$ = 4。cc表示一个四分音符的midi clock数(一般固定为24),bb表示一个四分音符相当于多少个32分音符(这不是傻?),如果没有拍号记录的话,默认为4/4拍

除开Track0外,其他Track中记录的为<delta_time> <event>的pair对,delta_time记录了上次事件到本次事件发生的时间间隔。event分为midi event,sysex event和meta event。

Midi Event:

  •   Channel voice message

  主要的就是note on和note off事件了 ,两者成对出现

  

  channel :midi channel

  data:貌似时pitch和velocity的组合数列

  length:?

  pitch:midi音符值

  statusmsg:?

  tick:delta_ticks

  velocity:音符力度,为0的话 不发声

  其他事件还包括AfterTouch(已经on的note的按键力度发生变化)、Controller Change(设备发生变化,如脚踩效果器等)、Program Change(?)、Pitch Bend(从名字猜测是音调变调,推弦?)

  • Channel Mode message

  包括了一些All Sound Off,Reset All Controllers,Local Control,All Notes Off,Omni Mode Off,Omni Mode On,Mono Mode On,Poly Mode On等控制信息

Sysex Events:

  保留字段用于后续扩展或交由合成器厂商自己实现

Meta Events:

  track-names, lyrics and cue-points(提示 如演员上场 幕帘拉开之类的),还有上面提到的Track0中的SetTempo event,TimeSignature等都是元事件

midi文件自行编写参考:http://blog.sina.com.cn/s/blog_622bd1660101aggj.html

http://www.360doc.com/content/17/0205/08/11411827_626609322.shtml

 

Overview of MIDI的更多相关文章

  1. [原] KVM 虚拟化原理探究(1)— overview

    KVM 虚拟化原理探究- overview 标签(空格分隔): KVM 写在前面的话 本文不介绍kvm和qemu的基本安装操作,希望读者具有一定的KVM实践经验.同时希望借此系列博客,能够对KVM底层 ...

  2. Activity之概览屏幕(Overview Screen)

    概览屏幕 概览屏幕(也称为最新动态屏幕.最近任务列表或最近使用的应用)是一个系统级别 UI,其中列出了最近访问过的 Activity 和任务. 用户可以浏览该列表并选择要恢复的任务,也可以通过滑动清除 ...

  3. Atitit.自然语言处理--摘要算法---圣经章节旧约39卷概览bible overview v2 qa1.docx

    Atitit.自然语言处理--摘要算法---圣经章节旧约39卷概览bible overview v2 qa1.docx 1. 摘要算法的大概流程2 2. 旧约圣经 (39卷)2 2.1. 与古兰经的对 ...

  4. Overview of OpenCascade Library

    Overview of OpenCascade Library eryar@163.com 摘要Abstract:对OpenCascade库的功能及其实现做简要介绍. 关键字Key Words:Ope ...

  5. Apache Sqoop - Overview——Sqoop 概述

    Apache Sqoop - Overview Apache Sqoop 概述 使用Hadoop来分析和处理数据需要将数据加载到集群中并且将它和企业生产数据库中的其他数据进行结合处理.从生产系统加载大 ...

  6. Windows 10 的音频和 MIDI API将统一

    微软一统 Windows 10 的音频和 MIDI API 微软在夏季NAMM上的A3E大会上做了主题演讲,他们对Windows 10的音频和MIDI API都做了新的规划,开发者针对Windows ...

  7. BOOST.Asio——Overview

    =================================版权声明================================= 版权声明:原创文章 谢绝转载  啥说的,鄙视那些无视版权随 ...

  8. MIDI信息为什么不能通过FL Studio输出

    讲解这个问题之前,小编先给大家科普一下什么是MIDI.所谓的MIDI其实只是数字信号,和我们熟知的乐谱有点像.它的作用就是能很好的传达什么时间演奏什么音,这个音要演奏多久等信息,就如同我们演唱会中指挥 ...

  9. [转]MIDI常识20条

    原文链接:http://www.midifan.com/modulearticle-detailview-488.htm Keyboard杂志老资格编辑Jim Aikin在纪念MIDI诞生20的时候发 ...

随机推荐

  1. Java jsp页面中jstl标签详解

    JSLT标签库,是日常开发经常使用的,也是众多标签中性能最好的.把常用的内容,放在这里备份一份,随用随查.尽量做到不用查,就可以随手就可以写出来.这算是Java程序员的基本功吧,一定要扎实. JSTL ...

  2. vagrant的学习 之 Yii2

    vagrant的学习 之 Yii2 本文根据慕课网的视频教程练习,感谢慕课网! 慕课视频学习地址:https://www.imooc.com/video/14218. 慕课的参考文档地址:https: ...

  3. POJ 1741 Tree【树分治】

    第一次接触树分治,看了论文又照挑战上抄的代码,也就理解到这个层次了.. 以后做题中再慢慢体会学习. 题目链接: http://poj.org/problem?id=1741 题意: 给定树和树边的权重 ...

  4. [Bzoj1821][JSOI2010]Group 部落划分 Group(并查集)(二分答案)

    1821: [JSOI2010]Group 部落划分 Group Time Limit: 10 Sec  Memory Limit: 64 MBSubmit: 2949  Solved: 1392[S ...

  5. Maven创建项目时出现Generating project in Interactive mode就一直卡住的解决方案

    使用maven命令在创建项目的时候出现 Generating project in Interactive mode 然后就一直卡住 网上搜做了很多解决方案 有说各种方案的,最后找到了一种.实验成功 ...

  6. oracle rac 安装错误整理。

    今天是2014.05.26,离别N久的博客今天继续使用. 近期一直忙着离职.入职另外加上家的网一直没有交费,弄的自己開始不那么安稳.学习就是须要一种心情平静.内心稳妥的去进行. 因换笔记本,特须要又一 ...

  7. vim配置为IDE环境(超详细,极力推荐 git)

    https://github.com/yangyangwithgnu/use_vim_as_ide 1. 用法 git clone https://github.com/VundleVim/Vundl ...

  8. Office文档如何转换 PDF 转 DOC XLS

    1 使用Adobe Acrobat Pro,打开任意PDF都可以转换为XLSX格式(似乎没找到XLS)   2 如果你转换之后的东西无法打开,则先转换成DOC,然后再把DOC全选复制粘贴到XLS即可 ...

  9. 同步定制 Unity团队 程序的C#文件模板

    孙广东   2015.7.30 就是把程序制定好的模板(不论什么人能够更改并同步git)放到,unity项目的Editor 目录下, 当程序新建一个C#脚本后就是这个模板了. "81-C# ...

  10. UICollectionView 具体解说学习

    UICollectionView 和UITableView非常像,是APPLE公司在iOS 6后推出的用于处理图片这类UITableView 布局困难的控件,和UITableView 一样,它也有自己 ...