SyntaxBomb - Indie Coders

Languages & Coding => BlitzMax / BlitzMax NG => Topic started by: Hardcoal on March 26, 2023, 21:22:09

Title: Chord Displayer
Post by: Hardcoal on March 26, 2023, 21:22:09
My method of work is to develop general environment of gadgets, and than decide what to do with them.
so i made gadgets for music apps.. and now im using it.

So this first thing I will probably release is this chord recognizer.

It display chords by its name and how its being played on a piano and a guitar..

all functions are already working.

I want to thank midimaster who helped me alot in all that regarding audio and notes..

I didnt use to care about looks for too much.
but since i got remarks about that, i started putting effort on looks as well.
and i admit.. its nice to see your app looks

(https://i.imgur.com/WgC8VgK.jpg)





Title: Re: Chord Displayer
Post by: Midimaster on March 27, 2023, 00:05:33
I have to tell you, that the notation of the Cm-chord you display in your example screenshot is already wrong.

A Cm-Chord must have a C and a Eb and a G! Writing it with a D# is not allowed!

These Chords must use # (sharps): G D A E B F#  and Em Bm F#m C#m G#m D#m
These Chords must use b (flats): F Bb Eb Ab Db Gb and Dm Gm Cm Fm Bbm Ebm

You could implement a music theory AI to decide which chord uses which sign. But the more convenient way is to simply create a table where the app can look for each chord.

Title: Re: Chord Displayer
Post by: Hardcoal on March 27, 2023, 03:12:06
lol midi master.. I still didnt get to that..
That will be the last thing ill do when ill be ready to release the app..
so worry not.. im fully aware of that..

I already create a table for all chords, but i didnt get to that yet..

I just wanted to make first impression

Title: Re: Chord Displayer
Post by: Midimaster on March 27, 2023, 09:04:26
The table could contain a bundle of chord definitions.
Each definition contains 3 or 4 notes.
Each note is a combination of a number for the altitude of the note and a letter for ev. presign:

"Cm =0 |2b|4 "

means Cm has three notes: The 0 represents C, the 2 represents E (two notes higher) and the b says that this E needs a flat presign. The 4 representsthe G.

Here is a stand alone runable example:

SuperStrict
Graphics 600,400
SetColor 255,255,255

' the table:
Global Chord:String[10]
' chord note lines definition: 0=C, 1=D, 2=E, 3=F, 4=G, 5=A, 6=H
' # means "has a sharp", b means "has a flat"
Chord
="Cm =0 |2b|4 "
Chord[1]="Bb =6b|1 |3 "
Chord[2]="F#7=3#|5 |0#|2 "
' the current chord defintion:
Global CurrChord:String
Find("Cm")
Repeat
    Cls
    If KeyHit(KEY_C) Then Find("Cm")
    If KeyHit(KEY_B) Then Find("Bb")
    If KeyHit(KEY_F) Then Find("F#7")
   
    DrawText "Press <C> for Cm-chord, <B> for Bb-Major-chord or <F> for F#7-chord", 30,50
    'the 5 note lines:
    For Local i:Int=1 To 5
        DrawRect 100,200+i*20,300,1
    Next 
   
    DrawActChord   
   
    Flip 1
Until AppTerminate()
Function Find(Chordname:String)
    ' scans the table and return the chord definition
    For Local a:String=EachIn Chord
        Local middle:Int=Instr(a,"=")
        Local key:String=Trim(Left(a,middle-1))
        Print "scan table..." + key
        If key = Chordname
            CurrChord=Mid(a,middle+1,-1)
            Print "found definition: " + CurrChord
            Return
        EndIf
    Next
End Function
Function DrawActChord()
    ' paints the notes depending on the current definition
   
    'splits the defintion in the single notes:
    Local notes:String[]=CurrChord.Split("|")
    Local lastpos:Int  ' cares about octave shifting
   
    For Local a:String= EachIn notes
        Local pos:Int= a.ToInt
       
        ' cares about octave shifting
        If pos<lastpos
            pos=pos+7
        EndIf
        lastpos=pos
       
       
        DrawOval 200,311-pos*10,30,18
       
        SetScale 1,3
        DrawText Right(a,1), 180,300-pos*10    
        SetScale 1,1
    Next
   
End Function



The Forum-Editor has heavy problems with the blitzmax code snipplet so I post it again as attachment:


[url="https://www.syntaxbomb.com/index.php?action=dlattach;attach=5752;type=preview;file"]ChordDisplayer.bmx[/url]
Title: Re: Chord Displayer
Post by: Hardcoal on March 27, 2023, 10:27:54
Awesome midi master..
I will not release this until it gets your approval anyway.
When i began developing it i was very busy with lots of aspects..
Now, im getting closer to the the finer details.

Im building things atm in a way that is accessible to any project so i don't need to repeat my code.
And if i improve one thing, it effects all projects.. For good and sometimes for bad.
But it can be balanced
Title: Re: Chord Displayer
Post by: lucidapogee on March 27, 2023, 20:13:48
Looks neat. Maybe this will be helpful in writing compositions with physical instruments.
Title: Re: Chord Displayer
Post by: Hardcoal on March 28, 2023, 07:05:46
Ok midiMaster.. Ive fixed it..

off course I will have to pass you the program for tests to know for certain everything is ok.
but this can wait.. i still have enough work around I want to do.

I must also thank Derron that caused me to put more effort and how my apps look.
Ive never considered before the importance of looks. but now i see how effective it is

(https://i.imgur.com/qEby3Kf.jpg)
Title: Re: Chord Displayer
Post by: Hardcoal on March 29, 2023, 20:26:36
I have this error RtMidiIn: message queue limit reached!! and i dont have any idea how to get rid of it..
or how to clean the queue...
Title: Re: Chord Displayer
Post by: Midimaster on March 30, 2023, 06:38:57
MidiIn? Did you connect a MIDI Keyboard to the IN-Port of the computer? Which Keyboard?

A lot of keyboard send ACTIVE SENSING and TIME TICK messages. These are a lot of datas

You can check this with the tool MIDI-OX, which is still the best tool to investigate the MIDI ports

http://www.midiox.com/ (http://www.midiox.com/)

(https://www.musikwolke.de/img/midiox.gif)
In your app you should check all the time the state of the midi in port and fetch away the messages.


Here is a code snipplet how I normaly handle the MIDI-IN-port. The open port sends messages as Byte[]-Arrays. Every 10msec I check, whether there are those messages and copy them all to my own message-list. Later I check this list and remove the messages I do not need, but return the messages of interest.

' function in the main code:

Function TimerTick()
    Global MidiInTimer:Int
   
    If (MidiInTimer<MilliSecs()) And (MIDI.InStarted=True) Then
        MidiInTimer = MilliSecs()+10
        MIDI.Receive
        If MyWindow()=Null
            MIDI.InMessages.clear()
        ElseIf GameMode>0
            GameWindow.FetchMidiMessage
        Else
            MIDI.InMessages.clear()
        EndIf
    EndIf
End Function



Type MidiMessageTyp
    Field Typ:Int, Channel:Int, Note:Int, Volume:Int
End Type



Type MIDI

    Global InMessages:TList = New TList

    Global MidiOut:TRtMidiOut, OutStarted:Int
    Global MidiIn :TRtMidiIn , InStarted:Int

    Function Receive()
        ' has to be called every 10msec!
        Local stamp:Double

        If InStarted=True Then
            message:Byte[] = midiIn.getMessage(stamp)
            nBytes:Int     = message.length

            Local Value:Int
            Local loc:MidiMessageTyp=New MidiMessageTyp  ' my message typ
            If nBytes > 0
                For Local i:Int = 0 Until nBytes
                    Value = message[i]
                    Select i
                        Case 0
                            loc.Typ     = Value/16
                            loc.Channel = Value Mod 16   
                        Case 1
                            loc.Note    = Value
                        Case 2
                            loc.Volume  = Value
                    End Select
                Next   
                InMessages.AddLast loc  ' List for the messages
            EndIf
        EndIf
    End Function
   
   
    Function GetNextMessage:MidiMessageTyp(OnlyThisMessageTyp:Int=0)
        ' this also removes unwanted messages from the list
               
        If InMessages.count()>0 Then
            For Local loc:MidiMessageTyp = EachIn InMessages
                Akt:MidiMessageTyp = loc
                InMessages.Remove loc
               
                If OnlyThisMessageTyp=0
                    Print "fetch all types"
                    Return Akt
                ElseIf akt.Typ = OnlyThisMessageTyp
                    Print "found my type"
                    Return Akt
                EndIf
            Next
        EndIf
        Return Null
    End Function
   
End Type
   
   


Title: Re: Chord Displayer
Post by: Hardcoal on March 30, 2023, 23:25:14
This midi ox is cool.. i made something like that .. but not that advanced..

here is the latest image 

(https://i.imgur.com/VuraZDb.jpg)
Title: Re: Chord Displayer
Post by: Hardcoal on April 02, 2023, 06:05:20
This is so annoying.. in RT midi.. I cant recognize if a midi is occupied by another program..
I tried every way.. including asking isportopen()
but the most annoying thing is that it does show an error message when trying to create new port.
but it does not bother to transmit the error message to the user from the DLL

so when i try opening the midi using  ' MidiIn = New TRtMidiIn.Create()' its and error but does not let you know.. by returning any flag
Method Prepare:String()
Local MSG:String, PortsExists_flg

MidiIn = New TRtMidiIn.Create()
MidiOut = New TRtMidiOut.Create()

   'Midi In

  Local PortsCount = Midi.midiIn.getPortCount()

   'If no Ports can be Open then
If PortsCount = 0 Then
Notify "No Midi Ports"
Return '<--End
Else
Print "Number of Midi Ports " + PortsCount
End If

For Local I:Int = 0 Until PortsCount
Print "  Input port Named " + Midi.MidiIn.getPortName(I)
PortsExists_flg = True
Next

MSG = MSG + "Opening " + Midi.MidiIn.getPortName() + "~n"

    If PortsExists_flg <> False Then Midi.MidiIn.openPort(0)  '< - 'This will not work if Mixcraft is open

   'Don't ignore sysex, timing, or active sensing messages.
Midi.MidiIn.ignoreTypes(False, False, False)

   'Midi Out
   
Return MSG
End Method


Title: Re: Chord Displayer
Post by: Midimaster on April 02, 2023, 08:24:18
Hi Hardcoal,

thats an interesting point. I never tested what happens if a device is there but already used by another app. 

First of all: You can always open a RT-MIDI-instance, also if no port or no device exists or it is used by another app or it would be avaiable for you. So there is never an error massage when opening the RT-MIDI .
MidiOut:TRtMidiOut = New TRtMidiOut.Create()

After you created the instance you have to check whether there are avaiable ports. In my opinion the instance should now report only the not used ports with...
PortsCount = MidiIn.GetPortCount()
For Local i%=0 To PortsCount-1
   Print MidiIn.getPortName(i)
   ....
 
Did you find out, that RT-MIDI now also counts and lists the ports, that are used by another app? This would be a bug, or?

If so...I would expect that in the last step the RT-MIDI report something when trying to open such a port:
Report = MidiOut.openPort(i)
Can you please check if this is possible and if what happens...

There are two people responsible for RT-MIDI. One is Brucey, which wrote the wrapper to BlitzMax and the second is Gary P. Scavone which is the author of RT-MIDI class. Both would be very interested in a bug report, but first we should be 100% sure, that is it a bug and not a forgotten check from us.

Here ist the RT-MIDI-Homepage with also a tutorial:

https://www.music.mcgill.ca/~gary/rtmidi/ (https://www.music.mcgill.ca/~gary/rtmidi/) 

There I can see that they published Version 5, while Brucey is still on version 4


Title: Re: Chord Displayer
Post by: Midimaster on April 02, 2023, 08:50:30
I now opened an issue on the GitHub-Account of RT-MIDI. It has the number #313

https://github.com/thestk/rtmidi/issues/313 (https://github.com/thestk/rtmidi/issues/313)

Here is the question:
Quotepre-information:
 Hi, I'm working with RT-MIDI via a BlitzMax-Wrapper. At the moment we use V 4.0.0. The BlitzMax-Wrapper is made by Bruce A Henderson (https://github.com/bmx-ng (https://github.com/bmx-ng)).
Today we come to the problem, that we have a MIDI-IN-Device, but it is used by another app. The question is now: How can we find out, that this Port is not aviable for us. Does RT-MIDI offer a way to detect this? by the way... is there a forum where we can ask qusetions like this to the RT-MIDI community?
we'll see what happens....

Years ago I found a bug on RT-MIDI and reported it to Brucey. He contacted Gary. And both were very helpful and immediately reacted with an update...
Title: Re: Chord Displayer
Post by: Derron on April 02, 2023, 09:40:33
I am not sure but the blitzmax glue code is doing this:
void bmx_rtmidiout_openPort(RtMidiOut * m, int portNumber, BBString * portName) {
    char * n = bbStringToUTF8String(portName);
   
    try {
        m->openPort(portNumber, n);
        bbMemFree(n);
    } catch (RtMidiError &error) {
        bbMemFree(n);
        bmx_rtmidi_throw(error);
    }   
}


while rtMidi does this:
void MidiOutCore :: openPort( unsigned int portNumber, const std::string &portName )
{
  if ( connected_ ) {
    errorString_ = "MidiOutCore::openPort: a valid connection already exists!";
    error( RtMidiError::WARNING, errorString_ );
    return;
  }
...

so if something fails in rtmidi it "error()"s . error is defined in RtMidi.h and extends "exceptions". So normally it should throw an exception which is then passed into "bmx_rtmidi_throw"


which itself then does:

void bmx_rtmidi_throw(RtMidiError &error) {
    bbExThrow(CB_PREF(bah_rtmidi_TRtError__create)(bbStringFromCString(error.what()), (int)error.getType()));
}


Maybe you can add some 'printf("bla");' to these portions so to see what actually does "what" and where it does no longer pass along the error.


Edit: the current version of that rtMidi.mod surely needs an update anyways (char conversion casts missing for current NG).

Edit2: I modified the glue.cpp to compile - if you want to check with your changes - https://gist.github.com/GWRon/c8df9f3e1097a149a013ccc07cbd6f14
As I do not have a midi input device it lists "0" here.

Edit3:
try {
m->openPort(portNumber, n);
printf("midi open port OK");
bbMemFree(n);
} catch (RtMidiError &error) {
printf("midi in openport error");
bbMemFree(n);
bmx_rtmidi_throw(error);
}
prints for me the OK part ... but not the caught exception.

I checked what the sample uses on "APIs":
For local i:int = EachIn midiIn.getCompiledApi()
print "api: " + i
Next
only number 5 ... which equals to
Rem
bbdoc: A compilable but non-functional API.
End Rem
Const RTMIDI_API_RTMIDI_DUMMY:Int = 5

So in my case it asks the "dummy" api to open ports ...  which might explain why no error is thrown.

bye
Ron
Title: Re: Chord Displayer
Post by: Midimaster on April 02, 2023, 10:24:23
That would means he has to do something like this?

...
If PortsExists_flg
Try
Midi.MidiIn.openPort(0)
Catch Exception:Object
Print "Device open failed:"
Print Exception.ToString()
End Try

EndIf
...
Title: Re: Chord Displayer
Post by: Derron on April 02, 2023, 10:50:35
I manually defined "#define __LINUX_ALSA__ 1" in RtMidi.cpp so it compiles in the ALSA api here on linux.

./bmk makeapp -g x64 -t console -r -x "/home/ronny/Arbeit/Tools/BlitzMaxNG/mod/bah.mod/rtmidi.mod/examples/midi_in.bmx"
[ 25%] Processing:midi_in.bmx
[100%] Linking:midi_in
  Input port #0 : Midi Through:Midi Through Port-0 14:0
Opening Midi Through:Midi Through Port-0 14:0
Reading MIDI from port ... quit with ESCAPE.
MidiInAlsa::openPort: a valid connection already exists!

The "printf" I added, report "OK" .. so opening the port was ok (here!) - dunno if it should work without anything connected. Guess so.


Think you should raise the issue in the bah.mod repository too ... and maybe add a link to the thread here. Brucey might then just update the module and fix potential issues he comes across doing so.


Anyways "opening" is something different than "reading" - so you might check "reading" too (not just "opening").

bye
Ron
Title: Re: Chord Displayer
Post by: Derron on April 02, 2023, 10:56:19
Regarding "isPortOpen" ...

Docs
QuoteReturns true if a port is open and false if not.

Note that this only applies to connections made with the openPort() function, not to virtual ports.

Implemented in RtMidiOut, and RtMidiIn.

So it only returns True if the connection was made in your application (via openPort() _not_ if some other programme uses the devices.

It simply returns either 0 (virtual ports) or the value of "connected". Means it does not ask any hardware or driver ... it simply returns a value it set itself:
  inline bool isPortOpen() const { return connected_; }

void MidiInCore :: openPort( unsigned int portNumber, const std::string &portName )
{
...
  // Save our api-specific port information.
  data->port = port;

  connected_ = true;
}

bye
Ron
Title: Re: Chord Displayer
Post by: Hardcoal on April 02, 2023, 12:42:57
I tried anyway i can imagine to detect if the port used.. and in vain. .

when you do getportcount its still gives you the number

and when you ask MidiIn.isPortOpen it gives you zero in both cases ..

the thing is that it crashes the app.. or i could have live with that


other than that .. Midi Master and Derron..  here is a link for download
feel free to test it
im sure youll have lots of remarks

https://drive.google.com/file/d/1j7ddB53Me7QoK_Wk6KhiaANAULq8pe-U/view?usp=sharing

I can say i kinda finished it for this point..
im not sure when ill publish it..
but im very pleased from the point i come..

from this point forwards ill decide what i wanna do.
but thats how i work..  I dont finish things 100% 
unless I really want to

and thanks to Derron i started carrying about the looks of my apps.
up till now i didnt care much and it was a mistake

im sure you will find bugs or errors in the note detections and so on..
and i didnt put all the chords yet or the most common ones
and i already fix certain things since this last release.

p.s
i didnt had such a great day. i mean it was ok day but something went wrong.
so im a bit unbalanced atm
so it also effects my replies quality




Title: Re: Chord Displayer
Post by: Midimaster on April 02, 2023, 17:09:00
I received this answer from Gary:
QuoteDo I understand it right: You have an existing MIDI Port on your system and want to read that MIDI stream with RtMidi. This doesn't work because the device is in use. This probably implies that you are using Windows as other systems usually have an intermediate layer that duplicates the stream to both applications. Both MacOS and ALSA have a device based API that allows exclusive access to the devices but usually the midi daemon (MacOS) or the sequencer API (ALSA) are used if exclusive access is necessary.
Whenever a port is not available while RtMidi tries to connect to it, an eception will be thrown. You should ask the BlitzMax people how to catch it.
Title: Re: Chord Displayer
Post by: Midimaster on April 02, 2023, 17:34:41

Quote...when you do getportcount its still gives you the number

That is correct. The RT-MIDI reports the devices it finds, no matter whether they are already used or not working.



Quote...and when you ask MidiIn.isPortOpen it gives you zero in both cases ..
In both cases? What do you mean? And... a MIDI-Device is only open when you have opened it from blitzmax. So this is a command line that can only follow after your  Midi.MidiIn.openPort(n) 
 


Quotethe thing is that it crashes the app..
When? Which code line? Did you read about the Exceptions?


QuoteI can say i kinda finished it for this point..
Does this mean, you are not longer interesed in solving this problem?



Quotep.s
i didnt had such a great day. i mean it was ok day but something went wrong.
so im a bit unbalanced atm

Keep on struggling! We know, how you suffer. Have a brake for today... There is always a tomorrow!
Title: Re: Chord Displayer
Post by: Hardcoal on April 02, 2023, 20:45:25
sure im interested in solving the problem lol..   I meant ive reached the point i wanted in this project,
lets compare It to mountain climbing.. ive reached the peek and now the descending is the same way.. but much easier ..
all im saying is that i can lower the intensity of dealing with this project.

But the whole Idea of Frameworking is that all problems must be solve so the system will work properly..
I need to solve this problem for future programs not only this one..
so how can i be not interested. :p

Quote...and when you ask MidiIn.isPortOpen it gives you zero in both cases ..

I meant that when i ask midiin.isportopen() when some external app is using the midi.. or when it doesnt 
it give same result which is 0.
anyway.. no way to detect if midi is busy unless theirs an external method to do it..

also one more thing. if i turn off my synthesizer.. the app crashes if i try to play.. 
because it seeks the port and it does not exist..
so this should be solved too.

im facing lots of issues.. and i thing there might be an issue with openal and windows 11 as well..
but i need to make more tests..

if you have a chance please check if my program runs on your computer..
it may be missing some image files.. 
but on my friends computer it somehow workd 
Title: Re: Chord Displayer
Post by: Midimaster on April 03, 2023, 01:18:59
Please check what happens, when you doing this:

1. Close all other MIDI-apps
2. Switch on your synthi
3. In your code: create a RTMidiIn instance
3. Open the port to your synthi device
4. Play something on the synthi
5. As a proof print the data protocol to the screen
5. Now check MidiIn.IsPortOpen()

Does it really now report "0"???
Title: Re: Chord Displayer
Post by: Hardcoal on April 03, 2023, 03:40:59
I made an arpagio chord player and for some reason when i press a chord button.
each time the first note does not play in the right bit.. either its too long or too short in like 50MS

MM... you gave a sync example that does not work. there is not Clear command in MidiIn.

IsPortOn() does return True when I use the synth..
whether I truned it before or after..

the IsPortOncannot check external use of midi.. so it seems. and theirs where the problem lies.

if instead of crashing the app it would just return error message all would be solved.



if i turn off my synth and i try to play midi out to the synth. the midi gives error and crashes..
and no way to detect this either


Title: Re: Chord Displayer
Post by: Midimaster on April 03, 2023, 08:43:52
The way MidiIn.IsPortOpen()  is working is correct. It only checks if YOU opened a port before. You cannot use it for ports you did not open!!!

The central point is the MidiIn.OpenPort(). Here you can find out if BlitzMax was able to open the port. If another app already uses this port the function MidiIn.OpenPort()  returns a error message in form of an exception. You need to be prepared to receive such an exception, otherwise the OS will "handle" the exception and react with stopping your app. That is what you see as "crash".

The exceptions are handled in a Try/Catch-Block

We (Deron and me) are not 100% sure, wether this would work, but test this:

(Hy Deron, did you read that LINUX instead of WINDOWS allowes to open the same port from different apps?)

...
If PortsExists_flg
    Try
        Midi.MidiIn.openPort(0)
    Catch Exception:Object
        Print "Device open failed:"
        Print Exception.ToString()
    End Try
   
EndIf

Title: Re: Chord Displayer
Post by: Hardcoal on April 03, 2023, 09:24:54
Ok i get it ill try this. 
I never used try catch thing 
It's new to me 
Title: Re: Chord Displayer
Post by: Derron on April 03, 2023, 10:37:07
The code @Midimaster wrote should work.

"IsOpenPort()" returns what inside of rtMidi is stored in "connected_". This variable is set to "true" once "OpenPort()" finished executing their internal stuff without erroring out.

If stuff errors out, rtMidi prints to the console/terminal/stdiout... that xyz is not OK. It additionally throws an exception with a similar error message.

Bruceys rtMidi.mod fetches these exceptions - and throws it's own "Blitzmax compatible exception".

Inside the module the OpenPort() method does not return any result. So you cannot do 
If Not MidiIn.OpenPort(0) then ...

You must - for now - do as Midimaster suggested: wrap it in try-catch.

bye
Ron
Title: Re: Chord Displayer
Post by: Midimaster on April 03, 2023, 12:05:07
Ok... I have made some test with my equipment.

If I connect my NORD ELECTRO 6 to the computer and start the corresponding NORD SOUND MANAGER app, they can exchange informations. When I now start my SCORETRAINER app, it is possible to use this MIDI-IN and MIDI-OUT port also from SCORETRAINER parallel.

If I connect my NORD ELECTRO 6 to the computer and start the MIDI-OX app, they can exchange informations, but.... When I now start my SCORETRAINER app, my app crashes, when trying to use this port too.

If I connect my NORD ELECTRO 6 to the computer and start the my SCORETRAINER app first, they can exchange informations, but.... When I now start the MIDI-OX app, MIDI-OX reports that the device is already in use and does not open the device.

So it depend on the software you use. Nevertheless my own software should be prepaired for situations where the device I want to connect is not avaiable. So I will also add the TRY/CATCH way to my MIDI-Class.

Title: Re: Chord Displayer
Post by: Hardcoal on April 03, 2023, 19:10:38
Ok. ive managed to catch the Error.. and inform the user of the problem.
But I cant still make it so that the app will keep running.. regardless..
but its a major progress. so at least the user will be aware of the problem

so up till today no one explained me well what this try and catch actually does..
and i did ask..

but anyway.. theirs some holes in my knowledge concerning blitz..
like for example .. i never created an event and i have no idea what exactly that is
and what it is good for
Title: Re: Chord Displayer
Post by: Midimaster on April 03, 2023, 19:37:48
The Try/Catch way prevents the app from crashing. If a error occurs and the system is able to "throw" an exception, you have the chance of reacting to this message. In this case the action you tried ("open the port") will be canceled and the app will continue and not crash.

I added this feature today to my MIDI-Class and now the app does not longer crash if a second app already uses the port I want to open.

Also your app should now continue! Of course you cannot use the port afterwards. It is not open!

In the CATCH-part you could set your variable PortExists_flg=False and later you can check this before sending anything.



Title: Re: Chord Displayer
Post by: Derron on April 04, 2023, 11:45:13
Quote from: Hardcoal on April 03, 2023, 19:10:38so up till today no one explained me well what this try and catch actually does..
and i did ask..

There is always the option to ... simply use a search engine of your choice. I bet it will come up with explanations even in your mother tongue.

Do not let us explain you everything!


bye
Ron
Title: Re: Chord Displayer
Post by: Hardcoal on April 04, 2023, 20:31:46
Derron.. 
I learnt 99% of things in my life by myself.. so please enough with this attacking attitude..
I dont force you to reply.. 
All im saying is when I asked about Try and Catch, In the past, I didnt get the appropriate explanation.

I dont always get answer to things I ask here..
and I get along so no worries.. TY
Title: Re: Chord Displayer
Post by: Derron on April 04, 2023, 22:22:48
I assume most of us are self-taught in many areas.
It was not an "attacking attitude" - just a reply to a lazy written "I asked but nobody answered"-style blame towards us (readers and potential answer givers).
Maybe it was not your intention to sound that way but it did (at least to me).

The same way
QuoteAll im saying is when I asked about Try and Catch, In the past, I didnt get the appropriate explanation.
sounds a bit ... demanding (in context of knowing the post before). Maybe a similar language barrier than we experience from time to time too.


google: blitzmax try catch
first hit will lead you to:  https://blitzmax.org/docs/en/language/exceptions/


bye
Ron
Title: Re: Chord Displayer
Post by: Hardcoal on April 05, 2023, 04:06:39
Ok. sorry.

I have zero complaints, toward any of you guys.
That things was years ago.. and not on this forum anyways/

Since I learn alone I have no one around me.
I have huge gaps in my knowledge which probably causing to do rookie errors.
that would be saved if I was in an environment of other programmers.
But ill keep doing what I can.
and some of what im doing, is rather good




 






Title: Re: Chord Displayer
Post by: Midimaster on April 05, 2023, 08:42:10
Don't worry, as I know you, I can handle posts like you sended it. I read more a despair than a aggression in your words.

But a adwise:
Read more carefully, what we write and react with another question if you do not understand, what we want to say. Often it is like that: On our side we think we already gave deep informations, but on your side you could not comprehend the algo. In this cases feel free to ask again and again. You can also open a PM conversation or meet us on DISCORD, where we can interact much faster.

We all have the same problems: In our real life we do not know experienced BlitzMax-Coders, where we could ask. We are alone like you. So we depend on this forum and the deep conversations, which are possible here. The aswers often come not immediately, because the expert does not understand where the problem is (for him it is no problem). Only after asking again and again does it become clear where the problem of understanding lies.

We often have the feeling, that after a post from us (derron and me) your answer often only repeats your problem, but does not respond on the code-snipplet we gave. Here we would wish to get back more "query" or "discussion".

Title: Re: Chord Displayer
Post by: Hardcoal on April 05, 2023, 11:52:59
Thanks for the comforting words.
Yea I sometimes Skip some information you Guys post. I admit.
Since my head is filled with so many things 
but even if i dont respond properly to a post.
I go back to those post even months later, so its not in vain.
Yea discord is a good idea, ill come to visit.

but in general i do make progress in all of my coding
and the best news which i already tried to say in various places is that 
Since I realized that I dont need to work on a project inside the project code.
its becoming exponentially faster. the amount of app im gonna release and with great quality 
and faster time releases.
I only wish I thought of it 10 years ago. 
Title: Re: Chord Displayer
Post by: Hardcoal on March 23, 2024, 08:43:51
(https://i.imgur.com/DBzkQKF.jpg)
Title: Re: Chord Displayer
Post by: 3DzForMe on March 24, 2024, 06:38:38
Nice User interface Hardcoal :)
Title: Re: Chord Displayer
Post by: Hardcoal on March 26, 2024, 20:46:19
(https://i.imgur.com/ilOgUcy.jpg)
Title: Re: Chord Displayer
Post by: Hardcoal on March 28, 2024, 19:46:50
I'm currently engaged in three music-related projects, all aimed at developing tools. I've transitioned my programming approach to a more generalized library method, ensuring that everything I create serves as a versatile tool applicable to various projects. I'm gradually approaching the desired milestone where I'll begin crafting the unique features I envision. As for the notation app mentioned earlier, it currently accommodates only four notes per measure, but it has the potential to evolve into a more sophisticated notation editor.
Title: Re: Chord Displayer
Post by: Hardcoal on May 05, 2024, 23:17:13
(https://i.imgur.com/EZXdaQT.jpg)

I just finished making Midi Data recorder.

In my track editor, midi subtracks and sample subtracks can be on the same Track..

anyways.. Im simply building  Tools so I can Use on future projects.
Ive managed to record Midi data Rather Wel..

As you can see. its the same piano on the same projects..

In my Track Editor theirs this thing called Wait Midi.. like in synthersizers.. it wont Start Recording before the first Piano Key is Pressed..

I dont understand all those foolish big companies who cannot implement this simple thing on their Apps.

Yet they are realising Version 12 13.

I also Made WaitSound.. which also works fine.

I wrote to Mixcraft company to implement it.. in the comunity forum.. but i got mocked by certain idiots.

I have strange ideas sometimes.. but none of them came  without thinking

I cant and not plan to make a full track editor.. (Its pointless)
I just want to show others that its possible and really not that hard

I will need help on Midi data managing in the future from anyone who is an expert at it,
but for now im contempt