Jump to content

Radio transmision script not playing short audiofiles


daemon1808

Recommended Posts

Hi,

When you use mission scripting engine scripts to play a radio transmission, the first one or two seconds are not played. This cause that sound files that have a duration of 1 second are barely played or not played at all.

 

Something like this in a trigger "DO SCRIPT" (where p = blablabla.getPlayer():getPoint())

trigger.action.radioTransmission('sounds/whatever1segfile.ogg', p, 0, false, 124000000, 100)

 

edit: it seems that it has nothing to do with the lenght of the sound, but the times the function is called in a row. When you try to call it several times, it works or not randomly.

I have attached an example mission when it happens. A loop happens every 10 seconds, and the sound is played sometimes, sometimes not (in 1 thread version and in MT version)

This not happens if you use the trigger outsound.

ED could you check this, please?

 

testsound.miz


Edited by daemon1808
Link to comment
Share on other sites

5 hours ago, daemon1808 said:

Hi,

When you use mission scripting engine scripts to play a radio transmission, the first one or two seconds are not played. This cause that sound files that have a duration of 1 second are barely played or not played at all.

 

Something like this in a trigger "DO SCRIPT" (where p = blablabla.getPlayer():getPoint())

trigger.action.radioTransmission('sounds/whatever1segfile.ogg', p, 0, false, 124000000, 100)

 

If you have two sounds set to play one after the other? The sound engine api is dumb and doesn't get this and just plays the final one and won't sequence them. Could this be the problem?

Link to comment
Share on other sites

51 minutes ago, Elphaba said:

If you have two sounds set to play one after the other? The sound engine api is dumb and doesn't get this and just plays the final one and won't sequence them. Could this be the problem?

No, no... my problem is not that. I'm aware that, If you try to play 2 sounds at the same time using "trigger.action.outsound", the last of them will interrupt the other (only 1 thread for playing sound seems to be used). And I'm using scripting engine, not the triggers for the ME.

But, in my case i'm not using "trigger.action.outsound" command for playing 2 sounds at a time. I'm using trigger.action.radioTransmission to play only one file.

The case is that using trigger.action.radioTransmission, the first 1 or 2 seconds of the sound are skyped. What is worse, if the sound duration is about 1 second, the sound is not played at all (let's say the sound is "hello!": you will only hear "lou" or nothing at all). That's not happening using trigger.action.outsound. In this case you will hear "hello!" without any syllable skyped.

So imagine that you want to say "enfield", a second later: "one", and another second later "three" using 3 commands trigger.action.radioTransmission, and scheduling them secuentially using timer.scheduleFunction. You will hear "..field .. ..ree" in total.

Same scenario using instead 3 trigger.action.outsound will give you a perfect and clear "Enfield one three".

 


Edited by daemon1808
Link to comment
Share on other sites

4 hours ago, daemon1808 said:

No, no... my problem is not that. I'm aware that, If you try to play 2 sounds at the same time using "trigger.action.outsound", the last of them will interrupt the other (only 1 thread for playing sound seems to be used). And I'm using scripting engine, not the triggers for the ME.

But, in my case i'm not using "trigger.action.outsound" command for playing 2 sounds at a time. I'm using trigger.action.radioTransmission to play only one file.

The case is that using trigger.action.radioTransmission, the first 1 or 2 seconds of the sound are skyped. What is worse, if the sound duration is about 1 second, the sound is not played at all (let's say the sound is "hello!": you will only hear "lou" or nothing at all). That's not happening using trigger.action.outsound. In this case you will hear "hello!" without any syllable skyped.

So imagine that you want to say "enfield", a second later: "one", and another second later "three" using 3 commands trigger.action.radioTransmission, and scheduling them secuentially using timer.scheduleFunction. You will hear "..field .. ..ree" in total.

Same scenario using instead 3 trigger.action.outsound will give you a perfect and clear "Enfield one three".

 

 

Okay, so I don't know if there is a fix except someone at ED fixing it, but have you considered shoving a 2-3 second silence at the front of each sound file in Audacity, so that it will actually play the bit you want and the length of the sound file will always be at least 3-4 seconds so it won't error at all? 

That's all I can think of to get you over this as a workaround, but the whole audio api is not fit for purpose really. 😕

Link to comment
Share on other sites

For me its a problem, because I'm trying to make complex messages joining 3 or 4 short audios dinamically (tipically one word)

I will try it, but I think it will not work and there will be a lot of silences between words.

Thanks for the help anyway

  • Like 1
Link to comment
Share on other sites

  • 2 weeks later...

Hi

I have tried enlarging the lengh of the sound, but no joy.

More even, I have found that the problem is not the lengh of the sound but, if you try to transmit several messages in the same radio freq, sometimes it is played ok, sometimes not.

I have attached an example mission when it happens. A loop hapens every 10 seconds, and the sound is played sometimes, sometimes not (in 1 thread version and in MT version)

This not happens if you use the trigger outsound.

ED could you check this, please?

testsound.miz

Link to comment
Share on other sites

On 3/12/2023 at 7:27 PM, daemon1808 said:

Hi

I have tried enlarging the lengh of the sound, but no joy.

More even, I have found that the problem is not the lengh of the sound but, if you try to transmit several messages in the same radio freq, sometimes it is played ok, sometimes not.

I have attached an example mission when it happens. A loop hapens every 10 seconds, and the sound is played sometimes, sometimes not (in 1 thread version and in MT version)

This not happens if you use the trigger outsound.

ED could you check this, please?

testsound.miz 35.92 kB · 1 download

You're going to have to do this from scripting. Have a very fast timer and meta data for each sound file and when you have counted the duration of the sound file, count a little more (your pref) and then move onto the next one. 

Trying to do this in the ME will lead to heartache and a broken monitor when you put your fist through it. 

Link to comment
Share on other sites

6 hours ago, Elphaba said:

You're going to have to do this from scripting. Have a very fast timer and meta data for each sound file and when you have counted the duration of the sound file, count a little more (your pref) and then move onto the next one. 

Trying to do this in the ME will lead to heartache and a broken monitor when you put your fist through it. 

Hi,

that is what I did to prove my point (just check the mission attached):

I'm using a script with a llop and a timer. The sound duration is 2.5 seconds and the loop iteration is 10 seconds

the sounds some times is played, sometimes not.... completely random.

Link to comment
Share on other sites

15 minutes ago, daemon1808 said:

Hi,

that is what I did to prove my point (just check the mission attached):

I'm using a script with a llop and a timer. The sound duration is 2.5 seconds and the loop iteration is 10 seconds

the sounds some times is played, sometimes not.... completely random.

Think you might have found a bug in the already woefully substandard sound api.

could you try playing a separate very short silent sound file mid way in the gap between your sound and the point at which it loops?

Link to comment
Share on other sites

2 hours ago, Elphaba said:

Think you might have found a bug in the already woefully substandard sound api.

could you try playing a separate very short silent sound file mid way in the gap between your sound and the point at which it loops?

Yes, the sound api is very anoying ^_^

No, I don't think it will work because it is random. Sometimes the sound is played, sometimes no... but it doesn't follow a pattern.

I'm afraid that I will have to use the function outsound instead of radiotransmission in my scripts 😞

Link to comment
Share on other sites

5 hours ago, daemon1808 said:

Yes, the sound api is very anoying ^_^

No, I don't think it will work because it is random. Sometimes the sound is played, sometimes no... but it doesn't follow a pattern.

I'm afraid that I will have to use the function outsound instead of radiotransmission in my scripts 😞

Would you consider posting a bug report in the Mission Editor bugs section and linking to this thread? I've already posted about sound issues, but your research into this will be additional help.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...