HomeiOS Developmentswift - If I play MIDI (.mid file) in iOS native AVMIDIPlayer,...

swift – If I play MIDI (.mid file) in iOS native AVMIDIPlayer, it simply performs devices, and never vocals


If I play MIDI (.mid file) utilizing on-line MIDI participant https://midiplayer.ehubsoft.internet/, it simply play devices, and never vocals (e.g. soprano, Alto, Tenore, Basso and so on).
I additionally tried with iOS native MIDI participant AVMIDIPlayer and result’s identical.

I scan .mid file utilizing iOS native framework and I can see that there are 8 tracks:

func inspectMIDIFile(_ url: URL) {

    var sequence: MusicSequence?
    NewMusicSequence(&sequence) // allocate
            
    guard let seq = sequence else {
        print("Didn't create MusicSequence")
        return
    }
    
    // Load the MIDI file into the sequence
    let standing = MusicSequenceFileLoad(seq, url as CFURL, .midiType, MusicSequenceLoadFlags())
    if standing != noErr {
        print("Error loading MIDI file: (standing)")
        return
    }
            
    var trackCount: UInt32 = 0
    MusicSequenceGetTrackCount(seq, &trackCount)
    print("MIDI has (trackCount) tracks")
}

It prints:

MIDI has 8 tracks

For displaying musical sheet (rating), I’m utilizing OpenSheetMusicDisplay in WKWebView and loading .musicxml / .mxl recordsdata. I can see vocal elements in rating sheet in addition to proven in beneath picture:

enter image description here

Vocal elements:

  1. Soprano
  2. Alto
  3. Tenore
  4. Basso

Instrument elements:

  1. Violino 1
  2. Violino 2
  3. Viola
  4. Contrabasso e Organo

Nonetheless, if I add .mxl file for identical association (not .mid file) on MuseScore, it play vocal half as properly.

I downloaded .mid and .mxl recordsdata from:
https://www.cpdl.org/wiki/index.php/Ave_verum_corpus,KV_618(Wolfgang_Amadeus_Mozart)

So am I lacking / misunderstanding one thing? Do I want .musicxml or .mid file for audio playback? If the reply is .musicxml, it isn’t playable in iOS AVMIDIPlayer

Notice: I’m not speaking about playback of lyrics (in human voice). I
know I should use solely .mp3 file for it.

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments