Author Topic: can I play a note with MIDI_OutShortMsg?  (Read 271 times)

daytime

  • Posts: 3
can I play a note with MIDI_OutShortMsg?
« on: 23 Dec '17 - 16:18 »
We can use midiOutShortMsg function to send a MIDI message to the specified MIDI output device to play a note.For example: midiOutShortMsg(midiout, &H90 + (pitch * &H100) + (volume * &H10000) + channel)   
Can I do this with BASS API?

saga

  • Posts: 2231
Re: can I play a note with MIDI_OutShortMsg?
« Reply #1 on: 23 Dec '17 - 17:18 »
No, BASS does not handle MIDI output. Do you have any issues with the method you descibred, or why do you want a different solution?

daytime

  • Posts: 3
Re: can I play a note with MIDI_OutShortMsg?
« Reply #2 on: 24 Dec '17 - 03:53 »
I want to play my project file with bassmidi,I  notice the bassmidi method:BASS_MIDI_StreamCreateFile(Byte(), Int64, Int64, BASSFlag, Int32),yet I DONOT KNOW HOW TO build the byte().Must I build a midi file first?

Falcosoft

  • Guest
Re: can I play a note with MIDI_OutShortMsg?
« Reply #3 on: 26 Dec '17 - 16:07 »
I want to play my project file with bassmidi,I  notice the bassmidi method:BASS_MIDI_StreamCreateFile(Byte(), Int64, Int64, BASSFlag, Int32),yet I DONOT KNOW HOW TO build the byte().Must I build a midi file first?
No, you do not have to. In Bassmidi the rough equivalent of midiOutShortMsg() is BASS_MIDI_StreamEvent()/BASS_MIDI_StreamEvents().
If you know the event type (e.g. in your case a Note On message) you can use BASS_MIDI_StreamEvent(midiStream, channel, MIDI_EVENT_NOTE,  pitch + (volume * &H100))

daytime

  • Posts: 3
Re: can I play a note with MIDI_OutShortMsg?
« Reply #4 on: 30 Dec '17 - 04:25 »
I try to use the code below but it does not work:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
 Dim handle As Integer = BASS_MIDI_StreamCreate(1, 0, 1)
 BassMidi.BASS_MIDI_StreamEvent(handle, 0, BASSMIDIEvent.MIDI_EVENT_NOTE, 60, 100)
 Thread.Sleep(1000)
 BassMidi.BASS_MIDI_StreamEvent(handle, 0, BASSMIDIEvent.MIDI_EVENT_NOTE, 60, 0)
End Sub

Ian @ un4seen

  • Administrator
  • Posts: 20724
Re: can I play a note with MIDI_OutShortMsg?
« Reply #5 on: 1 Jan '18 - 15:46 »
You will need a BASS_ChannelPlay call after the BASS_MIDI_StreamCreate call to start the stream. If you still hear nothing, also check the return values to confirm whether the calls are successful, in particular the BASS_MIDI_StreamCreate call.