Author Topic: Sound weirdness  (Read 7288 times)

0 Members and 1 Guest are viewing this topic.

Offline troflip

Sound weirdness
« on: June 09, 2015, 02:55:02 AM »
I've managed to get midi resources working in SCI1 for the most part. There is definitely some strange behavior:
- After the program change at the beginning of a channel's data, there must be a volume event, followed by a pan event. Otherwise, the first several seconds of music won't play. If it's a pan followed by volume (instead of volume followed by pan), the music will play, but everything will be panned to one side (despite the pan event).
- If channel 15 is present (this is where cue points and the loop point are specified), it must have (at time 0) a reverb event, followed by a pan event. Otherwise, the interpreter will hang shortly before the first "real" cue event, or shortly after the music starts if there is no "real" cue event.
- If channel 15 has any cue events (instead of just a loop point), then it *must* begin with a cue event (at time 0) with cue value set to 0 (otherwise it is subject to the hang described above)

This all seems very tenuous! ScummVM doesn't have any of these requirements, the sounds play fine without the specific events needed at the beginnings of channels.

Another thing that tripped me up was the loop value on the Sound object. You can't give the sound a number of times to loop. It's either infinity times (-1), or it plays just once (any value other than -1). I should have looked at the ScummVM source code before to see that this was the case.
« Last Edit: June 09, 2015, 02:56:36 AM by troflip »


Check out my website: http://icefallgames.com
Groundhog Day Competition

Offline OmerMor

Re: Sound weirdness
« Reply #1 on: June 09, 2015, 08:39:01 AM »
Maybe there's a more general problem with un-initialized midi properties?
Have you checked how other midi events such as expression, portamento, breath, etc. are treated if no initialized at 0 time?

Offline MusicallyInspired

Re: Sound weirdness
« Reply #2 on: June 09, 2015, 10:44:13 AM »
Yeah, that sounds very tedious and unlikely standard behaviour. The loop thing (infinity or not at all) makes sense, though. In Sierra games songs that loop only stop looping when a script event cues the next sound, from my experience.
« Last Edit: June 09, 2015, 11:14:53 AM by MusicallyInspired »
Brass Lantern Prop Competition

Offline troflip

Re: Sound weirdness
« Reply #3 on: June 09, 2015, 12:32:39 PM »
Yes, I suspect it has something to do with uninitialized MIDI properties, at least for the standard channels where the sounds comes out of one side (although in that case, pan was still set - it just happened to be set prior to volume. So maybe volume invalidates pan?) or don't play for a while.

In the case of channel 15 though, where the loop point and cues are, I wonder if the reverb/pan actually are special non-standard indicators of some kind? (since it hangs without them).
Check out my website: http://icefallgames.com
Groundhog Day Competition

Offline lskovlun

Re: Sound weirdness
« Reply #4 on: June 09, 2015, 03:09:04 PM »
It is true that Sierra SCI pulls some values out of the MIDI stream without looking at the MIDI commands. They are: reverb mode, channel count, program (i.e. instrument), volume and pan (and there are some remapping flags there as well, but they aren't part of the MIDI stream as such). If I were to guess, the hanging problem you're seeing is because the channel count gets set to a bogus value, causing the channel remapping code to loop indefinitely. Or maybe the flags I mentioned.

Offline troflip

Re: Sound weirdness
« Reply #5 on: June 09, 2015, 03:41:36 PM »
What do you mean SCI pulls values out? Like it assumes an event at a certain index is reverb, without checking if the command is actually reverb? So I'd need to guess when the channel count command goes? (is there a channel count? Channel count is part of the snd resource structure, does it also be in the MIDI command stream?) ... wait, that doesn't even make sense, the midi streams are separated per channel, so a channel count makes no sense.

I've also found that Adlib (0$), General MIDI ($7) and Roland MT-32/General MIDI ($c) tracks all need to be present (regardless if the driver is ADL.drv or GENMIDI.drv), or else weird stuff happens.
« Last Edit: June 09, 2015, 03:54:58 PM by troflip »
Check out my website: http://icefallgames.com
Groundhog Day Competition

Offline MusicallyInspired

Re: Sound weirdness
« Reply #6 on: June 09, 2015, 06:38:43 PM »
Here's a question (sorry to interject), do SCI1.1 sound resources support Tandy and/or PC Speaker channels?
« Last Edit: June 09, 2015, 08:05:57 PM by MusicallyInspired »
Brass Lantern Prop Competition

Offline troflip

Re: Sound weirdness
« Reply #7 on: June 09, 2015, 06:50:58 PM »
Yes, presumably. These are the tracks/devices I have in my code now:

Code: [Select]
    SCI1_Adlib = 0x00,
    SCI1_GM = 0x07,
    SCI1_GameBlaster = 0x09,
    SCI1_RolandGM = 0x0c,
    SCI1_PCSpeaker = 0x12,
    SCI1_Tandy = 0x13,
    SCI1_Unknown06 = 0x06,
    SCI1_Unknown08 = 0x08,
    SCI1_Unkonwn0b = 0x0b,

(I got the values/names from SV.exe, or ScummVM, I forget). I haven't had to time to test all of them yet though. That's what I have you folks for! :P
« Last Edit: June 09, 2015, 07:03:28 PM by troflip »
Check out my website: http://icefallgames.com
Groundhog Day Competition

Offline lskovlun

Re: Sound weirdness
« Reply #8 on: June 09, 2015, 08:52:01 PM »
What do you mean SCI pulls values out? Like it assumes an event at a certain index is reverb, without checking if the command is actually reverb?
Yes. To make matters worse, these sequences are different for the control channel and ordinary channels.

So I'd need to guess when the channel count command goes? (is there a channel count? Channel count is part of the snd resource structure, does it also be in the MIDI command stream?) ... wait, that doesn't even make sense, the midi streams are separated per channel, so a channel count makes no sense.
I meant voice count (i.e. polyphony) here. There's a field in the track header and there is a MIDI controller to change it on the fly (which for some reason isn't used in the header, unlike the other fields). It is used for channel remapping when more sounds are played than the hardware can handle.

I've also found that Adlib (0$), General MIDI ($7) and Roland MT-32/General MIDI ($c) tracks all need to be present (regardless if the driver is ADL.drv or GENMIDI.drv), or else weird stuff happens.
I'm not sure why you are seeing this, but then again the robustness of the SCI music player is not something I've investigated.

Offline MusicallyInspired

Re: Sound weirdness
« Reply #9 on: June 10, 2015, 12:21:17 AM »
Yes, presumably. These are the tracks/devices I have in my code now:

Code: [Select]
    SCI1_Adlib = 0x00,
    SCI1_GM = 0x07,
    SCI1_GameBlaster = 0x09,
    SCI1_RolandGM = 0x0c,
    SCI1_PCSpeaker = 0x12,
    SCI1_Tandy = 0x13,
    SCI1_Unknown06 = 0x06,
    SCI1_Unknown08 = 0x08,
    SCI1_Unkonwn0b = 0x0b,

(I got the values/names from SV.exe, or ScummVM, I forget). I haven't had to time to test all of them yet though. That's what I have you folks for! :P

Is that for SCI1 or SCI1.1? Or both?
Brass Lantern Prop Competition

Offline troflip

Re: Sound weirdness
« Reply #10 on: June 10, 2015, 01:17:17 AM »
As far as I know, SCI1 and SCI1.1 use the same set of devices (or SCI1.1 is at least a superset of SCI1 - unlike SCI0 which has completely different numbers).
Check out my website: http://icefallgames.com
Groundhog Day Competition

Offline lskovlun

Re: Sound weirdness
« Reply #11 on: June 10, 2015, 07:24:37 AM »
(I got the values/names from SV.exe, or ScummVM, I forget). I haven't had to time to test all of them yet though. That's what I have you folks for! :P
The ScummVM source code says 0x06 is Amiga/Mac in SCI1 (0x40 in SCI0). That leaves Atari ST, as far as exotic platforms is concerned.

Offline troflip

Re: Sound weirdness
« Reply #12 on: June 11, 2015, 02:05:23 PM »
So from looking at LSL6 and SQ5, standard channels always seem to start with:
- program chance
- volume
- pan

Some sounds (4 total in LSL6) have voice count markers which follow the pan (and also appear later in the stream). So it doesn't seem like voice count could be "plucked" out of the 4th event, since it's rarely there (it's possible it's required for channels on some devices though...?). Voice count doesn't seem like a commonly-used thing. And the voice count in the track header is simply polyphony on or off.

Reverb mode only appears on channel 16 (except in one obviously corrupt sound resource in SQ5).

Check out my website: http://icefallgames.com
Groundhog Day Competition

Offline MusicallyInspired

Re: Sound weirdness
« Reply #13 on: June 11, 2015, 05:41:12 PM »
For SCI0 at least with my experimenting the voice flag for polyphony was only required for Adlib. If it was too low on a channel certain notes wouldn't sound. I posted a thread here somewhere with my experimentations.
Brass Lantern Prop Competition


SMF 2.0.19 | SMF © 2021, Simple Machines
Simple Audio Video Embedder

Page created in 0.067 seconds with 23 queries.