Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 3 4 [5] 6 7

Author Topic: SoundSense-RS: SoundSense clone, written in Rust  (Read 43006 times)

Alatun

  • Bay Watcher
    • View Profile
Re: SoundSense-RS: SoundSense clone, written in Rust
« Reply #60 on: February 29, 2020, 04:37:45 am »

Season and Rain get written to the gamelog and rain sound is playing.

Weather seems to work. But season probably not - at least in my configuration. But maybe I'm having a wrong understanding what the "season" event should do. Should the files for "season" be play as a background sound for the whole season or is it considered a "one time sound event" indicating the start of a new season?
I've taken the "Four seasons" from Vivaldi (http://freemusicarchive.org/music/John_Harrison_with_the_Wichita_State_University_Chamber_Players/The_Four_Seasons_Vivaldi/) and tried to get them played. Sometimes it works, but mostly not. I wanted to have these files played as background music for the corresponding season.

Maybe something is wrong with my soundpack configuration. Apart from the changes I did for seasons it's taken from the LNP 0.44.12. As the XML files there seem a bit confusing, it would be helpful if SoundSense-RS could write a "debug log".

Logging the following details could help to diagnose the problem:
- the event which got detected from the gamelog
- the sound file chosen
- the status of the "open file" call
Logged

prixt

  • Bay Watcher
  • has been taken by a fey mood.
    • View Profile
Re: SoundSense-RS: SoundSense clone, written in Rust
« Reply #61 on: February 29, 2020, 07:34:57 am »

On MacOS and Linux, you can set the environment variable SOUNDSENSE_RS_LOG=trace to see all log messages. On Windows this is disabled, but I can upload a debug-version that opens with a console if necessary. EDIT: Uploaded debug version
Sometimes rodio(the sound crate soundsense-rs uses) fails to read certain sound files. I haven't been able to figure out why, but it should log it as a warning on the console.
« Last Edit: February 29, 2020, 07:42:02 am by prixt »
Logged
SOUNDSENSE-RS - SoundSense alternative written in Rust

Alatun

  • Bay Watcher
    • View Profile
Re: SoundSense-RS: SoundSense clone, written in Rust
« Reply #62 on: February 29, 2020, 07:46:42 am »

On MacOS and Linux, you can set the environment variable SOUNDSENSE_RS_LOG=trace to see all log messages. On Windows this is disabled, but I can upload a debug-version that opens with a console if necessary.
Sometimes rodio(the sound crate soundsense-rs uses) fails to read certain sound files. I haven't been able to figure out why, but it should log it as a warning on the console.

Thanks for the quick response. Unfortunately I'm on Windows. Is there a special reason the environment variable for debugging is disabled on Windows? It would be easy to set the env. var. from a batch file and then starting SoundSense. Should work the same way as on *nix like OS.

What do you mean exactly with "warning on the console"? Is there an output on stdout / stderr? If so, I could try to redirect these streams to a file to see if something weird is going on.
Logged

prixt

  • Bay Watcher
  • has been taken by a fey mood.
    • View Profile
Re: SoundSense-RS: SoundSense clone, written in Rust
« Reply #63 on: February 29, 2020, 07:51:29 am »

Uploaded debug version on releases page, see my comment above.

Yes, the logs are printed into stderr. You should be able to see them with `set SOUNDSENSE_RS_LOG=trace`, then `path/to/soundsense-rs.exe`.
Logged
SOUNDSENSE-RS - SoundSense alternative written in Rust

Alatun

  • Bay Watcher
    • View Profile
Re: SoundSense-RS: SoundSense clone, written in Rust
« Reply #64 on: February 29, 2020, 08:37:19 am »

Just activated the debug version. Getting various debug output written on the console window. The logging works so far. Thanks!

Let's see, if I can detect something unusual now.
Logged

jecowa

  • Bay Watcher
    • View Profile
Re: SoundSense-RS: SoundSense clone, written in Rust
« Reply #65 on: February 29, 2020, 04:46:05 pm »

Maybe there can be a way for sound packs to declare all their channels and set how sounds should be played on them:
  • play unlimited sounds at a time on the channel (like combat channel and other sound effects)
  • play only one sound at a time on the channel, fade to next sound as soon as next trigger on that channel comes in (like music, weather)
  • play only one sound at a time on the channel, ignore new triggers on that channel while current sound is playing (for notifications)
  • maybe eventually some kind of queuing setting, but that seems complicated
Was thinking it could be a .ini file in the soundpacks folder.
I think this could also prevent the music and weather channels from needing to be hard-coded.
Logged

prixt

  • Bay Watcher
  • has been taken by a fey mood.
    • View Profile
Re: SoundSense-RS: SoundSense clone, written in Rust
« Reply #66 on: February 29, 2020, 05:58:32 pm »

That would be nice. Would be relatively easy to implement. Could even be an xml file at the root of the pack, with the elements `ChannelSetting`, or something similar.
Logged
SOUNDSENSE-RS - SoundSense alternative written in Rust

Alatun

  • Bay Watcher
    • View Profile
Re: SoundSense-RS: SoundSense clone, written in Rust
« Reply #67 on: February 29, 2020, 06:59:59 pm »

Ok. Here is some log output:

after loading a game (generated by dfhack) - starts playing weather / music
Quote
[2020-02-29T15:00:09.172Z TRACE] log: Winter has arrived on the calendar.
[2020-02-29T15:00:09.184Z TRACE] log: The weather has cleared.
[2020-02-29T15:00:09.185Z TRACE]  pattern: The weather has cleared\.
[2020-02-29T15:00:09.185Z TRACE]   channel: weather
[2020-02-29T15:00:09.186Z TRACE]    loop=stop

after season change (generated by the game) - starts playing season
Quote
[2020-02-29T23:35:12.348Z TRACE] log: Autumn has come.
[2020-02-29T23:35:12.349Z TRACE]  pattern: Autumn has come\.
[2020-02-29T23:35:12.349Z TRACE]   channel: misc

So it's clear, why the season sound does not play after loading. The message is a little bit different.

Some other things that seemed peculiar:
* the gui shows channels: music, swords, trade, weather, misc - but I only saw "weather, misc". Never saw music and swords, which definitely are being used.

* many log entries that look like this - sometimes 20+ in a row (number of timeout is increasing)
Quote
[2020-02-29T13:44:20.612Z TRACE]  swapped: The metalcrafter stands up.
[2020-02-29T13:44:20.613Z TRACE]  pattern: The (.+) stands up\.
[2020-02-29T13:44:20.613Z TRACE]   can't play: current_timeout: 1768

* this one seems to happen frequently if masterpiece gets crafted.
Quote
[2020-02-29T13:44:44.198Z TRACE]  swapped: `Sigun_1' Mengduthnur has created a masterpiece quartzite door!
[2020-02-29T13:44:44.200Z TRACE]  pattern: (.+) has created a masterpiece (.+)!
[2020-02-29T13:44:44.200Z TRACE]   can't play: failed probability roll

This probably happend, while my military squad was training (too many strike events?) - this should go to swords?
Quote
[2020-02-29T21:43:33.695Z TRACE] log: The militia commander strikes at the macedwarf but the shot is blocked!
[2020-02-29T21:43:33.696Z TRACE]  pattern: The (.+) strikes (.+) but the shot is blocked!
[2020-02-29T21:43:33.696Z TRACE]   channel: misc
[2020-02-29T21:43:33.696Z TRACE]    can't play: at concurency limit: limit 4, channel 4
Logged

prixt

  • Bay Watcher
  • has been taken by a fey mood.
    • View Profile
Re: SoundSense-RS: SoundSense clone, written in Rust
« Reply #68 on: February 29, 2020, 08:09:14 pm »

Quote
after loading a game (generated by dfhack) - starts playing weather / music
Quote
[2020-02-29T15:00:09.172Z TRACE] log: Winter has arrived on the calendar.
[2020-02-29T15:00:09.184Z TRACE] log: The weather has cleared.
[2020-02-29T15:00:09.185Z TRACE]  pattern: The weather has cleared\.
[2020-02-29T15:00:09.185Z TRACE]   channel: weather
[2020-02-29T15:00:09.186Z TRACE]    loop=stop
after season change (generated by the game) - starts playing season
Quote
[2020-02-29T23:35:12.348Z TRACE] log: Autumn has come.
[2020-02-29T23:35:12.349Z TRACE]  pattern: Autumn has come\.
[2020-02-29T23:35:12.349Z TRACE]   channel: misc
Do you mean the season announcement voiceline? Yes, those are triggered by different message patterns.
The `(:season:) has arrived on the calendar.` pattern should trigger the music to change. Could you check the soundpack?
Expected log output:
Code: [Select]
[2020-03-01T01:04:50.072Z TRACE] log: Summer has arrived on the calendar.
[2020-03-01T01:04:50.096Z TRACE]  pattern: (It is now summer\.)|(Summer has arrived on the calendar\.)
[2020-03-01T01:04:50.098Z TRACE]   channel: music
[2020-03-01T01:04:50.098Z TRACE]    loop=start

Quote
Some other things that seemed peculiar:
* the gui shows channels: music, swords, trade, weather, misc - but I only saw "weather, misc". Never saw music and swords, which definitely are being used.
I'm not sure I'm understanding this correctly. Do you mean that you didn't see other channel names being mentioned in the log? That just means that there weren't any gamelog messages that triggered sounds to be played in those channels.

Quote
* many log entries that look like this - sometimes 20+ in a row (number of timeout is increasing)
Quote
[2020-02-29T13:44:20.612Z TRACE]  swapped: The metalcrafter stands up.
[2020-02-29T13:44:20.613Z TRACE]  pattern: The (.+) stands up\.
[2020-02-29T13:44:20.613Z TRACE]   can't play: current_timeout: 1768
If the sound has a timeout value, the same sound won't play for that amount of ms. This sound has a timeout of 2500ms, so this makes sense.
current_timeout doesn't change until the sound gets actually played, so previous triggers on the sound shouldn't increase current_timeout. Are you sure the number increases?

Quote
* this one seems to happen frequently if masterpiece gets crafted.
Quote
[2020-02-29T13:44:44.198Z TRACE]  swapped: `Sigun_1' Mengduthnur has created a masterpiece quartzite door!
[2020-02-29T13:44:44.200Z TRACE]  pattern: (.+) has created a masterpiece (.+)!
[2020-02-29T13:44:44.200Z TRACE]   can't play: failed probability roll
This happens because the sound has a probability(propability) of 25, so it only has a 25% chance of being triggered.

Quote
This probably happend, while my military squad was training (too many strike events?) - this should go to swords?
Quote
[2020-02-29T21:43:33.695Z TRACE] log: The militia commander strikes at the macedwarf but the shot is blocked!
[2020-02-29T21:43:33.696Z TRACE]  pattern: The (.+) strikes (.+) but the shot is blocked!
[2020-02-29T21:43:33.696Z TRACE]   channel: misc
[2020-02-29T21:43:33.696Z TRACE]    can't play: at concurency limit: limit 4, channel 4
As the log says, if there are too many sound playing in the channel (in this case misc), the sound won't play.
It plays on the misc channel because the soundpack didn't specify a channel. jecowa's version moved all combat-related sounds to the sword channel, so I'm guessing you're using the original pack?
Logged
SOUNDSENSE-RS - SoundSense alternative written in Rust

Alatun

  • Bay Watcher
    • View Profile
Re: SoundSense-RS: SoundSense clone, written in Rust
« Reply #69 on: March 01, 2020, 04:16:28 am »

Thanks for explaining the log entries. I think I've found the reason for the trouble. Sorry for causing such inconveniences.

Yes, I'm using the original soundpack (from soundsense of the LNP 0.44.12 pack). And I created a new season.xml to play the Vivaldi sound files. The original season.xml has sections headers that look like this:

Quote
   <sound logPattern="Spring has arrived!" haltOnMatch="false" playbackThreshhold="3">
   <sound logPattern="It is now summer\." haltOnMatch="false" playbackThreshhold="3">
   <sound logPattern="Autumn has come\." haltOnMatch="false" playbackThreshhold="3">
   <sound logPattern="Winter is upon you\." haltOnMatch="false" playbackThreshhold="3">

So I expected this being the correct section header, when I was building my own season.xml (back in 2018).

Today I checked the original season.xml and found additional entries.

Quote
   <sound logPattern="(Spring has arrived!)|(Spring has arrived on the calendar\.)" loop="start" channel="music" playbackThreshhold="0">
   <sound logPattern="(It is now summer\.)|(Summer has arrived on the calendar\.)" loop="start" channel="music" playbackThreshhold="0">
   <sound logPattern="(Autumn has come\.)|(Autumn has arrived on the calendar\.)" loop="start" channel="music" playbackThreshhold="0">
   <sound logPattern="(Winter is upon you\.)|(Winter has arrived on the calendar\.)" loop="start" channel="music" playbackThreshhold="0">

Probably this is the new expected format. I've fixed my season.xml and hopefully it should work now.
Logged

prixt

  • Bay Watcher
  • has been taken by a fey mood.
    • View Profile
Re: SoundSense-RS: SoundSense clone, written in Rust
« Reply #70 on: March 05, 2020, 09:02:09 am »

Hi! Just pre-released v1.5.0!
  • Added pause and skip function
  • Added threshold filtering
  • Added channelSetting capability via soundpack using channelSettings.xml
  • Some minor fixes
Try it out if you're interested, and if there are no big problems, I'll set it as released!
Logged
SOUNDSENSE-RS - SoundSense alternative written in Rust

thurin

  • Bay Watcher
    • View Profile
Re: SoundSense-RS: SoundSense clone, written in Rust
« Reply #71 on: March 05, 2020, 10:43:31 am »

Working for me on mac.  pause and skip are a nice touch.
Logged

Alatun

  • Bay Watcher
    • View Profile
Re: SoundSense-RS: SoundSense clone, written in Rust
« Reply #72 on: March 05, 2020, 05:06:15 pm »

Running the new version 1.5 for a few hours now. You added a randomization for the sounds, like I suggested? Great!
Logged

prixt

  • Bay Watcher
  • has been taken by a fey mood.
    • View Profile
Re: SoundSense-RS: SoundSense clone, written in Rust
« Reply #73 on: March 05, 2020, 05:49:19 pm »

Oh yeah, totally forgot about adding shuffle :P Glad you like it!
Could anyone using this on a Mac upload a screenshot? The current one is getting old.
Logged
SOUNDSENSE-RS - SoundSense alternative written in Rust

jecowa

  • Bay Watcher
    • View Profile
Re: SoundSense-RS: SoundSense clone, written in Rust
« Reply #74 on: March 05, 2020, 06:28:51 pm »

The music and misc channel plays in 1.5 preview, but not the combat channel. It doesn't matter if I'm using a "channelSettings.xml" file or not. Edit: Moving the combat stuff to "misc" (no channel) doesn't make the combat sounds work either. The same sound pack works fine with the old SoundSense-RS.

When using a "channelSettings.xml" I get this warning:
Quote
[WARN ] Unknown Channel PlayType: all
[WARN ] Will ignore this value.
I'm guessing this is harmless, though.


Ever since version 1.4, the "Load" button has always been gray as if it's being moused-over. It looks like the Linux version is the same.
« Last Edit: March 05, 2020, 06:52:18 pm by jecowa »
Logged
Pages: 1 ... 3 4 [5] 6 7