예제 #1
0
		public ChordBotV1(Sequence seq,
							int channel = 0,
							int instrument = (int)GeneralMidiInstrument.ChoirAahs,
							int minNote = 48,
							int maxNote = 72,
							int maxInterval = 7,
							int numVoices = 2,
							int minVol = 60,
							int maxVol = 90,
							int songLength = 25000,
							int subDiv = 100,
							int upDownChance = 50)
		{
			var trackLog = new TrackLog(_track);

			var note = _rnd.RandomInt(minNote, maxNote);
			var vol = _rnd.RandomInt(minVol, maxVol);


			trackLog.InsertChannelMessage(0, ChannelCommand.ProgramChange, channel, instrument);

			for (var i = 0; i <= songLength; i += subDiv)
			{
				for (var v = 0; v < numVoices; v++)
				{
					trackLog.InsertChannelMessage(i, ChannelCommand.NoteOn, channel, note, vol);
					trackLog.InsertChannelMessage(i + (subDiv - 1), ChannelCommand.NoteOff, channel, note);

					vol = _rnd.RandomMidiGeneral();

					if (_rnd.Chance(upDownChance))
					{
						note += _rnd.RandomInt(0, maxInterval);
						if (note > maxNote)
						{
							note = maxNote;
						}
					}
					else
					{
						note -= _rnd.RandomInt(0, maxInterval);
						if (note < minNote)
						{
							note = minNote;
						}
					}
				}
			}

			seq.Add(_track);
		}
예제 #2
0
		public DrumBotV1(Sequence seq,
							int songLength = 25000,
							int subDiv = 5,
							int sectionDiv = 1000,
							int restChance = 50,
							int drumChangeChance = 5,
							int pitchChangeChance = 10,
							int volChangeChance = 75)
		{
			var trackLog = new TrackLog(_track);

			var drum = _rnd.RandomDrum();
			var pitch = _rnd.RandomMidiGeneral();
			var vol = _rnd.RandomMidiGeneral();

			for (var i = 0; i <= songLength; i += subDiv)
			{
				if (i >= sectionDiv && (i % sectionDiv) == 0)
				{
					restChance = _rnd.RandomPercent();
					drumChangeChance = _rnd.RandomPercent();
					pitchChangeChance = _rnd.RandomPercent();
					volChangeChance = _rnd.RandomPercent();
				}

				if (_rnd.Chance(restChance))
				{
					continue;
				}

				if (_rnd.Chance(drumChangeChance))
				{
					drum = _rnd.RandomDrum();
				}
				if (_rnd.Chance(pitchChangeChance))
				{
					pitch = _rnd.RandomMidiGeneral();
				}
				if (_rnd.Chance(volChangeChance))
				{
					vol = _rnd.RandomMidiGeneral();
				}

				trackLog.InsertChannelMessage(i, ChannelCommand.PitchWheel, Channel, pitch, pitch);
				trackLog.InsertChannelMessage(i, ChannelCommand.NoteOn, Channel, drum, vol);
				trackLog.InsertChannelMessage(i + (subDiv - 1), ChannelCommand.NoteOff, Channel, drum);
			}

			seq.Add(_track);
		}