CIRCE-EYES / Some-Basic-functions-Drywetmidi

Some basic functions using Drywetmidi - Melanchall Library.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Exceptions when not enough MidiPorts

operatortwo opened this issue · comments

When I first started the piano app without any Midi devices connected, I got repeated exception.

System.ArgumentOutOfRangeException: "InvalidArgument = Value 0 for SelectedIndex is invalid

After I connected Midi devices, it worked.

The reason is maybe in 'Public Sub frmPiano_Load' where 'SelectedIndex' of the Combo_Input and Combo_output will be set to the value of 0 and 3.
This works in a known configuration where is at least 1 Input device and at least 4 output devices. But it fails when there is no input device and maybe only 1 output device,

A workaround could be something like:

        If Combo_Input.Items.Count > 0 Then
            Combo_Input.SelectedIndex = 0
        End If

        If Combo_output.Items.Count > 3 Then
            Combo_output.SelectedIndex = 3
        End If

👍 😄

commented

Thanks for reply, yes its true about selecting index fail, because that code lines are costumized for my ports, this code you can achieve all you like so all kind of suggestions are good !!!
I m making a new update with some of news features.
Drywet library its incredible good !!!

commented

Im looking for a smart coder in vbnet which help me to build a pianoroll notes.

Im looking for a smart coder in vbnet which help me to build a pianoroll notes.

Well, I am a hobby programmer using VB.Net for a few years now. I'm not a musican and don't have much knowledge of music theory. I reached not much limitations in VisualStudio and VB.Net so far. The biggest limitation was always the required time to write a project. It can take from a few dozen hours up to a few hundred hours.
So, I think it's possible to write a pianoroll. The result will depend what features you want and how much time you have available.
For me, programming is only a hobby and does not have first priority in my live. Sometimes other things are more important and then a programming project have to wait for a few days or weeks, So an entire project or part can need some months until finish.

For the pianoroll:
Basically I see no other way than taking a blank part of the application window and draw all text, lines, rectangles manually, including position calculation for each element that reperesents a note, the background, dividing lines, and so on.
The key for painting with GDI+ is the Graphics Class. Graphics Class (In practice, its easier than it looks)

At that point I can mention that I plan to create a new repository sometime next week containing an old project with a screen-keyboard (without any sound). It contains some code that handles the Paint-Event of a control (the client Part of a Form AFAIR) getting the Graphics object and do some painting with Graphics.FillRectangle(...) and so on. Could be interesting to see the code, but also to test the response and performance when running.

For pianoroll details, a few questions appear:

  • what control contains the pianoroll, is it a form, a control, a panel,.. ?
  • is it just a view or is editing needed ?
  • has it fixed size or should it be scalable (zoom in/out) in y-direction, in x-direction ?
  • what kind of data should be visualized, only notes, or controller-data also ?
  • what about the velocity value of the notes, should they be visualized too ?
  • is filtering needed, by channel, selection of channel(s), track ... ?
  • what is the data-source of the data to visualize, what is the exact structure of the datas ?
  • and much more

Considering the required time to write, the best solution would be to keep it as simple as possible. But you have to specify what do you have in mind.

If I find the time, I will create another new repository next week, containing an old project containig a Midi-File player. The code is a bit raw, because I wrote on it over two or more years. But it could be interesting because it contains a conversion from a midi-file to an internal format like: ListOf(TrackChunk) containing ListOf(TrackEvent),... It also decodes the TrackEvents to a list view with Time, EventType, SubType, Channel, Data (f.e. '90 51 7F - A5'), Duration (Ticks), and there is also a visualisation from the players Note-Events to the Secreen-Keyboard.
Hope I find the time to edit the source next week, among other things, I have to translate some comments and Menu items from German to English.

The reason that I mentioned my projects/coming repositories was not to push them, but to give you then the opportunity to take a little look behind Midi data, processing, graphics and VB.Net code, to get a little better feeling what is possible, what effort is needed, how does the code looks,.. to make a better decision what exactly you want to reach with your pianoroll.

Have fun


PS I'm new on Github, but this is probably not the right place to discuss a new project, because we are now in the 'issue' section. There seems to be the possibility that you enable the 'Discussion' Feature in the 'Settings' for a repository.
about discussions
I never used it, but it looks interesting. If I understand it right, one can also create a new repository without any code at the beginning, for example 'PianoRoll' to start developing. (so the content is separated from another,existing repository) (?)

commented

Wow ! Thanks a lot for your words and knowledge.

Sorry, but for safety and privacy reasons I won't give any email address to no one.
I would also to recommend you, to remove your address from the post, since it is now visible to the hole world.

There are better possibilities to communicate on GitHub, even with a free account.
Meanwhile I created a new, empty, private/personal repository and invited you to collaborate. Maybe you can respont to invitation and go to the 'Discussions' section of the corresponding repository.
Or you can create a new private repository on your account, enable 'Discussions' and invite me. This way you have even more control over the access.

I also just released my Midi_Keyboard repository which contains a bit painting with the Grpahics object.

commented

Hey !!!! See new project about roll !!!!!

https://github.com/CIRCE-EYES/Roll-midi-notes-using-a-Datagridview-object-Vstudio

I m learning about your last update about new features , your project its growing !! Are in your plans to create a simply roll ?? Maybe you could, by my side I just get into a datagrid.
Its good, but all notes have same duration !! 😩

Hey !!!! See new project about roll

Hi
Nice, I will try to reply in your project in discussions. If this works, I will close this Issue here.