Author Topic: playing midis?  (Read 438 times)

Legacy_archer4217

  • Full Member
  • ***
  • Posts: 206
  • Karma: +0/-0
playing midis?
« on: May 10, 2012, 09:56:14 pm »


               Hello all,

Trying out LOTRO has made me want to bring playable music to my mod. So my question is....is it possible to script a musical instrument so that when you use it, it plays an entire midi?

It would be great if I could put a convo on the instrument that would allow the player to choose which tune (midi) they wanted to play.

Thanks in advance
*hugs*'<img'>
               
               

               
            

Legacy_henesua

  • Hero Member
  • *****
  • Posts: 6519
  • Karma: +0/-0
playing midis?
« Reply #1 on: May 10, 2012, 10:11:59 pm »


               I don't know what you mean by midi, but you can definitely play mono sounds dynamically, change the background music, or tell existing sound objects to start or stop.

I've done something similar to what you suggest so yes I know it is possible. I've enabled PCs to play different sound clips based upon which musical instrument they have equipped. PCs do this via the *perform* emote, use of the bard song ability, or use of the equipped musical instrument.

That said... musical clips are not common in the game so you have a limited selection. I put in a request about six months to a year ago to project Q, and I was told that their sound guy made some more instrument sounds. Whenever Q 1.5 gets released I suspect that they will be in there.
               
               

               


                     Modifié par henesua, 10 mai 2012 - 09:14 .
                     
                  


            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
playing midis?
« Reply #2 on: May 10, 2012, 10:28:52 pm »


               MIDI = Musical Instrument Digital Interface.

I do not think you can directly interface the MIDI into NWN.  You would almost have to convert all of the MIDI files into .bmu files.   I am not sure how the MIDI files are formated or how many sounds each contains.  But by my thinking you would have to break each MIDI file up into hundreds of .bmu files.   At least this is my uneducuated guess.   hopefully someone will have a better answer for you.
               
               

               
            

Legacy_Leurnid

  • Sr. Member
  • ****
  • Posts: 473
  • Karma: +0/-0
playing midis?
« Reply #3 on: May 10, 2012, 11:25:43 pm »


               I often wish there were some good 'musical' audio objects, both for instruments and so music can fade in and out as you walk between market stalls, taverns and/or street performers.

Instead, the constant NWN Musak plays everywhere with the same consistency for all players, regardless of where they are in the area, trading dynamic audio immersion for a soundtrack that only recognizes day/night and fight. One can fake around the ambient audio with placed sounds, but music, not so much.

Dealing with audio is on the far end of my list of things to do, but I am eager for more development on this topic!
               
               

               
            

Legacy_archer4217

  • Full Member
  • ***
  • Posts: 206
  • Karma: +0/-0
playing midis?
« Reply #4 on: May 11, 2012, 12:18:56 am »


               What Lotro has is a plugin that someone created. Midis are converted into abc files which lets players play songs. I think the old school way, back before I started dabbling in Lotro, was for players to play each note using their keyboard, but then someone created a plugin called Songbook which contains all the abc song files, and with one click on the title, the entire song plays....no work needed from the player other than wowing the audience. '<img'>

Here's a link in case anyone is interested in checking it out. Maybe we have a NWN genius somewhere that would love to create a plugin for us, eh?

www.lotrointerface.com/downloads/info380-.html

forums.lotro.com/showthread.php
               
               

               


                     Modifié par archer4217, 10 mai 2012 - 11:23 .
                     
                  


            

Legacy_Rolo Kipp

  • Hero Member
  • *****
  • Posts: 4349
  • Karma: +0/-0
playing midis?
« Reply #5 on: May 11, 2012, 12:35:21 am »


               <putting in a finger...>

Henesua, what was the scripting you used for the jukebox in your OOC area? Was that from the Vault? <so asks the wizard that can't even play a kazoo...>
Well. It was good music. Really dynamic percussion ;-P

I know it's not a plugin to allow the use of MIDI files, but it *is* a way to access a music list, which may be part of the solution Archer is looking for...

<...to clean his tone-deaf ears>
               
               

               


                     Modifié par Rolo Kipp, 10 mai 2012 - 11:35 .
                     
                  


            

Legacy_henesua

  • Hero Member
  • *****
  • Posts: 6519
  • Karma: +0/-0
playing midis?
« Reply #6 on: May 11, 2012, 02:06:17 am »


               For playing music lists in the background, I generated a recursive script that works in combination with a column I added to the ambientmusic 2da. The new column contains a number which represents track length in seconds.

The music that I am using in Arnheim is available on the Vault, although to get the 2da you'd have to dig through Arnheim's core content which is currently only on the Nexus (I'll get to cross posting someday, promise!) The only reason why you might want to do this is that I entered all the lengths of the Wyvern Crown music tracks, which in my opinion are amongst the best music that vanilla NWN comes with.

Nevertheless I don't think any of that addresses what Archer is looking for. Back in Vives - circa 2006 - Veran and I riffed on the idea of recording mono sounds that could be used in a dynamic music system. We are both musicians, I apretender, and he the real thing. The idea was primarily his while I was his sounding board, and talked it out with him. Anyway, it never came to anything. The idea was that you could record chords and short phrases in various keys on a variety of instruments. Each of these sounds would have the same length, and follow a naming convention which would work well with scripts. Once these were rolled up in a HAK, a builder would create a script that would enable a player to access the music through chat commands.

I think this is the closest the game can come to enabling a player to generate a musical performance in game. It would require a large number of files. You'd need a number of various chords, and then a number of phrases in various keys and each key with various modes. That would cover stringed instruments. For horns, you'd focus on phrases. You could ofcourse simplify it all if you just did notes, but the game interface is not smooth enough in my opinion (as well as his) to enable this.

If you have these sounds already, it would be simply a matter of formatting them and putting together the system. Of mor eimportance would be making the right choices about which chords and phrases you include.
               
               

               
            

Legacy_Xardex

  • Sr. Member
  • ****
  • Posts: 414
  • Karma: +0/-0
playing midis?
« Reply #7 on: May 11, 2012, 02:27:09 pm »


               NWN can also play songs directly from override given the correct filename. It is picky about audio format though.
               
               

               
            

Legacy_Fester Pot

  • Hero Member
  • *****
  • Posts: 1698
  • Karma: +0/-0
playing midis?
« Reply #8 on: May 11, 2012, 02:39:39 pm »


               

Leurnid wrote...

I often wish there were some good 'musical' audio objects, both for instruments and so music can fade in and out as you walk between market stalls, taverns and/or street performers.

Instead, the constant NWN Musak plays everywhere with the same consistency for all players, regardless of where they are in the area, trading dynamic audio immersion for a soundtrack that only recognizes day/night and fight. One can fake around the ambient audio with placed sounds, but music, not so much.

Dealing with audio is on the far end of my list of things to do, but I am eager for more development on this topic!


Just make sure your music, for this particular example you give, is saved in mono, rather than stereo. This way, you'll be able to place it in the area as a placeable sound which plays from where it is placed. Have the sound always loop and you have what you want.

Also worth noting that doing it this way, requires the mono file to be saved as a .wav file and added to a HAK, so it can be selected as a custom sound bit.

FP!
               
               

               


                     Modifié par Fester Pot, 11 mai 2012 - 01:42 .
                     
                  


            

Legacy_Rolo Kipp

  • Hero Member
  • *****
  • Posts: 4349
  • Karma: +0/-0
playing midis?
« Reply #9 on: May 11, 2012, 04:14:16 pm »


               <trying not to...>

archer4217 wrote...
Trying out LOTRO has made me want to bring playable music to my mod. So my question is....is it possible to script a musical instrument so that when you use it, it plays an entire midi?

It would be great if I could put a convo on the instrument that would allow the player to choose which tune (midi) they wanted to play.

Hrmmm. The way I read it, Archer was looking at a way to use a convo to pick entire songs to play, like your jukebox, H. I.e. the bard chooses to play that damn fine Flamenco you hit me with and then wanders around the marketplace collecting tips from NPCs... <or rotten tomatoes, depending on a perform check? ;->

Scripting in Lute Hero would indeed be a nightmare... ;-)

<...look more confused than he really is>
               
               

               
            

Legacy_Leurnid

  • Sr. Member
  • ****
  • Posts: 473
  • Karma: +0/-0
playing midis?
« Reply #10 on: May 11, 2012, 05:00:44 pm »


               

Fester Pot wrote...

Leurnid wrote...

I often wish there were some good 'musical' audio objects, both for instruments and so music can fade in and out as you walk between market stalls, taverns and/or street performers.

Instead, the constant NWN Musak plays everywhere with the same consistency for all players, regardless of where they are in the area, trading dynamic audio immersion for a soundtrack that only recognizes day/night and fight. One can fake around the ambient audio with placed sounds, but music, not so much.

Dealing with audio is on the far end of my list of things to do, but I am eager for more development on this topic!


Just make sure your music, for this particular example you give, is saved in mono, rather than stereo. This way, you'll be able to place it in the area as a placeable sound which plays from where it is placed. Have the sound always loop and you have what you want.

Also worth noting that doing it this way, requires the mono file to be saved as a .wav file and added to a HAK, so it can be selected as a custom sound bit.

FP!


Thanks for the info!

I love the claustrophobic effects you have achieved with the thick layering of heavy sounds in your modules, it's quite inspiring.  I dislike a lot of the stock sounds that came with NWN, many of them sound like they had the microphone in a steel bucket while they were recording, and the voice acting is usually horrible. Just so, you took a pig's ear and made a silk purse!
               
               

               
            

Legacy_Leurnid

  • Sr. Member
  • ****
  • Posts: 473
  • Karma: +0/-0
playing midis?
« Reply #11 on: May 11, 2012, 05:14:13 pm »


               

Rolo Kipp wrote...

<trying not to...>

Hrmmm. The way I read it, Archer was looking at a way to use a convo to pick entire songs to play, like your jukebox, H. I.e. the bard chooses to play that damn fine Flamenco you hit me with and then wanders around the marketplace collecting tips from NPCs... <or rotten tomatoes, depending on a perform check? ;->

Scripting in Lute Hero would indeed be a nightmare... ;-)

<...look more confused than he really is>


This is one of the scripts (play next track) for a Jukebox placeable, controlled by conversation, from the Ambient City Demo. Ayath the Loafer put this together to showcase Nereng's work with the X2 Ambient scripts, but there are a lot of other easter-eggs in there.  This one script could be doctored to be a one-stop shop for changing tracks, or used as it is in the Ambient City Demo, in conjunction with several other similar scripts for track control.



//::///////////////////////////////////////////////
//:: Name n_am_at_nexttr
//:: Copyright (c) 2001 Bioware Corp.
//:://////////////////////////////////////////////
/*
     Changes the background music.
*/
//:://////////////////////////////////////////////
//:: Created By: nereng
//:: Created On: 01/12/04
//:://////////////////////////////////////////////
void main()
{
    int nTrack = GetLocalInt(OBJECT_SELF,"TRACK");
    nTrack += 1;
    if (nTrack == 76) nTrack = 1;
    object oAre = GetArea(OBJECT_SELF);

    MusicBackgroundChangeDay(oAre,nTrack);
    MusicBackgroundChangeNight(oAre,nTrack);

    SetLocalInt(OBJECT_SELF,"TRACK",nTrack);

    ActionPlayAnimation (ANIMATION_PLACEABLE_DEACTIVATE);
    ActionPlayAnimation (ANIMATION_PLACEABLE_ACTIVATE);

    switch (nTrack)
        {
        case 0:
        SpeakString("No track"); break;
        case 1:
        SpeakString("Rural Day1"); break;
        case 2:
        SpeakString("Rural Day2"); break;
        case 3:
        SpeakString("Rural Night"); break;
        case 4:
        SpeakString("Forest Day1"); break;
        case 5:
        SpeakString("Forest Day2"); break;
        case 6:
        SpeakString("Forest Night"); break;
        case 7:
        SpeakString("Generic Dungeon"); break;
        case 8:
        SpeakString("Sewer"); break;
        case 9:
        SpeakString("Mines1"); break;
        case 10:
        SpeakString("Mines2"); break;
        case 11:
        SpeakString("Crypt1"); break;
        case 12:
        SpeakString("Crypt2"); break;
        case 13:
        SpeakString("Evil Dungeon1"); break;
        case 14:
        SpeakString("Evil Dundeon2"); break;
        case 15:
        SpeakString("City Slums Day"); break;
        case 16:
        SpeakString("City Slums Night"); break;
        case 17:
        SpeakString("City Docks Day"); break;
        case 18:
        SpeakString("City Docks Night"); break;
        case 19:
        SpeakString("City Wealthy"); break;
        case 20:
        SpeakString("City Marketplace"); break;
        case 21:
        SpeakString("City Night"); break;
        case 22:
        SpeakString("Tavern1"); break;
        case 23:
        SpeakString("Tavern2"); break;
        case 24:
        SpeakString("Tavern3"); break;
        case 25:
        SpeakString("Generic Wealthy House"); break;
        case 26:
        SpeakString("Generic Store"); break;
        case 27:
        SpeakString("Good Temple"); break;
        case 28:
        SpeakString("Evil Temple"); break;
        case 29:
        SpeakString("NWN City Theme"); break;
        case 30:
        SpeakString("NWN Chapter1"); break;
        case 31:
        SpeakString("NWN Chapter2"); break;
        case 32:
        SpeakString("NWN Chapter3"); break;
        case 33:
        SpeakString("NWN Chapter4"); break;
        case 34:
        SpeakString("Rural Combat1"); break;
        case 35:
        SpeakString("Forest Combat1"); break;
        case 36:
        SpeakString("Forest Combat2"); break;
        case 37:
        SpeakString("Dungeon Combat1"); break;
        case 38:
        SpeakString("Dungeon Combat2"); break;
        case 39:
        SpeakString("Dungeon Combat3"); break;
        case 40:
        SpeakString("City Combat1"); break;
        case 41:
        SpeakString("City Combat2"); break;
        case 42:
        SpeakString("City Combat3"); break;
        case 43:
        SpeakString("Boss Combat City"); break;
        case 44:
        SpeakString("Boss Combat Forest"); break;
        case 45:
        SpeakString("Boss Lizardfolk"); break;
        case 46:
        SpeakString("Dragon Combat"); break;
        case 47:
        SpeakString("Combat Aribeth"); break;
        case 48:
        SpeakString("Final Boss Combat Source Stone"); break;
        case 49:
        SpeakString("Good Temple2"); break;
        case 50:
        SpeakString("Generic Castle Interior"); break;
        case 51:
        SpeakString("Aribeth Theme1"); break;
        case 52:
        SpeakString("Aribeth Theme2"); break;
        case 53:
        SpeakString("Theme Aarin Gend"); break;
        case 54:
        SpeakString("Theme Maugrim"); break;
        case 55:
        SpeakString("Theme Morag"); break;
        case 56:
        SpeakString("Tavern4"); break;
        case 57:
        SpeakString("Desert Combat"); break;
        case 58:
        SpeakString("Desert Day"); break;
        case 59:
        SpeakString("Winter Day"); break;
        case 60:
        SpeakString("Fight! Fight!"); break;
        case 61:
        SpeakString("Desert Night"); break;
        case 62:
        SpeakString("XP2 Theme"); break;
        case 63:
        SpeakString("XP2 Waterdeep"); break;
        case 64:
        SpeakString("XP2 Undermountain"); break;
        case 65:
        SpeakString("XP2 Rebel Camp"); break;
        case 66:
        SpeakString("XP2 Beholder Caves"); break;
        case 67:
        SpeakString("Queen of the Shattered Mirror"); break;
        case 68:
        SpeakString("XP2 Chapter3"); break;
        case 69:
        SpeakString("XP2 Dracolich"); break;
        case 70:
        SpeakString("XP2 Battle Small"); break;
        case 71:
        SpeakString("XP2 Battle Medium"); break;
        case 72:
        SpeakString("XP2 Battle Large"); break;
        case 73:
        SpeakString("XP2 Chapter3 Battle"); break;
        case 74:
        SpeakString("XP2 Battle Matron"); break;
        case 75:
        SpeakString("XP2 Final Battle"); break;
        default:
        SpeakString("No Track");
        break;
        }
}

Of course, this doesn't address the OP's original question...