Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411594 Posts in 69387 Topics- by 58444 Members - Latest Member: YomiKu_0

May 08, 2024, 01:35:03 AM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsDeveloperTechnical (Moderator: ThemsAllTook)how to read a Midi
Pages: [1]
Print
Author Topic: how to read a Midi  (Read 1742 times)
JasonPickering
Level 10
*****



View Profile WWW
« on: March 12, 2009, 03:27:25 PM »

is there anyway to have gamemaker check to see what note a Midi File is playing. I know that Midi files use numerical code to denote each note, but is there anyway I could write code to detect at each step if a new note is played, and what that new note is?
« Last Edit: March 31, 2009, 04:42:02 PM by Derek » Logged

Core Xii
Level 10
*****


the resident dissident


View Profile WWW
« Reply #1 on: March 12, 2009, 07:48:18 PM »

Not in Game Maker, no.
Logged
Matt Thorson
Level 7
**

c'est la vie


View Profile WWW
« Reply #2 on: March 12, 2009, 07:54:59 PM »

Well, you probably could open it just like any other file and interpret it yourself.  Just Google "MIDI file format" and I'm sure you'll be able to figure out how exactly they store the audio info.

That's pretty unrealistic a task to do in GM though (to interpret and play a MIDI with GML).

You could go into the MIDI file, put all the notes that play at each beat into a list, then play it regularly and use that list to do whatever action you want to do.  The only problem with this is that if anything happens to desync the MIDI from the list (ex: the player drags the titlebar to move the window, freezing the gameplay but continuing the music) you're screwed.
Logged

JasonPickering
Level 10
*****



View Profile WWW
« Reply #3 on: March 12, 2009, 09:11:08 PM »

thanks guys. I was wondering if it would be possible to create enemies in a schmup according to the music played. I thought it would be cool to fly a space ship while shooting enemies jamming out to David Bowie. i figured you could just randomly load files dropped into a folder, and then depending on pitch or the note code, create enemies. I think I will still look into this taking something and then extrapolating a procedurally generated level from that. perhaps a picture, or a text file.
Logged

pgil
Guest
« Reply #4 on: March 13, 2009, 01:19:38 PM »

I think BASS can give you the instruments that are playing. It only supports modules, but you can convert MIDI files with something like Modplug tracker. Search for GM BASS on the game maker forums.
Logged
Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic