Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Exploring QB64-PE default soundfont patches
#36
Well, this actually works for combining two tracks playing at the same time, but it doesn't use 2 different sounds yet, and there seems to be some note cancellation going one, but the tracks are playing together.  I imagine I need to look into midi channels and program change use in a midi track.  Each track needs their own I'm thinking. 

- Dav

Code: (Select All)
'generate midi data for 2 tracks
track1$ = MidiNotes$(100, 15, "enc4c4c4c4c4c4c4c4") 'keep first track as is, with a midi header
track2$ = Mid$(MidiNotes$(100, 11, "g5a5g5e5"), 15) 'strip this midi header off (removes 14 bytes)
'combine tracks 1 & 2
note$ = track1$ + track2$
'update midi header byte #12 to say 2 tracks now, not 1
Mid$(note$, 12, 1) = Chr$(2) 'two tracks now
midisong& = _SndOpen(note$, "memory")
_SndPlay midisong&

EDIT: From what I'm reading, the midi channel for each track needs to be given for each note call.  So I made a parameter to assign a midi channel when creating the MidiNotes$.  This eliminated the note cancellations and the tracks play ok.  But can't assign different sounds to the tracks yet.

Find my programs here in Dav's QB64 Corner
Reply


Messages In This Thread
RE: Exploring QB64-PE default soundfont patches - by Dav - 09-12-2024, 02:34 PM



Users browsing this thread: 28 Guest(s)