tutorial or explanation of library "midilib"

BlitzPlus Forums/BlitzPlus Beginners Area/tutorial or explanation of library "midilib"

josé marcos(Posted 2015) [#1]
(Original text in Portuguese, stuck here translated by google translator.)
------
Hello!
First, I want to say that I am very grateful to Ziltch by your library "midilib".
Since I am blind, I'm not a music editor that satisfies me.

How I learned to use the BlitzPlus language, I can create what I need.

Using the library "midilib," I managed to create a script to make music on the PC using the computer's own keyboard, and my yamaha keyboard mm6.
Looking deeper into the library, I found these lines:

Const RecSelectButton = $29
...
Const PlayButton = 19

I tried to study the midi parameters for how it would make sense.
... It's, nothing.

Could someone tell me if it is possible to write using these lines?
How would this be done?
Is there a document to explain how the library "midilib" can be best exploited?
I hope you have been able to express myself. Otherwise, ask I try to do the explanation otherwise.
I am very grateful to anyone who can help me.


RemiD(Posted 2015) [#2]
The integer/float/string which represents a constant may indeed means nothing.
But it could be an identifier or a keycode...

Without reading the code i can't say more...


josé marcos(Posted 2015) [#3]
Sure!

Sorry for my distraction.
He said it was a library, but did not show where to download.

No problem:

http://members.optusnet.com.au/ziltch/blitz/MIDI.zip

The library is extensive. But the part that interests me, is quoted at the beginning of the post.

Along with the library, there are two example programs, demonstrating its use It is quite useful. But gives only a beginning.

Some things could figure it out myself. While others asked for help here, and I was very well assisted.

I do not expect the answer to everything.

My difficulty is not with the Blitz commands. And yes, in the form of ultilizar this library efficiently.

I wrote this little script:

; -------------
Include "midilib.bb"

Graphics 800,600,16,2

; Start midi device
MidiOutHandle = OpenMidiOut(MidiOutDevice)

; Appoints the main variables
instrument = 1
MidiPitch = 14
pitch = 64

While Not KeyHit(1)

; Change instrument
If KeyHit(2)
If instrument = 18 instrument = 0 Else instrument = 18
SendMidiOut(MidiOutHandle,MidiChannel,MidiProgramChange, instrument)
EndIf

; Wheel simulates the pitch, using up and down arrows.
cpa=0
If KeyDown(200) cpa=1: pitch = pitch + 1: If pitch > 127 pitch = 127
If KeyDown(208) cpa=1: pitch = pitch - 1: If pitch < 0 pitch = 0
If cpa=0
If pitch>64 pitch = pitch-1
If pitch<64 pitch = pitch+1
EndIf

SendMidiOut(MidiOutHandle,MidiChannel, MidiPitch, 64, pitch)

; performs a chord when you press the spacebar
If KeyDown(57) play = play + 1 Else play = 0
If play = 1
SendMidiOut(MidiOutHandle,MidiChannel,MidiNoteOn, 64, 100)
SendMidiOut(MidiOutHandle,MidiChannel,MidiNoteOn, 68, 100)
SendMidiOut(MidiOutHandle,MidiChannel,MidiNoteOn, 71, 100)
EndIf
If play=0
SendMidiOut(MidiOutHandle,MidiChannel,MidiNoteOff,64)
SendMidiOut(MidiOutHandle,MidiChannel,MidiNoteOff,68)
SendMidiOut(MidiOutHandle,MidiChannel,MidiNoteOff,71)
EndIf


Cls
Text 0, 100, "Press space to play!"
Text 0, 140, "Press number 1 to change instrument"
Text 50, 180, "Instrument number = " + instrument

Flip
Delay 1

Wend
CloseMidiOut(MidiOutHandle)
End

Here now in Brazil, will have to midnight.

After I'll post something more interesting, and less complicated to be able to understand.


RemiD(Posted 2015) [#4]
I don't have any experience about midi or "music keyboards" so maybe someone else can help ?

Also, you may be interested in this :
http://www.blitzforum.de/forum/viewtopic.php?t=33817

You can use google translate to understand what they say (german to portuguese)
https://translate.google.com/translate?hl=en&sl=de&tl=pt&u=http%3A%2F%2Fwww.blitzforum.de%2Fforum%2Fviewtopic.php%3Ft%3D33817


josé marcos(Posted 2015) [#5]
Actually, a lot of material there.
The library is diverse. And it's hard to find a specific answer.
However, I try to communicate. Though I do not think they are using the same library I.

From what I saw, the parameters used in this "midilib.bb" are universal. So I think that possibly, they may give me an idea.

Thank you very much for your help.
If I get something on my doubt, I can even post here.
After all, it's kind of hard for me, seek information in another language.

Gracias!