MIDItoolbox
Version 1.1 18-May-2016A more detailed documentation of each function is available using the
help command. For instance, type help tempocurve.
A complete documentation is available online.
http://github/miditoolbox/
CONVERSION FUNCTIONS转换函数
dir2coll - Converts a directory of MIDI files to cellmatrix structure 文件夹种的MIDI文件转换成cellmatrix结构hz2midi - Convert frequencies to MIDI numbers频率转换为MIDI值
keyname - Convert keys (24) to key names (text)24个键值(1:24)转换到键名
midi2hz - Convert MIDI note numbers to frequencies (Herz)MIDI文件音高到频率(这个是不是基频??)midi2hz(pitch(createnmat));
notename - Convert MIDI numbers to American pitch spelling (text)MIDI音符值(音高)到音符名列向字符串 notename(pitch(NMAT));
readmidi - Reads a MIDI file to a notematrix (updated)读取midi文件
writemidi - Writes a MIDI file from a notematrix (updated)写midi文件
tempocurve - Extra tempo of each note in BPM (new)根据节拍抽取节拍曲线
GENERATION FUNCTIONS生成函数
createnmat - Create a notematrix from the input arguments创建一NMAT矩阵(节拍开始数,间隔节拍数,轨道,音高,速率(不懂角速度有无关),起始时间sec,间隔sec)nmat2snd - Synthesize NMAT using simple synthesis(把midi文件转换成wav文件,默认采样频率fs=44100)nmat2snd(nmat,'shepard', fs);
playsound - Play and synthesize NMAT using simple synthesis播放声音 playsound(nmat,'shepard', fs);
reftune - Obtain a 'reference' or example tune根据调整某个name的间隔时间sec。nmat=reftune('dowling1',20);playsound(nmat);
FILTER FUNCTIONS过滤函数
dropmidich - Note events that are not on channel CH 丢弃频道为CH的dropmidich(nmat,2); %CH=2dropshortnotes - Returns note events that are shorter than THRESHOLD丢弃节拍或周期少于THRESHOLD的音符dropshortnotes(nmat, 'beat', 1/16)
elim - Eliminate short MIDI tracks去掉轨道的时间少于一定比例的nmat2 =elim(nmat,0.5); %百分之五十
extreme - Returns extreme pitches (high/low) of a polyphonic NMAT从nmat中抽取高音/低音 nm2 = extreme(nmat,'low'); %或者‘high’默认高
getmidich - Note events on channel CH获取nmat中轨道为ch的数据部分nmat2
ismonophonic - Returns 1 if the sequence is monophonic判断是不是双声道,或者参数选项设置有无重叠
mchannels - Midi channels that are used in NMAT返回Nmat中有使用到的轨道集合
movewindow - Runs a selected function within a defined time window根据移动窗计算 movewindow(nmat,窗长秒,窗偏移秒,'对象’,‘计算函数’) movewindow(nmat,6,2,'velocity','mean');求速率均值 每个音符单独放到窗里面,在窗里面每偏移一定计算 。总行数*[(窗长秒+窗偏移秒/2)div窗偏移秒]
onsetwindow - Events with mintime <= onsettime <= maxtime 返回一定范围的时间 nmat2= onsetwindow(nmat,mintime,maxtime,<timetype>); %<timetype>='sec' 'beat'
perchannel - Create output for each available channel
quantize - Quantize note onsets and durations of NMAT
scale - Scales note data in given dimension (time, onsets, or duration)
setvalues - Sets the chosen notematrix value for every event 把nmat对应dim全部设置为val; nmat2 = setvalues(nmat,dim,val,<timetype>); DIM = dimension ('onset', 'dur', 'vel', or 'chan')
shift - Shifts note data in given dimension (onset, duration, or pitch)全部nmat对应dim增加或减少数值nm = shift(nmat,'pitch',12); nm = shift(nmat,'dur',-0.1,'sec');
transpose2c - Transposes NMAT to C major/C minor 利用昆曼索凯斯勒算法调C大调或小调的nmat2= transpose2c(nmat);
trim - Removal of leading silence (trim)
META FUNCTIONS事件函数
analyzecoll - Analyzes all NMAT in the COLLECTION分析收集的所有NMATanalyzedir - Analyzes all MIDI files in the directory分析当前文件夹的所有MIDI文件,并保存为outfile analyzedir('outfile, 'pcdist1', 'ivdist1', 'durdist1');
filtercoll - Filter COLLECTION according to filter function
PLOTTING FUNCTIONS绘图函数
pianoroll - Plots the NMAT as a "pianoroll" notation 绘钢琴图 pianoroll(nmat,varargin)plotdist - Plots pitch-class-, interval- or duration-distributions or transitions绘出三种分布 能量 plotdist(pcdist2(getmidich(nmat,1)),'hot'); proportion音程(间歇0)比例分布plotdist(ivsizedist1(getmidich(nmat,1)));
plothierarchy - Plots the metrical hierarchy of NMAT绘画NMAT的韵律层级h = plothierarchy(nmat,<timetype>)% TIMETYPE = time in beats ('beat', default) or seconds ('sec')
STATISTICAL FUNCTIONS统计功能
durdist1 - Distribution of note durations返会音符时间分布的九分量 n=1:9 --bin center (in units of one beat)=sqrt[2^(n-1)]/4; dd = durdist1(nmat); 返回1X9durdist2 - Duration transitions (duration pairs) DD=durdist2(getmidich(nmat,1));返回9X9
entropy - Entropy of a distribution
ivdirdist1 - Distribution of interval directions
ivdist1 - Distribution of intervals
ivdist2 - Interval transitions (interval pairs)
ivsizedist1 - Distribution of interval sizes
nnotes - Number of notes in NMAT
pcdist1 - Distribution of pitch-classes
pcdist2 - Pitch-class transitions (dyads)
refstat - Reference statistics (key profiles, Essen collection, etc.)
KEY-FINDING FUNCTIONS主键查询
keymode - Estimates the keymode (1=major, 2=minor) based on KK key返回主要1或次要2keysom - Projection of PC distribution on a SOM (Toiviainen & Krumhansl, 2003) 自组织映射上基音级分布的投影(静态)24和彩色keysom(nmat); keysom(getmidich(nmat,1));
keysomanim - Animation using the KEYSOM function使用keysom功能动画。动态24+色彩动来动去m = keysomanim(nmat, <stmem>, <step>, <ttype>, <opt>); %m = keysomanim(nmat, 3, 0.2, 'sec', 'movie');
kkcc - Correlation of the PC distribution to existing profiles (updated)对nmat用24昆曼索凯斯勒轮廓返回球场pcdist1类分布的相关性。
maxkkcc - Maximal correlation of the PC distr. with 24 K & K profiles 返回最大相关r= maxkkcc(nmat);
tonality - Krumhansl & Kessler key profiles values (major/minor)旋律中音调的稳定值p = tonality(nmat);
CONTOUR FUNCTIONS轮廓函数
melcontour - Contour vector轮廓向量(行向)c = melcontour(getmidich(nmat,1), 0.25, 'abs') ;%每步0.25拍一抽样; c = melcontour(getmidich(nmat,1), 32, 'rel') ;%只采样32个点; 。c=melcontour(getmidich(nmat,1),0.25,'abs','ac');%‘abs’ ,'ac'轮廓自相关这一图plot会对称
SEGMENTATION FUNCTIONS分割功能
segmentgestalt - Segmentation algorithm by Tenney & Polansky (1980)[c,s]=segmentgestalt(nmat);%c铿锵的界限 s段边界(二进制(0 | 1)列向量)[C,S,FIG]= segmentgestalt(nmat,<fig>);
segmentprob - Probabilistic estimation of segment boundaries基于马尔科夫概率的埃森集合段边界segm = segmentprob(nmat); % segm = segmentprob(nmat, <thres>,<fig>);%<fig>=1画图。
MELODIC FUNCTIONS旋律功能
ambitus - Melodic range in semitones半音旋律范围,一个数值 y = ambitus(nmat);complebm - Expectancy-based model of melodic complexity (Eerola & North, 2000) % y = complebm(getmidich(nmat,1),<method>);%<method>='p'音高'r'节奏‘o’两者
,y越高nmat越复杂
compltrans - Melodic originality measure (Simonton, 1984)计算西蒙顿旋律得分,有值的单声道,双声道返回[]s = compltrans(getmidich(nmat,1));
gradus - Degree of melodiousness (Euler, 1739)旋律程度 y=gradus(getmidich(nmat,5)); y值越低,越符合,必须单声道,双声道[]melaccent - Melodic accent (Thomassen, 1982)根据托马森模型估计旋律重音 ma = melaccent(getmidich(nmat,1));
melattraction - Melodic attraction (Lerdahl, 1996)根据弗赖德·勒达尔计算旋律的吸引? m=melattraction(getmidich(nmat,1)); %m的值在0~1之间
meteraccent - Measure of phenomenal accent synchrony (Eerola, 2006)由时长、重音、旋律层估测重音符同步值 a = meteraccent(getmidich(nmat,1));
mobility - Melodic motion as a mobility (Hippel, 2000)旋律运动流动性 y= mobility(getmidich(nmat,1)); %y为列向数组
narmour - Implication-realization principles by Narmour (1990)通过该Implication-realization模型预测 n = narmour(nmat,prin);% n = narmour(getmidich(nmat,1),'rd');
PRIN 特定原则:
rd = registral direction语域方向 (revised, Schellenberg 1997)
rr = registral return 语域回报(revised, Schellenberg 1997)
id = intervallic difference音程差异
cl = closure停止
pr = proximity 接近度(revised, Schellenberg 1997)
co = consonance 调和(Krumhansl, 1995)
meldistance - Measurement of distance between two NMATs计算出两个nmat距离单声道 y=meldistance(getmidich(nmat,1),getmidich(nmat,3),'pcdist1','taxi');自己和自己为0
METER-RELATED FUNCTIONS关系测量函数
concur - Calculates the proportion of concurrent onsets in NMATduraccent - Returns duration accent of the events (Parncutt, 1994)
gettempo - Get tempo (in BPM) updated
meter - Autocorrelation-based estimate of meter (Toiviainen & Eerola, 2006)
metrichierarchy- Metrical hierarchy (Lerdahl & Jackendoff, 1983)
notedensity - Notes per beat or second
nPVI - Measure of durational variability of events (Grabe & Low, 2002)
onsetacorr - Autocorrelation function of onset times
onsetdist - Distribution of onset times within a measure
settempo - Set tempo (in BPM)
DEMOS
mididemo - Run through 8 MIDI Toolbox demos %样例说明,命令行窗口mididemo
Part of the MIDI Toolbox 1.1, Copyright 2016, University of Jyvaskyla, Finland