Unusual background Music issue - bug???

Started by cdavenport, Thu 04/10/2018 20:18:05

Previous topic - Next topic

cdavenport

I'm not sure if this is some kind of bug, or something I've messed up somehow myself. I'm using [AGS Editor .NET (Build 3.4.1.13)
v3.4.1, May 2018].

When I'm playing or testing my game, sometimes at the end of a dialogue segment a piece of background music will inexplicably begin to play underneath the background music which I've already set to have playing during the scene. It seems to always happen during dialogue segments, and it is not always consistent. It doesn't happen in every dialogue, only sometimes.

There's nowhere in my scripting that I can find which would result in two different conflicting background music pieces being called to play over each other during the dialogue.

I have tried searching the forums, but it seems like such an unusual problem, that I haven't been able to narrow down any keyword searches which were brought up somewhere in the past.

I don't know if this is something simple I've overlooked, or if its some kind of unusual bug in the engine that's causing this behavior. Does anyone have any ideas of what could be causing such a thing, or any leads that I can try to investigate to solve it? :confused:


ManicMatt

I think it will help people to work out your problem if they can see your code, and how it is used to play background music, and where this code is, for instance - after fade in.

The song that plays over the other music, is it the same file being played or a different song?

cdavenport

It is a different song that plays underneath the music already playing.

The only solution I have found seems to create an entirely new dialogue segment. Then it seems to go away, but I think it will occur again in a different dialogue as it has done in the past.

As a test, I eliminated the background music in the room and dialogue segment and played it. And during the dialogue, the phantom background music still played even thoughthere is nothing in the script to call for any kind of sound or music.

ManicMatt

#3
Could you have told it to play music in the global script?

And again, if you could copy and paste any of your code, like in one of the dialogs that randomly plays music, it would certainly go a long way in identifying the problem.

Gurok

If you're using Sierra-style speech with portraits, check to see if any of your speech views have no frames.
[img]http://7d4iqnx.gif;rWRLUuw.gi

cdavenport

#5
I can't find anything in the global script that calls up music, and I checked to see if portraits were missing any frames and they all appear intact.

In the past I have fixed this issue by creating a new dialogue segment, and it went away for awhile, but then the phantom music seems to occur in the dialogue of another character in the game - like it jumps from one dialogue to infect another.

It has happened even at times when I have NO scripted music playing in either the room, or the dialogue segments between characters. So even though two characters are in a room where there is no music being called to play in either the rooms scripting, or the dialogue's scripting, the phantom music will play in the background. So I cannot identify an error by looking at the code, or posting it, since there is no music scripting at all in it. It's seems its something that's happening underneath everything else, hidden from plain view.

I cannot find anything about it as far as others troubleshooting a similar issue with their game, so I'm assuming it's a weird bug I've somehow stumbled upon.

I guess it is possible there could be some weird error I made without knowing about it in the global script or something, but right now I'm at a loss of where to look or what it could possibly be.

Privateer Puddin'

Do your dialogs run any animations? Could you have a sound tied to a view frame?

cdavenport


Was playing playing Unavowed and the phantom music sounded like it was going on in that game too, I could distinctly hear what sounded like two different background music songs playing over one another during a section of the game, but its too unpredictable to reproduce. At least I know its not just my game or something I did seems to be something in AGS.

Crimson Wizard

#8
That may be a silly question to ask, but I did not notice if this was asked anywhere above and want to confirm this to eliminate any chance of misunderstanding: is this "phantom" music actually a music clip from your game?
If yes, is it always the same clip?
How easy it is to reproduce this problem in your game? Have you tried giving your game to other people to test out to see if they get same error?

ManicMatt

that sounds like you're running the game twice?

Crimson Wizard

Quote from: ManicMatt on Sat 13/10/2018 07:50:50
that sounds like you're running the game twice?

By default AGS pauses on background, so unless multitasking mode was enabled deliberately by game creator they should not run in parallel.

ManicMatt

Just thought I'd throw that out there.

Would it also be useful perhaps if they game captured or even filmed what happens to show us?

Just to clarify also, what OS are you using?

cdavenport

Quote from: Crimson Wizard on Sat 13/10/2018 01:58:32
That may be a silly question to ask, but I did not notice if this was asked anywhere above and want to confirm this to eliminate any chance of misunderstanding: is this "phantom" music actually a music clip from your game?
If yes, is it always the same clip?
How easy it is to reproduce this problem in your game? Have you tried giving your game to other people to test out to see if they get same error?

Apologies for slow reply but I don't have reliable access to Internet at this time.

Yes, music is a clip from my game, and it is always same clip. It happened again when I was troubleshooting it last night.

The only fix I've found is to create a new dialog, to replace the one with where the music track plays when it's not supposed to. That seems to work, however it may occur again I won't know until all the dialogue sequences are finished and tested.

It *may* have something to do with when I use "player:" in the dialogue instead of using the characters name (e.g. "cEgo:") but I can't be certain.

Right now it's not feasible for me to send the game to other players to test, I was hoping somebody might have had this same issue but apparently not. If I can't figure out what it is I'll have to try and troubleshoot it later.

I can say it sounded like it was happening while I was playing Unavowed, I was in the section outside the police station talking to Donny, I could hear the ambient sounds, the musical track that was playing in the room, and then all of a sudden underneath those another musical fanfare started playing over and over again (just as what happens in my game) beneath the other tracks, while I was in the middle of a dialogue. It happened more than once but again I cannot predict exactly when and where it will occur.

All I can say is it doesn't happen with any other games I play, so I'm assuming its something in that version of AGS.






Crimson Wizard

#13
Quote from: cdavenport on Sun 14/10/2018 15:59:19
Yes, music is a clip from my game, and it is always same clip. It happened again when I was troubleshooting it last night.

The only fix I've found is to create a new dialog, to replace the one with where the music track plays when it's not supposed to. That seems to work, however it may occur again I won't know until all the dialogue sequences are finished and tested.

Are you using voice-over notations in the dialogs? Can it be that you put music clip in Speech folder and forgot about it?


Quote from: cdavenport on Sun 14/10/2018 15:59:19
It *may* have something to do with when I use "player:" in the dialogue instead of using the characters name (e.g. "cEgo:") but I can't be certain.

Right now it's not feasible for me to send the game to other players to test, I was hoping somebody might have had this same issue but apparently not. If I can't figure out what it is I'll have to try and troubleshoot it later.

If this happens again and will reproduce steadily, could you at least post particular dialog script?, because it's hard to guess the problem without having more details.


Quote from: cdavenport on Sun 14/10/2018 15:59:19
I can say it sounded like it was happening while I was playing Unavowed, I was in the section outside the police station talking to Donny, I could hear the ambient sounds, the musical track that was playing in the room, and then all of a sudden underneath those another musical fanfare started playing over and over again (just as what happens in my game) beneath the other tracks, while I was in the middle of a dialogue. It happened more than once but again I cannot predict exactly when and where it will occur.

Have you tried reporting this to Dave Gilbert? He might be able to find out something about this problem too.

Snarky

A sound randomly/continuously playing when you're not calling any audio functions, I'd say 99 times out of 100 are (as Privateer Puddin' says) because you've got an audio clip linked to an animation frame somewhere. One way to test that is to run this snippet (which removes linked audio from all frames in all loops in all views) and seeing if the problem disappears:

Spoiler
Code: ags

  for(int i=1; i<=Game.ViewCount; i++)
  {
    int loopCount = Game.GetLoopCountForView(i);
    for(int j=0; j<loopCount; j++)
    {
      int frameCount = Game.GetFrameCountForLoop(i, j);
      for(int k=0; k<frameCount; k++)
      {
        ViewFrame* viewFrame = Game.GetViewFrame(i, j, k);
        viewFrame.LinkedAudio = null;
      }
    }
  }
[close]
Some other details that might be useful to understand the problem:

-Once the error occurs in one place, is it consistent? (It always appears in that place until you change something in the script)
-Does the wrong clip play on a continuous loop? Does it play all the way through or is it interrupted before finishing? And if interrupted, is it always at the same place, or does it vary?
-How have you got your AudioTypes/AudioChannels set up? (How many channels assigned to each audio type)
-What are the AudioTypes of the clips that are playing?

You could also use the code here to take a look at what's happening with the audio as it's happening.

Monsieur OUXX

Isn't there an option in the Editor to attach a music to a room?
If yes, then there would be the automated room music, set with the editor, and another music that cdavenport plays manually, as the actual intended music.
 

morganw

Quote from: Monsieur OUXX on Mon 15/10/2018 11:42:51
Isn't there an option in the Editor to attach a music to a room?
There is no such option.

Crimson Wizard

Quote from: morganw on Mon 15/10/2018 14:19:18
Quote from: Monsieur OUXX on Mon 15/10/2018 11:42:51
Isn't there an option in the Editor to attach a music to a room?
There is no such option.

This option existed before version 3.2, where this and few other room options were deprecated in favor of scripting. It still exists internally for importing old projects but not displayed on Editor UI.

morganw

Does it get its own dedicated audio channel?

Crimson Wizard

#19
Quote from: morganw on Mon 15/10/2018 14:55:10
Does it get its own dedicated audio channel?

No, this property has no control over channels and such, it is simply converted into "aSomeMusic.Play();" command in the "On Room Load" script.

The reason I doubt this is related to current problem is that cdavenport mentioned "phantom music" starts playing at certain point in the dialog, not at the room start, and secondly, if this was the project imported from before AGS 3.2, there would be a noticable script command.

Monsieur OUXX

Quote from: Crimson Wizard on Mon 15/10/2018 14:48:50
Quote from: morganw on Mon 15/10/2018 14:19:18
Quote from: Monsieur OUXX on Mon 15/10/2018 11:42:51
Isn't there an option in the Editor to attach a music to a room?
There is no such option.

This option existed before version 3.2, where this and few other room options were deprecated in favor of scripting. It still exists internally for importing old projects but not displayed on Editor UI.

Since Unavowed has the same issue according to cdavenport, couldn't it be that the feature wakes up somehow, even without it being available in the UI? Something to do with the game having been developed in earlier AGS versions at the beginning, or even the Editor screwing up some import or room creation at some point?
 

cdavenport

Quote from: Crimson Wizard on Sun 14/10/2018 16:02:24
Quote from: cdavenport on Sun 14/10/2018 15:59:19

Are you using voice-over notations in the dialogs? Can it be that you put music clip in Speech folder and forgot about it?


If this happens again and will reproduce steadily, could you at least post particular dialog script?, because it's hard to guess the problem without having more details.

Have you tried reporting this to Dave Gilbert? He might be able to find out something about this problem too.

Thanks Crimson Wizard I've checked the speech folder and nothing is amiss in it except that I have a duplicate WAV audio file I forgot to delete, but it's a voice file not music so that couldn't have been it. I haven't reported this about Unavowed to Dave Gilbert yet it's really so subtle that I doubt anyone would even notice, and I wanted to play it a little more and try and see if and where it's happening, so I could reproduce it 100% before raising the issue.

It's sort of the thing that only a Developer might be aware of, because normally a player or even a play-tester would have no reason to suspect anything was going awry if the wrong background music was playing during a dialogue sequence.

I'll do some more troubleshooting and try some of the things others have brought up over the next few days.

Quote from: Snarky on Sun 14/10/2018 18:39:45
A sound randomly/continuously playing when you're not calling any audio functions, I'd say 99 times out of 100 are (as Privateer Puddin' says) because you've got an audio clip linked to an animation frame somewhere. One way to test that is to run this snippet (which removes linked audio from all frames in all loops in all views) and seeing if the problem disappears:
   
Some other details that might be useful to understand the problem:

-Once the error occurs in one place, is it consistent? (It always appears in that place until you change something in the script)
-Does the wrong clip play on a continuous loop? Does it play all the way through or is it interrupted before finishing? And if interrupted, is it always at the same place, or does it vary?
-How have you got your AudioTypes/AudioChannels set up? (How many channels assigned to each audio type)
-What are the AudioTypes of the clips that are playing?

You could also use the code here to take a look at what's happening with the audio as it's happening.

Thanks Snarky, I'll try running that code I manually checked to see if there was any music linked to any frames, I didn't find any checking it earlier but it's possible it could have been done accidentally, so that snippet will be a real help.

Yes, the wrong music error is consistent until I create a new dialogue, then it goes away. But it tends to reappear in another dialogue somewhere after that?

I haven't waited to see if the music looped because it's a rather long piece, lasting a few minutes. I'll try that. The wrong music always starts up during a dialogue, then continues in the game even after I break out of the dialogue segment.

I do not think I played around with assigning different audio channels, but I might have, I've been working on the game for over a year. I'll check that.

I'm using OGG files for everything, and the files are categorized as either Music or Sound. I have tried to keep everything simple as I'm a novice at scripting, and tried not to do anything with the game's audio handling besides the most basic usage and commands.

I'm mainly looking for ideas that will help me troubleshoot it so these will help, I'll see if I can find anything new.

ManicMatt

Clutching at straws here, but could there be any script ID names that are identical that cdavenport entered, which could confuse AGS?

I realise that doesn't explain Gilbert's game, however.

Khris

cdavenport: Which type of speech are you using? Are you using Lip sync? (If not, make sure you didn't enable it accidentally).

Anyway, I did a quick test and if I assign a piece of music to a talking view frame, then let the character talk, the music will start over and over again while the character is talking (whenever the frame is used during the animation), then keep playing when they finish talking. So if the piece has a couple of seconds of silence at the start, it'll simply sound like the music starts playing randomly.
I'm still 99% convinced that this is what's happening.

Crimson Wizard

#24
Quote from: Monsieur OUXX on Mon 15/10/2018 15:35:25
Since Unavowed has the same issue according to cdavenport, couldn't it be that the feature wakes up somehow, even without it being available in the UI? Something to do with the game having been developed in earlier AGS versions at the beginning, or even the Editor screwing up some import or room creation at some point?

While hypothetically that may be possible, IMHO this is too much to assume at once without firm evidence. We do not know if what cdavenport experienced in "Unawoved" is a bug and not by Dave's design, we do not know if it's the same kind of bug as he has in his game, and we still have no actual details to make conclusion of its nature.

Of all the theories mentioned in this thread, the clip linked to the frame sounds most logical to me so far, but I'd rather wait for further test results.

Dave Gilbert

Quote from: cdavenport on Sun 14/10/2018 15:59:19
I can say it sounded like it was happening while I was playing Unavowed, I was in the section outside the police station talking to Donny, I could hear the ambient sounds, the musical track that was playing in the room, and then all of a sudden underneath those another musical fanfare started playing over and over again (just as what happens in my game) beneath the other tracks, while I was in the middle of a dialogue. It happened more than once but again I cannot predict exactly when and where it will occur.

If it's in that location, than it's by design. Donny is playing a game on his phone and the music plays when you get close to him. You'll hear the same music in Unavowed HQ when Logan is playing the same game on his phone.

cdavenport

Thanks for all the help and suggestions I'll keep troubleshooting it, it doesn't seem to be a game-breaking issue (yet) and I can eliminate it by setting the music volume to 1 on the music that keeps playing in the background. The music doesn't appear to loop continuously, it just plays through once and stops.

Quote from: Snarky on Sun 14/10/2018 18:39:45
A sound randomly/continuously playing when you're not calling any audio functions, I'd say 99 times out of 100 are (as Privateer Puddin' says) because you've got an audio clip linked to an animation frame somewhere. One way to test that is to run this snippet (which removes linked audio from all frames in all loops in all views) and seeing if the problem disappears:

Spoiler
Code: ags

  for(int i=1; i<=Game.ViewCount; i++)
  {
    int loopCount = Game.GetLoopCountForView(i);
    for(int j=0; j<loopCount; j++)
    {
      int frameCount = Game.GetFrameCountForLoop(i, j);
      for(int k=0; k<frameCount; k++)
      {
        ViewFrame* viewFrame = Game.GetViewFrame(i, j, k);
        viewFrame.LinkedAudio = null;
      }
    }
  }
[close]
Some other details that might be useful to understand the problem:

I'd like to try this but not sure where to insert the code for it to work, I tried placing it in Room Load in the particular scene where the bug happens but it didn't seem to do anything. I still got the phantom music playing during the dialogue. Should it be in the Global script, or the dialogue script where the music starts playing when it's not supposed to?

Quote from: Dave Gilbert on Tue 16/10/2018 21:50:08
Quote from: cdavenport on Sun 14/10/2018 15:59:19
I can say it sounded like it was happening while I was playing Unavowed, I was in the section outside the police station talking to Donny, I could hear the ambient sounds, the musical track that was playing in the room, and then all of a sudden underneath those another musical fanfare started playing over and over again (just as what happens in my game) beneath the other tracks, while I was in the middle of a dialogue. It happened more than once but again I cannot predict exactly when and where it will occur.

If it's in that location, than it's by design. Donny is playing a game on his phone and the music plays when you get close to him. You'll hear the same music in Unavowed HQ when Logan is playing the same game on his phone.

Ah, I didn't make the connection that he was playing the game and it was coming from his phone, but now I understand.

Snarky

Quote from: cdavenport on Wed 17/10/2018 19:17:21
I'd like to try this but not sure where to insert the code for it to work, I tried placing it in Room Load in the particular scene where the bug happens but it didn't seem to do anything. I still got the phantom music playing during the dialogue. Should it be in the Global script, or the dialogue script where the music starts playing when it's not supposed to?

Room Load should be fine. The important thing is that it's called before the music play command is called. If it doesn't help, then that's a sign that linked audio on a frame is not the cause of the phenomenon. Which is interesting.

(If you want to check that the code snippet is actually running correctly, you could try adding some linked audio on a speech frame: without the code it should play during speech, with the code, the sound should go away.)

SMF spam blocked by CleanTalk