Page 1 of 1
dynamic music (yes, again)
Posted: 12 Dec 2008, 14:11
by hoijui
Argh has something in World Builder, but what i am thinking about, is different.
In the well approved tradition of software development for spring - the most complicated, powerful, modular and scriptable solution is the best, i was thinking about a music/sound generation interface (yeah, i can not think about other stuff then interfaces anymore).
the first question:
to get as much info as possible about a battle, how should such an API be connected to spring? should it be a LUA widget or gadget, or should it rather be directly coded into spring in C++, and fetch data from the internals?
the way i imagine the system (data flow diagram):
spring -> dynamics analyser -> sound generator -> sound reproducer
currently dynamic music widgets analyse the battlefield from an ally teams perspective, and choose music respectively.
in my imagination, it it should be choosable to analyse dynamics from a teams, ally teams or global perspective (therefore, i guess doing it with a widget is not an option).
in the most simple scenario, we have a single dynamics analyser that generates only a single value, lets call it actionValue. that could be done.. eg every ~30 frames. this value is sent to a sound generator (do not know how exactly, but would be by UDP i guess).
the sound generator could then do what current music widgets do aswell -> play an action rich song if the actionValue is high, and ... you get it. or it could be a program written in chuck or SuperCollider (the only two music programming languages i know), which plays sound directly or sends it by OSC over UDP to an other machine, or a bunch of machines, which play the sound, or which generate an ogg or mp3 stream to broadcast it once more.
so we could have autohosts generate music for the battle globally, and serve an ogg stream broadcast, and the clients could also let music be generated on their own machines, just from their perspective.
i don't know if i explained it well. and of course, it would have to be though through much better before starting anything, but...
what do you think? :D
(am fed up with hunting linking/compiling bugs in the C AI interface branch, thinking on this is more pleasant)
Re: dynamic music (yes, again)
Posted: 12 Dec 2008, 19:10
by Argh
"Why is there no music playing right now?"
"Oh, the musicAI is still making up its mind as to what sequence of notes might be appropriate to the moment..."
Heh. Seriously though, Stealth870 wrote a music Widget, it works and stuff. The only reason I never got around to worrying about dynamic music handling is that, very simply, I haven't run into any music I'd like to use for "battle" situations in P.U.R.E., the basic problems aren't rocket science.
Re: dynamic music (yes, again)
Posted: 12 Dec 2008, 19:46
by hoijui
Argh wrote:"Oh, the musicAI is still making up its mind as to what sequence of notes might be appropriate to the moment..."
thats so spring, man! :D
is it not?
for me, that would perfectly fit spring.
"why is the sound not changing? did i forget to turn on the souround system on my media box? aww no, i just forgot enabling Nat for the new UDP port of the game dynamics analyser server connected to the autohost, which is sendding data to my personal OSC enabled SuperCollider ogg stream generator to whichs broadcast my media box listens to."
we all need it, its just that you can not yet imagine that you need it, but you will know, when you have it.
to the particular problem you refer to...
this can be avoided if you set up a box with linux and realtime kernel, dedicated for music generation.
Re: dynamic music (yes, again)
Posted: 12 Dec 2008, 20:06
by Argh
thats so spring, man! :D
is it not?
for me, that would perfectly fit spring.
I'm a little frightened now, thinking about "AI music" that I've heard over the years
Seriously speaking... if you want to get that idea to be anything like practical, you'd probably be best off putting a MIDI sequencer into Spring. Shouldn't be too hard, there's a lot of code for reading MIDI available.
Then musicAIs could play specific MIDI tracks.
Or write them on the fly
As a much easier and probably more-pleasant alternative, you could just find a lot of "appropriate music" and use it with Stealth's music Widget, per game. That's a lot easier, since OGG support is already done, works well, and I have yet to hear anything that's pure MIDI that compares with a properly-mastered piece of professional music.
But having a "music server" as a "player" is probably not practical. Music isn't data you want to pass around in realtime. Maybe MIDI sequences, but certainly nothing streaming, that's a massive bandwidth hog.
Re: dynamic music (yes, again)
Posted: 12 Dec 2008, 22:11
by Linus
Hey guys,
I like the idea a lot; being a professional musician (I conduct an orchestra and a few choirs) with experience in arranging and composing I thought a lot about generated music for games. However, my programming knowledge is, hm, not so well (I used to be pretty good with python, though I didn't use for quite some time).
Now I don't have experience with SuperCollider (or CSound, or whatever), but from first sight I think SC is quite usable for algorithmic music, but more in a academic or somewhat electronical kind of way (might fit Kernel Panic, but not *TA). I suggest using a system that allows for the use of recorded samples - CSound I believe supports this, but my thought went along the lines of a
tracker. I've used Screamtracker and ImpulseTracker a lot - in the 90's. They are a bit like sequencers, with music structured in tracks and patterns. There are libraries around that play .it (ImpulseTracker) files and others - I know libmikmod, for an instance. That'd give the composer much freedom in if he wants to use "atomic" samples for single notes, transposing them by frequency increase/decrease (that's classical tracker style) or use whole pre-recorded parts.
I kinda like the idea of an api knows some categories - build-up, attack, successful defense, utter defeat, stuff like that - and each of these categories get some kind of value assigned (0 to 100%) according the the current situation. Then a system that lets me define tracks, and mix these (predefined) tracks dynamically to a pattern that I say match the current situation. So there'd always be some kind of latency, because the current pattern must be played to the end before the next one starts, and the composer has to make sure they fit no matter what and so on, but it would allow to use motives, themes and all of that. In the end it would produce some kind of .it stream (one pattern after another).
I don't think MIDI would be a good idea; it's not meant for computer game music (although it has been used that way

- seriously, that's no go). I don't see why dynamic music shouldn't be generated client-side (situation analysis is always different for different players). And lastly - the music is something that is mod-dependent, so while the low-level api should be in the core, the mod should do the analysis, and the music tracks and logic should be grouped with the other mod data.
To bring this to an end, I clearly have no technical idea what's going on within spring or a mod, but I'm very interested in this and think it would indeed make Spring very unique amongst games. I can provide "musical logic" as well as recordings and stuff, just give me a system to work in

Re: dynamic music (yes, again)
Posted: 13 Dec 2008, 00:22
by hoijui
:D :D :D
SO COOL!!!
hello Linus
well.. you are right about that electronic music does not fit most mods,
its just that to me, it seemed to be easyer to generate electronic music then .. normal one (as me, beeing a programmer, and electronic music can be totally comtrolled by code.. that was my logic

).
but actually i dont have an idea about that.
both SuperCollider and CSound support the OSC protocoll, if i googled right. though, the two tracker softwares you mentioned seem not to do so. i dont know if this would make any sense with tracker software anyway.
in OSC for example, you can define your own events, in our case it could be for example:
Code: Select all
SpringStateUpdate {
float build-up; // 0.0 - 1.0 (100%)
float attack; // 0.0 - 1.0 (100%)
float defense; // 0.0 - 1.0 (100%)
...
}
are there tracker softwares that support OSC?
though, if we keep the data we send over the interface relatively simple, we could also support two protocols, eg. OSC and our own, proprietary one.
well, i think we two should have a chat once, but i would like to serve you a system that you could use. i wont be around the next few days, but from mid next week i will have time again, hope to see you here then.
Re: dynamic music (yes, again)
Posted: 15 Dec 2008, 16:09
by Tribulexrenamed
I made a custom music generator thats basically based on little snippets of sound 2 years ago, if i find the code ill dig it out and post it.
Basically its a generalized application with configuration of patterns in xml, a long series of cut up music tracks, etc. So basically instead of different music for different situations, its one long dynamically generated piece that adjusts to special mood values as quickly as how short the tracks are. It was pretty good i think. I was trying to incorporate multiple sections to a piece, kind of like a larger overall pattern for certain parts, but never got around to it.
Yeah i just read this over and it makes no sense really, but i guess posting code is better than trying to describe it. ill start searching.
Re: dynamic music (yes, again)
Posted: 19 Dec 2008, 11:30
by hoijui
yeah, that would be nice Tribulex

Re: dynamic music (yes, again)
Posted: 22 Dec 2008, 11:27
by hoijui
Linus, i have sent you a PM, just if you did not recognize it yet.
i am pretty sure now, that OSC would be a good protocol for this thing.
it is very simple, and it is language independent. and its primary use is one-way connection-less media stearing/manipulation. just what we would do here.
i am now thinking about a protocol, but do not yet have anything to tell about that.
Re: dynamic music (yes, again)
Posted: 07 Feb 2009, 22:02
by hoijui
implementation available (does not include a music generating app so far):
viewtopic.php?f=12&t=17700