public MidiPlayer(Midi midi, string strFileName, int iInstrument, int iVolume) : this(midi) { StreamReader sr = new StreamReader(strFileName); string strLine, str = ""; while (null != (strLine = sr.ReadLine())) { if (strLine.Length == 0 || strLine[0] == '/') { continue; } str += strLine + " "; } sr.Close(); int iStart = 0; int iEnd = str.IndexOf('|', iStart); for (int i = 0; iEnd != -1; i++) { Add(i, str.Substring(iStart, iEnd - iStart + 1), iInstrument, iVolume, false); iStart = iEnd + 1; iEnd = str.IndexOf('|', iStart); } }
public override ChartFormat DecodeChart(FormatData data, ProgressIndicator progress) { if (!data.HasStream(this, ChartFile)) { throw new FormatException(); } Stream stream = data.GetStream(this, ChartFile); Midi midi = Midi.Create(Mid.Create(stream)); if (data.Song.Data.GetValue <bool>("RBChartExpertPlus")) { Midi.Track track = midi.GetTrack("PART DRUMS"); if (track != null) { foreach (Midi.NoteEvent note in track.Notes) { if (note.Note == 95) { note.Note = 96; } } } } ChartFormat chart = ChartFormat.Create(midi); data.CloseStream(stream); return(chart); }
void RenderMidi(SongSelectItemController item, Midi midi) { item.titleText.text = GetStringOrUnkonwn(midi.name); item.line1Text.text = "by " + GetStringOrUnkonwn(midi.artistName); item.line2Text.text = " 0 0x 0%"; item.action = () => { Debug.Log("ShowMidiDetail"); //level.selectedDownloadedMidi = midi; level.selectedMidiId = midi.id; level.Push(level.midiDetailPage); }; var coverUrl = midi.coverUrl; if (coverUrl != null) { web.LoadTexture(coverUrl, job => { var texture = job.GetData(); item.imageCutter.Cut(job.GetKey(), texture); }); } else { item.imageCutter.Cut(defaultTexture.name, defaultTexture); } }
//=========== SHOWING ============ #region Showing /**<summary>Shows the track graph window.</summary>*/ public static void Show(Window owner, Midi midi, int trackIndex) { TrackGraphWindow window = new TrackGraphWindow(midi, trackIndex); window.Owner = owner; window.ShowDialog(); }
//根据文件生成对象 public static Midi getMidi(string xmlPath) { Midi midi = new Midi(); XmlDocument xml = new XmlDocument(); xml.Load(xmlPath); XmlNode root = xml.SelectSingleNode("music"); midi.TotalLength = long.Parse(root.Attributes ["lenth"].Value.ToString()); midi.Count = int.Parse(root.Attributes["number"].Value.ToString()); midi.Note = new string[midi.Count]; midi.NoteDelta = new long[midi.Count]; midi.Force = new int[midi.Count]; XmlNodeList xmlNodeList = root.ChildNodes; int count = 0; foreach (XmlElement xl1 in xmlNodeList) { midi.Note[count] = getNote(xl1.GetAttribute("code")); midi.Force[count] = Convert.ToInt32(xl1.GetAttribute("force"), 16); midi.NoteDelta[count] = long.Parse(xl1.GetAttribute("delta")); count++; } return(midi); }
public override string ToString() { var optionValues = new List <string> { Geolocation.ToString(), Midi.ToString(), Notifications.ToString(), Push.ToString(), SyncXhr.ToString(), Microphone.ToString(), Camera.ToString(), Magnetometer.ToString(), Gyroscope.ToString(), Speaker.ToString(), Vibrate.ToString(), Fullscreen.ToString(), Payment.ToString(), Accelerometer.ToString(), AmbientLightSensor.ToString(), Autoplay.ToString(), EncryptedMedia.ToString(), PictureInPicture.ToString(), Usb.ToString(), Vr.ToString() }; optionValues.AddRange(Other.Select(o => { o.Value.FeatureName = o.Key; return(o.Value.ToString()); })); return(string.Join("; ", optionValues.Where(s => s.Length > 0))); }
private static float GetBars(ulong beats, Midi mid) { Midi.TimeSignatureEvent previous = new Midi.TimeSignatureEvent(0, 4, 2, 24, 8); Midi.TimeSignatureEvent next; int index = -1; ulong t; float bars = 0; while (beats > 0) { if (index + 1 == mid.Signature.Count) { next = new Midi.TimeSignatureEvent(ulong.MaxValue, 0, 0, 0, 0); } else { next = mid.Signature[++index]; } t = Math.Min(next.Time - previous.Time, beats); beats -= t; bars += (float)t / previous.Numerator; previous = next; } return(bars); }
public MidiMetaData(Midi midi, BmsTrackDetectionMode mode) { mChildren = new MidiTrackMetaData[16]; switch (mode) { case BmsTrackDetectionMode.Manual: { var metaData = midi.Select(track => MidiTrackMetaData.fromTrack(track)); Root = metaData.FirstOrDefault(t => t.TrackType == BmsTrackType.Root); for (var i = 0; i < 16; ++i) { mChildren[i] = metaData.FirstOrDefault(t => t.TrackType == BmsTrackType.Child && t.TrackId == i); } break; } case BmsTrackDetectionMode.Auto: { Root = MidiTrackMetaData.fromTrack(midi.FirstOrDefault(track => track.All(midiEvent => midiEvent is MetaEvent || midiEvent is ControlChangeEvent))); foreach (var track in midi.Where(track => track.Any<NoteOnEvent>())) { var id = track.First<ChannelEvent>().ChannelNumber; if (mChildren[id] != null) { MIDItoBMS.error("More than one track with ID {0}.", id); } mChildren[id] = MidiTrackMetaData.fromTrack(track); } break; } } if (Root == null) { MIDItoBMS.error("Failed to detect root track."); } }
private void OnAddMidi(object sender, RoutedEventArgs e) { Stop(); loaded = false; OpenFileDialog dialog = new OpenFileDialog(); dialog.Filter = "Midi Files|*.mid;*.midi|All Files|*.*"; dialog.FilterIndex = 0; var result = dialog.ShowDialog(this); if (result.HasValue && result.Value) { Midi midi = new Midi(); if (midi.Load(dialog.FileName)) { Config.Midis.Add(midi); Config.MidiIndex = Config.MidiCount - 1; listMidis.Items.Add(midi.ProperName); listMidis.SelectedIndex = Config.MidiIndex; listMidis.ScrollIntoView(listMidis.Items[Config.MidiIndex]); UpdateMidi(); } else { var result2 = TriggerMessageBox.Show(this, MessageIcon.Error, "Error when loading the selected midi! Would you like to see the error?", "Load Error", MessageBoxButton.YesNo); if (result2 == MessageBoxResult.Yes) { ErrorMessageBox.Show(midi.LoadException, true); } } } loaded = true; }
public Form1() { InitializeComponent(); Midi midi = File.Read("jauntyambience.mid"); Console.WriteLine(Formatter.FormatMidi(midi)); File.Write("jauntyambience.mid", midi); }
private void MainPage_Loaded(object sender, RoutedEventArgs e) { _midi = new Midi(); _midi.OutputDevicesEnumerated += _midi_OutputDevicesEnumerated; _midi.InputDevicesEnumerated += _midi_InputDevicesEnumerated; _midi.Initialize(); }
public void stop() { if (null != midi) { midi.Stop(); midi.Close(); midi = null; } }
public MidiMetaEvent(uint time, int type, byte[] bytes, Midi midi, MidiTrack track) { Time = time; Type = type; Bytes = bytes; Midi = midi; Track = track; }
public static string FormatMidi(Midi midi) { var ret = ""; foreach (var chunk in midi.Chunks) { ret += FormatChunk(chunk); } return(ret); }
/// <summary> /// Initializes an instance of the Sequencer class. /// </summary> public SequencerBase(Midi.IMidiReceiver inDevice, Midi.IMidiSender outDevice) { this.tickGen = new Endogine.Midi.TickGenerator(); this.tickGen.Ppqn = 96; //this.tickGen.Tempo = 500000; this.tickGen.Tick += new System.EventHandler(this.TickHandler); this.xoutDevice = outDevice; InitializeSequencer(); }
public MidiCommandEvent(uint time, int command, int channel, byte[] args, Midi midi, MidiTrack track) { Time = time; Command = command; Channel = channel; Args = args; Midi = midi; Track = track; }
private async void CbSelectMIDIOutputDevice_SelectionChanged(object sender, SelectionChangedEventArgs e) { Midi.ResetMidiOutput(); if (cbSelectMIDIOutputDevice != null && cbSelectMIDIOutputDevice.SelectedIndex > -1) { await Midi.InitOutput(((string)cbSelectMIDIOutputDevice.SelectedItem).Replace("Out: ", "")); btnEmulator.Focus(FocusState.Programmatic); } }
static void Make(string filepath) { Midi m = new Midi(filepath); Wave clip = new Wave(System.IO.FileMode.Open, "WOO.wav"); clip.Data.ChangePitch(100); clip.Save("woointerpolate.wav"); /*Wave w = m.TrackToWave(m.Tracks[0], "WOO.wav"); * w.Save("test.wav");*/ }
static void Main() { string strPrelude = CheckIfFileExists("BachCSharpPrelude.txt"); string strFugue = CheckIfFileExists("BachCSharpFugue.txt"); if (strPrelude == null || strFugue == null) { Console.WriteLine("Cannot find music files."); return; } int iInstrument = GetInteger("Enter instrument 0 through 127\r\n" + "\t(0 = Grand Piano, 6 = Harpsichord, 20 = Reed Organ)\r\n" + "\t\tor press Enter for piano: ", 0, 127, 0); int iVolume = GetInteger("Enter volume 1 through 127" + " or press Enter for default of 127: ", 1, 127, 127); int iPreludeTempo = GetInteger("Enter tempo for prelude" + " (70 through 280 quarter notes per minute)\r\n" + "\tor press Enter for default of 140: ", 70, 280, 140); int iFugueTempo = GetInteger("Enter tempo for fugue" + " (55 through 220 quarter notes per minute)\r\n" + "\tor press Enter for default of 110: ", 55, 220, 110); using (Midi midi = new Midi()) { MidiPlayer mp = new MidiPlayer(midi, strPrelude, iInstrument, iVolume); ManualResetEvent[] amre = mp.Play(iPreludeTempo); Console.Write("Playing the Prelude... "); ManualResetEvent.WaitAll(amre); mp.Stop(); Console.WriteLine(""); foreach (ManualResetEvent mre in amre) { mre.Close(); } mp = new MidiPlayer(midi, strFugue, iInstrument, iVolume); amre = mp.Play(iFugueTempo); Console.Write("Playing the Fugue... "); ManualResetEvent.WaitAll(amre); mp.Stop(); Console.WriteLine(""); foreach (ManualResetEvent mre in amre) { mre.Close(); } } }
public static void DecodeLeftHandAnimations(NoteChart chart, Midi midi) { Midi.Track track = midi.GetTrack("ANIM"); foreach (var note in track.Notes) { if (note.Note < 60 && note.Note >= 40) { chart.PartGuitar.FretPosition.Add(new Pair <NoteChart.Note, byte>(new NoteChart.Note(note), (byte)(note.Note - 40))); } } }
private void SendSysExBuffer(IntPtr handle, byte[] data) { MidiSysExMessage sysex = new MidiSysExMessage(true, handle); sysex.CreateBuffer(data); // If the header was perpared successfully. if (sysex.Prepare()) { // send a system-exclusive message to the output device Midi.MIDI_OutLongMsg(handle, sysex.MessageAsIntPtr); } }
public override bool FinishedLaunching(UIApplication app, NSDictionary options) { window = new UIWindow(UIScreen.MainScreen.Bounds); window.MakeKeyAndVisible(); Midi.Restart(); SetupMidi(); dvc = new DialogViewController(MakeRoot()); window.RootViewController = new UINavigationController(dvc); return(true); }
static int Main() { try { handler = new ConsoleEventDelegate(ConsoleEventCallback); SetConsoleCtrlHandler(handler, true); midi = new Midi(); midi.InOpen("midiTest"); midi.OutOpen("midiTest"); midi.SendMidi(new byte[] { 0x90, 0x3C, 0x7F, 0x00 }); //midi.InOpen("Ableton Push 2"); //midi.OutOpen("Ableton Push 2"); ////midi.OutOpen("MIDIOUT2 (Ableton Push 2)"); ////midi.InOpen("MIDIIN2 (Ableton Push 2)"); ////midi.OutOpen("fromDAW"); ////midi.InOpen("toDAW"); //midi.SendMidi(new byte[] { 0x90, 0x3C, 0x7F, 0x00 }); //Thread.Sleep(1000); //midi.SendMidi(new byte[] { 0x80, 0x3C, 0x00, 0x00 }); //midi.SendSysex(new byte[] { 0xF0, 0x00, 0x21, 0x1D, 0x01, 0x01, 0x0A, 0x00, 0xF7 }); ////midi.SendSysex(new byte[] { 0xF0, 0x00, 0x21, 0x1D, 0x01, 0x01, 0x0B, 0x00, 0xF7 }); ////midi.SendSysex(new byte[] { 0xF0, 0x00, 0x21, 0x1D, 0x01, 0x01, 0x0C, 0x00, 0xF7 }); //midi.OnShortReceive = test; //midi.OnLongReceive = test; Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new AudioWave()); //Push2Controller push2 = new Push2Controller(); midi.OutClose(); midi.InClose(); } catch (Exception ex) { Console.WriteLine(ex.Message); Console.ReadKey(); return(-1); } finally { Console.WriteLine("Block finally"); } Console.ReadKey(); return(0); }
public void start() { IConfiguration configuration = ServiceManager.get <IConfiguration>(netplug.Services.Configuration); string outputDevice = configuration.getProperty("arg0"); int outputDeviceId = (outputDevice.Length > 0) ? int.Parse(outputDevice) : -1; if (null == midi) { midi = new Midi(this); midi.Open(-1, outputDeviceId); midi.Start(); } }
// Use this for initialization void Start() { scoreUtil.init(); string xmlPath = Application.streamingAssetsPath + "/" + PlayerPrefs.GetString("selectedLevel") + ".xml"; midi = Midi.getMidi(xmlPath); midiPlayer.StopAll(); midiPlayer.Play(PlayerPrefs.GetString("selectedLevel") + ".mid"); analysisSignal = new AnalysisSignal(); analysisSignal.midiStart(0); midikeycode = new MidiKeyCode(); midichordcode = new ChordKeycode(); }
//import a midi file public void ImportMidi() { if (AlertIfUnsavedChanges()) { NSUrl loadPath = null; using (var openDialog = new NSOpenPanel()) { openDialog.AllowedFileTypes = new string[] { "mid", "midi" }; var result = openDialog.RunModal(); if (result == 1) { loadPath = openDialog.Url; } } if (loadPath != null) { try { var midi = new Midi(loadPath.RelativePath); if (midi.TrackCount > 1) { TrackChooserWindow trackChooser; using (var temp = new TrackChooserWindowController()) { trackChooser = temp.Window; trackChooser.SetTrackList(midi.GetTrackNames()); } NSApplication.SharedApplication.RunModalForWindow(trackChooser); if (trackChooser.Track != -1) { song.ImportFromMidiTrack(midi, trackChooser.Track); currentFile = null; UpdateOutput(true); } } else { song.ImportFromMidiTrack(midi, 0); currentFile = null; UpdateOutput(true); } } catch (Exception ex) { Alert.CreateAlert(ex.Message, AlertType.Caution); } } } }
private void DecodeCoop(Midi midi, bool coop) { Midi.Track cooptrack = midi.GetTrack("PART GUITAR COOP"); if (cooptrack != null && (coop || midi.GetTrack("PART GUITAR") == null)) { midi.RemoveTracks("PART GUITAR"); cooptrack.Name = "PART GUITAR"; } cooptrack = midi.GetTrack("PART RHYTHM"); if (cooptrack != null && (coop || midi.GetTrack("PART BASS") == null)) { midi.RemoveTracks("PART BASS"); cooptrack.Name = "PART BASS"; } }
protected override void DoTaskForFile(string pPath, IVgmtWorkerStruct pExtractMidiStruct, DoWorkEventArgs e) { long headerOffset = 0; using (FileStream fs = File.OpenRead(pPath)) { while ((headerOffset = ParseFile.GetNextOffset(fs, headerOffset, Midi.ASCII_SIGNATURE_MTHD)) > -1) { Midi midiFile = new Midi(); midiFile.Initialize(fs, pPath, headerOffset); midiFile.ExtractToFile(fs, Path.Combine(Path.GetDirectoryName(pPath), Path.GetFileNameWithoutExtension(pPath))); headerOffset += 1; } } }
public static Mub ParseMidi(Midi mid) { Mub mub = new Mub(); if (mid.Tracks.Count != 1) { throw new FormatException(); } Midi.Track track = mid.Tracks[0]; foreach (Midi.NoteEvent note in track.Notes) { float time = GetBars(note.Time, mid) / mid.Division.TicksPerBeat; float duration = (GetBars(note.Time + note.Duration, mid) - GetBars(note.Time, mid)) / mid.Division.TicksPerBeat; mub.Nodes.Add(new Node() { Time = time, Duration = duration, Type = (int)note.Note, Data = 0 }); } foreach (Midi.TextEvent comment in track.Comments) { float time = GetBars(comment.Time, mid) / mid.Division.TicksPerBeat; mub.Nodes.Add(new MarkerNode() { Time = time, Duration = 0, Type = (int)0x0AFFFFFF, Text = comment.Text }); } foreach (Midi.TextEvent comment in track.Markers) { float time = GetBars(comment.Time, mid) / mid.Division.TicksPerBeat; mub.Nodes.Add(new MarkerNode() { Time = time, Duration = 0, Type = (int)0x09FFFFFF, Text = comment.Text }); } return(mub); }
public Form2(Midi mid, string file) { // // Windows 窗体设计器支持所必需的 // InitializeComponent(); // // TODO: 在 InitializeComponent 调用后添加任何构造函数代码 // try { midi = mid; midiFileName = file; }catch (Exception err) { System.Windows.Forms.MessageBox.Show(err.Message); } }
RootElement MakeDevices() { return(new RootElement("Devices (" + Midi.DeviceCount + ", " + Midi.ExternalDeviceCount + ")") { new Section("Internal Devices") { from x in Enumerable.Range(0, Midi.DeviceCount) let dev = Midi.GetDevice(x) where dev.EntityCount > 0 select MakeDevice(dev) }, new Section("External Devices") { from x in Enumerable.Range(0, Midi.ExternalDeviceCount) let dev = Midi.GetExternalDevice(x) where dev.EntityCount > 0 select(Element) MakeDevice(dev) } }); }
// // Creates the content displayed // RootElement MakeRoot() { return(new RootElement("CoreMidi Sample") { (hardwareSection = new Section("Hardware") { (Element)MakeHardware(), (Element)MakeDevices(), }), new Section("Send") { new StringElement("Send Note", SendNote) }, new Section("Commands") { new StringElement("Rescan", delegate { ReloadDevices(); }), new StringElement("Restart MIDI", delegate { Midi.Restart(); }), } }); }
// // Creates the content displayed // RootElement MakeRoot() { return(new RootElement("CoreMidi Sample") { (hardwareSection = new Section("Hardware") { MakeHardware(), new RootElement("Devices (" + Midi.DeviceCount + ", " + Midi.ExternalDeviceCount + ")") }), new Section("Send") { new StringElement("Send Note", SendNote) }, new Section("Commands") { new StringElement("Rescan", delegate { ReloadDevices(); }), new StringElement("Restart MIDI", delegate { Midi.Restart(); }), } }); }
//========= CONSTRUCTORS ========= #region Constructors /**<summary>Constructs the track graph window.</summary>*/ public TrackGraphWindow(Midi midi, int trackIndex) { InitializeComponent(); playbackUITimer.Elapsed += OnPlaybackUIUpdate; playbackUITimer.AutoReset = true; if (!DesignerProperties.GetIsInDesignMode(this)) { playbackUITimer.Start(); oldPianoMode = Config.PianoMode; Config.PianoMode = true; toggleButtonPiano.IsChecked = true; toggleButtonWrapPianoMode.IsChecked = Config.WrapPianoMode; toggleButtonSkipPianoMode.IsChecked = Config.SkipPianoMode; } ListBoxItem item = new ListBoxItem(); item.Content = "All Tracks"; item.FontWeight = FontWeights.Bold; listTracks.Items.Add(item); for (int i = 0; i < Config.Midi.TrackCount; i++) { item = new ListBoxItem(); item.Content = Config.Midi.GetTrackSettingsAt(i).ProperName; if (!Config.Midi.GetTrackSettingsAt(i).Enabled) { item.Foreground = Brushes.Gray; } listTracks.Items.Add(item); } this.trackIndex = trackIndex; this.listTracks.SelectedIndex = trackIndex + 1; loaded = true; Width = InitialWidth; Height = InitialHeight; Title += " - " + midi.ProperName; }
protected static void UseOutputDevice(Midi.OutputDevice odNew) { if ((odNew == _devOut) || (odNew == null)) return; if (_midiClock.IsRunning) { _midiClock.Stop(); _midiClock.Reset(); } if ((_devOut != null) && _devOut.IsOpen) _devOut.Close(); _devOut = odNew; _devOut.Open(); _midiClock.Start(); }
public void SetInstrument(Midi.Instrument instrument) { midi.SetInstrument(instrument); }
public MidiTrack(Midi midi) { _midi = midi; Name = "Track" + GetHashCode(); }
public MidiChannel(Midi.Channel c) { channel = c; Name = Enum.GetName(typeof(Midi.Channel), c); }
public void NoteOn(Midi.NoteOnMessage msg, Midi.OutputDevice output) { throw new NotImplementedException(); }
public MidiIntegrationFacade(Midi.OutputDevice outputDevice) { this.outputDevice = outputDevice; }
public void OnMidiInput(Midi.MidiMessage message) { pianoRoll1.OnMidiInput(message); }
/// <summary> /// Called by Unity when the Component should render the UI. /// </summary> protected void OnGUI() { float x = 10; int selectedItemIndex = comboBoxControl.GetSelectedItemIndex(); selectedItemIndex = comboBoxControl.List(new Rect(x, 0, 300, 32), comboBoxList[selectedItemIndex].text, comboBoxList, listStyle); x += 310; if (GUI.Button(new Rect(x, 0, 100, 32), (midi == null) ? "Play" : "Stop")) { if (midi != null) { StopPlaying(); } else { string fileName = comboBoxList[selectedItemIndex].text; TextAsset asset = Resources.Load<TextAsset>("Midis/" + fileName.Substring(0, fileName.LastIndexOf("."))); Stream s = new MemoryStream(asset.bytes); BinaryReader br = new BinaryReader(s); midi = new Midi(br, this); if (!midi.Load()) { midi = null; } StartPlaying(); } } x += 110; useMixing = GUI.Toggle(new Rect(x, 0, 100, 32), useMixing, "Use Mixing"); x += 110; }
/// <summary> /// Called by the Synthesizer when the Synthesizer stops playing. /// </summary> public void StopPlaying() { if (OnStoppedPlaying != null) OnStoppedPlaying(); for (int i = 0; i < 16; i++) { channels[i].Reset(); } midi = null; }
public void Fire(Midi.OutputDevice outputDevice, Midi.Channel midiChannel) { outputDevice.SendNoteOn(midiChannel, pitch, velocity); }
private void midiPress(Midi.NoteOnMessage msg) { if (OnLaunchpadKeyPressed != null && !rightLEDnotes.Contains(msg.Pitch)) { OnLaunchpadKeyPressed(this, new LaunchpadKeyEventArgs(midiNoteToLed(msg.Pitch)[0], midiNoteToLed(msg.Pitch)[1])); } else if (OnLaunchpadKeyPressed != null && rightLEDnotes.Contains(msg.Pitch)) { OnLaunchpadCCKeyPressed(this, new LaunchpadCCKeyEventArgs(midiNoteToSideLED(msg.Pitch))); } }
string transpose(string musicKey, string targetKey, int direction, bool flat,out Midi.Pitch outpitch) { //convert the key to a number: //"G8" = 8 * "8" + 7 bool black = musicKey.Contains("Sharp"); musicKey = musicKey.Replace("Sharp", ""); string scale = "CDEFGABC"; int y = int.Parse(""+musicKey[1]); int x = scale.IndexOf(musicKey[0]); if (flat && black) //add1 to x x = (x + 1); if (x == 7) { x %= 7; y++; } int keyID = y * 7 + x; switch(targetKey) { case "G": direction = 3; break; case "A": direction = 2; break; case "B": direction =1; break; } keyID += direction; ; y = keyID / 7; x = keyID % 7; string preout = "" + scale[x] + ((black)?("Sharp"):("")) +y.ToString(); string cnote = "" + preout[0]; // bool sharp = musicKey.Contains("Sharp"); if (black) cnote += "#"; Midi.Note outnote = new Midi.Note(cnote); outpitch = outnote.PitchInOctave(y); return preout; }