Exemple #1
0
        public void SectionLayoutTest()
        {
            var structure = new SectionLayoutGenerator().GetSectionLayout(new SongInfo(TimeSignature.CommonTime, 4)
            {
                Tempo = 120, LengthInSeconds = 60
            });

            foreach (var sectionType in structure)
            {
                Console.WriteLine(sectionType);
            }
        }
Exemple #2
0
        public override void Generate(IParameterList parameterList)
        {
            var param = (ParameterList)parameterList;
            var time  = param.TimeSignatureFunc();
            var feel  = param.FeelFunc(time);

            _songInfo = new SongInfo(time, feel)
            {
                Parameters = param
            };

            var sections                = new SectionLayoutGenerator().GetSectionLayout(_songInfo).ToList();
            var chordProgressions       = GetDistinctChordProgressions(param, sections.Distinct().Count());
            var mappedChordProgressions = sections.Distinct().Select((s, i) => new Tuple <int, SectionType>(i, s));
            var sectionTypes            = mappedChordProgressions.Distinct()
                                          .ToDictionary(s => s.Item2, s => new SongSection(_songInfo, s.Item2, chordProgressions[s.Item1]));

            Sections = sections.Select(s => sectionTypes[s]).ToList();
        }