public YPitchBendCube(Point3D center, double radius, 
                Pitch pitch, Instrument instrument, OutputDevice device, Channel channel)
            : base(center, radius, new InstrumentNoteAction(device, channel, pitch)) {

                outputDevice = device;
                this.channel = channel;
        }
Exemple #2
0
        public Chord GenerateMajor(Pitch root, int inversion, int startInterval, NoteLength noteLength, byte velocity = 100)
        {
            var inversionOffset = new int[3];

            switch (inversion)
            {
                case 0:
                    inversionOffset = NoInversion;
                    break;
                case 1:
                    inversionOffset = FirstInversion;
                    break;
            };

            int note1 = (int)root + inversionOffset[0];
            int note2 = (int)root + inversionOffset[1];
            int note3 = (int)root + inversionOffset[2];

            var notes = new List<Note>
            {
                new Note(PitchCode.GetNoteName(note1), startInterval, noteLength, velocity),
                new Note(PitchCode.GetNoteName(note2), startInterval, noteLength, velocity),
                new Note(PitchCode.GetNoteName(note3), startInterval, noteLength, velocity)
            };

            return new Chord
            {
                Notes = notes
            };
        }
        public MidiMappingRecord[] FindMatchesInBuffer(Pitch[] buffer)
        {
            var results = new List<MidiMappingRecord>();
            var events = buffer.Cast<Pitch?>().ToArray();

            // Process chords first. Try to capture a chord with as many notes as possible.
            // This is O(scary), but seems quick enough in practice. (c) StackOverflow #184618
            foreach (var mapping in chordMappingsOrdered)
            {
                bool isChordComplete = mapping.Trigger.Pitches.All(p => events.Any(e => e.HasValue && e == p));
                if (isChordComplete)
                {
                    // Exclude matched notes from further processing.
                    for (int i = 0; i < events.Length; i++)
                    {
                        var pitch = events[i].Value;
                        if (mapping.Trigger.Pitches.Any(p => p == pitch))
                        {
                            events[i] = null;
                        }
                    }
                    results.Add(mapping);
                }
            }

            // Process remaining single notes.
            foreach (var e in events.Where(e => e.HasValue))
            {
                results.AddRange(FindSingleNoteMatches(e.Value));
            }

            return results.ToArray();
        }
Exemple #4
0
 public ToggleBox(int left, int top, Pitch pitch)
 {
     newToggleBox();
     this.Left = left;
     this.Top = top;
     this.pitch = pitch;
 }
 /// <summary>
 /// Spawns the particle system randomly inside a sphere of size
 /// randomRadius and centered on this object.
 /// </summary>
 public void randomSpawnParticle(ParticleSystem ps, Pitch pitch)
 {
     Vector3 randOffset = Random.insideUnitSphere * randomRadius;
     Vector3 center = this.transform.position;
     ParticleSystem tempParticles =
         Instantiate(ps, center + randOffset, Quaternion.identity) as ParticleSystem;
     tempParticles.startColor = NoteDecorator.pitchToColor(pitch);
 }
Exemple #6
0
		internal LibNoteMessage(Pitch pitch, int velocity, float time, MessageType type, int channel)
		{
			Pitch = pitch;
			Velocity = velocity;
			Time = time;
			Type = type;
			Channel = channel;
		}
 public void DoAction() {
     // start playing the note
     if (!isPlaying) {
         if (!internalPitch.IsInMidiRange())
             internalPitch = Pitch.C4;
         Device.SendNoteOn(Channel, internalPitch, 64 );
         isPlaying = true;
     }
 }
Exemple #8
0
        public void Pitch_Plus_Interval_Gives_Higher_Pitch()
        {
            var original = new Pitch(100);
            var second = new Interval(IntervalDistance.MajorSecond);

            var higher = original + second;

            Assert.True(higher > original);
            Assert.Equal(IntervalDistance.MajorSecond, (higher - original).Distance);
        }
Exemple #9
0
 public override void Run()
 {
     OutputDevice outputDevice = ExampleUtil.ChooseOutputDeviceFromConsole();
     char inp;
     int dx;
     Pitch[] notes=new Pitch[7] { Pitch.A4, Pitch.B4, Pitch.C4, Pitch.D4, Pitch.E4, Pitch.F4, Pitch.G4 };
     Percussion[] drums=new Percussion[3] { Percussion.BassDrum1, Percussion.MidTom1, Percussion.CrashCymbal1 };
     if(outputDevice==null) {
         Console.WriteLine("\nNo output devices, so can't run this example.");
         ExampleUtil.PressAnyKeyToContinue();
         return;
     }
     if(!File.Exists(PiPath)) {
         Console.WriteLine("\nCould not find the data file: {0}", PiPath);
         ExampleUtil.PressAnyKeyToContinue();
         return;
     }
     Console.WriteLine("This didn't turn out well at all. A back beat may help it but I'm moving on for now.\n\n");
     Console.WriteLine("The follow 10 notes will be used:");
     for(dx=0; dx<10 && Console.KeyAvailable==false; dx++) {
         if(dx>=notes.Length) {
             Console.WriteLine("\tDigit {0} is represented by a {1} drum.", dx, drums[dx-notes.Length].ToString());
         } else {
             Console.WriteLine("\tDigit {0} is represented by a {1} note.", dx, notes[dx].ToString());
         }
     }
     Console.WriteLine("Interpreting Pi...Press any key to stop...\n\n");
     outputDevice.Open();
     // outputDevice.SendProgramChange(Channel.Channel1, Instrument.AltoSax);
     outputDevice.SendControlChange(Channel.Channel1, Control.SustainPedal, 0);
     try {
         using(StreamReader sr=new StreamReader(PiPath)) {
             while(sr.Peek()>=0 && Console.KeyAvailable==false) {
                 inp=(char)sr.Read();
                 if(Char.IsNumber(inp)) { // Skip over non numbers.
                     Console.Write(inp);
                     dx=(int)Char.GetNumericValue(inp);
                     if(dx>=notes.Length) outputDevice.SendPercussion(drums[dx-notes.Length], 90);
                     else outputDevice.SendNoteOn(Channel.Channel1, notes[dx], 80);
                     Thread.Sleep(500);
                 }
             }
         }
     } catch(FieldAccessException e) {
         Console.WriteLine("\nError: Could not access file {0}\n\nThe exception was: {1}\n", PiPath, e.Message);
     } catch(Exception e) {
         Console.WriteLine("\nError: {1}\n", PiPath, e.Message);
     }
     outputDevice.Close();
     while(Console.KeyAvailable) { Console.ReadKey(false); }
     Console.WriteLine();
     ExampleUtil.PressAnyKeyToContinue();
 }
Exemple #10
0
 /// <summary>
 /// Decodes a Note Off short message.
 /// </summary>
 /// <param name="dwParam1">The dwParam1 arg passed to MidiInProc.</param>
 /// <param name="dwParam2">The dwParam2 arg passed to MidiInProc.</param>
 /// <param name="channel">Filled in with the channel.</param>
 /// <param name="pitch">Filled in with the pitch.</param>
 /// <param name="velocity">Filled in with the velocity, 0.127</param>
 /// <param name="timestamp">Filled in with the timestamp in microseconds since
 /// midiInStart().</param>
 public static void DecodeNoteOff(UIntPtr dwParam1, UIntPtr dwParam2,
     out Channel channel, out Pitch pitch, out int velocity, out UInt32 timestamp)
 {
     if (!IsNoteOff(dwParam1, dwParam2))
     {
         throw new ArgumentException("Not a Note Off message.");
     }
     channel = (Channel)((int)dwParam1 & 0x0f);
     pitch = (Pitch)(((int)dwParam1 & 0xff00) >> 8);
     velocity = (((int)dwParam1 & 0xff0000) >> 16);
     timestamp = (UInt32)dwParam2;
 }
Exemple #11
0
 public override void Run()
 {
     OutputDevice outputDevice = ExampleUtil.ChooseOutputDeviceFromConsole();
     char inp;
     int dx;
     Pitch[] notes=new Pitch[10] { Pitch.F3, Pitch.A4, Pitch.B4, Pitch.C4, Pitch.D4, Pitch.E4, Pitch.F4, Pitch.G4, Pitch.A5, Pitch.B6 };
     if(outputDevice==null) {
         Console.WriteLine("\nNo output devices, so can't run this example.");
         ExampleUtil.PressAnyKeyToContinue();
         return;
     }
     if(!File.Exists(PiPath)) {
         Console.WriteLine("\nCould not find the data file: {0}", PiPath);
         ExampleUtil.PressAnyKeyToContinue();
         return;
     }
     Console.WriteLine("This version simply pads the extra data space with notes from adjacent octaves.\n");
     Console.WriteLine("This version many will say is the most accurately reproduction of Pi. That may be true but "+
         "at the same time every way of doing this involves a lot of fiddling with the numbers anyway. I wouldn't "+
         "be surprised if there are people out there who could listen to this and write down the digits. That "+
         "is probably not true of most of the other methods.\n\n");
     Console.WriteLine("The follow 10 notes will be used:");
     for(dx=0; dx<10 && Console.KeyAvailable==false; dx++) {
         Console.WriteLine("\tDigit {0} is represented by a {1} note.", dx, notes[dx].ToString());
     }
     Console.WriteLine("Interpreting Pi...Press any key to stop...\n\n");
     outputDevice.Open();
     // outputDevice.SendProgramChange(Channel.Channel1, Instrument.AltoSax);
     outputDevice.SendControlChange(Channel.Channel1, Control.SustainPedal, 0);
     try {
         using(StreamReader sr=new StreamReader(PiPath)) {
             while(sr.Peek()>=0 && Console.KeyAvailable==false) {
                 inp=(char)sr.Read();
                 if(Char.IsNumber(inp)) { // Skip over non numbers.
                     Console.Write(inp);
                     outputDevice.SendNoteOn(Channel.Channel1, notes[(int)Char.GetNumericValue(inp)], 80);
                     Thread.Sleep(200);
                     outputDevice.SendNoteOff(Channel.Channel1, notes[(int)Char.GetNumericValue(inp)], 80);
                     Thread.Sleep(100);
                 }
             }
         }
     } catch(FieldAccessException e) {
         Console.WriteLine("\nError: Could not access file {0}\n\nThe exception was: {1}\n", PiPath, e.Message);
     } catch(Exception e) {
         Console.WriteLine("\nError: {1}\n", PiPath, e.Message);
     }
     outputDevice.Close();
     while(Console.KeyAvailable) {Console.ReadKey(false);}
     Console.WriteLine();
     ExampleUtil.PressAnyKeyToContinue();
 }
Exemple #12
0
 /// <summary>
 /// 初略想法,等待弹奏事件,正确就继续,错误继续等待
 /// 同GamePlayer CurrentEvent 需要改造
 /// </summary>
 /// <param name="pitch"></param>
 private void ProcessPitch(Pitch pitch)
 {
     Console.WriteLine("pitch:" + pitch + " waitPitch:" + waitPitch);
     if (pitch == waitPitch)
     {
         processer.Continue();
         OnLearing(true, null);
     }
     else
     {
         OnLearing(false, null);
     }
 }
Exemple #13
0
 /// <summary>
 /// Encodes a Note On short message.
 /// </summary>
 /// <param name="channel">The channel.</param>
 /// <param name="pitch">The pitch.</param>
 /// <param name="velocity">The velocity 0..127.</param>
 /// <returns>A value that can be passed to midiOutShortMsg.</returns>
 /// <exception cref="ArgumentOutOfRangeException">pitch is not in MIDI range.</exception>
 public static UInt32 EncodeNoteOn(Channel channel, Pitch pitch, int velocity)
 {
     channel.Validate();
     if (!pitch.IsInMidiRange())
     {
         throw new ArgumentOutOfRangeException("Pitch out of MIDI range.");
     }
     if (velocity < 0 || velocity > 127)
     {
         throw new ArgumentOutOfRangeException("Velocity is out of range.");
     }
     return (UInt32)(0x90 | ((int)channel) | ((int)pitch << 8) | (velocity << 16));
 }
Exemple #14
0
        public LearningPlayer(InputDevice input, MidiFile midifile, MidiOptions midiOption)
        {
            processer = new MidiProcesser(midifile, midiOption);
            inputDevice = input;
            inputDevice.NoteOn += delegate(NoteOnMessage msg)
            {
                ProcessPitch(msg.Pitch);
            };

            processer.NoteOn += delegate(Channel channel, Pitch pitch, int velocity)
            {
                waitPitch = pitch;
                processer.Stop();
            };
        }
Exemple #15
0
        private List<Pitch> ThirdChordNote(Pitch pitch1, Pitch pitch2)
        {
            List<Pitch> p;

            Pitch[] pitchnote1 = Second[pitch1];
            if (Second.ContainsKey(pitch2))
            {
                Pitch[] pitchnote2 = Second[pitch2];
                p =  pitchnote1.Intersect(pitchnote2).ToList();
            }
            else
            {
                p = pitchnote1.ToList();
            }
            p.Remove(pitch2);
            return p;
        }
Exemple #16
0
 public static double PitchToFrequency(Pitch pitch)
 {
     return PitchToFrequency((int)pitch);
 }
 /// <summary>
 /// Sends a Note Off message to this MIDI output device.
 /// </summary>
 /// <param name="channel">The channel.</param>
 /// <param name="pitch">The pitch.</param>
 /// <param name="velocity">The velocity 0..127.</param>
 /// <exception cref="ArgumentOutOfRangeException">channel, note, or velocity is
 /// out-of-range.</exception>
 /// <exception cref="InvalidOperationException">The device is not open.</exception>
 /// <exception cref="DeviceException">The message cannot be sent.</exception>
 public void SendNoteOff(Channel channel, Pitch pitch, int velocity)
 {
     lock (this)
     {
         CheckOpen();
         CheckReturnCode(Win32API.midiOutShortMsg(handle, ShortMsg.EncodeNoteOff(channel,
             pitch, velocity)));
     }
 }
Exemple #18
0
 /// <summary>
 /// If the specified key is one of the computer keys used for mock MIDI input, returns true
 /// and sets pitch to the value.
 /// </summary>
 /// <param name="key">The computer key pressed.</param>
 /// <param name="pitch">The pitch it mocks.</param>
 /// <returns></returns>
 public static bool IsMockPitch(ConsoleKey key, out Pitch pitch)
 {
     if (mockKeys.ContainsKey(key))
     {
         pitch = (Pitch)mockKeys[key];
         return true;
     }
     pitch = 0;
     return false;
 }
 public string PitchToString_UnalteredNotesPassed_DoesNotAddSharpsOrFlats_Test(Pitch pitch)
 {
     return PitchConverter.PitchToString(pitch);
 }
Exemple #20
0
        // Generates content of fontTablePart1.
        private void GenerateFontTablePart1Content(FontTablePart fontTablePart1)
        {
            Fonts fonts1 = new Fonts() { MCAttributes = new MarkupCompatibilityAttributes() { Ignorable = "w14 w15" } };
            fonts1.AddNamespaceDeclaration("mc", "http://schemas.openxmlformats.org/markup-compatibility/2006");
            fonts1.AddNamespaceDeclaration("r", "http://schemas.openxmlformats.org/officeDocument/2006/relationships");
            fonts1.AddNamespaceDeclaration("w", "http://schemas.openxmlformats.org/wordprocessingml/2006/main");
            fonts1.AddNamespaceDeclaration("w14", "http://schemas.microsoft.com/office/word/2010/wordml");
            fonts1.AddNamespaceDeclaration("w15", "http://schemas.microsoft.com/office/word/2012/wordml");

            Font font1 = new Font() { Name = "Calibri" };
            Panose1Number panose1Number1 = new Panose1Number() { Val = "020F0502020204030204" };
            FontCharSet fontCharSet1 = new FontCharSet() { Val = "00" };
            FontFamily fontFamily1 = new FontFamily() { Val = FontFamilyValues.Swiss };
            Pitch pitch1 = new Pitch() { Val = FontPitchValues.Variable };
            FontSignature fontSignature1 = new FontSignature() { UnicodeSignature0 = "E00002FF", UnicodeSignature1 = "4000ACFF", UnicodeSignature2 = "00000001", UnicodeSignature3 = "00000000", CodePageSignature0 = "0000019F", CodePageSignature1 = "00000000" };

            font1.Append(panose1Number1);
            font1.Append(fontCharSet1);
            font1.Append(fontFamily1);
            font1.Append(pitch1);
            font1.Append(fontSignature1);

            Font font2 = new Font() { Name = "Times New Roman" };
            Panose1Number panose1Number2 = new Panose1Number() { Val = "02020603050405020304" };
            FontCharSet fontCharSet2 = new FontCharSet() { Val = "00" };
            FontFamily fontFamily2 = new FontFamily() { Val = FontFamilyValues.Roman };
            Pitch pitch2 = new Pitch() { Val = FontPitchValues.Variable };
            FontSignature fontSignature2 = new FontSignature() { UnicodeSignature0 = "E0002EFF", UnicodeSignature1 = "C0007843", UnicodeSignature2 = "00000009", UnicodeSignature3 = "00000000", CodePageSignature0 = "000001FF", CodePageSignature1 = "00000000" };

            font2.Append(panose1Number2);
            font2.Append(fontCharSet2);
            font2.Append(fontFamily2);
            font2.Append(pitch2);
            font2.Append(fontSignature2);

            Font font3 = new Font() { Name = "Arial" };
            Panose1Number panose1Number3 = new Panose1Number() { Val = "020B0604020202020204" };
            FontCharSet fontCharSet3 = new FontCharSet() { Val = "00" };
            FontFamily fontFamily3 = new FontFamily() { Val = FontFamilyValues.Swiss };
            Pitch pitch3 = new Pitch() { Val = FontPitchValues.Variable };
            FontSignature fontSignature3 = new FontSignature() { UnicodeSignature0 = "E0002EFF", UnicodeSignature1 = "C0007843", UnicodeSignature2 = "00000009", UnicodeSignature3 = "00000000", CodePageSignature0 = "000001FF", CodePageSignature1 = "00000000" };

            font3.Append(panose1Number3);
            font3.Append(fontCharSet3);
            font3.Append(fontFamily3);
            font3.Append(pitch3);
            font3.Append(fontSignature3);

            Font font4 = new Font() { Name = "Calibri Light" };
            Panose1Number panose1Number4 = new Panose1Number() { Val = "020F0302020204030204" };
            FontCharSet fontCharSet4 = new FontCharSet() { Val = "00" };
            FontFamily fontFamily4 = new FontFamily() { Val = FontFamilyValues.Swiss };
            Pitch pitch4 = new Pitch() { Val = FontPitchValues.Variable };
            FontSignature fontSignature4 = new FontSignature() { UnicodeSignature0 = "A00002EF", UnicodeSignature1 = "4000207B", UnicodeSignature2 = "00000000", UnicodeSignature3 = "00000000", CodePageSignature0 = "0000019F", CodePageSignature1 = "00000000" };

            font4.Append(panose1Number4);
            font4.Append(fontCharSet4);
            font4.Append(fontFamily4);
            font4.Append(pitch4);
            font4.Append(fontSignature4);

            fonts1.Append(font1);
            fonts1.Append(font2);
            fonts1.Append(font3);
            fonts1.Append(font4);

            fontTablePart1.Fonts = fonts1;
        }
        // Generates content of fontTablePart1.
        private void GenerateFontTablePart1Content(FontTablePart fontTablePart1)
        {
            Fonts fonts1 = new Fonts(){ MCAttributes = new MarkupCompatibilityAttributes(){ Ignorable = "w14 w15" }  };
            fonts1.AddNamespaceDeclaration("mc", "http://schemas.openxmlformats.org/markup-compatibility/2006");
            fonts1.AddNamespaceDeclaration("r", "http://schemas.openxmlformats.org/officeDocument/2006/relationships");
            fonts1.AddNamespaceDeclaration("w", "http://schemas.openxmlformats.org/wordprocessingml/2006/main");
            fonts1.AddNamespaceDeclaration("w14", "http://schemas.microsoft.com/office/word/2010/wordml");
            fonts1.AddNamespaceDeclaration("w15", "http://schemas.microsoft.com/office/word/2010/11/wordml");

            Font font1 = new Font(){ Name = "Century" };
            Panose1Number panose1Number1 = new Panose1Number(){ Val = "02040604050505020304" };
            FontCharSet fontCharSet1 = new FontCharSet(){ Val = "00" };
            FontFamily fontFamily1 = new FontFamily(){ Val = FontFamilyValues.Roman };
            Pitch pitch1 = new Pitch(){ Val = FontPitchValues.Variable };
            FontSignature fontSignature1 = new FontSignature(){ UnicodeSignature0 = "00000287", UnicodeSignature1 = "00000000", UnicodeSignature2 = "00000000", UnicodeSignature3 = "00000000", CodePageSignature0 = "0000009F", CodePageSignature1 = "00000000" };

            font1.Append(panose1Number1);
            font1.Append(fontCharSet1);
            font1.Append(fontFamily1);
            font1.Append(pitch1);
            font1.Append(fontSignature1);

            Font font2 = new Font(){ Name = "MS 明朝" };
            AltName altName1 = new AltName(){ Val = "MS Mincho" };
            Panose1Number panose1Number2 = new Panose1Number(){ Val = "02020609040205080304" };
            FontCharSet fontCharSet2 = new FontCharSet(){ Val = "80" };
            FontFamily fontFamily2 = new FontFamily(){ Val = FontFamilyValues.Roman };
            Pitch pitch2 = new Pitch(){ Val = FontPitchValues.Fixed };
            FontSignature fontSignature2 = new FontSignature(){ UnicodeSignature0 = "E00002FF", UnicodeSignature1 = "6AC7FDFB", UnicodeSignature2 = "00000012", UnicodeSignature3 = "00000000", CodePageSignature0 = "0002009F", CodePageSignature1 = "00000000" };

            font2.Append(altName1);
            font2.Append(panose1Number2);
            font2.Append(fontCharSet2);
            font2.Append(fontFamily2);
            font2.Append(pitch2);
            font2.Append(fontSignature2);

            Font font3 = new Font(){ Name = "Times New Roman" };
            Panose1Number panose1Number3 = new Panose1Number(){ Val = "02020603050405020304" };
            FontCharSet fontCharSet3 = new FontCharSet(){ Val = "00" };
            FontFamily fontFamily3 = new FontFamily(){ Val = FontFamilyValues.Roman };
            Pitch pitch3 = new Pitch(){ Val = FontPitchValues.Variable };
            FontSignature fontSignature3 = new FontSignature(){ UnicodeSignature0 = "E0002AFF", UnicodeSignature1 = "C0007841", UnicodeSignature2 = "00000009", UnicodeSignature3 = "00000000", CodePageSignature0 = "000001FF", CodePageSignature1 = "00000000" };

            font3.Append(panose1Number3);
            font3.Append(fontCharSet3);
            font3.Append(fontFamily3);
            font3.Append(pitch3);
            font3.Append(fontSignature3);

            Font font4 = new Font(){ Name = "MS ゴシック" };
            AltName altName2 = new AltName(){ Val = "MS Gothic" };
            Panose1Number panose1Number4 = new Panose1Number(){ Val = "020B0609070205080204" };
            FontCharSet fontCharSet4 = new FontCharSet(){ Val = "80" };
            FontFamily fontFamily4 = new FontFamily(){ Val = FontFamilyValues.Modern };
            Pitch pitch4 = new Pitch(){ Val = FontPitchValues.Fixed };
            FontSignature fontSignature4 = new FontSignature(){ UnicodeSignature0 = "E00002FF", UnicodeSignature1 = "6AC7FDFB", UnicodeSignature2 = "00000012", UnicodeSignature3 = "00000000", CodePageSignature0 = "0002009F", CodePageSignature1 = "00000000" };

            font4.Append(altName2);
            font4.Append(panose1Number4);
            font4.Append(fontCharSet4);
            font4.Append(fontFamily4);
            font4.Append(pitch4);
            font4.Append(fontSignature4);

            Font font5 = new Font(){ Name = "Arial" };
            Panose1Number panose1Number5 = new Panose1Number(){ Val = "020B0604020202020204" };
            FontCharSet fontCharSet5 = new FontCharSet(){ Val = "00" };
            FontFamily fontFamily5 = new FontFamily(){ Val = FontFamilyValues.Swiss };
            Pitch pitch5 = new Pitch(){ Val = FontPitchValues.Variable };
            FontSignature fontSignature5 = new FontSignature(){ UnicodeSignature0 = "E0002AFF", UnicodeSignature1 = "C0007843", UnicodeSignature2 = "00000009", UnicodeSignature3 = "00000000", CodePageSignature0 = "000001FF", CodePageSignature1 = "00000000" };

            font5.Append(panose1Number5);
            font5.Append(fontCharSet5);
            font5.Append(fontFamily5);
            font5.Append(pitch5);
            font5.Append(fontSignature5);

            fonts1.Append(font1);
            fonts1.Append(font2);
            fonts1.Append(font3);
            fonts1.Append(font4);
            fonts1.Append(font5);

            fontTablePart1.Fonts = fonts1;
        }
Exemple #22
0
 public void Flattened_Pitch_Is_Lower_Than_Original()
 {
     var original = new Pitch(100);
     Assert.True(original.Flatten() < original);
 }
Exemple #23
0
		public NoteOnOff(Pitch pitch, int velocity, float time, float duration, int channel = 0) : base(pitch, velocity, time, MessageType.On, channel)
		{
			Chain = new NoteOff(pitch, velocity, time + duration, channel);
		}
Exemple #24
0
 /// <summary>
 /// Returns true if this chord contains the specified pitch.
 /// </summary>
 /// <param name="pitch">The pitch to test.</param>
 /// <returns>True if this chord contains the pitch.</returns>
 public bool Contains(Pitch pitch)
 {
     return positionInOctaveToContains[pitch.PositionInOctave()];
 }
Exemple #25
0
 public bool Contains(Pitch pitch)
 {
     return Contains(pitch.Note);
 }
 public string PitchToString_AlteredNotesPassed_AddsAlterationSymbols_Test(Pitch pitch)
 {
     return PitchConverter.PitchToString(pitch);
 }
Exemple #27
0
 public void Sharpened_Pitch_Is_Higher_Than_Original()
 {
     var original = new Pitch(100);
     Assert.True(original.Sharpen() > original);
 }
 public string PitchToString_NegativeOctavePassed_NegativeOctaveInOutput_Test(Pitch pitch)
 {
     return PitchConverter.PitchToString(pitch);
 }
        // Generates content of fontTablePart2.
        private void GenerateFontTablePart2Content(FontTablePart fontTablePart2)
        {
            Fonts fonts2 = new Fonts(){ MCAttributes = new MarkupCompatibilityAttributes(){ Ignorable = "w14 w15" }  };
            fonts2.AddNamespaceDeclaration("mc", "http://schemas.openxmlformats.org/markup-compatibility/2006");
            fonts2.AddNamespaceDeclaration("r", "http://schemas.openxmlformats.org/officeDocument/2006/relationships");
            fonts2.AddNamespaceDeclaration("w", "http://schemas.openxmlformats.org/wordprocessingml/2006/main");
            fonts2.AddNamespaceDeclaration("w14", "http://schemas.microsoft.com/office/word/2010/wordml");
            fonts2.AddNamespaceDeclaration("w15", "http://schemas.microsoft.com/office/word/2010/11/wordml");

            Font font6 = new Font(){ Name = "Century" };
            Panose1Number panose1Number6 = new Panose1Number(){ Val = "02040604050505020304" };
            FontCharSet fontCharSet6 = new FontCharSet(){ Val = "00" };
            FontFamily fontFamily6 = new FontFamily(){ Val = FontFamilyValues.Roman };
            Pitch pitch6 = new Pitch(){ Val = FontPitchValues.Variable };
            FontSignature fontSignature6 = new FontSignature(){ UnicodeSignature0 = "00000287", UnicodeSignature1 = "00000000", UnicodeSignature2 = "00000000", UnicodeSignature3 = "00000000", CodePageSignature0 = "0000009F", CodePageSignature1 = "00000000" };

            font6.Append(panose1Number6);
            font6.Append(fontCharSet6);
            font6.Append(fontFamily6);
            font6.Append(pitch6);
            font6.Append(fontSignature6);

            Font font7 = new Font(){ Name = "MS 明朝" };
            AltName altName3 = new AltName(){ Val = "MS Mincho" };
            Panose1Number panose1Number7 = new Panose1Number(){ Val = "02020609040205080304" };
            FontCharSet fontCharSet7 = new FontCharSet(){ Val = "80" };
            FontFamily fontFamily7 = new FontFamily(){ Val = FontFamilyValues.Roman };
            Pitch pitch7 = new Pitch(){ Val = FontPitchValues.Fixed };
            FontSignature fontSignature7 = new FontSignature(){ UnicodeSignature0 = "E00002FF", UnicodeSignature1 = "6AC7FDFB", UnicodeSignature2 = "00000012", UnicodeSignature3 = "00000000", CodePageSignature0 = "0002009F", CodePageSignature1 = "00000000" };

            font7.Append(altName3);
            font7.Append(panose1Number7);
            font7.Append(fontCharSet7);
            font7.Append(fontFamily7);
            font7.Append(pitch7);
            font7.Append(fontSignature7);

            Font font8 = new Font(){ Name = "Times New Roman" };
            Panose1Number panose1Number8 = new Panose1Number(){ Val = "02020603050405020304" };
            FontCharSet fontCharSet8 = new FontCharSet(){ Val = "00" };
            FontFamily fontFamily8 = new FontFamily(){ Val = FontFamilyValues.Roman };
            Pitch pitch8 = new Pitch(){ Val = FontPitchValues.Variable };
            FontSignature fontSignature8 = new FontSignature(){ UnicodeSignature0 = "E0002AFF", UnicodeSignature1 = "C0007841", UnicodeSignature2 = "00000009", UnicodeSignature3 = "00000000", CodePageSignature0 = "000001FF", CodePageSignature1 = "00000000" };

            font8.Append(panose1Number8);
            font8.Append(fontCharSet8);
            font8.Append(fontFamily8);
            font8.Append(pitch8);
            font8.Append(fontSignature8);

            Font font9 = new Font(){ Name = "MS ゴシック" };
            AltName altName4 = new AltName(){ Val = "MS Gothic" };
            Panose1Number panose1Number9 = new Panose1Number(){ Val = "020B0609070205080204" };
            FontCharSet fontCharSet9 = new FontCharSet(){ Val = "80" };
            FontFamily fontFamily9 = new FontFamily(){ Val = FontFamilyValues.Modern };
            Pitch pitch9 = new Pitch(){ Val = FontPitchValues.Fixed };
            FontSignature fontSignature9 = new FontSignature(){ UnicodeSignature0 = "E00002FF", UnicodeSignature1 = "6AC7FDFB", UnicodeSignature2 = "00000012", UnicodeSignature3 = "00000000", CodePageSignature0 = "0002009F", CodePageSignature1 = "00000000" };

            font9.Append(altName4);
            font9.Append(panose1Number9);
            font9.Append(fontCharSet9);
            font9.Append(fontFamily9);
            font9.Append(pitch9);
            font9.Append(fontSignature9);

            Font font10 = new Font(){ Name = "Arial" };
            Panose1Number panose1Number10 = new Panose1Number(){ Val = "020B0604020202020204" };
            FontCharSet fontCharSet10 = new FontCharSet(){ Val = "00" };
            FontFamily fontFamily10 = new FontFamily(){ Val = FontFamilyValues.Swiss };
            Pitch pitch10 = new Pitch(){ Val = FontPitchValues.Variable };
            FontSignature fontSignature10 = new FontSignature(){ UnicodeSignature0 = "E0002AFF", UnicodeSignature1 = "C0007843", UnicodeSignature2 = "00000009", UnicodeSignature3 = "00000000", CodePageSignature0 = "000001FF", CodePageSignature1 = "00000000" };

            font10.Append(panose1Number10);
            font10.Append(fontCharSet10);
            font10.Append(fontFamily10);
            font10.Append(pitch10);
            font10.Append(fontSignature10);

            fonts2.Append(font6);
            fonts2.Append(font7);
            fonts2.Append(font8);
            fonts2.Append(font9);
            fonts2.Append(font10);

            fontTablePart2.Fonts = fonts2;
        }
Exemple #30
0
 public void SetNoteBlockAction(int x, int y, int z, Instrument instrument, Pitch pitch)
 {
     X = x;
     Y = y;
     Z = z;
     DataA = (sbyte)instrument;
     DataB = (sbyte)pitch;
 }