public void Randomize()
    {
        if (clickNUmber <= 1)
        {
            buttonAR.GetComponentInChildren <Text>().text = "Auto";
            nextButton.gameObject.SetActive(false);
            previousButton.gameObject.SetActive(false);
            if (timePassed > timer)
            {
                print(numberarray.Length);
                currentChord = chordCollection[numberarray[Random.Range(0, numberarray.Length)]];


                timePassed = 0;
                Refresh();
            }
        }
        else
        {
            buttonAR.GetComponentInChildren <Text>().text = "Manual";
            clickNUmber  = 0;
            randomizedOn = false;
            nextButton.gameObject.SetActive(true);
            previousButton.gameObject.SetActive(true);
            GetCurrentChord();
        }
    }
    /// <summary>
    /// Get all triads from the given intervals, that include more than one octave. Each interval has to be smaller than the next one.
    /// </summary>
    /// <param name="key">The wanted key.</param>
    /// <param name="intervals">Intervals [1-7]. Amount has to be 3.</param>
    public static Chord[] AllBigTriads(Key key, int degree, int[] intervals, int minNote, int maxNote)
    {
        // 1. Get Intervals from Big Chords
        int[][] bigIntervals = Chords.BigChordStructures(intervals, key.notesPerOctave);
        Chord[] chords       = new Chord[bigIntervals.Length];

        // 2. Get all chords within one octave
        for (int i = 0; i < bigIntervals.Length; i++)
        {
            chords[i] = Triad(key, degree, bigIntervals[i], 0);
        }

        // 3. Get all chords withing tone range
        List <Chord> allChords  = new List <Chord>();
        int          allOctaves = allMidiNotes / notesPerOctave - 1;

        for (int i = 0; i < allOctaves; i++)
        {
            for (int j = 0; j < chords.Length; j++)
            {
                bool chordIsWithinRange = ChordIsWithinRange(chords[j], minNote, maxNote);
                if (chordIsWithinRange)
                {
                    allChords.Add(chords[j].DeepCopy());
                }
                chords[j] = Transpose_BySemiTones(chords[j], notesPerOctave);
            }
        }


        return(allChords.ToArray());
    }
示例#3
0
        public string Format(Chords chords)
        {
            var header = GetHeader(chords.SourceLink);
            var body   = GetBody(chords.RawChords);

            return($"{header} \n {body}");
        }
示例#4
0
        private void New_Click(object sender, RoutedEventArgs e)
        {
            db = new OracleDbContext();
            Chords    chord1 = new Chords();
            ChordCard chord  = new ChordCard()
            {
                Margin = new Thickness(25)
            };
            var currentPage = ((MainWindow)Application.Current.MainWindow).CurrentPage.Content;

            if (currentPage == null || (currentPage != null && currentPage.GetType().Name == "AnonimPage"))
            {
                chord.Panel.Visibility = Visibility.Collapsed;
                chord.Tresh.Visibility = Visibility.Hidden;
                chord.Pen.Visibility   = Visibility.Hidden;
            }
            else if (currentPage == null || (currentPage != null && currentPage.GetType().Name == "UserPage"))
            {
                chord.Panel.Visibility = Visibility.Collapsed;
                chord.Tresh.Visibility = Visibility.Collapsed;
                chord.Pen.Visibility   = Visibility.Collapsed;
            }
            else if (currentPage == null || (currentPage != null && currentPage.GetType().Name == "AdminPage"))
            {
                chord.Panel.Visibility = Visibility.Visible;
                chord.Tresh.Visibility = Visibility.Visible;
                chord.Pen.Visibility   = Visibility.Visible;
            }

            db.Chords.Add(chord1);
            db.SaveChanges();
            db.Chords.Load();
            SearchResultList.ItemsSource = db.Chords.Local;
        }
示例#5
0
        private void SplitTextWithChordsToTextAndChords()
        {
            if (TextWithChords.Count == 0)
            {
                return;
            }
            StringBuilder chords = new StringBuilder();
            StringBuilder text   = new StringBuilder();

            foreach (TextLineWithChords textLineWithChords in TextWithChords)
            {
                chords.AppendLine(textLineWithChords.Chords);
                text.AppendLine(textLineWithChords.TextLine);
            }

            if (!String.IsNullOrWhiteSpace(Text) && !Text.Equals(text.ToString()))
            {
                Text      = TekstowoHelper.DeleteStartAndEndEmptyLines(text.ToString());
                Song.Text = Text;
            }


            if (!String.IsNullOrWhiteSpace(Chords) && !Chords.Equals(chords.ToString()))
            {
                Chords      = chords.ToString();
                Song.Chords = Chords;
            }
        }
示例#6
0
        public void Write(BinaryWriter w)
        {
            BPMs.Write(w);
            Phrases.Write(w);
            Chords.Write(w);
            ChordNotes.Write(w);
            Vocals.Write(w);

            if (Vocals.Count > 0)
            {
                SymbolsHeader.Write(w);
                SymbolsTexture.Write(w);
                SymbolsDefinition.Write(w);
            }

            PhraseIterations.Write(w);
            PhraseExtraInfo.Write(w);
            NLD.Write(w);
            Actions.Write(w);
            Events.Write(w);
            Tones.Write(w);
            DNAs.Write(w);
            Sections.Write(w);
            Arrangements.Write(w);
            Meta.Write(w);
        }
示例#7
0
        public async Task <IActionResult> Edit(Guid id, [Bind("Id,Artist,Song,Capo,Key,Content,DateAdded,DateEdited,Uploader")] Chords chords)
        {
            if (id != chords.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    // popravimo datum spremembe
                    chords.DateEdited = DateTime.Now;
                    _context.Update(chords);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ChordsExists(chords.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }

            return(View(chords));
        }
示例#8
0
        /// <summary>
        /// gchgc
        /// </summary>
        /// <param name="chord">аккорд</param>
        /// <param name="tact">такт</param>
        /// <returns></returns>
        public static int[] GetNotes(Chords chord, int tact)
        {
            Random   notesCount = new Random(), positions = new Random();//position - позиция устойчивой ноты
            MyRandom stables = new MyRandom(new int[] { 1, 3, 5 }, new int[] { 33, 33, 34 });

            switch (chord)
            {
            case Chords.Am:
                stables = new MyRandom(new int[] { 1, 3, 5 }, new int[] { 33, 33, 34 });
                break;

            case Chords.Dm:
                stables = new MyRandom(new int[] { 1, 3, 5 }, new int[] { 33, 33, 34 });
                break;

            case Chords.E:
                stables = new MyRandom(new int[] { 1, 3, 5 }, new int[] { 33, 33, 34 });
                break;

            case Chords.F:
                stables = new MyRandom(new int[] { 3 }, new int[] { 100 });
                break;
            }

            int length = 6;// notesCount.Next(4, 10);//количество нот во фразе

            int[] phrase = new int[length];
            for (int i = 0; i < phrase.Length; i++)
            {
                phrase[i] = 0;
            }
            int stable   = stables.Next();
            int position = 1;

            switch (tact)//2 и 3 такт одинаковы, поэтому в параметры передаем всегда 2
            {
            case 1:
                phrase[0]        = 1;
                position         = positions.Next(1, length);
                phrase[position] = stable;
                break;

            case 2:
                position         = positions.Next(0, length);
                phrase[position] = stable;
                break;

            case 4:
                phrase[length - 1] = 1;
                position           = length - 1;
                stable             = 1;
                break;
            }
            phrase = Transitions(chord, phrase, stable, position);

            return(phrase);
        }
示例#9
0
        private Func <Task> SendChordsAsFileFn(Chords chords, long chatId)
        {
            var formattedChords = _chordsFormatter.Format(chords);
            var fileName        = $"{chords.SourceLink.SongAuthor} - {chords.SourceLink.SongName}";

            var txtFile = ToTextFile(fileName, formattedChords);

            return(SendFileFn(txtFile, chatId));
        }
 public void GetLastChord()
 {
     currentChordIndex--;
     if (currentChordIndex <= 0)
     {
         currentChordIndex = 3;
     }
     currentChord = chordCollection[numberarray[currentChordIndex]];
     Refresh();
 }
 public void GetCurrentChord()
 {
     currentChordIndex++;
     if (currentChordIndex >= numberarray.Length)
     {
         currentChordIndex = 0;
     }
     currentChord = chordCollection[numberarray[currentChordIndex]];
     Refresh();
 }
 public override void Add <T>(T mess)
 {
     if (mess is GuitarChord)
     {
         Chords.Add((mess as GuitarChord).CloneToMemory(this, Owner.CurrentDifficulty));
     }
     else
     {
         base.Add(mess);
     }
 }
        public void BeginPaste(Point startPoint)
        {
            Owner.SelectStartPoint = startPoint;

            mousePointBegin  = Owner.SelectStartPoint;
            mouseStringBegin = MinSelectionString;

            var sp = Chords.First().ScreenPointPair;

            FirstChordOffset = new Point(mousePointBegin.X, 0);

            UpdatePastePoint(mousePointBegin, Point.Empty);
        }
示例#14
0
        public IChord GetChord(INote note, Chords type)
        {
            var definition = definitions.FirstOrDefault(d => d.Equals(type));

            if (definition == null)
            {
                throw new ArgumentException($"the type {type} is not a supported chord", nameof(type));
            }

            var ret = GetChord(note, definition);

            return(ret);
        }
示例#15
0
        /// <summary>
        /// gchgc
        /// </summary>
        /// <param name="chord">аккорд</param>
        /// <param name="tact">такт</param>
        /// <returns></returns>
        public static int[] GetNotes(Chords chord, int tact)
        {
            Random notesCount = new Random(), positions = new Random();//position - позиция устойчивой ноты
            MyRandom stables = new MyRandom(new int[] { 1, 3, 5 }, new int[] { 33, 33, 34 });
            switch (chord)
            {
                case Chords.Am:
                    stables = new MyRandom(new int[] { 1, 3, 5 }, new int[] { 33, 33, 34 });
                    break;
                case Chords.Dm:
                    stables = new MyRandom(new int[] { 1, 3, 5 }, new int[] { 33, 33, 34 });
                    break;
                case Chords.E:
                    stables = new MyRandom(new int[] { 1, 3, 5 }, new int[] { 33, 33, 34 });
                    break;
                case Chords.F:
                    stables = new MyRandom(new int[] { 3 }, new int[] { 100 });
                    break;
            }

            int length = 6;// notesCount.Next(4, 10);//количество нот во фразе
            int[] phrase = new int[length];
            for (int i = 0; i < phrase.Length; i++)
            {
                phrase[i] = 0;
            }
            int stable = stables.Next();
            int position = 1;

            switch (tact)//2 и 3 такт одинаковы, поэтому в параметры передаем всегда 2
            {
                case 1:
                    phrase[0] = 1;
                    position = positions.Next(1, length);
                    phrase[position] = stable;
                    break;
                case 2:
                    position = positions.Next(0, length);
                    phrase[position] = stable;
                    break;
                case 4:
                    phrase[length - 1] = 1;
                    position = length - 1;
                    stable = 1;
                    break;
            }
            phrase = Transitions(chord, phrase, stable, position);

            return phrase;
        }
示例#16
0
        private void PrepareTextWithChordsList()
        {
            TextWithChords.Clear();
            string[] chords = Chords.Split(Environment.NewLine.ToCharArray());
            string[] text   = Text.Split(Environment.NewLine.ToCharArray());

            for (int i = 0; i < text.Length; i++)
            {
                TextWithChords.Add(new TextLineWithChords()
                {
                    Chords   = chords.ElementAtOrDefault(i) == null || String.IsNullOrWhiteSpace(chords[i]) ? "" : chords[i],
                    TextLine = text[i]
                });
            }
        }
示例#17
0
        public async Task <IActionResult> Create([Bind("Id,Artist,Song,Capo,Key,Content,DateAdded,DateEdited,Uploader")] Chords chords)
        {
            if (ModelState.IsValid)
            {
                chords.Id = Guid.NewGuid();
                // ob kreiranju nastavimo oba datuma na trenutni čas
                chords.DateAdded  = DateTime.Now;
                chords.DateEdited = DateTime.Now;
                _context.Add(chords);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(chords));
        }
        public IStringInstrumentChord Chord(
            [FromServices]INoteService noteService,
            [FromServices]IStringInstrumentService stringInstrumentService,
            [FromServices]IStringInstrumentChordService stringInstrumentChordService,
            string stringNotes, int semiToneCount, string root, Chords type)
        {
            var sn = stringNotes
                .Split(',')
                .Select(noteName => noteService.GetNoteByName(noteName))
                .ToArray();

            var rootNote = noteService.GetNoteByName(root);
            var instrument = stringInstrumentService.CreateInstrument<StringInstrument>(semiToneCount, sn);
            var ret = stringInstrumentChordService.GetChord(instrument, rootNote, type);
            return ret;
        }
示例#19
0
        /*
         *  Finds all possible chords from sequence of chord notes
         */
        public void FindChords()
        {
            Chords.Clear();
            List <Note> myChordNotes = new List <Note>();

            for (int i = 0; i < chordNotes.Length; i++) // Creates iterable chord notes list
            {
                double avgMagnitude = 0;
                for (int j = 0; j < chordNotes[i].Count; j++) // Finds average magnitude of that note type and assigns it to magnitude of chord note
                {
                    avgMagnitude += chordNotes[i][j].Magnitude;
                }
                avgMagnitude /= chordNotes[i].Count;

                Note newChordNote = (Note)chordNotes[i][0].Clone();
                newChordNote.Magnitude = avgMagnitude;
                newChordNote.Octave    = chordNotes[i].Count;
                myChordNotes.Add(newChordNote);
            }

            for (int i = 0; i < chordNotes.Length; i++)
            {
                List <int> intervals = new List <int>();
                for (int j = 1; j < chordNotes.Length; j++) // Finds interval between adjacent notes
                {
                    int noteDifference = myChordNotes[j].NoteIndex - myChordNotes[0].NoteIndex;
                    if (noteDifference < 0)
                    {
                        noteDifference = 12 + noteDifference;
                    }
                    intervals.Add(noteDifference);
                }
                string chordQuality = Music.GetChordQuality(intervals, out int fifthOmitted); // Determines chord quality from intervals
                if (chordQuality != "N/A")
                {
                    Chords.Add(CreateChord(myChordNotes[0].Name, chordQuality, myChordNotes, fifthOmitted));
                }

                myChordNotes = NextChord(myChordNotes); // Iterates chord root note
            }
            AdjustChordProbabilities();
            Chords = Chords.OrderByDescending(x => x.Probability).ToList();
            if (Chords.Count > 0)
            {
                prevChord = Chords[0];
            }
        }
        public void CreateMajorChordTest()
        {
            // Arrange
            const Tone   baseTone = Tone.C;
            const Chords chordId  = Chords.Major;

            // Act
            var myChord = _target.CreateChord(baseTone, chordId);

            // Assert
            Assert.IsNotNull(myChord);
            Assert.AreEqual(chordId, myChord.Chord);
            Assert.AreEqual(baseTone, myChord.BaseTone);
            Assert.IsTrue(myChord.DegreesOfOneOctave.Contains(Degrees.I_perfectPrime));
            Assert.IsTrue(myChord.DegreesOfOneOctave.Contains(Degrees.III_majorThird));
            Assert.IsTrue(myChord.DegreesOfOneOctave.Contains(Degrees.V_perfectFifth));
        }
示例#21
0
        static void Main(string[] args)
        {
            Func <double, double> f  = (x) => { return(x * x * x - 1.3 * x * x + x - 1); };
            Func <double, double> f1 = (x) => { return(3 * x * x - 2.6 * x + 1); };
            Func <double, double> f2 = (x) => { return(6 * x - 2.6); };

            //Func<double, double> f = (x) => { return x * x * x - 3 * x * x + 4 * x - 5; };
            //Func<double, double> f1 = (x) => { return 3 * x * x - 6 * x + 4; };
            //Func<double, double> f2 = (x) => { return 6 * x - 6; };

            HalfDeviation   method  = new HalfDeviation(2, 3, f);
            SimpleIteration method1 = new SimpleIteration(2, 3, 0.00001, f, f1);
            Chords          method2 = new Chords(2, 3, 0.00001, f, f1, f2);
            Newton          method3 = new Newton(2, 3, 0.00001, f, f1, f2);

            Console.ReadLine();
        }
示例#22
0
文件: Bar.cs 项目: cwelt/Soloist
        /// <inheritdoc cref="IBar.GetOverlappingNotesForChord(IChord, out IList{int})"/>
        public IList <INote> GetOverlappingNotesForChord(IChord chord, out IList <int> chordNotesIndices)
        {
            // assure the chord argument exists in this bar's instance chord sequence.
            int chordIndex = Chords.IndexOf(chord);

            // if valid, redirect to overloaded version which accepts chord's index
            if (chordIndex >= 0)
            {
                return(GetOverlappingNotesForChord(chordIndex, out chordNotesIndices));
            }

            else // invalid, return empty note sequence
            {
                chordNotesIndices = null;
                return(null);
            }
        }
示例#23
0
        /// <summary>
        /// Creates the specified chord.
        /// </summary>
        /// <param name="baseTone">The base tone.</param>
        /// <param name="chordId">The chord identifier.</param>
        /// <returns>
        /// The created object.
        /// </returns>
        public IChord CreateChord(Tone baseTone, Chords chordId)
        {
            IList <Degrees> degrees = null;

            if (chordId.ToString().StartsWith(Chords.Major.ToString()))
            {
                degrees = CreateMajorDegrees();
            }
            else if (chordId.ToString().StartsWith(Chords.Minor.ToString()))
            {
                degrees = CreateMinorDegrees();
            }

            if (degrees == null)
            {
                throw new NotSupportedException("Not supported chord Id");
            }

            switch (chordId)
            {
            case Chords.Major:
                return(CreateChord(baseTone, chordId, degrees));

            case Chords.Major_b7:
                Add_b7(ref degrees);

                return(CreateChord(baseTone, chordId, degrees));

            case Chords.Major_j7:
                Add_j7(ref degrees);

                return(CreateChord(baseTone, chordId, degrees));

            case Chords.Minor:
                return(CreateChord(baseTone, chordId, degrees));

            case Chords.Minor_b7:
                Add_b7(ref degrees);

                return(CreateChord(baseTone, chordId, degrees));

            default:
                throw new NotSupportedException("Not supported chord Id");
            }
        }
    void Start()
    {
        timeBar.maxValue = 20f;
        setTimer1        = 10;
        setTimer2        = 20;
        setTimer3        = 30;



        randomizedOn      = false;
        fingerInstances   = new List <GameObject>();
        timer             = 20f;
        newFspace         = GetComponent <PixelEditor>().fretSpace;
        newSpace          = GetComponent <PixelEditor>().space;
        currentChordIndex = 0;
        currentChord      = chordCollection[numberarray[currentChordIndex]];
        Refresh();
    }
示例#25
0
        private Func <Task> SendChordsFn(Chords chords, long chatId)
        {
            var format = FormatMapping.ContainsKey(chatId)
                ? FormatMapping[chatId]
                : Format.Message;

            switch (format)
            {
            case Format.Message:
                return(SendMessageFn(chords.RawChords, chatId));

            case Format.Txt:
                return(SendChordsAsFileFn(chords, chatId));

            default:
                return(SendMessageFn(chords.RawChords, chatId));
            }
        }
示例#26
0
 public APCIntance(IMidiOutput output, IMidiInput input)
 {
     outdevice = output;
     indevice  = input;
     indevice.MessageReceived += Message_Received;
     for (int row = 0; row < 64; row++)
     {
         Seq64.Add(row, false);
         Clips.Add(row, false);
     }
     for (int row = 0; row < 8; row++)
     {
         Seq8a.Add(row, new Dictionary <int, bool>());
         Seq8b.Add(row, new Dictionary <int, bool>());
         Chords.Add(row, new List <int>());
         for (int col = 0; col < 8; col++)
         {
             Seq8a[row].Add(col, false);
             Seq8b[row].Add(col, false);
         }
     }
     DrawPage(true);
 }
示例#27
0
    // 키보드로부터 어떠한 입력을 받고 그에 대한 결과를 생성해주는 메소드이다.
    public void Output(TextBox display, StackPanel input, Item item)
    {
        string value = string.Empty;

        switch (item.Mode)
        {
        case Modes.Backspace:
            int start = display.SelectionStart == 0 ?
                        display.Text.Length + 1 : display.SelectionStart;
            display.Select(start - 1, 1);
            display.SelectedText = string.Empty;
            break;

        case Modes.Character:
            value = (_chord == Chords.shift) ? item.Shift : item.Normal;
            break;

        case Modes.Enter:
            value = "\n";
            break;

        case Modes.Shift:
            _chord = (_chord == Chords.shift) ? Chords.normal : Chords.shift;
            Update(input);
            break;

        case Modes.Space:
            value = " ";
            break;

        case Modes.Tab:
            value = "\t";
            break;
        }
        display.Text += value;
    }
示例#28
0
        private void Read(Stream CITFile)
        {
            CITFile.Position += 0x04;

            if (!CITFile.ReadString(4).Equals(Magic))
            {
                throw new Exception($"Invalid Identifier. Expected \"{Magic}\"");
            }

            uint   FileSize = BitConverter.ToUInt32(CITFile.ReadReverse(0, 4), 0);
            ushort ChordCount = BitConverter.ToUInt16(CITFile.ReadReverse(0, 2), 0), ScaleCount = BitConverter.ToUInt16(CITFile.ReadReverse(0, 2), 0);

            int[] ChordPointers = new int[ChordCount], ScalePairPointers = new int[ScaleCount];
            for (int i = 0; i < ChordCount; i++)
            {
                ChordPointers[i] = BitConverter.ToInt32(CITFile.ReadReverse(0, 4), 0);
                long PausePosition = CITFile.Position;
                CITFile.Position = ChordPointers[i];
                Chords.Add(new Chord((Note)CITFile.ReadByte(), (Note)CITFile.ReadByte(), (Note)CITFile.ReadByte(), (Note)CITFile.ReadByte(), (Note)CITFile.ReadByte(), (Note)CITFile.ReadByte(), (Note)CITFile.ReadByte(), (Note)CITFile.ReadByte()));
                CITFile.Position = PausePosition;
            }
            for (int i = 0; i < ScaleCount; i++)
            {
                ScalePairPointers[i] = BitConverter.ToInt32(CITFile.ReadReverse(0, 4), 0);
                long PausePosition = CITFile.Position;
                CITFile.Position = ScalePairPointers[i];
                int OffsetA = BitConverter.ToInt32(CITFile.ReadReverse(0, 4), 0);
                int OffsetB = BitConverter.ToInt32(CITFile.ReadReverse(0, 4), 0);
                CITFile.Position = OffsetA;
                Scale ScaleA = new Scale((Note)CITFile.ReadByte(), (Note)CITFile.ReadByte(), (Note)CITFile.ReadByte(), (Note)CITFile.ReadByte(), (Note)CITFile.ReadByte(), (Note)CITFile.ReadByte(), (Note)CITFile.ReadByte(), (Note)CITFile.ReadByte(), (Note)CITFile.ReadByte(), (Note)CITFile.ReadByte(), (Note)CITFile.ReadByte(), (Note)CITFile.ReadByte());
                CITFile.Position = OffsetB;
                Scale ScaleB = new Scale((Note)CITFile.ReadByte(), (Note)CITFile.ReadByte(), (Note)CITFile.ReadByte(), (Note)CITFile.ReadByte(), (Note)CITFile.ReadByte(), (Note)CITFile.ReadByte(), (Note)CITFile.ReadByte(), (Note)CITFile.ReadByte(), (Note)CITFile.ReadByte(), (Note)CITFile.ReadByte(), (Note)CITFile.ReadByte(), (Note)CITFile.ReadByte());
                Scales.Add(new Tuple <Scale, Scale>(ScaleA, ScaleB));
                CITFile.Position = PausePosition;
            }
        }
示例#29
0
        public void AddChords()
        {
            Random random = new Random();

            Chords.Add(new Chord("major", LEVEL.BEGINNER, new List <string>()
            {
                "Jazz", "Classical Music", "Rock"
            }, new List <int>()
            {
                4, 7
            }));
            Chords.Add(new Chord("7", LEVEL.BEGINNER, new List <string>()
            {
                "Jazz", "Rock", "Classical Music"
            }, new List <int>()
            {
                4, 7, 10
            }));
            Chords.Add(new Chord("minor", LEVEL.BEGINNER, new List <string>()
            {
                "Jazz", "Rock", "Classical Music", "Heavy Metal"
            }, new List <int>()
            {
                3, 7
            }));
            Chords.Add(new Chord("m7", LEVEL.BEGINNER, new List <string>()
            {
                "Jazz", "Classical Music", "Heavy Metal"
            }, new List <int>()
            {
                3, 7, 10
            }));
            Chords.Add(new Chord("maj7", LEVEL.BEGINNER, new List <string>()
            {
                "Jazz", "Classical Music", "Heavy Metal"
            }, new List <int>()
            {
                4, 7, 11
            }));
            Chords.Add(new Chord("sus4", LEVEL.BEGINNER, new List <string>()
            {
                "Rock", "Heavy Metal", "Classical Music"
            }, new List <int>()
            {
                5, 7
            }));
            Chords.Add(new Chord("sus2", LEVEL.BEGINNER, new List <string>()
            {
                "Rock", "Heavy Metal", "Classical Music"
            }, new List <int>()
            {
                2, 7
            }));
            Chords.Add(new Chord("5", LEVEL.BEGINNER, new List <string>()
            {
                "Rock", "Heavy Metal", "Classical Music"
            }, new List <int>()
            {
                7
            }));
            Chords.Add(new Chord("m3", LEVEL.BEGINNER, new List <string>()
            {
                "Rock", "Heavy Metal", "Classical Music"
            }, new List <int>()
            {
                3
            }));
            Chords.Add(new Chord("3", LEVEL.BEGINNER, new List <string>()
            {
                "Rock", "Heavy Metal", "Classical Music"
            }, new List <int>()
            {
                4
            }));
            Chords.Add(new Chord("b5", LEVEL.BEGINNER, new List <string>()
            {
                "Rock", "Heavy Metal", "Classical Music"
            }, new List <int>()
            {
                6
            }));
            //BEGINNER
            Chords.Add(new Chord("maj9", LEVEL.INTERMEDIATE, new List <string>()
            {
                "Rock", "Heavy Metal", "Classical Music"
            }, new List <int>()
            {
                2, 4, 7
            }));
            Chords.Add(new Chord("dim", LEVEL.INTERMEDIATE, new List <string>()
            {
                "Jazz", "Classical Music", "Heavy Metal"
            }, new List <int>()
            {
                3, 6
            }));
            Chords.Add(new Chord("aug", LEVEL.INTERMEDIATE, new List <string>()
            {
                "Jazz", "Classical Music"
            }, new List <int>()
            {
                4, 8
            }));
            Chords.Add(new Chord("add9", LEVEL.INTERMEDIATE, new List <string>()
            {
                "Rock", "Classical Music", "Heavy Metal"
            }, new List <int>()
            {
                4, 7, 2
            }));
            Chords.Add(new Chord("dom7", LEVEL.INTERMEDIATE, new List <string>()
            {
                "Rock", "Classical Music", "Jazz"
            }, new List <int>()
            {
                4, 7, 10
            }));
            Chords.Add(new Chord("aug7", LEVEL.INTERMEDIATE, new List <string>()
            {
                "Jazz", "Classical Music", "Heavy Metal"
            }, new List <int>()
            {
                4, 8, 10
            }));
            Chords.Add(new Chord("domt7b5", LEVEL.INTERMEDIATE, new List <string>()
            {
                "Jazz", "Classical Music", "Heavy Metal"
            }, new List <int>()
            {
                4, 6, 10
            }));
            Chords.Add(new Chord("dim7", LEVEL.INTERMEDIATE, new List <string>()
            {
                "Jazz", "Heavy Metal", "Classical Music"
            }, new List <int>()
            {
                3, 6, 9
            }));
            Chords.Add(new Chord("min(maj7)", LEVEL.INTERMEDIATE, new List <string>()
            {
                "Jazz", "Heavy Metal", "Classical Music"
            }, new List <int>()
            {
                3, 7, 10
            }));
            //INTERMEDIATE
            Chords.Add(new Chord("dim*", LEVEL.ADVANCED, new List <string>()
            {
                "Rock", "Heavy Metal", "Classical Music"
            }, new List <int>()
            {
                3, 6, 10
            }));
            Chords.Add(new Chord("sus11", LEVEL.ADVANCED, new List <string>()
            {
                "Jazz", "Classical Music", "Heavy Metal"
            }, new List <int>()
            {
                5, 7
            }));
            Chords.Add(new Chord("11", LEVEL.ADVANCED, new List <string>()
            {
                "Jazz", "Classical Music"
            }, new List <int>()
            {
                2, 5, 7, 10
            }));
            Chords.Add(new Chord("13", LEVEL.ADVANCED, new List <string>()
            {
                "Rock", "Classical Music", "Heavy Metal"
            }, new List <int>()
            {
                2, 4, 5, 7, 10
            }));
            Chords.Add(new Chord("4", LEVEL.ADVANCED, new List <string>()
            {
                "Rock", "Classical Music", "Jazz"
            }, new List <int>()
            {
                5, 7
            }));
            Chords.Add(new Chord("6", LEVEL.ADVANCED, new List <string>()
            {
                "Jazz", "Classical Music", "Heavy Metal", "Rock"
            }, new List <int>()
            {
                4, 7, 9
            }));
            Chords.Add(new Chord("7b5", LEVEL.ADVANCED, new List <string>()
            {
                "Jazz", "Classical Music", "Heavy Metal", "Rock"
            }, new List <int>()
            {
                4, 6, 10
            }));
            Chords.Add(new Chord("9", LEVEL.ADVANCED, new List <string>()
            {
                "Jazz", "Classical Music", "Heavy Metal", "Rock"
            }, new List <int>()
            {
                2, 4, 7, 10
            }));
            Chords.Add(new Chord("7b9", LEVEL.ADVANCED, new List <string>()
            {
                "Jazz", "Classical Music", "Heavy Metal", "Rock"
            }, new List <int>()
            {
                1, 4, 7, 10
            }));
            Chords.Add(new Chord("79", LEVEL.ADVANCED, new List <string>()
            {
                "Jazz", "Classical Music", "Heavy Metal", "Rock"
            }, new List <int>()
            {
                2, 4, 7, 10
            }));
            Chords.Add(new Chord("7#5", LEVEL.ADVANCED, new List <string>()
            {
                "Jazz", "Classical Music", "Heavy Metal", "Rock"
            }, new List <int>()
            {
                8, 10
            }));
            //ADVANCED
        }
示例#30
0
        public IChord GetChord(string name, Chords type)
        {
            var note = NoteService.GetNoteByName(name);

            return(GetChord(note, type));
        }
示例#31
0
 /// <summary>
 /// Creates the chord.
 /// </summary>
 /// <param name="baseTone">The base tone.</param>
 /// <param name="chordId">The chord identifier.</param>
 /// <param name="degrees">The list of degrees.</param>
 /// <returns>The created chord.</returns>
 private IChord CreateChord(Tone baseTone, Chords chordId, IList <Degrees> degrees)
 {
     return(new DelegateChord(baseTone, chordId, degrees));
 }
示例#32
0
        public static int[] Transitions(Chords chord, int[] phrase, int stable, int position)
        {
            var random = new Random();
            int[] notes;
            switch (chord)
            {
                case Chords.Am:
                    for (int i = position + 1; i < phrase.Length; i++)
                    {
                        if (random.Next(0, 2) == 1)//идем либо вверх либо вниз по гамме
                        {
                            if (phrase[i] == 0)
                            {
                                phrase[i] = (phrase[i - 1] + random.Next(1, 8)) % 7;
                                if (phrase[i] == 0)
                                    phrase[i] = 7;
                            }
                        }
                        else
                        {
                            if (phrase[i] == 0)
                            {
                                phrase[i] = (Math.Abs(phrase[i - 1] - random.Next(1, 8))) % 7;
                                if (phrase[i] == 0)
                                    phrase[i] = 7;
                            }
                        }
                    }
                    for (int i = position - 1; i >= 0; i--)
                    {
                        if (random.Next(0, 2) == 1)//идем либо вверх либо вниз по гамме
                        {
                            if (phrase[i] == 0)
                            {
                                phrase[i] = (phrase[i + 1] + random.Next(1, 8)) % 7;
                                if (phrase[i] == 0)
                                    phrase[i] = 7;
                            }
                        }
                        else
                        {
                            if (phrase[i] == 0)
                            {
                                phrase[i] = (Math.Abs(phrase[i + 1] - random.Next(1, 8))) % 7;
                                if (phrase[i] == 0)
                                    phrase[i] = 7;
                            }
                        }
                    }
                    break;

                case Chords.Dm:
                    for (int i = position + 1; i < phrase.Length; i++)
                    {
                        if (random.Next(0, 2) == 1)//идем либо вверх либо вниз по гамме
                        {
                            if (phrase[i] == 0)
                            {
                                phrase[i] = (phrase[i - 1] + random.Next(1, 8)) % 7;
                                if (phrase[i] == 0)
                                    phrase[i] = 7;
                                if (phrase[i] == 2)
                                    phrase[i] = random.Next(3, 5);
                            }
                        }
                        else
                        {
                            if (phrase[i] == 0)
                            {
                                phrase[i] = (Math.Abs(phrase[i - 1] - random.Next(1, 8))) % 7;
                                if (phrase[i] == 0)
                                    phrase[i] = 7;
                                if (phrase[i] == 2)
                                    phrase[i] = new MyRandom(new int[] { 1, 7 }, new int[] { 50, 50 }).Next();
                            }
                        }
                    }
                    for (int i = position - 1; i >= 0; i--)
                    {
                        if (random.Next(0, 2) == 1)//идем либо вверх либо вниз по гамме
                        {
                            if (phrase[i] == 0)
                            {
                                phrase[i] = (phrase[i + 1] + random.Next(1, 8)) % 7;
                                if (phrase[i] == 0)
                                    phrase[i] = 7;
                                if (phrase[i] == 2)
                                    phrase[i] = random.Next(3, 5);
                            }
                        }
                        else
                        {
                            if (phrase[i] == 0)
                            {
                                phrase[i] = (Math.Abs(phrase[i + 1] - random.Next(1, 8))) % 7;
                                if (phrase[i] == 0)
                                    phrase[i] = 7;
                                if (phrase[i] == 2)
                                    phrase[i] = new MyRandom(new int[] { 1, 7 }, new int[] { 50, 50 }).Next();
                            }
                        }
                    }
                    break;

                case Chords.E:
                    for (int i = position - 1; i >= 0; i--)
                    {
                        if (random.Next(0, 2) == 1)//идем либо вверх либо вниз по гамме
                        {
                            if (phrase[i] == 0)
                            {
                                phrase[i] = (phrase[i + 1] + random.Next(1, 8)) % 7;
                                if (phrase[i] == 0)
                                    phrase[i] = 7;
                                if (phrase[i] == 6)
                                    phrase[i] = new MyRandom(new int[] { 1, 7 }, new int[] { 50, 50 }).Next();
                            }
                        }
                        else
                        {
                            if (phrase[i] == 0)
                            {
                                phrase[i] = (Math.Abs(phrase[i + 1] - random.Next(1, 8))) % 7;
                                if (phrase[i] == 0)
                                    phrase[i] = 7;
                                if (phrase[i] == 6)
                                    phrase[i] = random.Next(4, 6);
                            }
                        }
                    }
                    break;

                case Chords.F:
                    notes = new int[3] { 3, 6, 7 };
                    if (position - 1 >= 0)
                        phrase[position - 1] = 4;
                    for (int i = position + 1; i < phrase.Length; i++)
                    {
                        if (random.Next(0, 2) == 1)//идем либо вверх либо вниз по гамме
                        {
                            if (phrase[i] == 0)
                            {
                                phrase[i] = notes[random.Next(0, 3)];////////////////////////////////////////////
                            }
                        }
                        else
                        {
                            if (phrase[i] == 0)
                            {
                                phrase[i] = notes[random.Next(0, 3)];/////////////////////////////////////////////
                            }
                        }
                    }
                    for (int i = position - 1; i >= 0; i--)
                    {

                        if (random.Next(0, 2) == 1)//идем либо вверх либо вниз по гамме
                        {
                            if (phrase[i] == 0)
                            {
                                phrase[i] = notes[random.Next(0, 3)];/////////////////////////////////////////////
                            }
                        }
                        else
                        {
                            if (phrase[i] == 0)
                            {
                                phrase[i] = notes[random.Next(0, 3)];/////////////////////////////////////////////
                            }
                        }
                    }
                    break;
            }
            return phrase;
        }