东拼西凑的介绍

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. hdu1059(背包dp二进制优化)

    Dividing Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Subm ...

  2. 显示倒计时的Button按钮

    package com.pingyijinren.helloworld.activity; import android.os.CountDownTimer; import android.suppo ...

  3. PAT (Advanced Level) 1032. Sharing (25)

    简单题,不过数据中好像存在有环的链表...... #include<iostream> #include<cstring> #include<cmath> #inc ...

  4. Sublime3 Preference, Settings-User

    {"font_face": "Consolas","font_size": 15,"ignored_packages": ...

  5. 删除,“windows setup 启用EMS”

    方案1[笔者推荐]:进入Windows后按Windows+R输入msconfig回车进入系统配置,切换到引导,点击你要删除的选项然后点击删除就行[1].

  6. django 简易博客开发 2 模板和数据查询

    首先还是贴一下项目地址  https://github.com/goodspeedcheng/sblog   因为代码全在上面 上一篇博客我们介绍了 django的安装配置,新建project,新建a ...

  7. 【stl学习笔记】list

    list使用双向链表来管理元素. 与vector.deque的区别: 1.list不支持随机存取,在list中随机遍历任意元素,是很缓慢的行为 2.任何位置上执行元素的安插和移除都非常快,始终是常数时 ...

  8. 【转】c++ 如何批量初始化数组 fill和fill_n函数的应用

    http://blog.csdn.net/sunquana/article/details/9153213 一. fill和fill_n函数的应用: fill函数的作用是:将一个区间的元素都赋予val ...

  9. CentOS 6.x ELK(Elasticsearch+Logstash+Kibana)

    CentOS 6.x ELK(Elasticsearch+Logstash+Kibana) 前言 Elasticsearch + Logstash + Kibana(ELK)是一套开源的日志管理方案, ...

  10. Office EXCEL 如何将复制的一堆数据按空格断开

    1 复制粘贴一堆数据,点击数据-分类,然后点击下一步   2 一直下一步   3 最后效果如下图所示