FreeOrion

Forums for the FreeOrion project
It is currently Wed Dec 13, 2017 1:47 am

All times are UTC




Post new topic Reply to topic  [ 31 posts ]  Go to page Previous  1, 2, 3  Next
Author Message
 Post subject:
PostPosted: Fri Oct 08, 2004 9:31 pm 
Offline
Space Kraken
User avatar

Joined: Sat Jun 05, 2004 5:35 am
Posts: 130
Location: Boston, USA
that's quite alright, I've done my fair share of pouring through hex dumps in the past... nevermind not knowing the format... although you should be able to attain it easy enough...I would think.

But your program would have to be pretty dynamic to read midi files... knowing what I do know about midi...

Isn't there some header file that has a class or struct you could use? Or some utility that reads midi files? you shouldn't have to rewrite it from scratch...but then again you wrote your own sequencer...

If you had a utility to organize it in memory, you'd be golden.

loop
if MIDfile.track1.note[x] == NOTE_ON then
{
GUIObject.whatever = MIDfile.track1.note[x].pitch;
GUIObject.whatever = MIDfile.track1.note[x].duration;
GUIObject.whatever = MIDfile.track1.note[x].velocity;
GUIObject.whatever = MIDfile.track1.note[x].controllers; etc....
}

its just reading the format of the midi file that's tricky...

_________________
"The mighty warships of the Vl'Hurg Empire dived screaming upon the unknowing Earth, where due to a terrible miscalculation of scale the entire battle fleet was accidentally swallowed by a small dog." -Hitchhikers Guide


Top
 Profile  
 
 Post subject:
PostPosted: Sat Oct 09, 2004 5:08 pm 
Offline
Audio Lead Emeritus
User avatar

Joined: Fri Jul 25, 2003 1:52 pm
Posts: 188
Location: Cincinnati OH, USA
For those who might care, this is the MIDI File Format document I finally settled on a year or two ago after much Google searching:

http://www.csw2.co.uk/tech/midi2.htm

Strat, you don't give me enough credit. I don't trust other people's code to work exactly the way I want, and besides it's much more fun to do it myself. :p

LlamaWare's midi importer has been fully functional for a long time, it just had a bug or two causing, mainly, the tempo values and note durations to be completely farked most of the time (but not always). Reading midi files is not that difficult with a good manual like the one linked to above; unfortunately, something else had to have been going on that they weren't mentioning.

Sure enough, after 4 hours or so of work this morning, I *finally* figured out what the hell it was. (And I would've figured it out years ago had I broken down and gone through a problematic file in a hex viewer sooner, sigh.) Unfortunately, fixing it is going to require a heuristic approach since they couldn't be bothered to add one little bytecode to the file format version of the spec over the hardware protocol version, but anyway... I'm out of energy and hitting the sack (at 1pm, woohoo). Will finish this tomorrow.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Oct 09, 2004 5:52 pm 
Offline
Space Kraken
User avatar

Joined: Sat Jun 05, 2004 5:35 am
Posts: 130
Location: Boston, USA
oh I give you tons of credit... I think its amazing that you wrote your own sequencer... its just that I couldn't fathom doing it myself... I often take the "If you want something done right, do it yourself" approach... But I just wouldn't have the patience when I know someone somewhere already figure out the problem I'm working on. Although I agree the end result is more fun...its just getting there...

I give you credit, in fact, I envy your perseverance and focus. :D

_________________
"The mighty warships of the Vl'Hurg Empire dived screaming upon the unknowing Earth, where due to a terrible miscalculation of scale the entire battle fleet was accidentally swallowed by a small dog." -Hitchhikers Guide


Top
 Profile  
 
 Post subject:
PostPosted: Sun Oct 10, 2004 2:57 am 
Offline
Audio Lead Emeritus
User avatar

Joined: Fri Jul 25, 2003 1:52 pm
Posts: 188
Location: Cincinnati OH, USA
You know, I'm still not convinced I know exactly what the term "sequencer" means... LW is a notation program with staffs and notes and my own set of tools for manipulating them, and it does playback; but there are no signal waveforms on the screen, no silly loops, no effects (yet)...

Perserverance and focus, lol... I am *anything* but focused, I'm a lazy bum, my mind wanders constantly, and the only reason it looks like perserverance is, other than playing computer games I have absolutely nothing to do with my 24/7 free time around here, so LW was bound to get some degree of steady attention over the last 2 years. :p

Now, on to the subject at hand: god I hate waking up... argh... Okay, okay, I'm up... <takes a moment to bask in Strat's credit and envy> Mmm, much better. ;)

Okay so the problem I was talking about yesterday is essentially this. Many midi files (including yours), though not all, apparently do NoteOff before the full period for the note has elapsed. How much before seems fairly random, however the NoteOn duration plus the following period of inactivity do always add up to an exact duration (8th note, quarter note, whatever). Note I said period of inactivity rather than period of silence since many synths have significant decay envelopes. In most cases where the NoteOff second half is of significant length (on the order of the NoteOn duration), the Sibelius Demo writes the full note with an accent mark (dot over the notehead), however I am strongly inclined to use a half-duration note followed by a half-duration rest in my program, since that's more consistent with what the synth hardware is actually being told to do (accent marks are something for humans playing real instruments). The heuristic issue I mentioned yesterday has to do with just how the hell exactly one sets a threshold for introducing a rest object after the note as opposed to just rounding up the note duration to the nearest clean value (8th note, quarter note, whatever :).

The reason durations were being farked in my midi importer is I always just assumed a note in a midi file would always have NoteOn for its full written duration (exactly), followed immediately by a NoteOff for it and a NoteOn for the next note (both with zero deltatime). Dumbass assumption, I know that now. Still, it meant very few note objects in the imported file were being given durations it knew how to display correctly, and worse, lots of tiny rest objects (many with less duration than my smallest standard unit, the 32nd note) were being introduced, which didn't display at all b/c they were so small, but were still in the object list, causing all kinds of weirdness in the GUI.

The farked up tempo values aren't explicitly addressed by this, but I have a sneaking suspicion they'll correct themselves when I fix it. I do also still have to figure out why there are three extra staffs in WarHorn.mid instead of just one (the header/tempo track), but that's minor, if nothing else I can just tell it to delete any staffs with no note data in them at the end of the import process. Anyway, time to get to it...


Top
 Profile  
 
 Post subject:
PostPosted: Sun Oct 10, 2004 3:32 am 
Offline
Programming, Design, Admin
User avatar

Joined: Wed Oct 08, 2003 1:33 am
Posts: 12041
Location: Munich
LithiumMongoose wrote:
In most cases where the NoteOff second half is of significant length (on the order of the NoteOn duration), the Sibelius Demo writes the full note with an accent mark (dot over the notehead), however I am strongly inclined to use a half-duration note followed by a half-duration rest in my program, since that's more consistent with what the synth hardware is actually being told to do (accent marks are something for humans playing real instruments).

My understanding is that Sibelius is a notation program first, and a midi sequencer second. Thus being consistent with standard notation practices for scores for humans playing real instruments, and generally pretty-looking, are its primary concern, rather than unambiguously representing the midi commands in staff form.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Oct 10, 2004 3:44 am 
Offline
Audio Lead Emeritus
User avatar

Joined: Fri Jul 25, 2003 1:52 pm
Posts: 188
Location: Cincinnati OH, USA
Exactly. And I have no respect for standard notation practices, minimal respect for humans, and only some respect for real instruments. :p

Still, Sibelius had a nice demo version available that was able to successfully import the midi files I was having trouble with, so it was helpful for seeing what the end result was *supposed* to look like, roughly.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Oct 10, 2004 10:20 pm 
Offline
Space Kraken
User avatar

Joined: Sat Jun 05, 2004 5:35 am
Posts: 130
Location: Boston, USA
I don't use Sibelius, but I do use Finale (which is a beast in its own right), so I know those notation programs do some funky things with importing midi files...

as far as the dot over the note head, the staccato marking...Sibelius must be combining velocity and duration to come up with some sort of expression marking. It makes sense. Most of what is in that mid I played on keyboard and cleaned it up later with the software. But I left durations alone.

So if I play notes and hang on to them a tad more than an 8th, or a tad shorter than an 8th...there will be empty space to the right. And depending on the beat resolution level there probably won't be a rest that would fit evenly into it.

I'm not sure if you are saying your software tries to read it like a notation program would write it... Since notation programs are for writing sheet music for musicians to play (even sheet music is highly interpretable) you couldn't *actually* represent the duration of notes in a performance. If you try to make notation from raw midi data, you're screwed... unless things were chopped down to exact measurements, and the only thing that can do that is a computer.

The way soft-sequencers do it, is to NOT have notation represent midi data... staff views are available, its just not exact, unless that is where you are inputing it from - in that case an 8th is exactly 240 and a 16th is exactly 120 etc...(assuming you use 480 PPQ). So this could be your issue where there is discrepency with NoteOff and duration...(was that the original problem?)

To answer your earlier question...all I mean by sequencer is: A program (hardware or software) that can create a set(s) of sequenced midi commands and send them to a midi device to be played. And preferably have some sort of GUI. The only difference between all the software out there for sale is more tools that allow you to input/edit midi data realistically. The better the tools for emulation of real human players, the better the sequencer.

_________________
"The mighty warships of the Vl'Hurg Empire dived screaming upon the unknowing Earth, where due to a terrible miscalculation of scale the entire battle fleet was accidentally swallowed by a small dog." -Hitchhikers Guide


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 11, 2004 7:03 am 
Offline
Audio Lead Emeritus
User avatar

Joined: Fri Jul 25, 2003 1:52 pm
Posts: 188
Location: Cincinnati OH, USA
Ah I see. It never occured to me that stuff might've come from a keyboard recording -- makes much more sense now. Certainly explains the randomness of the note durations.

Actually what it looked like to me Sibelius was doing, was simply rounding note durations to standard values, and placing the accent mark if it had to round up a significant amount to get there. (Btw, I could easily be wrong about this, but I seem to recall from college classes that the dot over the notehead is just a generic accent mark that can apply to anything, and staccato is something different, a specific way of bowing that only applies to string instruments, and is written with a "st ~~~~~" kind of mark.)

My first pass at rounding durations in my own program definitely cleaned up the WarHorn import significantly. It's still not perfect, and I'm not sure why yet -- Sibelius manages to come up with a notation that's perfectly synced and consistent, whereas mine's close but desyncs by a 32nd note on the second bar for example. It's good enough I can edit it into what it's "supposed" to be easily enough though.

What I don't know yet is whether I will try to keep the non-exact durations from your keyboard performance in the LW representation after import, and maybe introduce some sort of controlled blurring of the exact durations of new notes I enter, to make it sound more realistic. Probably not, since everything I've written so far has had exact durations in playback (since it was all entered into the GUI manually/directly), and sounds fine. But it's an interesting idea. :)


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 15, 2004 4:34 am 
Offline
Space Kraken
User avatar

Joined: Sat Jun 05, 2004 5:35 am
Posts: 130
Location: Boston, USA
well, the thing about having music exactly aligned to the beats, is that it can sound robitic or lack 'energy'.

Although, in orchestral things, its less noticable. But still, depending on the rhythm, lines can sound computerish and without feeling.

Especially when it comes to expression controllers, like: velocity,sustain, pitch bend, and mod wheel. I find it nearly impossible to give a melody any life with modifying that stuff manually. So hence why I use the keyboard as much as I can. Even if I can't play it time, whether my keyboard chops aren't there or its just plain hard. At least I get the velocities, which I think is most important - then I clean it up with the software. But also, certian triplet feels and anticipations sometime don't align to the preset beat resolutions. Especially in styles like jazz, funk and latin. Forget about inputing a swing by hand...believe me, I've tried...I'd rather chew off my toes.

Digital Performer actually has a tool called humanize. You select a bunch of notes you input manually with the mouse, and it can randomly push or pull the notes behind or on top of the beat. You can do that with velocites and durations as well. I guess its pretty good when you get that hang of it, so I hear. But still I don't think its as good as playing it yourself.

I'm not saying your stuff sounds bad, actually you do a good job of disguising it and one wouldn't really know it was sequenced music. Obviously you've been doing it for sometime.

Do you play an instrument?

_________________
"The mighty warships of the Vl'Hurg Empire dived screaming upon the unknowing Earth, where due to a terrible miscalculation of scale the entire battle fleet was accidentally swallowed by a small dog." -Hitchhikers Guide


Top
 Profile  
 
 Post subject:
PostPosted: Sat Oct 16, 2004 3:10 pm 
Offline
Audio Lead Emeritus
User avatar

Joined: Fri Jul 25, 2003 1:52 pm
Posts: 188
Location: Cincinnati OH, USA
Re: tool called humanize -- Like I said above, controlled blurring. :p

I wish I knew what DP's algorithm for that was so I could try copying it myself hehe. I can try purely random noise but I suspect the results would be better if there was at least some sort of pattern to the blurring, which would require a fairly complicated algorithm. Oh well.

Newp, natta, zeros-ki, negativo-da, ixney on the instrument-quey. They tried to force us to learn piano with a lab attached to the first/lowest two theory classes at MIT, but I really didn't make much progress in them... I only have good control over the thumb, index, and middle fingers on each hand, and I type with just those 6 as well (3 on each hand). Worse, I still can't read notes off a printed staff nearly quickly enough to play anything in real time... I'm closest with the treble clef but bass and alto give me fits, it literally takes me 1 to 3 seconds of staring at the page and thinking (reciting all-cars-eat-gas type rhymes is more like it) PER NOTE to get a letter/accidental in my head, then another second or two of looking at the keyboard to remember which key to press, so it's a mess, and I didn't feel like devoting hundreds of hours to it to get to a more intuitive point than that. I never really tried any other instruments at all either, the piano thing was only because they forced us as part of the classes. (Though my parents did try to get me to learn violin when I was really young, like 4-6 yrs old, and Mrs. Kramer shoved the recorder (simple wind instrument) down our throats in grade school music class from 4th grade to 8th grade, but both met with dismal results as I wasn't even *trying* then heh.)

I also can't sing worth a plug turkey. Trust me, it's horrible. This is why I didn't minor in music in college... I had enough credits from the theory classes but needed a minimum unit of performance credit. So I just took the concentration which is the level below a minor and the minimum required for your degree heh.

On the upside, I can whistle reasonably well... 2 or 3 octave range, pitches marginally accurate, volume from whisper level to painfully loud. :)


Top
 Profile  
 
 Post subject: Re: StratCaster Music
PostPosted: Thu Jun 21, 2007 5:13 am 
Offline
Space Kraken
User avatar

Joined: Sat Jun 05, 2004 5:35 am
Posts: 130
Location: Boston, USA
just bumping this to get rid of the spammer being the last one to 'touch' this thread...

colors :mrgreen:

_________________
"The mighty warships of the Vl'Hurg Empire dived screaming upon the unknowing Earth, where due to a terrible miscalculation of scale the entire battle fleet was accidentally swallowed by a small dog." -Hitchhikers Guide


Top
 Profile  
 
 Post subject: Re: StratCaster Music
PostPosted: Fri Jun 22, 2007 9:20 am 
Offline
Cosmic Dragon
User avatar

Joined: Fri Jun 27, 2003 12:37 am
Posts: 2175
Location: Auckland, New Zealand
hmm, a good idea :)


Top
 Profile  
 
 Post subject: Re: StratCaster Music
PostPosted: Fri Jun 20, 2008 2:57 am 
Offline
Space Floater
User avatar

Joined: Thu Jun 19, 2008 3:51 pm
Posts: 42
None of the links are available to listen to =(


Top
 Profile  
 
 Post subject: Re: StratCaster Music
PostPosted: Fri Jun 20, 2008 4:07 am 
Offline
Programming, Design, Admin
User avatar

Joined: Wed Oct 08, 2003 1:33 am
Posts: 12041
Location: Munich
xanoblivion wrote:
None of the links are available to listen to =(

That does tend to happen when threads that link to files are more than three years old...


Top
 Profile  
 
 Post subject: Re: StratCaster Music
PostPosted: Fri Jun 20, 2008 4:30 am 
Offline
Space Floater
User avatar

Joined: Thu Jun 19, 2008 3:51 pm
Posts: 42
Geoff the Medio wrote:
xanoblivion wrote:
None of the links are available to listen to =(

That does tend to happen when threads that link to files are more than three years old...


I know, it's just a pity :?


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 31 posts ]  Go to page Previous  1, 2, 3  Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group