How to play sound effects during dialogs

Started by rattusrattus, Sat 12/10/2024 03:37:30

Previous topic - Next topic

rattusrattus

Sorry to not respond to your replies I keep forgetting to. I am wondering if there's a way to play a sound effect during dialogs? I tried to put the sound effect as a speech sound file under the narrator and it doesn't seem to work.

[Mod edit: Split question into new topic from original thread]

heltenjon

Quote from: rattusrattus on Sat 12/10/2024 03:37:30Sorry to not respond to your replies I keep forgetting to. I am wondering if there's a way to play a sound effect during dialogs? I tried to put the sound effect as a speech sound file under the narrator and it doesn't seem to work.
If you indent with a space or two, you can use normal script commands inside your dialog script.

Crimson Wizard

#2
Quote from: rattusrattus on Sat 12/10/2024 03:37:30Sorry to not respond to your replies I keep forgetting to. I am wondering if there's a way to play a sound effect during dialogs? I tried to put the sound effect as a speech sound file under the narrator and it doesn't seem to work.

In general, please do not post unrelated questions in the existing topic. This topic is about "blurry fonts", so it's in no way connected to the speech sounds.

About your question, please clarify, are you trying to add voice-over to the narrator, or are you trying to play an arbitrary sound during narrator's speaking?
When you say that you're tried something and that does not work, please always explain what exactly did you try and what happened. For example, post your actual code, and explain result, or post a error message if you got one.

AGS has a voice-over system, as explained in the manual:
https://adventuregamestudio.github.io/ags-manual/VoiceSpeech.html

Is this what you are looking for, or you want something else?

rattusrattus

Oh, I apologize. I read somewhere on this forum that it's pointless to make a whole new topic for a question. I'm sorry.

As for my question, I was just trying to figure out a way to add a sound effect during dialogs. heltenjon's advice solved my problem. My issue beforehand though was that I tried to implement the sound effect through a speech voice over, and it didn't work. I titled the wav file of the sound effect NARR1. This is the code I tried to use:

Code: ags
@S  // Dialog startup entry point
return
@1
narrator:&1 The creature lets out a cry
stop
@2
narrator:&1 The creature lets out a cry
stop

Crimson Wizard

Quote from: rattusrattus on Sat 12/10/2024 14:41:46My issue beforehand though was that I tried to implement the sound effect through a speech voice over, and it didn't work. I titled the wav file of the sound effect NARR1. This is the code I tried to use:

The code looks fine. The speech file has to be called NARR1.wav and placed into "Speech" subfolder in your project - this is where AGS finds the voice-over files and compiles speech.vox from them. Also it's worth checking whether this file plays at all if imported as a regular sound: because AGS had issues with certain WAV files in the past.

The question here is rather, whether are you planning to make whole game with voice-over, or only play 1 sound for narrator messages.

If latter, then it may be convenient to write a custom function that plays the sound and displays given text, and then use that function instead of placing sound Play function every time before narrator sais something in a dialog. That might save some time and be less prone to mistakes.

I don't know your intentions, or what you are doing in your code, so mention this just for information.

rattusrattus

Yeah at the moment I'm just trying to figure out the software by making a short little experience for my friends. I'm still trying to figure out writing custom functions and when to use the tools the software gives you. Thank you for the advice! And thank you with the help with voice overs.

Snarky

Using voice speech for sound effects during speech that aren't actually a voice-over of the line of speech is going to have side-effects that may not be wanted. For example, the duration of the line is then determined by the length of the audio clip rather than the length of the text, and the audio will cut off if players click to advance the dialog.

So if what you want are other sound effects during the conversation (e.g. a thunderclap or fanfare at a certain point of the dialog), you should probably use a different approach.

SMF spam blocked by CleanTalk