Jump to content

Midi UDF


Recommended Posts

Hello everyone.

I have been working for a few days on an Autoit wrapper around the low level Midi API using

normal dll calls and structs. It has required both time and effort, but today I am finally

done with the basics. This UDF uses no third party libraries or extra dll's, it calls

winmm.dll directly. It does not use MCI, it goes down even lower, to using midiOutShortMsg

and all the other functions that I have discovered are a nightmare to work with unless

you're 100 % sure of what you're doing.

One thing that I should clarify. This UDF does not read or write Midi files, this is beyond

me at the moment but I'll try to add this capability in as I go along developing it. The

functions are designed to play midi notes in realtime on whatever channel you may prefer,

with any of the 128 instruments that are available in general Midi (GM).

Here's what you can do so far, note that there's a lot more to be added before I can call it

complete.

1. Get the number of available Midi out devices on the system, starting at 0.

2. Get the name of a device, based on it's index number also starting at 0.

3. Open a device using it's index number starting at 0, or use -1 to open the users prefered

output Midi device. This function returns a handle to be used in future calls.

4. Play a Midi note, notes ranging from 0 to 127 where 60 is middle C.

Arguments:

Handle - As returned by the open device function.

Channel - An integer between 0 and 15, channel 9 is used for drums and on some older

devices, so is 15. In most midi programs the channels start from 1, so for a normal user the

drum channel would be number 10.

Note - The note to be played, on channel 9 it will play drum sounds rather than notes.

Velocity - How hard the key is pushed, from 0 being completely silent to 127 where the key

is literally slammed down.

5. Stop a playing note.

Arguments:

Handle

Channel

Note

6. Change the program of a given channel, which is the same as changing the instrument.

Arguments:

Handle

Channel

Program - An integer ranging from 0 to 127, all representing a different instrument. For

example 0 is acoustic piano, 25 is steel guitar, 32 is acoustic bass, 60 is a french horn

and 127 is a gunshot.

If this command is changed on channel 9, it will change the kit that is used. Some standard

kits are dance, techno and acoustic drums, although I don't remember their numbers right off

hand.

7. Close the midi device. This should always be done before closing the program, if not some

devices will crash and refuse to play anything until you restart the computer or reset the

synthesiser in some other way. An example of a software synth that has this bug is

WinGroove.

I am not going to post this code publicly in the forum since it is far from ready and I want

to know who is using the functions, but if anyone is interested in it please email me or add

me to msn. Do not contact me through this forum since I hardly ever go here. My email is

philip_bennefall@pb-games.com, and my msn is philip_bennefall@hotmail.com.

Who knows, maybe I can find someone to develop this together with?

Regards

Philip Bennefall

Link to comment
Share on other sites

...I am not going to post this code publicly...

Why not? people here aren't interested in taking credit for others work, and i'm sure you'd get much more help with developing it if the forum can tweak your code, If you're really uptight and worried about someone stealing your work, post a generic version of the code without all the "secrets" that are so great people might copy them

Link to comment
Share on other sites

Why not? people here aren't interested in taking credit for others work, and i'm sure you'd get much more help with developing it if the forum can tweak your code, If you're really uptight and worried about someone stealing your work, post a generic version of the code without all the "secrets" that are so great people might copy them

I agree, we are all friends here. this is a community, you take some, you give some. Be a team player

[center]AutoIT + Finger Print Reader/Scanner = COOL STUFF -> Check Out Topic![/center][center][font=Arial Black]Check out ConsultingJoe.com[/font][/center][center]My Scripts~~~~~~~~~~~~~~Web Protocol Managing - Simple WiFi Scanner - AutoTunes - Remote PC Control V2 - Audio SpectrascopePie Chart UDF - At&t's TTS - Custom Progress Bar - Windows Media Player Embed[/center]

Link to comment
Share on other sites

if ur not going to post it why make this topic... ur just braggin for no reason

true dat

[center]AutoIT + Finger Print Reader/Scanner = COOL STUFF -> Check Out Topic![/center][center][font=Arial Black]Check out ConsultingJoe.com[/font][/center][center]My Scripts~~~~~~~~~~~~~~Web Protocol Managing - Simple WiFi Scanner - AutoTunes - Remote PC Control V2 - Audio SpectrascopePie Chart UDF - At&t's TTS - Custom Progress Bar - Windows Media Player Embed[/center]

Link to comment
Share on other sites

Bragging? Nah, I don't think that's fair to say. All I'm saying is I'd rather not post it on the forum because it's far from ready, but if someone is interested in looking at it please contact me. That's all I'm saying. Not that I won't give it out at all, simply that I want to wait with posting it publicly until I am ready with it. But I made this topic so that people that were interested could get a hold of it if they wanted to, but I'd like to have an idea of who is using it since it is in such an early stage.

Regards

Philip Bennefall

Link to comment
Share on other sites

This would great for having a midi tune playing and sound effects in your autoit game... :D

Post it here Philip, theres some really clever people here who would help you develop this...

2015 - Still no flying cars, instead blankets with sleeves.

Link to comment
Share on other sites

...but I'd like to have an idea of who is using it since it is in such an early stage.

Regards

Philip Bennefall

I don't understand, what does it matter who uses it and at what stage, if you are going to post it in the future, woudn't it be nice to have several brains thinking together on something to get it done faster?

If it's in early development, people can help you finish a rough version of it, and when it gets to a stage where you feel it can be used, people can test it and give feedback, which can then be inproved upon and so on until you have a great program.But you have to post it first

And how will this thing where we have to e-mail you to get code give you a better idea of who is using it? So you know my "yahoo e-mail", thats really no more informative than knowing my screen name on the forum.

Link to comment
Share on other sites

if you never post the code i'm sure someone in this forum would of eventually find a way, and "they" would get the credit since "they" found, made the code and shared it with everyone..

:D

Edited by WTS
Link to comment
Share on other sites

Okay, let me get this straight. I am indeed going to post the code, but not until I am finished with it. That concept makes perfect sence to me. All I wanted was to find some people that were interested in working on it with me privately, not on the forum where everyone can see it. Call me conservative, but I just don't like releasing stuff that is not complete. A few people actually emailed me, and I sent them the code. That way I know who is using/working on it, I don't want unfinished copies to spread around. That's all I'm saying, so let's not turn this into a huge flame war. If anyone's interested in working on it with me, just let me know. I will release the UDF on the forum once I'm ready with it.

Link to comment
Share on other sites

I emailed both of your email address and both return errors..

The original message was received at Mon, 10 Jul 2006 18:25:46 -0400

from bos-mail-wwl1b.bos.lycos.com [10.124.64.81]----- The following addresses had permanent fatal errors -----

<philip_bennefall@pb-games.com>

(reason: 550 <philip_bennefall@pb-games.com>, Recipient unknown)

----- Transcript of session follows -----

... while talking to mail.pb-games.com.:

>>> RCPT To:<philip_bennefall@pb-games.com>

<<< 550 <philip_bennefall@pb-games.com>, Recipient unknown

550 5.1.1 <philip_bennefall@pb-games.com>... User unknown

451 4.4.1 reply: read error from mail.pb-games.com.

Reporting-MTA : dns; smail1.lycosmail.lycos.com

Arrival-Date : Mon, 10 Jul 2006 18:25:46 -0400

Final-Recipient: RFC822; philip_bennefall@pb-games.com

Action: failed

Status: 5.1.1

Remote-MTA: DNS; mail.pb-games.com

Diagnostic-Code: SMTP; 550 <philip_bennefall@pb-games.com>, Recipient unknown

Last-Attempt-Date: Mon, 10 Jul 2006 18:26:06 -0400

The original message was received at Mon, 10 Jul 2006 18:25:46 -0400

from bos-mail-wwl1b.bos.lycos.com [10.124.64.81]----- The following addresses had permanent fatal errors -----

<philip_bennefall@hotmail.com>

(reason: 550 Requested action not taken: mailbox unavailable)

----- Transcript of session follows -----

... while talking to mx2.hotmail.com.:

>>> DATA

<<< 550 Requested action not taken: mailbox unavailable

550 5.1.1 <philip_bennefall@hotmail.com>... User unknown

<<< 503 Need Rcpt command.

Reporting-MTA : dns; smail1.lycosmail.lycos.com

Arrival-Date : Mon, 10 Jul 2006 18:25:46 -0400

Final-Recipient: RFC822; philip_bennefall@hotmail.com

Action: failed

Status: 5.1.1

Remote-MTA: DNS; mx2.hotmail.com

Diagnostic-Code: SMTP; 550 Requested action not taken: mailbox unavailable

Last-Attempt-Date: Mon, 10 Jul 2006 18:25:52 -0400

Edited by WTS
Link to comment
Share on other sites

Can't blame phillip for posting an excellent idea, which might motivate others to follow. I often post incomplete scripts and forget altogether to share the end, that is, finished result. I don't think I ever got that much interest from the community but I understand completely how annoying it is.

I'll make a note of sharing FINISHED scripts, if there's ever such a thing.

Link to comment
Share on other sites

  • 2 weeks later...

They weren't flaming.

It was mearly suggestions.

I came here looking for a midi UDF.

Instead, I seen a kid bragging about not being able to write this UDF unless you know 100% about what your doing, and trying to fill up his MSN list. You post incomplete scripts, thus scripts and scrapts is the name of the forum. Any good AutoIT coder should be able to get something out of a scrap. But, just bragging, and trying to get people... (Was this even on topic of this forum?)... That's basically all that was. What's the difference between email and posting the code here? OK, we all know the code isn't totally finished. Its just like a program. There are bugs. So, its the person's problem if they copy and paste his code, and try to run it. Blame there lame asses for not listening.

Just my 2 cents.

L8Rs,

its... ~~TheCreator~~

Link to comment
Share on other sites

I am not going to post this code publicly in the forum since it is far from ready and I want

to know who is using the functions, but if anyone is interested in it please email me or add

me to msn. Do not contact me through this forum since I hardly ever go here.

Then why the hell make the post? Why do you care who is using the functions? You are using a free tool and you learned from examples written by people in this community. Dont come on our forum, say you have something but arent willing to post it here and to not contact you on the very forum you are posting on, because you rarely come here.

This post is so useless it isnt even funny.

AutoIt Scripts:Aimbot: Proof of Concept - PixelSearching Aimbot with several search/autoshoot/lock-on techniques.Sliding Toolbar - Add a nice Sliding Toolbar to your next script. Click the link to see an animation of it in action!FontInfo UDF - Get list of system fonts, or search to see if a particular font is installed.Get Extended Property UDF - Retrieve a files extended properties (e.g., video/image dimensions, file version, bitrate of song/video, etc)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...