public void StartProgram() { SnapsEngine.SetTitleString("Twinkle Twinkle"); SongNote[] twinkleTwinkle = new SongNote[] { new SongNote(pitch: 0, duration: 0.4), new SongNote(pitch: 0, duration: 0.4), new SongNote(pitch: 7, duration: 0.4), new SongNote(pitch: 7, duration: 0.4), new SongNote(pitch: 9, duration: 0.4), new SongNote(pitch: 9, duration: 0.4), new SongNote(pitch: 7, duration: 0.8), new SongNote(pitch: 5, duration: 0.4), new SongNote(pitch: 5, duration: 0.4), new SongNote(pitch: 4, duration: 0.4), new SongNote(pitch: 4, duration: 0.4), new SongNote(pitch: 2, duration: 0.4), new SongNote(pitch: 2, duration: 0.4), new SongNote(pitch: 0, duration: 0.8) }; foreach (SongNote note in twinkleTwinkle) { SnapsEngine.PlayNote(pitch: note.NotePitch, duration: note.NoteDuration); } }
private SongNote GetNote(Chord chord, Chord nextChord) { SongNote note = new SongNote(); Note zNote = chord.Notes[0]; note.Fret = (sbyte)zNote.Fret; note.String = (byte)zNote.StringNo; note.Bend = 0; note.HammerOn = (zNote.IsTapNote || chord.IsHammerOn) ? (byte)1 : (byte)0; note.Harmonic = 0; note.Hopo = note.HammerOn; note.Ignore = 0; note.PalmMute = (zNote.IsXNote || chord.IsMute) ? (byte)1 : (byte)0; note.Sustain = (chord.EndTime - chord.StartTime > .5) ? chord.EndTime - chord.StartTime : 0; note.Time = (float)chord.StartTime; note.Tremolo = 0; if (chord.IsSlide && nextChord != null) { note.SlideTo = (sbyte)Math.Max(nextChord.Notes[0].Fret, 1); note.Sustain = chord.EndTime - chord.StartTime; note.HammerOn = note.Hopo = note.PalmMute = 0; } else { note.SlideTo = -1; } return(note); }
public void StartProgram() { for (int i = 0; i < 20; i = i + 1) { SongNote note = RandomSongNote(); PlaySongNote(note); } }
public static SongNote ConvertXmlNoteToSongNote(double noteTime, Note xmlNote) { var songNote = new SongNote(); songNote.NoteTime = noteTime; songNote.PitchId = (xmlNote.Pitch.Octave + 1) * 12 + XmlMusicHelper.GetMidiIdOffsetFromC(xmlNote); songNote.Velocity = 100; songNote.Duration = xmlNote.Duration; return songNote; }
public void StartProgram() { SongNote [] notes = new SongNote[3]; notes[0].NotePitch = 0; notes[0].NoteDuration = 0.4; notes[1].NotePitch = 2; notes[1].NoteDuration = 0.8; notes[2].NotePitch = 4; notes[2].NoteDuration = 0.4; for (int i = 0; i < 3; i = i + 1) { SnapsEngine.PlayNote(pitch: notes[i].NotePitch, duration: notes[i].NoteDuration); } }
private SongNote2014 GetNoteInfo(SongNote songNote) { SongNote2014 songNote2014 = new SongNote2014(); songNote2014.Bend = (float)songNote.Bend; // tested ... BendValue time causing in game hangs if off by 0.001f if (songNote.Bend > 0) { var bendValues = new List <BendValue>(); // CRITICAL CALCULATION - DO NOT CHANGE - MULTIPLIER VALUE MUST BE 0.3333 TO ACHEIVE PROPER ACCURACY AND MATCH EOF OUTPUT bendValues.Add(new BendValue { Step = songNote.Bend, Time = (float)Math.Round((songNote.Sustain * 0.3333 / songNote.Bend) + songNote.Time, 3), Unk5 = 0 }); songNote2014.BendValues = bendValues.ToArray(); } // RS1 // <note time="73.047" bend="0" fret="5" hammerOn="0" harmonic="0" hopo="0" ignore="0" palmMute="0" pullOff="0" slideTo="-1" string="1" sustain="0" tremolo="0"/> songNote2014.Time = (float)songNote.Time; songNote2014.Bend = (float)songNote.Bend; songNote2014.Fret = (sbyte)songNote.Fret; songNote2014.HammerOn = (byte)songNote.HammerOn; songNote2014.Harmonic = (byte)songNote.Harmonic; songNote2014.Hopo = (byte)songNote.Hopo; songNote2014.Ignore = (byte)songNote.Ignore; songNote2014.PalmMute = (byte)songNote.PalmMute; songNote2014.PullOff = (byte)songNote.PullOff; songNote2014.SlideTo = (sbyte)songNote.SlideTo; songNote2014.String = (byte)songNote.String; songNote2014.Sustain = (float)songNote.Sustain; songNote2014.Tremolo = (byte)songNote.Tremolo; // initialize elements not present in RS1 songNote2014.Slap = 0; // EOF is non-compliant songNote2014.Pluck = 0; // EOF is non-compliant songNote2014.LinkNext = 0; songNote2014.Accent = 0; songNote2014.LeftHand = -1; songNote2014.Mute = 0; songNote2014.HarmonicPinch = 0; songNote2014.PickDirection = 0; songNote2014.RightHand = -1; songNote2014.SlideUnpitchTo = -1; songNote2014.Tap = 0; songNote2014.Vibrato = 0; return(songNote2014); }
private SongNote2014 GetNoteInfo(SongNote songNote) { SongNote2014 songNote2014 = new SongNote2014(); songNote2014.Bend = (byte)songNote.Bend; if (songNote.Bend > 0) { var bendValues = new List <BendValue>(); bendValues.Add(new BendValue { Step = songNote.Bend, Time = (float)Math.Round((songNote.Sustain * .333 / songNote.Bend) + songNote.Time, 3), Unk5 = 0 }); songNote2014.BendValues = bendValues.ToArray(); } songNote2014.Fret = (sbyte)songNote.Fret; songNote2014.HammerOn = (byte)songNote.HammerOn; songNote2014.Harmonic = (byte)songNote.Harmonic; songNote2014.Hopo = (byte)songNote.Hopo; songNote2014.Ignore = (byte)songNote.Ignore; songNote2014.PalmMute = (byte)songNote.PalmMute; songNote2014.Pluck = (sbyte)songNote.Pluck; // -1; // EOF is non-compliant songNote2014.PullOff = (byte)songNote.PullOff; songNote2014.Slap = (sbyte)songNote.Slap; // -1; // EOF is non-compliant songNote2014.SlideTo = (sbyte)songNote.SlideTo; songNote2014.String = (byte)songNote.String; songNote2014.Sustain = (float)songNote.Sustain; songNote2014.Time = (float)songNote.Time; songNote2014.Tremolo = (byte)songNote.Tremolo; // initialize elements not present in RS1 songNote2014.LinkNext = 0; songNote2014.Accent = 0; songNote2014.LeftHand = -1; songNote2014.Mute = 0; songNote2014.HarmonicPinch = 0; songNote2014.PickDirection = 0; songNote2014.RightHand = -1; songNote2014.SlideUnpitchTo = -1; songNote2014.Tap = 0; songNote2014.Vibrato = 0; return(songNote2014); }
public static Songs.Model.Song readMidi(string fileName) { var midiFile = MidiFile.Read(fileName); List <SongNote> notes = new List <SongNote>(); TempoMap tempoMap = midiFile.GetTempoMap(); foreach (var trackChunk in midiFile.GetTrackChunks()) { using (var notesManager = trackChunk.ManageNotes()) { foreach (Melanchall.DryWetMidi.Smf.Interaction.Note midiNote in notesManager.Notes) { SongNote note = new SongNote(midiNote.NoteName, midiNote.Octave, midiNote.Time / 1000f, (midiNote.Time + midiNote.Length) / 1000f); notes.Add(note); } } } return(new Songs.Model.Song(notes)); }
public void StartProgram() { SnapsEngine.SetTitleString("Keyboard Cat Alarm"); SnapsEngine.DisplayString("Tap the screen to stop the alarm"); SnapsEngine.ClearScreenTappedFlag(); while (true) { SongNote note = RandomSongNote(); PlaySongNote(note); if (SnapsEngine.ScreenHasBeenTapped()) { break; } } SnapsEngine.DisplayString("Alarm cleared"); }
public void StartProgram() { SnapsEngine.SetTitleString("Song Recorder"); // Store the notes in an array SongNote[] tune = new SongNote[100]; // Holds the length of the tune int tuneLength = 0; // repeatedly read notes until the tune is complete for (int tunePos = 0; tunePos < tune.Length; tunePos = tunePos + 1) { string command = SnapsEngine.SelectFrom2Buttons("New Note", "Play Tune"); // Quit the loop if the user wants to exit if (command == "Play Tune") { // Record the length of the tune for playback tuneLength = tunePos; break; } // Get the note details int notePitch = SnapsEngine.ReadInteger("Note Pitch"); float noteDuration = SnapsEngine.ReadFloat("Note Duration"); // Create a new note SongNote newNote = new SongNote(pitch: notePitch, duration: noteDuration); // Store the new note in the tune tune[tunePos] = newNote; } // Play the tune for (int tunePos = 0; tunePos < tuneLength; tunePos++) { SnapsEngine.PlayNote(pitch: tune[tunePos].NotePitch, duration: tune[tunePos].NoteDuration); } }
public void StartProgram() { List <SongNote> tune = new List <SongNote>(); //int _notepitch = SnapsEngine.ReadInteger("Note Pitch"); //double _noteduration = SnapsEngine.ReadInteger("Note Duration"); //SongNote newNote = new SongNote(_notepitch, _noteduration); SongNote newNote1 = new SongNote(1, .4); SongNote newNote2 = new SongNote(4, .4); SongNote newNote3 = new SongNote(7, .4); tune.Add(newNote1); tune.Add(newNote2); tune.Add(newNote3); for (int i = 0; i < tune.Count; i++) { SnapsEngine.PlayNote(tune[i].NotePitch, tune[i].NoteDuration); } //Playing a song with an array //SongNote[] notes = new SongNote[5]; //notes[0].NotePitch = 0; notes[0].NoteDuration = .4; //notes[1].NotePitch = 2; notes[1].NoteDuration = .4; //notes[2].NotePitch = 4; notes[2].NoteDuration = .4; //notes[3].NotePitch = 6; notes[3].NoteDuration = .4; //notes[4].NotePitch = 8; notes[4].NoteDuration = .4; //for (int i = 0; i < notes.Length; i++) //{ // SnapsEngine.PlayNote(pitch: notes[i].NotePitch, duration: notes[i].NoteDuration); //} }
private int CalculateNoteDuration(SongNote songNote) { return (int)songNote.Duration * 1000 * 60 / _song.Tempo; }
private int CalculateNoteDurationMilliSeconds(int tempo, SongNote note) { return((int)(LengthOfBeatInMicroSeconds(tempo) * note.Duration / 1000)); }
public void PlaySongNote(SongNote noteToPlay) { SnapsEngine.PlayNote(noteToPlay.NotePitch, noteToPlay.NoteDuration); }
//public static WholeShowSongList GetSongList(ISet set) //{ // //set.songl //} public void AddSong(ISong song, SongNote note) { SongList.Add(new KeyValuePair<ISong, SongNote>(song, note)); }
public void PlaySongNote(SongNote noteToPlay) { SnapsEngine.PlayNote(pitch: noteToPlay.Pitch, duration: noteToPlay.Duration); }
//public static WholeShowSongList GetSongList(ISet set) //{ // //set.songl //} public void AddSong(ISong song, SongNote note) { SongList.Add(new KeyValuePair <ISong, SongNote>(song, note)); }
public void StartProgram() { SongNote note = new SongNote(inPitch: 0, inDuration: 0.4); }
public void JsonLoad(JObject jObject) { this.DisplayName = jObject["DisplayName"].Value <String>(); this.StepListName = jObject["StepListName"].Value<String>(); this.ArtistName = jObject["ArtistName"].Value<String>(); this.SongName = jObject["SongName"].Value<String>(); this.MusicName = jObject["MusicName"].Value<String>(); this.Difficulty = jObject["Difficulty"].Value<SongDifficulty>(); this.BeatsPerSecond = jObject["BeatsPerSecond"].Value<int>(); this.SongLength = jObject["SongLength"].Value<int>(); this.Snapping = jObject["Snapping"].Value<SongRecordingSnapping>(); foreach(var note in jObject["Notes"]) { var songNote = new SongNote(); SongNotes.Add(songNote); songNote.JsonLoad(note); } }