Community

SCI Programming => SCI Syntax Help => Topic started by: NilG on May 29, 2019, 06:34:22 PM

Title: Music/Playing Note Sticks When Leaving a Room
Post by: NilG on May 29, 2019, 06:34:22 PM
I'm finally for real wrapping up the last few things for a demo, and things are working pretty much as expected.  Music's one of those last things, and I've put some in a number of the rooms.  For the most part, all's well, rooms without music shut up, rooms playing different music switch as expected, all that goodness.  I'm finding when I leave one room in particular, though, if there's a particular flute sound playing, the flute note sticks and doesn't unstick until I've reentered the room and the music progresses to that point again.  Even entering different rooms with different music just piles the noise on top, rather than silencing the stuck note.

This "effect" kinda seems like a blast from the past in the Adlib or MIDI synth with some of the older games (this setup here specifically is just using GM), but since this appears to be happening consistently for this room and this one instrument, I was wondering if anyone had any thoughts on how to force it to shut up when the user leaves the room?
Title: Re: Music/Playing Note Sticks When Leaving a Room
Post by: MusicallyInspired on May 29, 2019, 08:52:41 PM
Are you using just General MIDI music files? With the General MIDI driver? How are you handling stopping the music between rooms, with "(gMusic1 stop:)"?

I've run into this with some GM MIDIs I imported with Companion. One of them doesn't play all the instruments and another one deals with the stuck notes (and still another doesn't sound at all!). I haven't really dove into sound yet. Just been using placeholders. I just removed the offending music for now.
Title: Re: Music/Playing Note Sticks When Leaving a Room
Post by: Doan Sephim on May 29, 2019, 09:09:14 PM
I had this problem constantly and never did find a solution to the problem.

For Betrayed Alliance, I ended up using Gumby's SCI Audio script to play the music instead. This was a good work-around (and one that allowed me to play multiple sounds at a time).

Here's the thread that goes into the details. (http://sciprogramming.com/community/index.php?topic=634.0)
Title: Re: Music/Playing Note Sticks When Leaving a Room
Post by: NilG on May 30, 2019, 09:58:49 PM
Yep, just General MIDI created in MuseScore and run through Soundbox with the General MIDI driver (I think, the one I found here and it seems to do the trick).  I've currently got the (gMusic stop:) in place as mentioned; I did try messing with some other things; I'm honestly uncertain how the signaling works or prev_sig or anything, but couldn't seem to figure out a way to force a note off yet, if that's even what the issue is.  I kind of suspect it's something else going on anyway, but that's completely a guess.

I'll definitely check out the SCI Audio script, that could be promising.  I saw the other thread you made in terms of working around the script size (which may be problematic as-is for a couple of rooms), so if I can figure out reading over and toying with it how to loop the songs from a certain point or that sort of thing, it could work for what I've got in mind, thank you.  The multi-sounds and work-around to the midi-only restriction that I've read pure GM has (I think) is a bonus, too, so I'll for sure check it out.
Title: Re: Music/Playing Note Sticks When Leaving a Room
Post by: MusicallyInspired on May 30, 2019, 11:10:17 PM
Soundbox you say? Is there a reason why you're not using Companion's Sound tool? It might not solve your problem, but just wondering.

I believe the problem is rooted in driver issues. A stuck MIDI note used to happen in DOS because a particular MIDI interface wasn't in "intelligent mode." Sometimes it's the MIDI device receiving the MIDI information. I had a Roland MT-200 that was basically a Roland SC-55 (Sound Canvas) with the added functionality to track songs and save them to a floppy disk. I could never use it with Sierra games though because it would always give stuck notes everywhere. When I got a CM-500 (An SC-55 and MT-32 in one, basically) the note-sticking stopped. Not saying any of these are the issue, but it makes me doubt this problem is SCI-related a bit.
Title: Re: Music/Playing Note Sticks When Leaving a Room
Post by: NilG on May 31, 2019, 01:22:30 AM
I'd really just used Soundbox at first because I'd seen mention of its use on the boards here.  It seemed like the MIDI files could be imported directly without issue, so I wasn't sure if Soundbox was advised for any specific reason.  When I decided to add loop points to them, though, it looked like Soundbox was again necessary, since I think the Companion editor only allows enabling and disabling of existing loop points?

It's also all brand new.  I've started working on the MIDIs themselves a couple of weeks ago, but just started monkeying with them and the game last week.  That and my status as not-really-any-kind-of-programmer makes it all a real learning experience.  I am positive that I'm doing most things pretty ugly while learning the ropes.    :D

The driver theory sounds pretty reasonable, if also like something that'll guarantee the need to rethink the attack.
Title: Re: Music/Playing Note Sticks When Leaving a Room
Post by: Kawa on May 31, 2019, 04:53:12 AM
it looked like Soundbox was again necessary, since I think the Companion editor only allows enabling and disabling of existing loop points?
False. You can drag and drop the loop point icon to move it around.
Title: Re: Music/Playing Note Sticks When Leaving a Room
Post by: MusicallyInspired on May 31, 2019, 09:19:28 AM
Yeah, you can create whatever loop/cue points you want in Companion. Soundbox is very very old. Like, SCI Studio old. The conversations you saw about Soundbox are likely quite old as well. Before troflip returned and started updating SCI Companion again to version 3+.

Are you making an SCI0 game or SCI1.1?
Title: Re: Music/Playing Note Sticks When Leaving a Room
Post by: NilG on May 31, 2019, 02:43:54 PM
Oh, that's good to know, then.  It's SCI0, wanted to stick with the parser and early 90s kind of feel overall with this one, at least.
Title: Re: Music/Playing Note Sticks When Leaving a Room
Post by: NilG on May 31, 2019, 03:46:12 PM
Just another note, "fixed" it by switching the flute over to a plucked instrument with a slow enough release that the sound keeps through the duration.

I'll probably want to revisit and either sort it here or get sciAudio implemented after some practice.  I preferred the original sound in this track, and I do really enjoy the fact that exporting to mp3 retains the effects used on the MuseScore mixer, adding some versatility without really sacrificing the retro sound (imho).  Some of the tracks are less than ideal through the GM driver, though nothing completely unexpected yet.

Anyway, for the time being, I'll probably stick to this hacky track since at least it plays without shitting all over literally every other room, haha.  Still interested in learning more about these things, though.
Title: Re: Music/Playing Note Sticks When Leaving a Room
Post by: Collector on May 31, 2019, 09:34:51 PM
Keep in mind that using sciAudio will limit your game's portability.Users on other platforms may likely not be able get sciAudio to work, leaving your game mute. It will also break the game for ScummVM. sciAudio was a great way to get more extended digital audio for SCI0 games before SCI Companion 3 was released, but with the ability to create SCI1.1 games it makes sciAudio less desirable of an option.
Title: Re: Music/Playing Note Sticks When Leaving a Room
Post by: NilG on June 01, 2019, 12:42:48 PM
That's true, portability; I guess .NET's still required, which is the big one?  I seem to have worked out most of the issues here to some extent and will keep looking at things.  This one's SCI0, so I don't have the full extent of goodies available for 1, but I wasn't sitting around as a kid thinking about how limited those Sierra games were back then, either, just marveling at how limitless they felt.  In this case, I guess it's go retro or go home.    :D
Title: Re: Music/Playing Note Sticks When Leaving a Room
Post by: Kawa on June 01, 2019, 02:34:28 PM
.Net... or Mono, if it's well-behaved. If it is, then it'll run on all three major players.
Title: Re: Music/Playing Note Sticks When Leaving a Room
Post by: lskovlun on June 01, 2019, 09:13:25 PM
sciAudio has been implemented (https://github.com/scummvm/scummvm/blob/3e61864ad8f007c36c3e568361a422baf2666a9c/engines/sci/sound/audio.cpp#L63) in ScummVM, but I have no idea how good it is.
Title: Re: Music/Playing Note Sticks When Leaving a Room
Post by: NilG on June 17, 2019, 03:40:08 PM
Ran into this again with another room and decided that I'm not just going to change every brass or woodwind instrument to a plucked instrument as a workaround since I'd eventually like to get past this anyway.

I tried loading up SCI Audio to play around; will it work despite being SCI Script when the rest of the game is Sierra script?  I had some difficulty with it, but may just need to play with it more.  I can try to convert it, but it's size still worries me a bit, even the second, smaller iteration.  It also sounds like there should be some way to get these tracks to play back and end as expected within the newest SCICompanion.  I'm sure there's got to me something.

I tried messing with some other drivers, as well, but what exactly needs to be done to work with these?  ADL.drv just doesn't give me sound; I also copied SNDBLAST.drv from QFG2 and configured that, but receive a "patch.4335" error when I try to start the game.  I'm not sure what that is at all, though it looks like others here have been able to play and experiment with different drivers.

I'm pretty much an idiot when it comes to this stuff, so any help or advice with driver swapping/testing would be excellent.

EDIT:  Regarding the patch.4335 error, looks like that had to do with stealing the QFG2 driver; the one up on the wiki doesn't give that error.  It doesn't work for me yet, either, but not-crashing is a good start, so I'll see what I can do from there.
Title: Re: Music/Playing Note Sticks When Leaving a Room
Post by: gumby on June 19, 2019, 09:45:18 AM
I tried loading up SCI Audio to play around; will it work despite being SCI Script when the rest of the game is Sierra script?  I had some difficulty with it, but may just need to play with it more.  I can try to convert it, but it's size still worries me a bit, even the second, smaller iteration.

I started working on changing the syntax to use Sierra script, but I don't think I ever got it finished.  It's a memory hog for sure, specifically because of the array used to pass commands.
Title: Re: Music/Playing Note Sticks When Leaving a Room
Post by: troflip on June 19, 2019, 01:13:36 PM
I tried messing with some other drivers, as well, but what exactly needs to be done to work with these?  ADL.drv just doesn't give me sound;

The key is that the right tracks need to be enabled for each sound driver in SCI Companion's sound editor (top left of the sound editor).

I feel like this lingering note problem has been discussed and solved before, but my memory fails...
Title: Re: Music/Playing Note Sticks When Leaving a Room
Post by: Collector on June 19, 2019, 08:31:44 PM
I do know that some tried to solve the couldn't initialize the hardware error by swapping drivers from other games from near the same era. This often lead to the hanging note. I think we discussed this when the SCI1.1 template game was being developed.
Title: Re: Music/Playing Note Sticks When Leaving a Room
Post by: NilG on June 20, 2019, 05:34:09 PM
I've tried enabling all tracks for all driver options and all tracks within just the AdLib option in SCIC, but am still running into troubles with both ADL and SNDBLAST.  Am I right in thinking that the SNDBLAST driver works with ADL set tracks?  I did also install the GM Midi/Ad Lib patch Gumby uploaded here some time ago, although I think that's more to improve mapping, rather than to fix any complete lack of sound?

There's only one other instrument I've found that's sticking, so I broke and changed it to an acoustic guitar for now.  The first chunk/part/demo's done, a little QA aside, so that works to at least share what I've got.  Definitely going to take some time to figure out what I'm doing wrong here, though.