Android Question MidiSystem

Luca1967

Active Member
Hi Stevel.
I am doing karaoke in B4A.
I have some problems that I wish you could clarify.
1) Sometimes with the same base the synchronization is correct, sometimes it is wrong.
2) If I set a channel to zero (0), the synchronization is always wrong.
3) If I make a transpose , the synchronization is always wrong.
I'll give you the source of the program. Can you tell me where am I wrong?

2009.zip it's a song for test.

P:S. I have a samsung A10 and I test the release software
 

Attachments

  • 2009.zip
    35.3 KB · Views: 124
  • KFunny.zip
    14.4 KB · Views: 111

stevel05

Expert
Licensed User
Longtime User
If I use your source code library, the response is this and the sound is off and not run.
You'll need to explain a little more about what you are trying to do.

Do you mean that you are trying to use the library without compiling it?
 
Upvote 0

stevel05

Expert
Licensed User
Longtime User
The source code is provided for completeness and information, you should not use it directly in a project. There is no benefit in doing so, as the code contains multiple threaded processes, it will not work in debug mode.

Use the compiled library.
 
Upvote 0

Luca1967

Active Member
Il codice sorgente è fornito per completezza e informazione, non dovresti usarlo direttamente in un progetto. Non vi è alcun vantaggio in questo modo, poiché il codice contiene più processi a thread, non funzionerà in modalità di debug.

Usa la libreria compilata.
Thanks
 
Upvote 0

Luca1967

Active Member
Hi Stevel.

Does the Sub in B4A seem correct for you to transpose?
When I raise or lower the pitch it sometimes keeps me from overlapping sounds.
I tried to reset the notes with the Sub OffNote but it doesn't work.
Am I wrong something?
Thank you.



B4X:
Public Sub TransposeTrack2(TTrack As MidiTrack,Semitones As Int, ExcludeChannels As List)
    Dim Msg() As Byte
    For i = 0 To TTrack.Size - 1
        Dim E As MidiEvent = TTrack.Get(i)
        If E.GetMessage.IsShortMessage Then
            If e.Message.IsShortMessage And e.Message.ShortMessageCommand = MidiMessage_Static.STATUS_NOTE_ON Or _
                e.Message.IsShortMessage And e.Message.ShortMessageCommand = MidiMessage_Static.STATUS_NOTE_OFF Then
                Dim Chnl As Int = E.Message.ShortMessageChannel
                Msg = E.GetMessage.GetMessage
                Msg(1) = Bit.And(Msg(1),0xFF) + Semitones
                e.Message.SetShortMessage_Message3(Msg(0),Msg(1),Msg(2))
            End If
        End If
    Next
End Sub


Public Sub OffNotes

Dim t As Int
    
    Dim Msg() As Byte = MidiMessage_Static.ALLNOTESOFF
        For t = 0 To Seq.GetTracks.Length - 1
            SendMessage(Array As Byte(Bit.Or(Msg(0),i),Msg(1),Msg(2)),-1)
        Next   
End Sub
 
Upvote 0

stevel05

Expert
Licensed User
Longtime User
Yes, you will need to send Seqr.SendAllNotesOff immediately after the transposition to make sure that notes playing before the transposition do not hang.

You can also set the transpose value on each receiver that you have setup to do the same thing. It depends whether you want to save the file transposed or just make adjustments while the file is playing. You would still need to send the AllNotesOff message afterwards.
 
Upvote 0

Luca1967

Active Member
Thank you
I have 2 questions.

1) Is it possible to use SoundFonts and if so, what can I do?

2) Do you think this application can work on an android TV?

Hello and thanks
 
Upvote 0
Top