StratCaster Music

Samples of sound/music, ideas or suggestions related to the development of audio assets for FreeOrion.
Message
Author
User avatar
StratCaster
Space Kraken
Posts: 130
Joined: Sat Jun 05, 2004 5:35 am
Location: Boston, USA

#16 Post by StratCaster » Fri Oct 08, 2004 9:31 pm

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

User avatar
LithiumMongoose
Audio Lead Emeritus
Posts: 188
Joined: Fri Jul 25, 2003 1:52 pm
Location: Cincinnati OH, USA

#17 Post by LithiumMongoose » Sat Oct 09, 2004 5:08 pm

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.

User avatar
StratCaster
Space Kraken
Posts: 130
Joined: Sat Jun 05, 2004 5:35 am
Location: Boston, USA

#18 Post by StratCaster » Sat Oct 09, 2004 5:52 pm

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

User avatar
LithiumMongoose
Audio Lead Emeritus
Posts: 188
Joined: Fri Jul 25, 2003 1:52 pm
Location: Cincinnati OH, USA

#19 Post by LithiumMongoose » Sun Oct 10, 2004 2:57 am

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...

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 12248
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

#20 Post by Geoff the Medio » Sun Oct 10, 2004 3:32 am

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.

User avatar
LithiumMongoose
Audio Lead Emeritus
Posts: 188
Joined: Fri Jul 25, 2003 1:52 pm
Location: Cincinnati OH, USA

#21 Post by LithiumMongoose » Sun Oct 10, 2004 3:44 am

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.

User avatar
StratCaster
Space Kraken
Posts: 130
Joined: Sat Jun 05, 2004 5:35 am
Location: Boston, USA

#22 Post by StratCaster » Sun Oct 10, 2004 10:20 pm

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

User avatar
LithiumMongoose
Audio Lead Emeritus
Posts: 188
Joined: Fri Jul 25, 2003 1:52 pm
Location: Cincinnati OH, USA

#23 Post by LithiumMongoose » Mon Oct 11, 2004 7:03 am

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. :)

User avatar
StratCaster
Space Kraken
Posts: 130
Joined: Sat Jun 05, 2004 5:35 am
Location: Boston, USA

#24 Post by StratCaster » Fri Oct 15, 2004 4:34 am

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

User avatar
LithiumMongoose
Audio Lead Emeritus
Posts: 188
Joined: Fri Jul 25, 2003 1:52 pm
Location: Cincinnati OH, USA

#25 Post by LithiumMongoose » Sat Oct 16, 2004 3:10 pm

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. :)

User avatar
StratCaster
Space Kraken
Posts: 130
Joined: Sat Jun 05, 2004 5:35 am
Location: Boston, USA

Re: StratCaster Music

#26 Post by StratCaster » Thu Jun 21, 2007 5:13 am

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

User avatar
utilae
Cosmic Dragon
Posts: 2175
Joined: Fri Jun 27, 2003 12:37 am
Location: Auckland, New Zealand

Re: StratCaster Music

#27 Post by utilae » Fri Jun 22, 2007 9:20 am

hmm, a good idea :)

User avatar
xanoblivion
Space Floater
Posts: 42
Joined: Thu Jun 19, 2008 3:51 pm

Re: StratCaster Music

#28 Post by xanoblivion » Fri Jun 20, 2008 2:57 am

None of the links are available to listen to =(

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 12248
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: StratCaster Music

#29 Post by Geoff the Medio » Fri Jun 20, 2008 4:07 am

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...

User avatar
xanoblivion
Space Floater
Posts: 42
Joined: Thu Jun 19, 2008 3:51 pm

Re: StratCaster Music

#30 Post by xanoblivion » Fri Jun 20, 2008 4:30 am

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 :?

Post Reply