Exemple #1
0
 public Song(string artistName, string trackName, SegmentStats segmentStats, SectionStats sectionsStats, 
     double familiarity, double hotttnesss, double artistLongtitude, double artistLatitude,
     double danceability, double duration, double energy, double tempo, Key key, TimeSignature timeSignature, String genre = null)
 {
     ArtistName = artistName;
     TrackName = trackName;
     SegmentStats = segmentStats;
     SectionsStats = sectionsStats;
     Familiarity = familiarity;
     Hotttnesss = hotttnesss;
     ArtistLongtitude = artistLongtitude;
     ArtistLatitude = artistLatitude;
     Danceability = danceability;
     Duration = duration;
     Energy = energy;
     Tempo = tempo;
     Key = key;
     TimeSignature = timeSignature;
     Genre = genre;
 }
Exemple #2
0
        public static void Initialize()
        {
            TimeSignatureList.Clear();
            TimeSignatureList.Add(new TimeSignature { Id = 4, Name = "4,4", Description = "4 beats per measure. Quarter note = 1 beat.", Caption = "4/4", Vector = "M5.74559982,37.1088018 L2.07359991,42.6383991 L5.74559982,42.6383991 z M6.630525,33.4800009 L8.25120018,33.4800009 L8.25120018,42.6383991 L10.3248,42.6383991 L10.3248,44.7984009 L8.25120018,44.7984009 L8.25120018,48.168 L5.74559982,48.168 L5.74559982,44.7984009 L1.48204773E-07,44.7984009 L1.48204773E-07,42.9144759 z M5.74559982,20.7360009 L2.07359991,26.2656 L5.74559982,26.2656 z M6.630525,17.1071991 L8.25120018,17.1071991 L8.25120018,26.2656 L10.3248,26.2656 L10.3248,28.4256 L8.25120018,28.4256 L8.25120018,31.8383991 L5.74559982,31.8383991 L5.74559982,28.4256 L1.48204773E-07,28.4256 L1.48204773E-07,26.5416741 z" });
            TimeSignatureList.Add(new TimeSignature { Id = 0, Name = "2,2", Description = "2 beats per measure. Half note = 1 beat.", Caption = "2/2", Vector = "M4.70879991,33.3936 C5.92559964,33.3936 6.94259973,33.7875768 7.75979973,34.5755268 C8.57699973,35.3634759 8.98559937,36.3129768 8.98560018,37.4240277 C8.98559937,38.3352741 8.75576187,39.2136759 8.29608795,40.059225 C7.83641223,40.9047777 7.14307455,41.8360509 6.21607518,42.8530518 L3.15359973,45.7920009 L9.72,45.7920009 L9.72,48.168 L6.76548099E-09,48.168 L6.76548099E-09,47.3931 L2.76614973,43.90065 C3.15359973,43.4007 3.56782482,42.8853375 4.00882491,42.3545643 C4.44982509,41.8237875 4.84323732,41.3224884 5.1890625,40.8506634 C5.53488723,40.3788384 5.81489955,39.9213018 6.02909991,39.4780518 C6.24330027,39.0348018 6.35040018,38.6228241 6.35040063,38.2421241 C6.35040018,37.471725 6.12438786,36.8598384 5.67236268,36.4064634 C5.2203375,35.9530884 4.61114991,35.7263991 3.84479982,35.7263991 C3.27869991,35.7263991 2.85974982,35.8682634 2.58795,36.1519893 C2.31615018,36.4357107 1.95435,37.1578491 1.50255,38.3184 L6.76548099E-09,38.3184 C0.183149991,37.1997 0.381487473,36.4420143 0.595012293,36.0453393 C0.808537428,35.6486643 1.08269991,35.2521027 1.41749991,34.85565 C2.3274,33.88095 3.42449982,33.3936 4.70879991,33.3936 z M4.70879991,17.3232009 C5.92514991,17.3232045 6.94203759,17.7158286 7.75946241,18.5010759 C8.57688732,19.2863277 8.98559937,20.2329009 8.98560018,21.3408 C8.98559937,22.24935 8.75576187,23.1249384 8.29608795,23.9675625 C7.83641223,24.8101875 7.14307455,25.7384259 6.21607518,26.7522759 L3.15359973,29.6783982 L9.72,29.6783982 L9.72,32.0544009 L6.76548099E-09,32.0544009 L6.76548099E-09,31.2801777 L2.76614973,27.799875 C3.15359973,27.3017259 3.56782482,26.7881634 4.00882491,26.2591884 C4.44982509,25.7302143 4.84323732,25.2306 5.1890625,24.7603491 C5.53488723,24.2901018 5.81489955,23.8339152 6.02909991,23.3917875 C6.24330027,22.9496634 6.35040018,22.5396009 6.35040063,22.1616009 C6.35040018,21.3948009 6.12450027,20.7855009 5.6727,20.3337 C5.22089964,19.8819018 4.61159964,19.656 3.84479982,19.656 C3.27869991,19.656 2.85974982,19.7978643 2.58795,20.0815884 C2.31615018,20.3653116 1.95435,21.08745 1.50255,22.2479991 L6.76548099E-09,22.2479991 C0.183149991,21.1293009 0.381487473,20.3716134 0.595012293,19.9749384 C0.808537428,19.5782634 1.08269991,19.1817 1.41749991,18.7852509 C2.3274,17.8105509 3.42449982,17.3232045 4.70879991,17.3232009 z" });
            TimeSignatureList.Add(new TimeSignature { Id = 13, Name = "2,2", Description = "2 beats per measure. Half note = 1 beat.", Caption = "2/2", Vector = "M6.2880001,29.232 C6.256,29.264002 6.1040001,29.408001 5.8320003,29.664 C5.5599999,29.920002 5.2080002,30.464001 4.776,31.296 C4.3439999,32.127998 3.9680002,33.248001 3.648,34.655998 L3.648,39.071999 C3.8079998,40 3.9759998,40.760002 4.152,41.352001 C4.3280001,41.944 4.52,42.424 4.7280002,42.792 C4.9359999,43.16 5.1679997,43.440002 5.4240003,43.632 C5.6799998,43.824001 5.9679999,43.984001 6.2880001,44.112 z M6.2880001,21.071999 L8.4960003,21.071999 L8.4960003,27.312 C8.816,27.312002 9.2479992,27.376001 9.7919998,27.504 C10.335999,27.632002 10.896,27.808002 11.472,28.032 C12.496,28.352001 13.392,28.992001 14.16,29.952 C14.799999,30.784 15.119999,31.792 15.12,32.975998 C15.119999,34.127998 14.591999,35.008003 13.536,35.616001 L12,36 C11.615999,35.936001 11.32,35.848 11.112,35.736 C10.904,35.624001 10.688,35.392002 10.464,35.040001 C10.303999,34.816002 10.191999,34.599998 10.128,34.391998 C10.064,34.183998 10,33.903999 9.9359999,33.552002 C9.9040003,33.200001 9.9519997,32.84 10.08,32.472 C10.208,32.104 10.351999,31.792 10.512,31.536001 C10.639999,31.280003 10.816,31.040001 11.04,30.816 C11.264,30.592001 11.535999,30.448002 11.856,30.384001 C12.336,30.384003 12.576,30.256001 12.576,30 C12.576,29.84 12.4,29.616001 12.048,29.328001 L10.704,28.752001 C10.576,28.720001 10.384,28.68 10.128,28.632 C9.8719997,28.584 9.6159992,28.560001 9.3599997,28.559999 C9.1359997,28.560001 8.9279995,28.568001 8.7360001,28.584 C8.5439997,28.6 8.4639997,28.624001 8.4960003,28.656 L8.4960003,44.591999 C8.4960003,44.591999 8.6160002,44.576 8.8559999,44.543999 C9.0959997,44.512001 9.3839998,44.464001 9.7200003,44.400002 C10.056,44.335999 10.391999,44.248001 10.728,44.136002 C11.064,44.024002 11.328,43.872002 11.52,43.68 C11.903999,43.360001 12.264,43.008003 12.6,42.624001 C12.935999,42.240002 13.216,41.807999 13.440001,41.327999 C14.048,40.240002 14.352,39.328003 14.352,38.591999 L15.264,38.591999 C14.976,41.056 14.176,42.896 12.864,44.112 C12.16,44.751999 11.424,45.216003 10.656,45.504002 C9.8879995,45.792 9.1359997,45.968002 8.3999996,46.032001 L8.3999996,52.368 L6.2880001,52.32 L6.2880001,45.84 C5.6799998,45.648003 5.0159998,45.312 4.296,44.832001 C3.5759997,44.352001 2.8639998,43.728001 2.1599998,42.959999 C1.4879999,42.223999 0.95999992,41.312 0.57599998,40.223999 C0.192,39.136002 0,37.952 1.6901686E-07,36.672001 C0,34.496002 0.60800004,32.560001 1.8239999,30.864 C2.4639997,30.032001 3.1759999,29.336002 3.96,28.776001 C4.744,28.216003 5.52,27.824001 6.2880001,27.6 z" });
            TimeSignatureList.Add(new TimeSignature { Id = 1, Name = "3,2", Description = "3 beats per measure. Half note = 1 beat.", Caption = "3,2", Vector = "M5.2319999,37.104 C6.5839996,37.104 7.7139997,37.541752 8.6219997,38.417252 C9.5299997,39.292751 9.9839993,40.347752 9.9840002,41.582253 C9.9839993,42.594749 9.7286243,43.570751 9.2178755,44.51025 C8.7071247,45.449753 7.9367495,46.484501 6.9067502,47.614502 L3.5039997,50.880001 L10.8,50.880001 L10.8,53.52 L1.2213786E-07,53.52 L1.2213786E-07,52.659 L3.0734999,48.7785 C3.5039997,48.223 3.9642498,47.650375 4.4542499,47.060627 C4.9442501,46.470875 5.3813748,45.913876 5.765625,45.389626 C6.1498747,44.865376 6.4609995,44.357002 6.6989999,43.864502 C6.9370003,43.372002 7.0560002,42.914249 7.0560002,42.491249 C7.0560002,41.63525 6.8048754,40.955376 6.3026252,40.451626 C5.800375,39.947876 5.1234999,39.695999 4.2719998,39.695999 C3.6429999,39.695999 3.1774998,39.853626 2.8755002,40.168877 C2.5735002,40.484123 2.1715,41.286499 1.6695001,42.576 L1.2213786E-07,42.576 C0.20349999,41.333 0.42387497,40.491127 0.66112506,40.050377 C0.89837492,39.609627 1.2029999,39.169003 1.5749998,38.7285 C2.586,37.6455 3.8049998,37.104 5.2319999,37.104 z M5.7600002,19.296001 C6.9629998,19.296001 7.9917498,19.632378 8.8462505,20.305126 C9.7007504,20.977879 10.128,21.841501 10.128,22.896 C10.128,23.609001 9.9507504,24.328876 9.5962505,25.055626 C9.2417498,25.782377 8.7150002,26.288002 8.0159998,26.5725 C8.3885002,26.605001 8.6491251,26.677002 8.7978754,26.7885 C8.9466248,26.900002 9.1564999,27.074251 9.4274998,27.311251 C9.7664995,27.752251 10.048,28.159374 10.272,28.532625 C10.496,28.905876 10.608,29.443003 10.608,30.144001 C10.608,32.035004 9.92875,33.468002 8.5702505,34.443001 C7.9657497,34.941002 7.2368746,35.301003 6.383625,35.523003 C5.530375,35.745003 4.6665001,35.856003 3.7920003,35.856003 C2.9155002,35.856003 2.184375,35.734879 1.5986251,35.492626 C1.0128751,35.250374 0.72000003,34.811501 0.71999991,34.176003 C0.72000003,33.734501 0.86399996,33.456123 1.1520002,33.340874 C1.4399998,33.225624 1.7599999,33.167999 2.1119998,33.167999 C2.3269999,33.167999 2.5523748,33.187626 2.7881253,33.226875 C3.0238748,33.266125 3.3009999,33.358498 3.6194999,33.503998 C4.0895,33.800499 4.454,33.955002 4.7129998,33.967499 C4.9719996,33.98 5.1657495,33.964752 5.29425,33.921753 C6.1362495,33.652252 6.7552495,33.3605 7.1512499,33.046501 C7.5472498,32.732502 7.789,32.153 7.8765001,31.308001 C7.9375,30.6255 7.7798748,30.008501 7.403625,29.457001 C7.0273747,28.9055 6.52175,28.519001 5.8867502,28.297501 C5.6382499,28.214001 5.3742495,28.164877 5.0947499,28.150126 C4.8152499,28.135376 4.1890001,28.128 3.2160003,28.128 L3.2160003,26.583 C4.2749996,26.379501 4.9702501,26.2155 5.3017502,26.091 C5.6332502,25.966503 5.9697504,25.733501 6.3112502,25.392 C6.5362496,25.142002 6.7966247,24.780251 7.0923753,24.306749 C7.3881249,23.83325 7.5359998,23.411001 7.5360003,23.040001 C7.5359998,22.482002 7.3341246,22.070501 6.9303751,21.8055 C6.5266247,21.540501 6.0085001,21.408001 5.3759999,21.408001 C4.7614999,21.408001 4.2368746,21.590376 3.8021247,21.955126 C3.3673749,22.319876 2.8634999,22.9855 2.2905002,23.952 L0.76799995,23.952 C1.0445,22.785 1.295875,22.01 1.5221249,21.627001 C1.7483749,21.243999 2.046,20.901752 2.4149997,20.60025 C3.3204999,19.730751 4.4355001,19.296001 5.7600002,19.296001 z" });
            TimeSignatureList.Add(new TimeSignature { Id = 2, Name = "2,4", Description = "2 beats per measure. Quarter note = 1 beat.", Caption = "2/4", Vector = "M6.3839998,41.232002 L2.3040001,47.375999 L6.3839998,47.375999 z M7.36725,37.200001 L9.1680002,37.200001 L9.1680002,47.375999 L11.472,47.375999 L11.472,49.776001 L9.1680002,49.776001 L9.1680002,53.52 L6.3839998,53.52 L6.3839998,49.776001 L-3.4578989E-09,49.776001 L-3.4578989E-09,47.682751 z M5.8080001,19.296001 C7.1595001,19.296001 8.2893753,19.73225 9.1976252,20.604752 C10.105875,21.477253 10.56,22.529001 10.56,23.76 C10.56,24.769501 10.304625,25.742374 9.7938747,26.678625 C9.2831249,27.614876 8.5127497,28.646252 7.4827499,29.772751 L4.0799999,33.024002 L11.376,33.024002 L11.376,35.664001 L0.57600003,35.664001 L0.57600003,34.803749 L3.6495001,30.93675 C4.0799999,30.383251 4.5402498,29.812626 5.0302501,29.224874 C5.5202498,28.637127 5.957375,28.082001 6.3416252,27.5595 C6.7258749,27.037003 7.0370002,26.530127 7.2750001,26.038876 C7.513,25.547626 7.632,25.092003 7.632,24.672001 C7.632,23.820004 7.381,23.143002 6.8790002,22.641001 C6.3769999,22.139 5.6999998,21.888 4.848,21.888 C4.2189999,21.888 3.7535,22.045626 3.4514999,22.360876 C3.1494999,22.676126 2.7474999,23.4785 2.2455001,24.768 L0.57600003,24.768 C0.77950001,23.525002 0.99987501,22.683125 1.2371249,22.242374 C1.474375,21.801624 1.7789999,21.361 2.1510003,20.920502 C3.1619999,19.837502 4.381,19.296001 5.8080001,19.296001 z" });
            TimeSignatureList.Add(new TimeSignature { Id = 3, Name = "3,4", Description = "3 beats per measure. Quarter note = 1 beat.", Caption = "3/4", Vector = "M6.3839998,41.232002 L2.3039999,47.375999 L6.3839998,47.375999 z M7.36725,37.200001 L9.1680002,37.200001 L9.1680002,47.375999 L11.472,47.375999 L11.472,49.776001 L9.1680002,49.776001 L9.1680002,53.52 L6.3839998,53.52 L6.3839998,49.776001 L1.6467197E-07,49.776001 L1.6467197E-07,47.682751 z M6.6240001,19.007999 C7.8270001,19.007999 8.8557501,19.344376 9.7102499,20.017124 C10.564749,20.689877 10.991999,21.553499 10.992,22.608 C10.991999,23.318501 10.823874,24.036751 10.487625,24.762751 C10.151375,25.48875 9.6154995,25.99275 8.8800001,26.27475 C9.2735004,26.30525 9.5473747,26.378376 9.7016249,26.494125 C9.8558741,26.609877 10.071249,26.788752 10.34775,27.03075 C10.646749,27.463251 10.908875,27.867001 11.134125,28.242001 C11.359375,28.617001 11.472,29.155001 11.472,29.856001 C11.472,31.708002 10.8245,33.128002 9.5295,34.116001 C8.8935003,34.639999 8.1488752,35.013 7.2956252,35.235001 C6.4423747,35.457001 5.5784998,35.568001 4.704,35.568001 C3.8274999,35.568001 3.096375,35.446877 2.5106249,35.204628 C1.924875,34.962376 1.632,34.523499 1.6320001,33.888 C1.632,33.455502 1.7665,33.179375 2.0355,33.059624 C2.3045001,32.939877 2.6340001,32.880001 3.0239999,32.880001 C3.2389998,32.880001 3.4643748,32.899628 3.7001252,32.938873 C3.9358749,32.978127 4.2129998,33.070499 4.5314999,33.216 C5.0015001,33.512501 5.3622499,33.666748 5.61375,33.678749 C5.8652501,33.69075 6.1020002,33.647251 6.3239999,33.548248 C7.0979996,33.300751 7.6795001,33.029503 8.0685005,32.734501 C8.4575005,32.439499 8.6812496,31.869501 8.7397499,31.0245 C8.83325,30.329 8.6913748,29.699875 8.3141251,29.137125 C7.9368749,28.574375 7.4344997,28.184002 6.8070002,27.966 C6.5654998,27.912003 6.3018751,27.877502 6.0161252,27.862501 C5.7303753,27.847502 5.085,27.84 4.0799999,27.84 L4.0799999,26.247 C5.1389999,26.043499 5.83425,25.879501 6.16575,25.755001 C6.4972501,25.630501 6.8004999,25.430752 7.0755,25.15575 C7.4064999,24.857752 7.71,24.469002 7.9860001,23.9895 C8.2619991,23.510002 8.3999996,23.081501 8.3999996,22.704 C8.3999996,22.138 8.2072496,21.724503 7.8217502,21.463501 C7.4362502,21.202499 6.9090004,21.071999 6.2400002,21.071999 C5.6225004,21.071999 5.1070004,21.251251 4.6935,21.609751 C4.2799997,21.96825 3.7829998,22.637001 3.2025001,23.616001 L1.6799999,23.616001 C1.952,22.463001 2.1951251,21.698875 2.4093752,21.323624 C2.6236248,20.948376 2.8764999,20.663502 3.168,20.469002 C4.1914997,19.494999 5.3435001,19.007999 6.6240001,19.007999 z" });
            TimeSignatureList.Add(new TimeSignature { Id = 11, Name = "4,4", Description = "4 beats per measure. Quarter note = 1 beat.", Caption = "4/4", Vector = "M8.6879997,27.072001 L9.552,27.072001 C9.6159992,27.104002 9.7199993,27.128002 9.8640003,27.144001 C10.007999,27.160002 10.191999,27.200001 10.416,27.264 C10.864,27.424 11.167999,27.535999 11.328,27.6 C11.487999,27.664001 11.695999,27.744003 11.952,27.84 C12.464,28.096001 12.944,28.376001 13.392,28.68 C13.84,28.984001 14.24,29.360001 14.592,29.808001 C15.328,30.639999 15.696,31.6 15.696,32.688 C15.696,33.616001 15.392,34.431999 14.784,35.136002 C14.048,35.776001 13.248,36.096001 12.384,36.096001 C10.784,36.096001 9.8239994,35.216 9.5039997,33.456001 C9.5039997,32.656002 9.7600002,32 10.272,31.488001 C10.751999,30.880001 11.359999,30.496 12.096,30.336 L12.48,30.288 L12.864,30.144001 L13.008,29.856001 C12.88,29.344 12.432,28.959999 11.664001,28.704 C11.056,28.384003 10.368,28.224003 9.6000004,28.224001 C8.8319998,28.224003 8.1279993,28.448002 7.4879999,28.896 C7.1999998,29.024 6.8800001,29.264 6.5279999,29.616001 C6.2719998,29.872002 6.0319996,30.16 5.8080001,30.48 C5.1680002,31.696001 4.848,33.632 4.848,36.288002 C4.848,39.200001 4.96,40.928001 5.184,41.472 C5.7599998,43.84 7.1679997,45.024002 9.408,45.024002 C11.136,45.024002 12.559999,44.063999 13.68,42.144001 C14.224,41.056 14.592,39.919998 14.784,38.736 L15.888,38.736 C15.792,39.856003 15.552,40.864002 15.168,41.760002 C14.784,42.655998 14.271999,43.472 13.632,44.208 C12.224,45.648003 10.432,46.368 8.2560005,46.368 C6.5599999,46.368 5.1039996,45.856003 3.888,44.832001 C2.6079998,43.872002 1.648,42.592003 1.008,40.992001 C0.72000003,40.256001 0.47999996,39.456001 0.28800011,38.591999 C0.096000001,37.728001 0,36.928001 7.1238532E-08,36.192001 C0,34.720001 0.41600001,33.279999 1.2479999,31.872 C1.9519999,30.528 3.0079999,29.376001 4.4159999,28.416 C5.7919998,27.520002 7.2159996,27.072002 8.6879997,27.072001 z" });
            TimeSignatureList.Add(new TimeSignature { Id = 12, Name = "4,4", Description = "4 beats per measure. Quarter note = 1 beat.", Caption = "4/4", Vector = "M0 0" });
            TimeSignatureList.Add(new TimeSignature { Id = 5, Name = "5,4", Description = "5 beats per measure. Quarter note = 1 beat.", Caption = "5/4", Vector = "M6.3839998,41.232002 L2.3039997,47.375999 L6.3839998,47.375999 z M7.36725,37.200001 L9.1680002,37.200001 L9.1680002,47.375999 L11.472,47.375999 L11.472,49.776001 L9.1680002,49.776001 L9.1680002,53.52 L6.3839998,53.52 L6.3839998,49.776001 L-8.8687727E-08,49.776001 L-8.8687727E-08,47.682751 z M3.4042504,19.056 L10.128,19.056 L10.128,21.456001 L4.836,21.456001 L3.5520003,24.132 C4.7389998,24.179001 5.8143749,24.363125 6.7781253,24.684376 C7.7418747,25.005627 8.5314999,25.439751 9.1470003,25.98675 C9.8635006,26.631252 10.302125,27.239502 10.462875,27.811501 C10.623625,28.383501 10.704,29.097 10.704,29.952 C10.704,30.838501 10.578375,31.577625 10.327126,32.169373 C10.075874,32.761127 9.6844997,33.3395 9.1529999,33.904503 C8.4864998,34.645 7.7019997,35.083374 6.7995,35.219627 C5.8969998,35.355873 4.9425001,35.424 3.9360003,35.424 C3.0355,35.424 2.274375,35.303627 1.6526247,35.062874 C1.030875,34.822124 0.72000003,34.366501 0.72000003,33.695999 C0.72000003,33.258003 0.85750002,32.956501 1.1325002,32.7915 C1.4074999,32.626503 1.7659998,32.543999 2.2080002,32.543999 C2.5184999,32.543999 2.8102498,32.592751 3.08325,32.69025 C3.3562498,32.78775 3.7087498,32.9935 4.1407499,33.307503 C4.1882496,33.355 4.4369998,33.383625 4.8870001,33.393375 C5.3369999,33.403126 5.8140001,33.311752 6.3179998,33.119247 C6.9599996,32.811752 7.4206247,32.448753 7.6998749,32.030251 C7.9791245,31.611752 8.1484995,30.894501 8.2080002,29.8785 C8.2080002,29.374001 8.1592503,28.947502 8.0617504,28.599001 C7.9642501,28.2505 7.8123751,27.960251 7.6061254,27.728251 C7.3998747,27.496252 7.0769997,27.281752 6.6375003,27.084751 C6.198,26.887751 5.6500001,26.685251 4.9935002,26.477251 C4.7999997,26.422752 4.5506248,26.380253 4.2453752,26.349751 C3.940125,26.319252 3.645,26.304001 3.3600001,26.304001 L2.4960001,26.304001 L1.5637501,26.304001 L1.0079999,25.0275 z" });
            TimeSignatureList.Add(new TimeSignature { Id = 6, Name = "2,8", Description = "2 beats per measure. Eighth note = 1 beat.", Caption = "2/8", Vector = "M4.848,46.464001 C4.112,47.007999 3.4319999,47.543999 2.8079998,48.071999 C2.184,48.599998 1.8399999,49.232002 1.7759999,49.968002 C1.744,50.352001 1.824,50.695999 2.0159998,51 C2.2079999,51.304001 2.4719999,51.552002 2.8079998,51.743999 C3.1440001,51.936001 3.52,52.080002 3.9360001,52.175999 C4.3519998,52.271999 4.7839994,52.32 5.2319999,52.32 C5.9679995,52.32 6.5759997,52.136002 7.0560002,51.768002 C7.5359998,51.400002 7.8079996,50.944 7.8720002,50.400002 C7.9039998,50.080002 7.9119997,49.799999 7.8959999,49.560001 C7.8799996,49.32 7.8079996,49.088001 7.6800003,48.863998 C7.552,48.639999 7.368,48.416 7.1280003,48.192001 C6.8879995,47.968002 6.5599995,47.695999 6.1440001,47.375999 z M5.2319999,39.216 C4.4960003,39.216003 3.8400002,39.384003 3.2639997,39.720001 C2.6880002,40.056 2.4000001,40.528 2.4000001,41.136002 C2.4000001,41.776001 2.5120001,42.264 2.7360003,42.599998 C2.96,42.936001 3.4400001,43.360001 4.1760001,43.872002 L5.2319999,44.591999 C5.9999995,44.048 6.5999994,43.528 7.0320001,43.032001 C7.4639997,42.535999 7.6479998,41.952 7.5840001,41.279999 C7.5199995,40.544003 7.2559996,40.015999 6.7920003,39.695999 C6.3280001,39.375999 5.8079996,39.216003 5.2319999,39.216 z M5.184,37.728001 C6.336,37.728001 7.2880001,38.026752 8.04,38.624252 C8.7919998,39.221752 9.1680002,40.021 9.1680002,41.021999 C9.1680002,41.797001 9,42.547874 8.6640005,43.274628 C8.3280001,44.001373 7.5679998,44.6875 6.3839998,45.333 L6.3839998,45.381752 C7.3119993,46.092251 8.0799999,46.762375 8.6879997,47.392124 C9.2959995,48.021877 9.6000004,48.805 9.6000004,49.741501 C9.6000004,50.936501 9.1999998,51.865002 8.3999996,52.527 C7.5999994,53.188999 6.4799995,53.52 5.04,53.52 C3.6959999,53.52 2.5679998,53.221249 1.6560001,52.623749 C0.74400002,52.026249 0.28799999,51.130001 0.2879999,49.935001 C0.28799999,49.547501 0.34399998,49.192375 0.45600024,48.869625 C0.56799996,48.546875 0.75999999,48.223999 1.0319998,47.901001 C1.304,47.577999 1.656,47.238876 2.0880001,46.883625 C2.52,46.528374 3.056,46.108501 3.6960001,45.624001 C3.056,45.107502 2.552,44.671627 2.1840003,44.316376 C1.816,43.961128 1.536,43.622002 1.344,43.299 C1.152,42.976002 1.0239999,42.661125 0.96000022,42.354374 C0.89600003,42.047626 0.86399996,41.7005 0.86400002,41.313 C0.86399996,40.279503 1.28,39.423626 2.112,38.745377 C2.944,38.067127 3.9679999,37.728001 5.184,37.728001 z M4.7519999,19.920002 C5.9679999,19.920002 6.9840002,20.314754 7.8000002,21.104252 C8.6160002,21.893751 9.0240002,22.852501 9.0240002,23.980499 C9.0240002,24.915001 8.7840004,25.825251 8.3039999,26.71125 C7.8239999,27.597252 7.0719995,28.604252 6.0479999,29.73225 L2.5439999,33.743999 L9.8400002,33.743999 L9.8400002,35.472 L-1.5803744E-07,35.472 L-1.5803744E-07,35.230499 L2.9760003,31.460251 C3.424,30.880251 3.888,30.300251 4.368,29.720251 C4.8479996,29.140251 5.2880001,28.576376 5.6880002,28.028625 C6.0880003,27.480877 6.4159999,26.941128 6.6719999,26.409376 C6.928,25.877626 7.0560002,25.370001 7.0560002,24.886499 C7.0560002,23.888 6.7600002,23.090626 6.1680002,22.494375 C5.5760002,21.898127 4.7839999,21.600002 3.7919998,21.6 C3.0240002,21.600002 2.4560001,21.792002 2.0880001,22.176001 C1.72,22.560001 1.3119999,23.328001 0.86400002,24.48 L-1.5803744E-07,24.48 C0.19199999,23.648001 0.39999998,23.024 0.62400007,22.608 C0.84799999,22.191999 1.136,21.776001 1.4879998,21.360001 C2.3839998,20.400002 3.4719999,19.920002 4.7519999,19.920002 z" });
            TimeSignatureList.Add(new TimeSignature { Id = 7, Name = "3,8", Description = "3 beats per measure. Eighth note = 1 beat.", Caption = "3/8", Vector = "M5.0452499,46.464001 C4.4732499,46.9645 3.9092498,47.450001 3.3532503,47.920502 C2.7972498,48.390999 2.493,48.928501 2.4405,49.533001 C2.4135001,49.818001 2.4765,50.08025 2.6294997,50.319752 C2.7824998,50.55925 2.9965,50.757626 3.2715001,50.914875 C3.5465,51.072124 3.8696251,51.193626 4.2408752,51.279377 C4.6121249,51.365128 5.0065002,51.408001 5.4240003,51.408001 C6.0469999,51.408001 6.5498753,51.261375 6.9326248,50.968124 C7.3153753,50.674877 7.5325003,50.311001 7.5840001,49.876499 C7.6160002,49.580502 7.6252499,49.338375 7.6117501,49.150124 C7.5982499,48.961876 7.5421247,48.781376 7.4433751,48.608627 C7.3446245,48.435875 7.1916246,48.25275 6.984375,48.05925 C6.7771249,47.865749 6.4569998,47.602501 6.0240002,47.269501 z M5.4240003,39.216 C4.7795,39.216003 4.2263751,39.350624 3.7646253,39.619873 C3.302875,39.889126 3.072,40.234501 3.072,40.655998 C3.072,41.221001 3.164875,41.64275 3.3506253,41.921249 C3.536375,42.199753 3.9654999,42.573002 4.638,43.041 L5.415,43.632 C5.9495001,43.212502 6.4126248,42.781376 6.8043752,42.338623 C7.196125,41.895874 7.3600001,41.39925 7.296,40.848751 C7.2449999,40.261253 7.0380001,39.842251 6.6750002,39.591751 C6.3119993,39.341251 5.8949995,39.216003 5.4240003,39.216 z M5.3759999,36.816002 C6.6435003,36.816002 7.7043753,37.155376 8.5586252,37.834126 C9.4128752,38.512875 9.8400002,39.415501 9.8400002,40.542 C9.8400002,41.387001 9.6531248,42.213753 9.2793751,43.022251 C9.0924997,43.426498 8.8137808,43.805252 8.4432182,44.158501 L7.3251538,44.950977 L9.3022499,46.695374 C9.9487495,47.365128 10.271999,48.220501 10.272,49.261501 C10.271999,50.607002 9.8208752,51.653126 8.9186249,52.399876 C8.0163746,53.146626 6.7874994,53.52 5.2319999,53.52 C3.7844999,53.52 2.5506248,53.185875 1.5303749,52.517624 C0.51012504,51.849377 0,50.828499 2.5146147E-07,49.455002 C0,49.0205 0.063250005,48.621124 0.18975012,48.256874 C0.31625,47.892624 0.52925003,47.532749 0.82875013,47.17725 C1.1282499,46.821751 1.5079999,46.454876 1.9680001,46.076626 C2.428,45.698376 2.908,45.390751 3.408,45.153751 C2.8564999,44.859749 2.3904998,44.529125 2.01,44.161877 C1.6294999,43.794624 1.3315001,43.429749 1.1159999,43.067249 C0.9005,42.70475 0.75662494,42.349998 0.68437481,42.002998 C0.61212498,41.655998 0.57599998,41.265999 0.57600021,40.833 C0.57599998,39.672501 1.0415,38.712875 1.9724998,37.954124 C2.9034998,37.195374 4.0380001,36.816002 5.3759999,36.816002 z M5.4720001,19.248001 C6.6750002,19.248005 7.7037501,19.584377 8.5582504,20.257126 C9.4127502,20.929874 9.8400002,21.793501 9.8400002,22.848 C9.8400002,23.561001 9.6627502,24.280876 9.3082504,25.007626 C8.9537497,25.734375 8.427,26.24 7.7280002,26.5245 C8.1005001,26.557001 8.361124,26.629002 8.5098753,26.740499 C8.6586246,26.852001 8.8684998,27.026251 9.1394997,27.26325 C9.4784994,27.70425 9.7600002,28.111376 9.9840002,28.484625 C10.207999,28.857876 10.32,29.395 10.32,30.096001 C10.32,31.987001 9.640749,33.420002 8.2822504,34.395 C7.6777501,34.893002 6.948875,35.252998 6.0956249,35.474998 C5.2423754,35.696999 4.3785,35.807999 3.5039999,35.807999 C2.6275001,35.807999 1.8963749,35.686874 1.3106248,35.444626 C0.72487497,35.202377 0.43199998,34.763504 0.43200022,34.127998 C0.43199998,33.686501 0.57599998,33.408127 0.8640002,33.292877 C1.152,33.177628 1.472,33.120003 1.8240001,33.120003 C2.039,33.120003 2.264375,33.139626 2.5001249,33.178875 C2.7358749,33.218124 3.013,33.310501 3.3315003,33.456001 C3.8014998,33.752502 4.1659999,33.907001 4.4250002,33.919502 C4.684,33.931999 4.8777499,33.916752 5.0062499,33.873749 C5.8482494,33.604252 6.4672499,33.3125 6.8632503,32.998501 C7.2592502,32.684502 7.5009999,32.105003 7.5885,31.26 C7.6494999,30.577501 7.4918747,29.960501 7.1156249,29.409 C6.7393751,28.857502 6.2337499,28.471003 5.5987501,28.2495 C5.3502498,28.166002 5.0862498,28.116877 4.8067498,28.102125 C4.5272498,28.087376 3.9009998,28.080002 2.928,28.08 L2.928,26.535 C3.987,26.331501 4.68225,26.167501 5.0137501,26.042999 C5.3452501,25.918501 5.6817498,25.685501 6.0232501,25.344 C6.24825,25.094002 6.508625,24.732252 6.8043752,24.258751 C7.1001248,23.785252 7.2480001,23.363001 7.2480001,22.992001 C7.2480001,22.434002 7.0461249,22.022503 6.642375,21.7575 C6.2386246,21.4925 5.7204995,21.360001 5.0879998,21.360001 C4.4734998,21.360001 3.948875,21.542377 3.5141249,21.907125 C3.0793748,22.271877 2.5755,22.9375 2.0024998,23.903999 L0.48000023,23.903999 C0.75650001,22.737 1.007875,21.962002 1.2341251,21.579 C1.460375,21.196003 1.7579999,20.853752 2.1270001,20.55225 C3.0325,19.682751 4.1475,19.248005 5.4720001,19.248001 z" });
            TimeSignatureList.Add(new TimeSignature { Id = 8, Name = "6,8", Description = "6 beats per measure. Eighth note = 1 beat.", Caption = "6/8", Vector = "M5.66925,46.512001 C5.09725,47.012501 4.5332499,47.498001 3.9772503,47.968502 C3.4212499,48.438999 3.1169999,48.976501 3.0645001,49.581001 C3.0374999,49.866001 3.1004999,50.12825 3.2535002,50.367752 C3.4064999,50.60725 3.6204998,50.805626 3.8954999,50.962875 C4.1704998,51.120125 4.4936247,51.241627 4.8648748,51.327377 C5.236125,51.413124 5.6304998,51.456001 6.0479999,51.456001 C6.6709995,51.456001 7.1738749,51.309376 7.5566254,51.016125 C7.9393744,50.722878 8.1564999,50.359001 8.2080002,49.9245 C8.2399998,49.628502 8.2492504,49.386375 8.2357502,49.198124 C8.22225,49.009876 8.1661243,48.829376 8.0673752,48.656624 C7.9686246,48.483875 7.8156247,48.300751 7.6083751,48.10725 C7.401125,47.91375 7.0809999,47.650501 6.6480002,47.317501 z M6.0479999,39.312 C5.4034996,39.312 4.8503752,39.446625 4.3886251,39.715874 C3.9268751,39.985126 3.6960001,40.330502 3.6959999,40.751999 C3.6960001,41.317001 3.7888751,41.73875 3.9746249,42.01725 C4.1603751,42.29575 4.5895,42.668999 5.2620001,43.137001 L6.039,43.728001 C6.5734997,43.308502 7.0366249,42.877377 7.4283752,42.434624 C7.8201246,41.991875 7.9839993,41.495251 7.9200001,40.944752 C7.8689995,40.35725 7.6619997,39.938251 7.2990003,39.687752 C6.9359999,39.437252 6.5190001,39.312 6.0479999,39.312 z M6,36.912003 C7.2674994,36.912003 8.3283749,37.250374 9.1826248,37.927124 C10.036875,38.603874 10.463999,39.50425 10.464,40.62825 C10.463999,41.471252 10.277124,42.295753 9.9033747,43.101749 C9.7164993,43.504749 9.4377813,43.882374 9.0672188,44.234627 L7.9500227,45.024368 L9.9112501,46.753876 C10.567749,47.431625 10.896,48.287498 10.896,49.321499 C10.896,50.666 10.44425,51.701874 9.5407505,52.429127 C8.6372499,53.156376 7.4089999,53.52 5.8559999,53.52 C4.408,53.52 3.1739998,53.195999 2.1539998,52.548 C1.1340001,51.900002 0.62399995,50.888752 0.62400001,49.514252 C0.62399995,49.076752 0.686625,48.678123 0.8118751,48.318375 C0.93712497,47.958626 1.150125,47.60075 1.4508752,47.244751 C1.7516251,46.888752 2.132,46.522125 2.592,46.144875 C3.052,45.767624 3.5320001,45.46125 4.0320001,45.22575 C3.4805,44.93325 3.0176249,44.60675 2.6433752,44.24625 C2.269125,43.88575 1.9705,43.518501 1.7474999,43.144501 C1.5244999,42.7705 1.3774999,42.413876 1.3065001,42.074623 C1.2355,41.735374 1.2,41.349751 1.2,40.917751 C1.2,39.76075 1.6654999,38.803875 2.5964999,38.047127 C3.5274999,37.290375 4.6619997,36.912003 6,36.912003 z M5.4213753,27.694126 C5.0011249,27.756876 4.578125,27.849125 4.1523752,27.970875 C3.726625,28.092625 3.328625,28.235001 2.9583747,28.398001 C2.588125,28.561001 2.3860002,28.653751 2.352,28.67625 L2.352,28.752001 C2.352,29.408501 2.4056249,30.050877 2.5128748,30.679125 C2.6201248,31.307377 2.7961249,31.858875 3.040875,32.333626 C3.285625,32.808376 3.5883749,33.186127 3.9491251,33.466873 C4.309875,33.747627 4.7535,33.888 5.2800002,33.888 L5.9264998,33.888 C6.698,33.865002 7.3431249,33.524876 7.8618751,32.867626 C8.3806248,32.210377 8.6247501,31.394001 8.5942497,30.418501 C8.4777498,29.516001 8.2737503,28.899126 7.9822502,28.567875 C7.6907501,28.236628 7.1745,27.957003 6.4335008,27.729 C6.1789999,27.643002 5.8416247,27.631376 5.4213753,27.694126 z M10.08,19.296001 L10.004251,21.312 C8.8327503,21.312 7.8578749,21.461628 7.0796251,21.760876 C6.3013749,22.060127 5.605875,22.471376 4.993125,22.994625 C4.3803749,23.517878 3.8614998,24.143627 3.4365001,24.871876 C3.0114999,25.600126 2.73,26.173502 2.592,26.592001 C2.8755,26.198002 3.3878751,25.9235 4.1291251,25.768499 C4.8703752,25.613499 5.526,25.535999 6.0960002,25.535999 C7.5169997,25.535999 8.6623745,25.997499 9.5321255,26.9205 C10.401875,27.8435 10.854,28.963751 10.8885,30.28125 C10.923,32.050251 10.447875,33.453625 9.4631252,34.491375 C8.4783745,35.529125 7.1960001,36.048 5.6160002,36.048 C3.849,36.048 2.49775,35.418251 1.5622501,34.158752 C1.0302501,33.560753 0.63687497,32.786251 0.38212487,31.835251 C0.12737501,30.884251 0,29.8885 -1.0489748E-07,28.848 C0,27.215 0.25800002,25.874126 0.77400011,24.825375 C1.29,23.776627 2.141,22.653502 3.3270001,21.456001 C3.8610001,20.895504 4.7371254,20.395374 5.9553752,19.955624 C7.173625,19.515877 8.5485001,19.296001 10.08,19.296001 z" });
            TimeSignatureList.Add(new TimeSignature { Id = 9, Name = "9,8", Description = "9 beats per measure. Eighth note = 1 beat.", Caption = "9/8", Vector = "M5.0452499,46.464001 C4.4732499,46.9645 3.9092498,47.450001 3.3532503,47.920502 C2.7972498,48.390999 2.493,48.928501 2.4405,49.533001 C2.4135001,49.818001 2.4765,50.08025 2.6294997,50.319752 C2.7824998,50.55925 2.9965,50.757626 3.2714999,50.914875 C3.5465,51.072124 3.8696251,51.193626 4.2408752,51.279377 C4.6121249,51.365128 5.0065002,51.408001 5.4240003,51.408001 C6.0469999,51.408001 6.5498753,51.261375 6.9326253,50.968124 C7.3153753,50.674877 7.5325003,50.311001 7.5840006,49.876499 C7.6160002,49.580502 7.6252499,49.338375 7.6117501,49.150124 C7.5982499,48.961876 7.5421247,48.781376 7.4433751,48.608627 C7.3446245,48.435875 7.1916246,48.25275 6.984375,48.05925 C6.7771249,47.865749 6.4569998,47.602501 6.0240002,47.269501 z M5.4240003,39.167999 C4.7795,39.167999 4.2263751,39.302628 3.7646253,39.571877 C3.302875,39.841125 3.072,40.186501 3.0719998,40.608002 C3.072,41.173 3.164875,41.594749 3.3506253,41.873249 C3.536375,42.151749 3.9654999,42.525002 4.638,42.993 L5.415,43.584 C5.9495001,43.164501 6.4126248,42.733376 6.8043752,42.290627 C7.196125,41.847878 7.3600001,41.35125 7.296,40.800751 C7.2449999,40.213249 7.0380001,39.79425 6.6750002,39.543751 C6.3119993,39.293251 5.8949995,39.167999 5.4240003,39.167999 z M5.3759999,36.767998 C6.6440001,36.767998 7.7049999,37.10825 8.559,37.78875 C9.4130001,38.469254 9.8400002,39.374252 9.8400002,40.50375 C9.8400002,41.35125 9.6532497,42.180252 9.2797499,42.990749 C9.0930004,43.396 8.8143129,43.775749 8.4436884,44.130001 L7.3234959,44.926136 L9.3022499,46.676624 C9.9487495,47.348373 10.271999,48.206249 10.272,49.250252 C10.271999,50.599251 9.8208752,51.648125 8.9186249,52.396877 C8.0163746,53.145626 6.7874994,53.52 5.2319994,53.52 C3.7839997,53.52 2.5499997,53.184875 1.5300002,52.514626 C0.50999999,51.844376 0,50.820999 6.49909E-08,49.4445 C0,49.009003 0.063875005,48.606251 0.19162524,48.236252 C0.31937498,47.866249 0.528,47.508877 0.81749976,47.164124 C1.107,46.819374 1.469,46.467876 1.9035002,46.109627 C2.3379998,45.751377 2.8395,45.425751 3.408,45.132751 C2.8885,44.860252 2.42875,44.530502 2.0287497,44.143501 C1.62875,43.7565 1.32275,43.384251 1.1107502,43.026749 C0.89874995,42.66925 0.75662494,42.316628 0.68437475,41.968876 C0.61212498,41.621124 0.57599998,41.230003 0.57599992,40.795502 C0.57599998,39.6325 1.041375,38.670502 1.9721249,37.9095 C2.9028749,37.148499 4.0374999,36.767998 5.3759999,36.767998 z M5.1360002,21.456001 C4.5275002,21.456005 3.9723749,21.700127 3.4706249,22.188375 C2.9688749,22.676624 2.6894999,23.418499 2.6325002,24.414 C2.5734999,25.449501 2.7364998,26.186003 3.1215003,26.623501 C3.5064998,27.061003 4.0282497,27.292252 4.6867499,27.317249 L5.4285002,27.264 C5.6424999,27.264 6.0018749,27.158751 6.5066252,26.94825 C7.011375,26.737751 7.3549995,26.515251 7.5374999,26.28075 C7.7924995,25.96475 7.8584995,25.29475 7.7354999,24.27075 C7.5865002,23.286251 7.2755003,22.571001 6.8025002,22.125 C6.3295002,21.679003 5.7740002,21.456005 5.1360002,21.456001 z M5.1360002,19.439999 C6.6700001,19.439999 7.8897495,20.001499 8.7952499,21.1245 C9.21175,21.714502 9.5459995,22.421127 9.7980003,23.244375 C10.049999,24.067627 10.176,24.927502 10.176,25.823999 C10.176,26.448002 10.157999,27.117878 10.122,27.833626 C10.085999,28.549377 9.9756241,29.209625 9.7908754,29.814375 C9.6061249,30.419125 9.3286247,30.994877 8.958375,31.541626 C8.5881252,32.088375 8.0944996,32.584503 7.4775,33.029999 C7.0804996,33.318501 6.6240001,33.554249 6.1080003,33.737251 C5.592,33.92025 5.0591249,34.063126 4.5093751,34.165874 C3.9596248,34.268623 3.438375,34.344002 2.9456251,34.391998 C2.4528751,34.440002 1.855,34.464001 1.1519998,34.464001 L1.1519998,32.780251 C3.2045,32.603249 4.7846251,32.152874 5.892375,31.429125 C7.0001249,30.705376 7.6279998,29.701 7.776,28.416 C7.5314999,28.787001 7.1083751,29.04775 6.5066252,29.19825 C5.9048748,29.348751 5.336,29.424 4.8000002,29.424 C3.4679999,29.424 2.3989999,28.98525 1.5930003,28.10775 C0.787,27.230251 0.384,26.053001 0.38399997,24.576 C0.384,23.032501 0.82750005,21.790627 1.7145,20.850376 C2.6015,19.910126 3.7420001,19.439999 5.1360002,19.439999 z" });
            TimeSignatureList.Add(new TimeSignature { Id =10, Name = "4,2", Description = "4 beats per measure. Half note = 1 beat.", Caption = "4/2", Vector = "M5.7600007,37.104 C7.112,37.104 8.2419996,37.541752 9.1499996,38.417252 C10.058,39.292751 10.511999,40.347752 10.512,41.582253 C10.511999,42.594749 10.256624,43.570751 9.7458754,44.51025 C9.2351246,45.449753 8.4647493,46.484501 7.4347501,47.614502 L4.0320001,50.880001 L11.328,50.880001 L11.328,53.52 L0.52800006,53.52 L0.52800006,52.659 L3.6015003,48.7785 C4.0319996,48.223 4.49225,47.650375 4.9822502,47.060627 C5.47225,46.470875 5.9093747,45.913876 6.2936249,45.389626 C6.6778746,44.865376 6.9889994,44.357002 7.2270002,43.864502 C7.4650002,43.372002 7.5839996,42.914249 7.5840001,42.491249 C7.5839996,41.63525 7.3328748,40.955376 6.8306251,40.451626 C6.3283749,39.947876 5.6514997,39.695999 4.8000002,39.695999 C4.171,39.695999 3.7054999,39.853626 3.4035001,40.168877 C3.1015,40.484123 2.6994998,41.286499 2.1975,42.576 L0.52800006,42.576 C0.73149997,41.333 0.95187497,40.491127 1.1891251,40.050377 C1.4263749,39.609627 1.7309998,39.169003 2.1029999,38.7285 C3.1139998,37.6455 4.3330002,37.104 5.7600007,37.104 z M6.3839998,23.040001 L2.3039999,29.184 L6.3839998,29.184 z M7.36725,19.007999 L9.1680002,19.007999 L9.1680002,29.184 L11.472,29.184 L11.472,31.584 L9.1680002,31.584 L9.1680002,35.375999 L6.3839998,35.375999 L6.3839998,31.584 L1.6467197E-07,31.584 L1.6467197E-07,29.490749 z" });

            var b = (from a in TimeSignatureList where a.Id == Defaults.DefaultTimeSignatureId select a);
            TimeSignature = (b.Any()) ? b.Single() : TimeSignatureList[0];
        }
Exemple #3
0
        /** Return the rest symbols needed to fill the time interval between
         * start and end.  If no rests are needed, return nil.
         */
        private RestSymbol[] GetRests(TimeSignature time, int start, int end)
        {
            RestSymbol[] result;
            RestSymbol r1, r2;

            if (end - start < 0)
            return null;

            NoteDuration dur = time.GetNoteDuration(end - start);
            switch (dur) {
            case NoteDuration.Whole:
            case NoteDuration.Half:
            case NoteDuration.Quarter:
            case NoteDuration.Eighth:
                r1 = new RestSymbol(start, dur);
                result = new RestSymbol[]{ r1 };
                return result;

            case NoteDuration.DottedHalf:
                r1 = new RestSymbol(start, NoteDuration.Half);
                r2 = new RestSymbol(start + time.Quarter*2,
                                    NoteDuration.Quarter);
                result = new RestSymbol[]{ r1, r2 };
                return result;

            case NoteDuration.DottedQuarter:
                r1 = new RestSymbol(start, NoteDuration.Quarter);
                r2 = new RestSymbol(start + time.Quarter,
                                    NoteDuration.Eighth);
                result = new RestSymbol[]{ r1, r2 };
                return result;

            case NoteDuration.DottedEighth:
                r1 = new RestSymbol(start, NoteDuration.Eighth);
                r2 = new RestSymbol(start + time.Quarter/2,
                                    NoteDuration.Sixteenth);
                result = new RestSymbol[]{ r1, r2 };
                return result;

            default:
                return null;
            }
        }
Exemple #4
0
        /** Given the raw midi notes (the note number and duration in pulses),
         * calculate the following note data:
         * - The white key
         * - The accidental (if any)
         * - The note duration (half, quarter, eighth, etc)
         * - The side it should be drawn (left or side)
         * By default, notes are drawn on the left side.  However, if two notes
         * overlap (like A and B) you cannot draw the next note directly above it.
         * Instead you must shift one of the notes to the right.
         *
         * The KeySignature is used to determine the white key and accidental.
         * The TimeSignature is used to determine the duration.
         */
        private static NoteData[] CreateNoteData(List<MidiNote> midinotes, KeySignature key,
            TimeSignature time)
        {
            int len = midinotes.Count;
            NoteData[] notedata = new NoteData[len];

            for (int i = 0; i < len; i++) {
            MidiNote midi = midinotes[i];
            notedata[i] = new NoteData();
            notedata[i].number = midi.Number;
            notedata[i].leftside = true;
            notedata[i].whitenote = key.GetWhiteNote(midi.Number);
            notedata[i].duration = time.GetNoteDuration(midi.EndTime - midi.StartTime);
            notedata[i].accid = key.GetAccidental(midi.Number, midi.StartTime / time.Measure);

            if (i > 0 && (notedata[i].whitenote.Dist(notedata[i-1].whitenote) == 1)) {
                /* This note (notedata[i]) overlaps with the previous note.
                 * Change the side of this note.
                 */

                if (notedata[i-1].leftside) {
                    notedata[i].leftside = false;
                } else {
                    notedata[i].leftside = true;
                }
            } else {
                notedata[i].leftside = true;
            }
            }
            return notedata;
        }
Exemple #5
0
        /** Return true if the chords can be connected, where their stems are
         * joined by a horizontal beam. In order to create the beam:
         *
         * - The chords must be in the same measure.
         * - The chord stems should not be a dotted duration.
         * - The chord stems must be the same duration, with one exception
         *   (Dotted Eighth to Sixteenth).
         * - The stems must all point in the same direction (up or down).
         * - The chord cannot already be part of a beam.
         *
         * - 6-chord beams must be 8th notes in 3/4, 6/8, or 6/4 time
         * - 3-chord beams must be either triplets, or 8th notes (12/8 time signature)
         * - 4-chord beams are ok for 2/2, 2/4 or 4/4 time, any duration
         * - 4-chord beams are ok for other times if the duration is 16th
         * - 2-chord beams are ok for any duration
         *
         * If startQuarter is true, the first note should start on a quarter note
         * (only applies to 2-chord beams).
         */
        public static bool CanCreateBeam(ChordSymbol[] chords, TimeSignature time, bool startQuarter)
        {
            int numChords = chords.Length;
            Stem firstStem = chords[0].Stem;
            Stem lastStem = chords[chords.Length-1].Stem;
            if (firstStem == null || lastStem == null) {
            return false;
            }
            int measure = chords[0].StartTime / time.Measure;
            NoteDuration dur = firstStem.Duration;
            NoteDuration dur2 = lastStem.Duration;

            bool dotted8_to_16 = false;
            if (chords.Length == 2 && dur == NoteDuration.DottedEighth &&
            dur2 == NoteDuration.Sixteenth) {
            dotted8_to_16 = true;
            }

            if (dur == NoteDuration.Whole || dur == NoteDuration.Half ||
            dur == NoteDuration.DottedHalf || dur == NoteDuration.Quarter ||
            dur == NoteDuration.DottedQuarter ||
            (dur == NoteDuration.DottedEighth && !dotted8_to_16)) {

            return false;
            }

            if (numChords == 6) {
            if (dur != NoteDuration.Eighth) {
                return false;
            }
            bool correctTime =
               ((time.Numerator == 3 && time.Denominator == 4) ||
                (time.Numerator == 6 && time.Denominator == 8) ||
                (time.Numerator == 6 && time.Denominator == 4) );

            if (!correctTime) {
                return false;
            }

            if (time.Numerator == 6 && time.Denominator == 4) {
                /* first chord must start at 1st or 4th quarter note */
                int beat = time.Quarter * 3;
                if ((chords[0].StartTime % beat) > time.Quarter/6) {
                    return false;
                }
            }
            }
            else if (numChords == 4) {
            if (time.Numerator == 3 && time.Denominator == 8) {
                return false;
            }
            bool correctTime =
              (time.Numerator == 2 || time.Numerator == 4 || time.Numerator == 8);
            if (!correctTime && dur != NoteDuration.Sixteenth) {
                return false;
            }

            /* chord must start on quarter note */
            int beat = time.Quarter;
            if (dur == NoteDuration.Eighth) {
                /* 8th note chord must start on 1st or 3rd quarter note */
                beat = time.Quarter * 2;
            }
            else if (dur == NoteDuration.ThirtySecond) {
                /* 32nd note must start on an 8th beat */
                beat = time.Quarter / 2;
            }

            if ((chords[0].StartTime % beat) > time.Quarter/6) {
                return false;
            }
            }
            else if (numChords == 3) {
            bool valid = (dur == NoteDuration.Triplet) ||
                          (dur == NoteDuration.Eighth &&
                           time.Numerator == 12 && time.Denominator == 8);
            if (!valid) {
                return false;
            }

            /* chord must start on quarter note */
            int beat = time.Quarter;
            if (time.Numerator == 12 && time.Denominator == 8) {
                /* In 12/8 time, chord must start on 3*8th beat */
                beat = time.Quarter/2 * 3;
            }
            if ((chords[0].StartTime % beat) > time.Quarter/6) {
                return false;
            }
            }

            else if (numChords == 2) {
            if (startQuarter) {
                int beat = time.Quarter;
                if ((chords[0].StartTime % beat) > time.Quarter/6) {
                    return false;
                }
            }
            }

            foreach (ChordSymbol chord in chords) {
            if ((chord.StartTime / time.Measure) != measure)
                return false;
            if (chord.Stem == null)
                return false;
            if (chord.Stem.Duration != dur && !dotted8_to_16)
                return false;
            if (chord.Stem.isBeam)
                return false;
            }

            /* Check that all stems can point in same direction */
            bool hasTwoStems = false;
            int direction = Stem.Up;
            foreach (ChordSymbol chord in chords) {
            if (chord.HasTwoStems) {
                if (hasTwoStems && chord.Stem.Direction != direction) {
                    return false;
                }
                hasTwoStems = true;
                direction = chord.Stem.Direction;
            }
            }

            /* Get the final stem direction */
            if (!hasTwoStems) {
            WhiteNote note1;
            WhiteNote note2;
            note1 = (firstStem.Direction == Stem.Up ? firstStem.Top : firstStem.Bottom);
            note2 = (lastStem.Direction == Stem.Up ? lastStem.Top : lastStem.Bottom);
            direction = StemDirection(note1, note2, chords[0].Clef);
            }

            /* If the notes are too far apart, don't use a beam */
            if (direction == Stem.Up) {
            if (Math.Abs(firstStem.Top.Dist(lastStem.Top)) >= 11) {
                return false;
            }
            }
            else {
            if (Math.Abs(firstStem.Bottom.Dist(lastStem.Bottom)) >= 11) {
                return false;
            }
            }
            return true;
        }
 public void CopyFrom(TimeSignature ts)
 {
     tick        = ts.tick;
     numerator   = ts.numerator;
     denominator = ts.denominator;
 }
Exemple #7
0
 /// <summary>Initializes a new instance of the <seealso cref="TimingPoint"/> class.</summary>
 /// <param name="bpm">The BPM of the timing point.</param>
 /// <param name="timeSignature">The time signature of the timing point.</param>
 public TimingPoint(BPM bpm, TimeSignature timeSignature)
 {
     BPM           = bpm;
     TimeSignature = timeSignature;
 }
Exemple #8
0
        /** Add rest symbols between notes.  All times below are
         * measured in pulses.
         */
        private List<MusicSymbol> AddRests(List<MusicSymbol> symbols, TimeSignature time)
        {
            int prevtime = 0;

            List<MusicSymbol> result = new List<MusicSymbol>( symbols.Count );

            foreach (MusicSymbol symbol in symbols) {
            int starttime = symbol.StartTime;
            RestSymbol[] rests = GetRests(time, prevtime, starttime);
            if (rests != null) {
                foreach (RestSymbol r in rests) {
                    result.Add(r);
                }
            }

            result.Add(symbol);

            /* Set prevtime to the end time of the last note/symbol. */
            if (symbol is ChordSymbol) {
                ChordSymbol chord = (ChordSymbol)symbol;
                prevtime = Math.Max( chord.EndTime, prevtime );
            }
            else {
                prevtime = Math.Max(starttime, prevtime);
            }
            }
            return result;
        }
        /// <summary>
        /// Calculates the meter and saves it in BeatEvents
        /// </summary>
        /// <param name="midi"></param>
        public static void CalculateMetre(Model midi)
        {
            var offset = CalculateMeterFitnessMetric(midi);

            //use beats that are already in the midi file
            if (midi.GoodnessOfMetreFit > 0.4)
            {
                midi.IsNormalizedByMidiItself = true;
                CalculateImplicitMetre();
            }

            // else detect the meter by the detector
            else
            {
                midi.IsNormalizedByMidiItself = false;
                PadNotesToZero(midi);

                var metre = Analyze(midi).Select(TimeSpan.FromMilliseconds).ToList();
                for (var i = metre.Sum(t => t.TotalMilliseconds); i <= midi.Length.TotalMilliseconds; i += metre.Last().TotalMilliseconds)
                {
                    metre.Add(metre.Last());
                }

                CreateBeatEvents(metre);

                var beatStrengthAnalyzer = new BeatStrengthAnalyzer(midi);
                beatStrengthAnalyzer.Analyze();
            }

            var firstBeatTime = midi.EventsOfType <BeatEvent>().Min(b => b.AbsoluteRealTime);

            if (firstBeatTime != TimeSpan.Zero)
            {
                var beatEvent = new BeatEvent {
                    AbsoluteRealTime = TimeSpan.Zero, Level = 2, Length = firstBeatTime
                };
                midi.Tracks[0].MetaEvents.Add(beatEvent);
            }

            if (!midi.IsNormalizedByMidiItself)
            {
                midi.GoodnessOfMetreFit = (float)CalculateMeterFitnessOfBeatEvents(midi);
            }


            void CalculateImplicitMetre()
            {
                var baseTick = GetTicksPerBeat(midi);

                var end                 = midi.EventsOfType <EndOfTrack>().Max(e => e.AbsoluteTime);
                var timeSignatures      = new Queue <TimeSignature>(midi.EventsOfType <TimeSignature>().OrderBy(e => e.AbsoluteTime));
                var actualTimeSignature = new TimeSignature {
                    AbsoluteTime = 0, Numerator = 4, Denominator = 4
                };
                var tick       = baseTick * 4 / actualTimeSignature.Denominator;
                var barCounter = 0;

                if (offset > 0)
                {
                    midi.Tracks[0].MetaEvents.Add(new BeatEvent {
                        AbsoluteTime = 0, Level = 2
                    });
                }

                for (var time = offset; time <= end; time += tick)
                {
                    if (timeSignatures.Count > 0 && timeSignatures.Peek().AbsoluteTime <= time)
                    {
                        actualTimeSignature = timeSignatures.Dequeue();
                        barCounter          = 0;
                        tick = baseTick * 4 / actualTimeSignature.Denominator;
                    }

                    var level = 2;
                    if (barCounter % actualTimeSignature.Numerator == 0)
                    {
                        level = 0;
                    }
                    else if ((actualTimeSignature.Numerator == 4 && barCounter % actualTimeSignature.Numerator == 2) ||
                             (actualTimeSignature.Numerator == 6 && barCounter % actualTimeSignature.Numerator == 3))
                    {
                        level = 1;
                    }

                    var beat = new BeatEvent {
                        AbsoluteTime = time, Level = (byte)level
                    };
                    midi.Tracks[0].MetaEvents.Add(beat);

                    barCounter++;
                }

                TimeCalculator.ComputeRealTimes(midi);
                CalculateBeatLengths();

                var averageLength = midi.EventsOfType <BeatEvent>().Average(b => b.Length.TotalMilliseconds);

                while (averageLength > 1000)
                {
                    var beats = midi.EventsOfType <BeatEvent>().ToArray();
                    foreach (var beat in beats)
                    {
                        midi.Tracks[0].MetaEvents.Add(new BeatEvent {
                            AbsoluteRealTime = beat.AbsoluteRealTime + beat.Length.Divide(2), Level = 2
                        });
                    }
                    CalculateBeatLengths();
                    averageLength = averageLength / 2;
                }
            }

            void CalculateBeatLengths()
            {
                var beatEvents = midi.EventsOfType <BeatEvent>().OrderBy(b => b.AbsoluteRealTime).ToArray();

                for (var i = 0; i < beatEvents.Length - 1; i++)
                {
                    beatEvents[i].Length = beatEvents[i + 1].AbsoluteRealTime - beatEvents[i].AbsoluteRealTime;
                }
                beatEvents[beatEvents.Length - 1].Length = beatEvents[beatEvents.Length - 2].Length;
            }

            void CreateBeatEvents(IEnumerable <TimeSpan> metre)
            {
                var time = TimeSpan.Zero;

                foreach (var beat in metre)
                {
                    var beatEvent = new BeatEvent {
                        AbsoluteRealTime = time, Level = 0, Length = beat
                    };
                    midi.Tracks[0].MetaEvents.Add(beatEvent);
                    time += beat;
                }
            }
        }
Exemple #10
0
        public MidiSequenceReader(string fileName)
        {
            Sequence midiSequence = new Sequence();

            midiSequence.Load(fileName);

            int           division     = midiSequence.Division;
            INote         previousNote = null;
            int           previousNoteAbsoluteTicks = 0;
            double        percentageOfBarReached    = 0;
            bool          startedNoteIsClosed       = true;
            TimeSignature previousTimeSignature     = null;

            Sequence.Symbols.Add(new Clef(ClefType.GClef));

            foreach (Track track in midiSequence)
            {
                foreach (MidiEvent midiEvent in track.Iterator())
                {
                    IMidiMessage midiMessage = midiEvent.MidiMessage;
                    switch (midiMessage.MessageType)
                    {
                    case MessageType.Meta:
                        MetaMessage metaMessage = midiMessage as MetaMessage;
                        switch (metaMessage.MetaType)
                        {
                        case MetaType.TimeSignature:
                            ITimeSignatureEvent timeSignatureEvent = new MidiTimeSignatureEvent(metaMessage);
                            Sequence.Symbols.Add(timeSignatureEvent.TimeSignature);
                            previousTimeSignature = timeSignatureEvent.TimeSignature;
                            break;

                        case MetaType.Tempo:
                            ITempoEvent tempoEvent = new MidiTempoEvent(metaMessage);
                            Sequence.BeatsPerMinute = tempoEvent.BeatsPerMinute;
                            break;

                        case MetaType.EndOfTrack:
                            break;
                        }
                        break;

                    case MessageType.Channel:
                        ChannelMessage channelMessage = midiEvent.MidiMessage as ChannelMessage;
                        if (channelMessage.Command == ChannelCommand.NoteOn)
                        {
                            INoteEvent noteEvent = new MidiNoteEvent(channelMessage);
                            INote      note      = noteEvent.Note;

                            if (note != null)
                            {
                                Sequence.Symbols.Add(note);

                                previousNote        = note;
                                startedNoteIsClosed = false;
                            }
                            else
                            {
                                // Previous note must be closed
                                IBarLineEvent barLineEvent = new MidiBarLineEvent(
                                    midiEvent, previousNote, ref startedNoteIsClosed,
                                    ref previousNoteAbsoluteTicks, division, previousTimeSignature,
                                    ref percentageOfBarReached);

                                if (barLineEvent.BarLine != null)     // End of bar has been reached, start a new one
                                {
                                    Sequence.Symbols.Add(barLineEvent.BarLine);
                                }
                            }
                        }
                        break;
                    }
                }
            }
        }
Exemple #11
0
    static void ProcessSongComponentLine(string line, Song song, List <Anchor> anchorData)
    {
        int stringViewIndex = 0;

        uint position = HackyStringViewFunctions.GetNextTick(line, ref stringViewIndex);

        HackyStringViewFunctions.AdvanceChartLineStringView(line, ref stringViewIndex);  // Skip over the equals sign
        char type = line[stringViewIndex];

        HackyStringViewFunctions.AdvanceChartLineStringView(line, ref stringViewIndex);

        switch (type)
        {
        case 'B':
        {
            uint value = HackyStringViewFunctions.AdvanceStringToUInt(line, ref stringViewIndex);
            song.Add(new BPM(position, value), false);
        }
        break;

        case 'T':
        {
            uint numerator = HackyStringViewFunctions.AdvanceStringToUInt(line, ref stringViewIndex);

            TimeSignature ts = new TimeSignature(position, numerator);
            song.Add(ts, false);

            if (stringViewIndex < line.Length)
            {
                uint denominator = HackyStringViewFunctions.AdvanceStringToUInt(line, ref stringViewIndex);

                denominator    = (uint)(Mathf.Pow(2, denominator));
                ts.denominator = denominator;
            }
        }
        break;

        case 'E':
        {
            string       text       = HackyStringViewFunctions.GetNextTextUpToQuote(line, ref stringViewIndex);
            const string SECTION_ID = "section";

            // Check if it's a section
            if (string.Compare(text, 0, SECTION_ID, 0, SECTION_ID.Length) == 0)
            {
                text = text.Remove(0, SECTION_ID.Length);
                text = text.Trim();
                song.Add(new Section(text, position), false);
            }
            else
            {
                song.Add(new Event(text, position), false);
            }
        }
        break;

        case 'A':
        {
            uint   anchorValue = HackyStringViewFunctions.AdvanceStringToUInt(line, ref stringViewIndex);
            Anchor a;
            a.position   = position;
            a.anchorTime = (float)(anchorValue / 1000000.0d);
            anchorData.Add(a);
        }
        break;

        default:
            return;
        }
    }
Exemple #12
0
        private List <MidiEvent> CreateTempoTrack(Tempo tempo, TimeSignature ts)
        {
            List <MidiEvent> track = new List <MidiEvent>();

            _tempoIdx.Clear();
            track.Add(new NAudio.Midi.TextEvent("bfTempo", MetaEventType.SequenceTrackName, 0));

            if (tempo.Events.Count <= 0 || tempo.Events[0].Start > 0.0f)
            {
                var idxEntry = new TempoIndex(0, 0, 120);
                //track.Add(new NAudio.Midi.TempoEvent(idxEntry.MicroPerQuarter, idxEntry.AbsoluteTime));
                _tempoIdx.Add(idxEntry);
            }

            long GetAbsoluteTime(double startTime, TempoIndex currentTempo)
            {
                double difference    = startTime - currentTempo.RealTime;
                long   absoluteTicks = currentTempo.AbsoluteTime + (1000L * (long)difference * DELTA_TICKS_PER_QUARTER) / currentTempo.MicroPerQuarter;

                //int q = DELTA_TICKS_PER_QUARTER / 32; // 1/128th quantization
                //if (absoluteTicks % q != 0) absoluteTicks += q - (absoluteTicks % q);

                // Applies quantization and snaps to grid
                int q = DELTA_TICKS_PER_QUARTER / 32; // 1/128th quantization

                if (absoluteTicks % q != 0)
                {
                    long before = absoluteTicks % q;
                    long after  = q - before;

                    if (before < after)
                    {
                        absoluteTicks -= before;
                    }
                    else
                    {
                        absoluteTicks += after;
                    }
                }

                return(absoluteTicks);
            }

            // Adds tempo changes
            if (tempo.Events.Count > 0)
            {
                var firstTempo = tempo.Events.First();
                var idxEntry   = new TempoIndex()
                {
                    AbsoluteTime = _tempoIdx.Count > 0 ? GetAbsoluteTime(firstTempo.Start, _tempoIdx.Last()) : 0,
                    RealTime     = firstTempo.Start,
                    BPM          = firstTempo.BPM
                };

                track.Add(new NAudio.Midi.TempoEvent(idxEntry.MicroPerQuarter, idxEntry.AbsoluteTime));
                _tempoIdx.Add(idxEntry);

                foreach (var tempoEntry in tempo.Events.Skip(1))
                {
                    idxEntry = new TempoIndex()
                    {
                        AbsoluteTime = GetAbsoluteTime(tempoEntry.Start, _tempoIdx.Last()),
                        RealTime     = tempoEntry.Start,
                        BPM          = tempoEntry.BPM
                    };

                    track.Add(new NAudio.Midi.TempoEvent(idxEntry.MicroPerQuarter, idxEntry.AbsoluteTime));
                    _tempoIdx.Add(idxEntry);
                }
            }

            // Adds time signature changes
            foreach (var time in ts.Events)
            {
                int den = (int)Math.Log(time.Measure, 2);

                track.Add(new TimeSignatureEvent(this.GetAbsoluteTime(time.Start), time.Beat, den, 24, 8));
            }

            // Sort by absolute time (And ensure track name is first event)
            track.Sort((x, y) => (int)(x is NAudio.Midi.TextEvent ? int.MinValue : x.AbsoluteTime - y.AbsoluteTime));

            // Adds end track
            track.Add(new MetaEvent(MetaEventType.EndTrack, 0, track.Last().AbsoluteTime));
            return(track);
        }
Exemple #13
0
        public void MsPerTickTest()
        {
            var ts = new TimeSignature(3, 4);

            Assert.AreEqual(25, ts.GetMSPerTick(100), "ms per tick");
        }
Exemple #14
0
 public void GetTicksForNoteTest()
 {
     Assert.AreEqual(24, TimeSignature.GetTicksForNote(4));
 }
Exemple #15
0
        /** Connect chords of the same duration with a horizontal beam.
         *  numChords is the number of chords per beam (2, 3, 4, or 6).
         *  if startBeat is true, the first chord must start on a quarter note beat.
         */
        private static void CreateBeamedChords(List<MusicSymbol>[] allsymbols, TimeSignature time,
            int numChords, bool startBeat)
        {
            int[] chordIndexes = new int[numChords];
            ChordSymbol[] chords = new ChordSymbol[numChords];

            foreach (List<MusicSymbol> symbols in allsymbols) {
            int startIndex = 0;
            while (true) {
                int horizDistance = 0;
                bool found = FindConsecutiveChords(symbols, time,
                                                   startIndex,
                                                   chordIndexes,
                                                   ref horizDistance);
                if (!found) {
                    break;
                }
                for (int i = 0; i < numChords; i++) {
                    chords[i] = (ChordSymbol)symbols[ chordIndexes[i] ];
                }

                if (ChordSymbol.CanCreateBeam(chords, time, startBeat)) {
                    ChordSymbol.CreateBeam(chords, horizDistance);
                    startIndex = chordIndexes[numChords-1] + 1;
                }
                else {
                    startIndex = chordIndexes[0] + 1;
                }

                /* What is the value of startIndex here?
                 * If we created a beam, we start after the last chord.
                 * If we failed to create a beam, we start after the first chord.
                 */
            }
            }
        }
Exemple #16
0
        /** Add in the vertical bars delimiting measures.
         *  Also, add the time signature symbols.
         */
        private List<MusicSymbol> AddBars(List<ChordSymbol> chords, TimeSignature time,
            int lastStart)
        {
            List<MusicSymbol> symbols = new List<MusicSymbol>();

            TimeSigSymbol timesig = new TimeSigSymbol(time.Numerator, time.Denominator);
            symbols.Add(timesig);

            /* The starttime of the beginning of the measure */
            int measuretime = 0;

            int i = 0;
            while (i < chords.Count) {
            if (measuretime <= chords[i].StartTime) {
                symbols.Add(new BarSymbol(measuretime) );
                measuretime += time.Measure;
            }
            else {
                symbols.Add(chords[i]);
                i++;
            }
            }

            /* Keep adding bars until the last StartTime (the end of the song) */
            while (measuretime < lastStart) {
            symbols.Add(new BarSymbol(measuretime) );
            measuretime += time.Measure;
            }

            /* Add the final vertical bar to the last measure */
            symbols.Add(new BarSymbol(measuretime) );
            return symbols;
        }
 private void OnTimeSignatureSelectedCommand(TimeSignature timeSignature)
 {
     Infrastructure.Dimensions.TimeSignatures.TimeSignature = timeSignature;
 }
Exemple #18
0
        /// <summary>Parses a string representation of a relative timing point into a <seealso cref="RelativeTimingPoint"/>.</summary>
        /// <param name="s">The string representation of a relative timing point to parse.</param>
        public static RelativeTimingPoint Parse(string s)
        {
            var split = s.Split('|');

            return(new RelativeTimingPoint(MeasuredTimePosition.Parse(split[0]), ParseDouble(split[1]), TimeSignature.Parse(split[2])));
        }
        public static List <Bar> GetBarsOfSong(string base64encodedMidiFile)
        {
            List <Bar> retObj    = new List <Bar>();
            int        barNumber = 1;
            var        midiFile  = MidiFile.Read(base64encodedMidiFile);

            var ticksPerBeat        = GetTicksPerBeatOfSong(base64encodedMidiFile);
            var songDurationInTicks = GetSongDurationInTicks(base64encodedMidiFile);
            var timeSignatureEvents = GetEventsOfType(base64encodedMidiFile, MidiEventType.TimeSignature);
            var setTempoEvents      = GetEventsOfType(base64encodedMidiFile, MidiEventType.SetTempo);

            timeSignatureEvents = ConvertDeltaTimeToAccumulatedTime(timeSignatureEvents);
            var TempoEvents = QuantizeTempos(ConvertDeltaTimeToAccumulatedTime(setTempoEvents));

            //status
            TimeSignatureEvent currentTimeSignature = new TimeSignatureEvent
            {
                Numerator   = 4,
                Denominator = 4
            };

            if (timeSignatureEvents.Count > 0)
            {
                currentTimeSignature = (TimeSignatureEvent)timeSignatureEvents[0];
            }

            int currentTempo = 500000;

            int  timeSigIndex = 0;
            int  tempoIndex   = 0;
            long currentTick  = 0;

            while (currentTick < songDurationInTicks)
            {
                if (TempoEvents.Count > 0)
                {
                    currentTempo = (int)TempoEvents[tempoIndex].MicrosecondsPerQuarterNote;
                }
                long timeOfNextTimeSignatureEvent = songDurationInTicks;
                if (timeSignatureEvents.Count - 1 > timeSigIndex)
                {
                    timeOfNextTimeSignatureEvent = timeSignatureEvents[timeSigIndex + 1].DeltaTime;
                }
                long timeOfNextSetTempoEvent = songDurationInTicks;
                if (TempoEvents.Count - 1 > tempoIndex)
                {
                    timeOfNextSetTempoEvent = TempoEvents[tempoIndex + 1].DeltaTime;
                }

                long lastTickOfBarToBeAdded = currentTimeSignature.Numerator * ticksPerBeat + currentTick;

                while ((lastTickOfBarToBeAdded <= timeOfNextTimeSignatureEvent && lastTickOfBarToBeAdded <= timeOfNextSetTempoEvent) ||
                       (lastTickOfBarToBeAdded > songDurationInTicks))
                {
                    var timeSignature = new TimeSignature
                    {
                        Numerator   = currentTimeSignature.Numerator,
                        Denominator = currentTimeSignature.Denominator
                    };
                    var bar = new Bar
                    {
                        BarNumber = barNumber++,
                        TicksFromBeginningOfSong          = currentTick,
                        TimeSignature                     = timeSignature,
                        TempoInMicrosecondsPerQuarterNote = currentTempo
                    };
                    retObj.Add(bar);
                    currentTick            += currentTimeSignature.Numerator * ticksPerBeat;
                    lastTickOfBarToBeAdded += currentTimeSignature.Numerator * ticksPerBeat;
                    if (currentTick >= songDurationInTicks)
                    {
                        break;
                    }
                }
                if (lastTickOfBarToBeAdded >= timeOfNextTimeSignatureEvent)
                {
                    timeSigIndex++;
                }
                if (lastTickOfBarToBeAdded >= timeOfNextSetTempoEvent)
                {
                    tempoIndex++;
                }
            }
            return(retObj);
        }
Exemple #20
0
 protected override void OnDisable()
 {
     base.OnDisable();
     currentTS = null;
 }
Exemple #21
0
 private static void GenerateDoubleKick(TimeSignature timeSignature, int feel, out IEnumerable <double> kicks, out IEnumerable <double> hihats, out IEnumerable <double> snares)
 {
     kicks  = EveryNthOfBeat(timeSignature.BeatCount, 1.0 / feel);
     snares = EveryNthOfBeat(timeSignature.BeatCount, feel / 2.0, 1);
     hihats = EveryNthOfBeat(timeSignature.BeatCount, 2.0 / feel);
 }
 public TimeSignature(TimeSignature ts) : base(ts.tick)
 {
     numerator   = ts.numerator;
     denominator = ts.denominator;
 }
        public static IEnumerable <NoteOrRest>[] SplitByBeats(this IEnumerable <NoteOrRest> notes, TimeSignature timeSignature)
        {
            var groups = new List <List <NoteOrRest> >();
            var queue  = new Queue <NoteOrRest>(notes);

            while (queue.Count > 0)
            {
                var sum          = 0d;
                var currentGroup = new List <NoteOrRest>();
                while (sum == 0 || sum - Math.Floor(sum) != 0)
                {
                    if (queue.Count == 0)
                    {
                        break;
                    }
                    var currentNote = queue.Dequeue();
                    currentGroup.Add(currentNote);
                    sum += ((1d + Enumerable.Range(1, currentNote.NumberOfDots).Sum(r => Math.Pow(0.5d, r))) / currentNote.BaseDuration.Denominator) * timeSignature.TypeOfBeats;
                }
                groups.Add(currentGroup);
            }
            return(groups.ToArray());
        }
        public static void ExportToAudicaFile(AudicaFile audicaFile, bool autoSave)
        {
            if (!File.Exists(audicaFile.filepath))
            {
                Debug.Log("Save file is gone... :(");
                return;
            }

            Encoding encoding     = Encoding.GetEncoding(437);
            string   targetPath   = audicaFile.filepath;
            string   autoSavePath = "";

            using (var archive = ZipArchive.Open(audicaFile.filepath)) {
                HandleCache.CheckCacheFolderValid();
                HandleCache.CheckSaveFolderValid();

                bool expert = false, advanced = false, standard = false, easy = false, modifiers = false;
                //Write the cues files to disk so we can add them to the audica file.
                if (audicaFile.diffs.expert.cues != null)
                {
                    File.WriteAllText($"{Application.dataPath}/.cache/expert-new.cues", CuesToJson(audicaFile.diffs.expert));
                    expert = true;
                }
                if (audicaFile.diffs.advanced.cues != null)
                {
                    File.WriteAllText($"{Application.dataPath}/.cache/advanced-new.cues", CuesToJson(audicaFile.diffs.advanced));
                    advanced = true;
                }
                if (audicaFile.diffs.moderate.cues != null)
                {
                    File.WriteAllText($"{Application.dataPath}/.cache/moderate-new.cues", CuesToJson(audicaFile.diffs.moderate));
                    standard = true;
                }
                if (audicaFile.diffs.beginner.cues != null)
                {
                    File.WriteAllText($"{Application.dataPath}/.cache/beginner-new.cues", CuesToJson(audicaFile.diffs.beginner));
                    easy = true;
                }
                audicaFile.modifiers           = new ModifierList();
                audicaFile.modifiers.modifiers = ModifierHandler.Instance.MapToDTO();
                if (audicaFile.modifiers.modifiers.Count > 0)
                {
                    File.WriteAllText($"{Application.dataPath}/.cache/modifiers-new.json", ModifiersToJson2(audicaFile.modifiers));
                    modifiers = true;
                }

                File.WriteAllText($"{Application.dataPath}/.cache/{audicaFile.desc.moggSong}", audicaFile.mainMoggSong.ExportToText());
                File.WriteAllText($"{Application.dataPath}/.cache/song-new.desc", Newtonsoft.Json.JsonConvert.SerializeObject(audicaFile.desc, Formatting.Indented));

                var      workFolder = Path.Combine(Application.streamingAssetsPath, "Ogg2Audica");
                MidiFile songMidi   = new MidiFile(Path.Combine(workFolder, "songtemplate.mid"));

                MidiEventCollection events = new MidiEventCollection(0, (int)Constants.PulsesPerQuarterNote);
                foreach (var tempo in audicaFile.desc.tempoList)
                {
                    events.AddEvent(new TempoEvent((int)tempo.microsecondsPerQuarterNote, (long)tempo.time.tick), 0);
                    events.AddEvent(new TimeSignatureEvent((long)tempo.time.tick, (int)tempo.timeSignature.Numerator, (int)TimeSignature.GetMIDIDenominator(tempo.timeSignature.Denominator), 0, 8), 0);
                }

                events.PrepareForExport();
                MidiFile.Export(Path.Combine(workFolder, $"{Application.dataPath}/.cache/song.mid"), events);


                //Remove any files we'll be replacing
                foreach (ZipArchiveEntry entry in archive.Entries)
                {
                    if (entry.ToString() == "expert.cues")
                    {
                        archive.RemoveEntry(entry);
                    }
                    else if (entry.ToString() == "song.desc")
                    {
                        archive.RemoveEntry(entry);
                    }
                    else if (entry.ToString() == audicaFile.desc.moggSong)
                    {
                        archive.RemoveEntry(entry);
                    }
                    else if (entry.ToString() == "song.mid")
                    {
                        archive.RemoveEntry(entry);
                    }
                    else if (entry.ToString() == "song.png")
                    {
                        archive.RemoveEntry(entry);
                    }
                    else if (entry.ToString() == "advanced.cues")
                    {
                        archive.RemoveEntry(entry);
                    }
                    else if (entry.ToString() == "moderate.cues")
                    {
                        archive.RemoveEntry(entry);
                    }
                    else if (entry.ToString() == "beginner.cues")
                    {
                        archive.RemoveEntry(entry);
                    }
                    else if (entry.ToString() == "modifiers.json")
                    {
                        archive.RemoveEntry(entry);
                    }
                }
                if (expert)
                {
                    archive.AddEntry("expert.cues", $"{Application.dataPath}/.cache/expert-new.cues");
                }
                if (advanced)
                {
                    archive.AddEntry("advanced.cues", $"{Application.dataPath}/.cache/advanced-new.cues");
                }
                if (standard)
                {
                    archive.AddEntry("moderate.cues", $"{Application.dataPath}/.cache/moderate-new.cues");
                }
                if (easy)
                {
                    archive.AddEntry("beginner.cues", $"{Application.dataPath}/.cache/beginner-new.cues");
                }
                if (modifiers)
                {
                    archive.AddEntry("modifiers.json", $"{Application.dataPath}/.cache/modifiers-new.json");
                }



                if (autoSave)
                {
                    int    pos       = audicaFile.filepath.LastIndexOf(@"\") + 1;
                    string fileName  = audicaFile.filepath.Substring(pos, audicaFile.filepath.Length - pos);
                    string shortName = fileName.Substring(0, fileName.LastIndexOf(@"."));
                    shortName    = shortName.Replace(" ", "");
                    targetPath   = $"{Application.dataPath}/autosaves/{shortName}/";
                    autoSavePath = targetPath;
                    targetPath  += DateTime.Now.ToString("MM-dd_h-mm-ss_");
                    targetPath  += fileName;
                    if (!Directory.Exists($"{Application.dataPath}/autosaves/"))
                    {
                        Directory.CreateDirectory($"{Application.dataPath}/autosaves/");
                    }
                    if (!Directory.Exists($"{Application.dataPath}/autosaves/{shortName}/"))
                    {
                        Directory.CreateDirectory($"{Application.dataPath}/autosaves/{shortName}/");
                    }
                }
                archive.AddEntry($"{audicaFile.desc.moggSong}", $"{Application.dataPath}/.cache/{audicaFile.desc.moggSong}");
                archive.AddEntry("song.desc", $"{Application.dataPath}/.cache/song-new.desc");
                archive.AddEntry("song.mid", $"{Application.dataPath}/.cache/song.mid");
                if (File.Exists($"{Application.dataPath}/.cache/song.png"))
                {
                    archive.AddEntry("song.png", $"{Application.dataPath}/.cache/song.png");
                }
                archive.SaveTo(audicaFile.filepath + ".temp", SharpCompress.Common.CompressionType.None);
                archive.Dispose();
            }
            File.Delete($"{Application.dataPath}/.cache/{audicaFile.desc.moggSong}");

            if (!autoSave)
            {
                File.Delete(audicaFile.filepath);
            }

            File.Move(audicaFile.filepath + ".temp", targetPath);


            if (autoSave)
            {
                NRSettings.autosavePath = autoSavePath;
            }
            Debug.Log("Export finished.");
        }
Exemple #25
0
 private void HandleTime(TimeSignature signature)
 {
     byte[] timeSignature = ConvertTimeSignatureToByteArray(signature);
     _metaTrack.Insert(_absoluteTicks, new MetaMessage(MetaType.TimeSignature, timeSignature));
 }
Exemple #26
0
        private int width; /** The width of the chord */

        #endregion Fields

        #region Constructors

        /** Create a new Chord Symbol from the given list of midi notes.
         * All the midi notes will have the same start time.  Use the
         * key signature to get the white key and accidental symbol for
         * each note.  Use the time signature to calculate the duration
         * of the notes. Use the clef when drawing the chord.
         */
        public ChordSymbol(List<MidiNote> midinotes, KeySignature key, 
            TimeSignature time, Clef c, SheetMusic sheet)
        {
            int len = midinotes.Count;
            int i;

            hastwostems = false;
            clef = c;
            sheetmusic = sheet;

            starttime = midinotes[0].StartTime;
            endtime = midinotes[0].EndTime;

            for (i = 0; i < midinotes.Count; i++) {
            if (i > 1) {
                if (midinotes[i].Number < midinotes[i-1].Number) {
                    throw new System.ArgumentException("Chord notes not in increasing order by number");
                }
            }
            endtime = Math.Max(endtime, midinotes[i].EndTime);
            }

            notedata = CreateNoteData(midinotes, key, time);
            accidsymbols = CreateAccidSymbols(notedata, clef);

            /* Find out how many stems we need (1 or 2) */
            NoteDuration dur1 = notedata[0].duration;
            NoteDuration dur2 = dur1;
            int change = -1;
            for (i = 0; i < notedata.Length; i++) {
            dur2 = notedata[i].duration;
            if (dur1 != dur2) {
                change = i;
                break;
            }
            }

            if (dur1 != dur2) {
            /* We have notes with different durations.  So we will need
             * two stems.  The first stem points down, and contains the
             * bottom note up to the note with the different duration.
             *
             * The second stem points up, and contains the note with the
             * different duration up to the top note.
             */
            hastwostems = true;
            stem1 = new Stem(notedata[0].whitenote,
                             notedata[change-1].whitenote,
                             dur1,
                             Stem.Down,
                             NotesOverlap(notedata, 0, change)
                            );

            stem2 = new Stem(notedata[change].whitenote,
                             notedata[notedata.Length-1].whitenote,
                             dur2,
                             Stem.Up,
                             NotesOverlap(notedata, change, notedata.Length)
                            );
            }
            else {
            /* All notes have the same duration, so we only need one stem. */
            int direction = StemDirection(notedata[0].whitenote,
                                          notedata[notedata.Length-1].whitenote,
                                          clef);

            stem1 = new Stem(notedata[0].whitenote,
                             notedata[notedata.Length-1].whitenote,
                             dur1,
                             direction,
                             NotesOverlap(notedata, 0, notedata.Length)
                            );
            stem2 = null;
            }

            /* For whole notes, no stem is drawn. */
            if (dur1 == NoteDuration.Whole)
            stem1 = null;
            if (dur2 == NoteDuration.Whole)
            stem2 = null;

            width = MinWidth;
        }
Exemple #27
0
        /// <summary>
        /// In MIDI Format 1, this would be the first track (index = 0).
        /// Otherwise Format 0: index = 0 and with
        /// Format 2, each track will essentially be like a Format 0 track.
        ///
        /// This method collects information from the 'tempo map' track such as
        ///
        /// - Tempo Information
        /// - SMPTE Offset
        /// - Time Signature
        /// - Key Signatuer
        /// - Sequencer Specific Data
        /// - System Exclusive Data (in tempo map)
        /// </summary>
        int GetTempoMap(int nTrackIndex, int nTrackOffset, int delta)
        {
            int  DELTA_Returned = delta;
            var  msg16          = FileHandle.Get16Bit(nTrackIndex, nTrackOffset);
            byte msg8           = (byte)(msg16 & 0xFF);

            CurrentStatus = msg16; // This is just an attempt at aligning running status.
            // var hexMsg = $"{msg16:X2}";
            if (msg16 >= 0xFF00 && msg16 <= 0xFF0C)
            {
                DELTA_Returned = FileHandle.Tracks[nTrackIndex].DeltaSeek(nTrackOffset);
                return(++DELTA_Returned);
            }
            switch (msg16)
            {
            // text
            case Stat16.SequenceNumber: // 0xFF00
            case Stat16.ChannelPrefix:  // 0xFF20
            case Stat16.PortMessage: /* 0xFF21 */ DELTA_Returned = FileHandle.Tracks[nTrackIndex].DeltaSeek(nTrackOffset); break;

            case Stat16.EndOfTrack: /* 0xFF2F */ DELTA_Returned = FileHandle.Tracks[nTrackIndex].Data.Length - 1; break;

            case Stat16.SetTempo: // 0xFF51
                var muspqn = FileHandle[ReaderIndex].ReadU24(nTrackOffset + 3);
                TempoMap.Push(muspqn, Division, CurrentTrackPulse);
                DELTA_Returned = FileHandle.Tracks[nTrackIndex].DeltaSeek(nTrackOffset);
                break;

            case Stat16.SMPTEOffset: // 0xFF54
                SMPTE.SetSMPTE(
                    FileHandle.Tracks[nTrackIndex].Data[nTrackOffset + 3],
                    FileHandle.Tracks[nTrackIndex].Data[nTrackOffset + 4],
                    FileHandle.Tracks[nTrackIndex].Data[nTrackOffset + 5],
                    FileHandle.Tracks[nTrackIndex].Data[nTrackOffset + 6],
                    FileHandle.Tracks[nTrackIndex].Data[nTrackOffset + 7]
                    );
                DELTA_Returned = FileHandle.Tracks[nTrackIndex].DeltaSeek(nTrackOffset);
                break;

            case Stat16.TimeSignature: // 0xFF58
                TimeSignature.SetSignature(
                    (int)this[nTrackIndex, nTrackOffset + 3],
                    (int)Math.Pow(-this[nTrackIndex, nTrackOffset + 4], 2),
                    (int)this[nTrackIndex, nTrackOffset + 5],
                    (int)this[nTrackIndex, nTrackOffset + 6]
                    );
                DELTA_Returned = FileHandle.Tracks[nTrackIndex].DeltaSeek(nTrackOffset);
                break;

            case Stat16.KeySignature: // 0xFF59
                KeySignature.SetSignature(
                    this[nTrackIndex, nTrackOffset + 3],
                    this[nTrackIndex, nTrackOffset + 4]);
                DELTA_Returned = FileHandle.Tracks[nTrackIndex].DeltaSeek(nTrackOffset);
                break;

            case Stat16.SequencerSpecific_70: // 0xFF70
            case Stat16.SequencerSpecific_71: // 0xFF71
            case Stat16.SequencerSpecific_72: // 0xFF72
            case Stat16.SequencerSpecific_73: // 0xFF73
            case Stat16.SequencerSpecific_74: // 0xFF74
            case Stat16.SequencerSpecific_75: // 0xFF75
            case Stat16.SequencerSpecific_76: // 0xFF76
            case Stat16.SequencerSpecific_77: // 0xFF77
            case Stat16.SequencerSpecific_78: // 0xFF78
            case Stat16.SequencerSpecific_79: // 0xFF79
            case Stat16.SequencerSpecific_7A: // 0xFF7A
            case Stat16.SequencerSpecific_7B: // 0xFF7B
            case Stat16.SequencerSpecific_7C: // 0xFF7C
            case Stat16.SequencerSpecific_7D: // 0xFF7D
            case Stat16.SequencerSpecific_7E: // 0xFF7E
            case Stat16.SequencerSpecific:    // 0xFF7F
                DELTA_Returned = FileHandle.Tracks[nTrackIndex].DeltaSeek(nTrackOffset);
                break;

            case Stat16.SystemExclusive:
                var pLastIndex = FileHandle[nTrackIndex].GetEndOfSystemExclusive(nTrackOffset);
                DELTA_Returned = pLastIndex;
                break;

            default:
            {
                if (FileHandle.Tracks[nTrackIndex].Data[nTrackOffset] < 0x80)
                {
                    CurrentStatus = CurrentRunningStatus16;
                    // Running Status
                    // int ExpandedRSE = CurrentTrackRunningStatus;// << 8;
                    int ExpandedRSE = CurrentRunningStatus8;// << 8;
                    int delta1      = -1;
                    if ((delta1 = Increment(nTrackOffset)) == -1)
                    {
                        int test = GetOffset(nTrackIndex, nTrackOffset);
                        Debug.Assert(false, string.Format("warning… {0:X2}, {1:X}|{1:N0}", ExpandedRSE, test));
                    }
                    else
                    {
                        DELTA_Returned = delta1;
                    }
                }
                else if (StatusQuery.IsMidiMessage(msg8))
                {
                    CurrentRunningStatus8  = msg8;
                    CurrentRunningStatus16 = msg16;
                    DELTA_Returned         = Increment(nTrackOffset + 1);
                    return(++DELTA_Returned);
                }
                else
                {
                    throw new FormatException("Bad format!\nThere is probably a problem with the Input File unless we made an error reading it!)");
                }
            }

            break;
            }
            return(++DELTA_Returned);
        }
Exemple #28
0
        /** Given the chord symbols for a track, create a new symbol list
         * that contains the chord symbols, vertical bars, rests, and clef changes.
         * Return a list of symbols (ChordSymbol, BarSymbol, RestSymbol, ClefSymbol)
         */
        private List<MusicSymbol> CreateSymbols(List<ChordSymbol> chords, ClefMeasures clefs,
            TimeSignature time, int lastStart)
        {
            List<MusicSymbol> symbols = new List<MusicSymbol>();
            symbols = AddBars(chords, time, lastStart);
            symbols = AddRests(symbols, time);
            symbols = AddClefChanges(symbols, clefs, time);

            return symbols;
        }
Exemple #29
0
 public double GetQuantizedNoteLength(double bpm, TimeSignature timeSig)
 {
     double bps = bpm / 60d;
     double beats = Duration.Seconds * bps;
     return beats / timeSig.BottomNumber;
 }
Exemple #30
0
        /** Connect chords of the same duration with a horizontal beam.
         *
         *  We create beams in the following order:
         *  - 6 connected 8th note chords, in 3/4, 6/8, or 6/4 time
         *  - Triplets that start on quarter note beats
         *  - 3 connected chords that start on quarter note beats (12/8 time only)
         *  - 4 connected chords that start on quarter note beats (4/4 or 2/4 time only)
         *  - 2 connected chords that start on quarter note beats
         *  - 2 connected chords that start on any beat
         */
        private static void CreateAllBeamedChords(List<MusicSymbol>[] allsymbols, TimeSignature time)
        {
            if ((time.Numerator == 3 && time.Denominator == 4) ||
            (time.Numerator == 6 && time.Denominator == 8) ||
            (time.Numerator == 6 && time.Denominator == 4) ) {

            CreateBeamedChords(allsymbols, time, 6, true);
            }
            CreateBeamedChords(allsymbols, time, 3, true);
            CreateBeamedChords(allsymbols, time, 4, true);
            CreateBeamedChords(allsymbols, time, 2, true);
            CreateBeamedChords(allsymbols, time, 2, false);
        }
Exemple #31
0
        private void handleTimingPoint(string line)
        {
            string[] split = line.Split(',');

            double time            = getOffsetTime(Parsing.ParseDouble(split[0].Trim()));
            double beatLength      = Parsing.ParseDouble(split[1].Trim());
            double speedMultiplier = beatLength < 0 ? 100.0 / -beatLength : 1;

            TimeSignature timeSignature = TimeSignature.SimpleQuadruple;

            if (split.Length >= 3)
            {
                timeSignature = split[2][0] == '0' ? TimeSignature.SimpleQuadruple : new TimeSignature(Parsing.ParseInt(split[2]));
            }

            LegacySampleBank sampleSet = defaultSampleBank;

            if (split.Length >= 4)
            {
                sampleSet = (LegacySampleBank)Parsing.ParseInt(split[3]);
            }

            int customSampleBank = 0;

            if (split.Length >= 5)
            {
                customSampleBank = Parsing.ParseInt(split[4]);
            }

            int sampleVolume = defaultSampleVolume;

            if (split.Length >= 6)
            {
                sampleVolume = Parsing.ParseInt(split[5]);
            }

            bool timingChange = true;

            if (split.Length >= 7)
            {
                timingChange = split[6][0] == '1';
            }

            bool kiaiMode = false;
            bool omitFirstBarSignature = false;

            if (split.Length >= 8)
            {
                LegacyEffectFlags effectFlags = (LegacyEffectFlags)Parsing.ParseInt(split[7]);
                kiaiMode = effectFlags.HasFlagFast(LegacyEffectFlags.Kiai);
                omitFirstBarSignature = effectFlags.HasFlagFast(LegacyEffectFlags.OmitFirstBarLine);
            }

            string stringSampleSet = sampleSet.ToString().ToLowerInvariant();

            if (stringSampleSet == @"none")
            {
                stringSampleSet = @"normal";
            }

            if (timingChange)
            {
                var controlPoint = CreateTimingControlPoint();

                controlPoint.BeatLength    = beatLength;
                controlPoint.TimeSignature = timeSignature;

                addControlPoint(time, controlPoint, true);
            }

#pragma warning disable 618
            addControlPoint(time, new LegacyDifficultyControlPoint(beatLength)
#pragma warning restore 618
            {
                SliderVelocity = speedMultiplier,
            }, timingChange);

            var effectPoint = new EffectControlPoint
            {
                KiaiMode         = kiaiMode,
                OmitFirstBarLine = omitFirstBarSignature,
            };

            int onlineRulesetID = beatmap.BeatmapInfo.Ruleset.OnlineID;

            // osu!taiko and osu!mania use effect points rather than difficulty points for scroll speed adjustments.
            if (onlineRulesetID == 1 || onlineRulesetID == 3)
            {
                effectPoint.ScrollSpeed = speedMultiplier;
            }

            addControlPoint(time, effectPoint, timingChange);

            addControlPoint(time, new LegacySampleControlPoint
            {
                SampleBank       = stringSampleSet,
                SampleVolume     = sampleVolume,
                CustomSampleBank = customSampleBank,
            }, timingChange);
        }
Exemple #32
0
        /** Find 2, 3, 4, or 6 chord symbols that occur consecutively (without any
         *  rests or bars in between).  There can be BlankSymbols in between.
         *
         *  The startIndex is the index in the symbols to start looking from.
         *
         *  Store the indexes of the consecutive chords in chordIndexes.
         *  Store the horizontal distance (pixels) between the first and last chord.
         *  If we failed to find consecutive chords, return false.
         */
        private static bool FindConsecutiveChords(List<MusicSymbol> symbols, TimeSignature time,
            int startIndex, int[] chordIndexes,
            ref int horizDistance)
        {
            int i = startIndex;
            int numChords = chordIndexes.Length;

            while (true) {
            horizDistance = 0;

            /* Find the starting chord */
            while (i < symbols.Count - numChords) {
                if (symbols[i] is ChordSymbol) {
                    ChordSymbol c = (ChordSymbol) symbols[i];
                    if (c.Stem != null) {
                        break;
                    }
                }
                i++;
            }
            if (i >= symbols.Count - numChords) {
                chordIndexes[0] = -1;
                return false;
            }
            chordIndexes[0] = i;
            bool foundChords = true;
            for (int chordIndex = 1; chordIndex < numChords; chordIndex++) {
                i++;
                int remaining = numChords - 1 - chordIndex;
                while ((i < symbols.Count - remaining) && (symbols[i] is BlankSymbol)) {
                    horizDistance += symbols[i].Width;
                    i++;
                }
                if (i >= symbols.Count - remaining) {
                    return false;
                }
                if (!(symbols[i] is ChordSymbol)) {
                    foundChords = false;
                    break;
                }
                chordIndexes[chordIndex] = i;
                horizDistance += symbols[i].Width;
            }
            if (foundChords) {
                return true;
            }

            /* Else, start searching again from index i */
            }
        }
Exemple #33
0
 /// <summary>Gets the end time position of this event based on the used <seealso cref="TimeSignature"/>.</summary>
 /// <param name="timeSignature">The <seealso cref="TimeSignature"/> based on which to calculate the end time position of the event.</param>
 public MeasuredTimePosition GetEnd(TimeSignature timeSignature) => TimePosition.Add(Duration, timeSignature);
Exemple #34
0
 /** The current clef is always shown at the beginning of the staff, on
  * the left side.  However, the clef can also change from measure to
  * measure. When it does, a Clef symbol must be shown to indicate the
  * change in clef.  This function adds these Clef change symbols.
  * This function does not add the main Clef Symbol that begins each
  * staff.  That is done in the Staff() contructor.
  */
 private List<MusicSymbol> AddClefChanges(List<MusicSymbol> symbols,
     ClefMeasures clefs,
     TimeSignature time)
 {
     List<MusicSymbol> result = new List<MusicSymbol>( symbols.Count );
     Clef prevclef = clefs.GetClef(0);
     foreach (MusicSymbol symbol in symbols) {
     /* A BarSymbol indicates a new measure */
     if (symbol is BarSymbol) {
         Clef clef = clefs.GetClef(symbol.StartTime);
         if (clef != prevclef) {
             result.Add(new ClefSymbol(clef, symbol.StartTime-1, true));
         }
         prevclef = clef;
     }
     result.Add(symbol);
     }
     return result;
 }
Exemple #35
0
        private void WriteMeasureHeader(MeasureHeader measure, TimeSignature timeSignature)
        {
            sbyte flags = 0;

            if (measure.Number == 0)
            {
                flags |= 0x40;
            }
            if (measure.Number == 0 ||
                !(measure.TimeSignature.Denominator.Value == timeSignature.Denominator.Value &&
                  measure.TimeSignature.Numerator == timeSignature.Numerator))
            {
                flags |= 0x01;
                flags |= 0x02;
            }
            if (measure.IsRepeatOpen)
            {
                flags |= 0x04;
            }
            if (measure.RepeatClose > 0)
            {
                flags |= 0x08;
            }
            if (measure.RepeatAlternative > 0)
            {
                flags |= 0x10;
            }
            if (measure.Marker != null)
            {
                flags |= 0x20;
            }

            WriteUnsignedByte(flags);

            if ((flags & 0x01) != 0)
            {
                WriteByte((byte)measure.TimeSignature.Numerator);
            }
            if ((flags & 0x02) != 0)
            {
                WriteByte((byte)measure.TimeSignature.Denominator.Value);
            }
            if ((flags & 0x08) != 0)
            {
                WriteByte((byte)(measure.RepeatClose + 1));
            }
            if ((flags & 0x20) != 0)
            {
                WriteMarker(measure.Marker);
            }
            if ((flags & 0x10) != 0)
            {
                WriteByte((byte)measure.RepeatAlternative);
            }
            if ((flags & 0x40) != 0)
            {
                SkipBytes(2);
            }
            if ((flags & 0x01) != 0)
            {
                WriteBytes(MakeBeamEighthNoteBytes(measure.TimeSignature));
            }
            if ((flags & 0x10) == 0)
            {
                WriteByte((byte)0);
            }
            if (measure.TripletFeel == MeasureHeader.TripletFeelNone)
            {
                WriteByte((byte)0);
            }
            else if (measure.TripletFeel == MeasureHeader.TripletFeelEighth)
            {
                WriteByte((byte)1);
            }
            else if (measure.TripletFeel == MeasureHeader.TripletFeelSixteenth)
            {
                WriteByte((byte)2);
            }
        }
Exemple #36
0
        /** Create the chord symbols for a single track.
         * @param midinotes  The Midinotes in the track.
         * @param key        The Key Signature, for determining sharps/flats.
         * @param time       The Time Signature, for determining the measures.
         * @param clefs      The clefs to use for each measure.
         * @ret An array of ChordSymbols
         */
        private List<ChordSymbol> CreateChords(List<MidiNote> midinotes, 
            KeySignature key,
            TimeSignature time,
            ClefMeasures clefs)
        {
            int i = 0;
            List<ChordSymbol> chords = new List<ChordSymbol>();
            List<MidiNote> notegroup = new List<MidiNote>(12);
            int len = midinotes.Count;

            while (i < len) {

            int starttime = midinotes[i].StartTime;
            Clef clef = clefs.GetClef(starttime);

            /* Group all the midi notes with the same start time
             * into the notes list.
             */
            notegroup.Clear();
            notegroup.Add(midinotes[i]);
            i++;
            while (i < len && midinotes[i].StartTime == starttime) {
                notegroup.Add(midinotes[i]);
                i++;
            }

            /* Create a single chord from the group of midi notes with
             * the same start time.
             */
            ChordSymbol chord = new ChordSymbol(notegroup, key, time, clef, this);
            chords.Add(chord);
            }

            return chords;
        }
Exemple #37
0
 /// <summary>Initializes a new instance of the <seealso cref="RelativeTimingPoint"/> class.</summary>
 /// <param name="timePosition">The time position of the event.</param>
 /// <param name="bpm">The BPM of the timing point.</param>
 /// <param name="timeSignature">The time signature of the timing point.</param>
 public RelativeTimingPoint(MeasuredTimePosition timePosition, BPM bpm, TimeSignature timeSignature)
     : base(timePosition, bpm, timeSignature)
 {
 }