Bay 12 Games Forum

Dwarf Fortress => DF Modding => Utilities and 3rd Party Applications => Topic started by: prixt on September 05, 2019, 05:53:21 am

Title: SoundSense-RS: SoundSense clone, written in Rust
Post by: prixt on September 05, 2019, 05:53:21 am
SOUNDSENSE-RS
(https://raw.githubusercontent.com/prixt/soundsense-rs/master/icons/icon.png)
A SoundSense clone, written in Rust

Releases (https://github.com/prixt/soundsense-rs/releases) - Repository (https://github.com/prixt/soundsense-rs)

Spoiler: Windows Screenshot (click to show/hide)
Spoiler: Mac Screenshot (click to show/hide)
Spoiler: Linux Screenshot (click to show/hide)

Hello! I am writing a SoundSense alternative in Rust.

Why?
Ultimately, you should only need one binary executable, the soundpack folder, and DF.

Current Features

Command line parameters
Example:
Code: [Select]
soundsense-rs.exe -l "C:\path\to\gamelog.txt" -p "D:\path\to\soundpack\folder"This will make soundsense-rs check if there is a file named "ignore.txt" in the working directory, and will use that file to make the ignore list.

Dependencies
Linux: libasound2, libgtk-3, libgdk-3, libwebkit2gtk-4.0, libjavascriptcregtk-4.0

Known Issues

Bug reports and feature requests are welcome!
Title: Re: SoundSense-RS: SoundSense clone, written in Rust
Post by: jecowa on February 05, 2020, 09:05:40 pm
Looks cool. It would be great to not need Java or mono.
Title: Re: SoundSense-RS: SoundSense clone, written in Rust
Post by: jecowa on February 06, 2020, 02:12:31 am
Do you have an icon for this application? Here's what I'm using right now:

(https://i.imgur.com/ujDWPal.png)

Spoiler: Screenshot in-use: (click to show/hide)
Title: Re: SoundSense-RS: SoundSense clone, written in Rust
Post by: Abadrausar on February 08, 2020, 07:42:52 am
I have liked this utility because it is multi-platform and very lightweight in memory usage, liberating a whole lot of system memory for being usable in Dwarf Fortress where it is badly needed.

ApplicationPlatform LanguageVersionDownload size in MBRuntime required in MB
LinuxOSXWindows
SoundSensejava runtimer2016-111165-80
SoundCensec# CLR1.4.45.275.275.27100
SoundSense-RSRust native or WebAssembler1.3.22.811.912.70

Any possibility of converting this into a WebAssembly (https://www.rust-lang.org/what/wasm) application which is supported by the Rust build system apparently.

Milo Christiansen did that with his Rubble (http://www.bay12forums.com/smf/index.php?topic=154304.0) modding system for DF, as a way to streamline the deployment and the debugging of the UI of his application over the many OS supported by DFHACK (Windows, Linux, OSX).

Then; only one application wasm package would be usable in all the 3 OS.




Title: Re: SoundSense-RS: SoundSense clone, written in Rust
Post by: Button on February 08, 2020, 01:57:24 pm
How does this handle combat sounds coming in too fast to complete? When I tried SoundCense (the version that was packed with the LNP at the time), combat sounds were almost unusable, because they'd all be queued up and each sound was a lot longer than the actual combat event in question. I'd end up having to pause the game a bunch to let the combat sound channel resolve.

SoundSense is better in that it seems to play the most recent combat sound, rather than queuing them up; which means that if you're hearing a combat sound, combat is currently ongoing.

What approach does SoundSense-RS take?
Title: Re: SoundSense-RS: SoundSense clone, written in Rust
Post by: jecowa on February 08, 2020, 07:48:41 pm
How does this handle combat sounds coming in too fast to complete? When I tried SoundCense (the version that was packed with the LNP at the time), combat sounds were almost unusable, because they'd all be queued up and each sound was a lot longer than the actual combat event in question. I'd end up having to pause the game a bunch to let the combat sound channel resolve.

SoundSense is better in that it seems to play the most recent combat sound, rather than queuing them up; which means that if you're hearing a combat sound, combat is currently ongoing.

What approach does SoundSense-RS take?

If there's too much stuff going on at once, it just doesn't play anything. It goes silent. It does not queue things up. Around five units fighting at-once in the arena seems like too much for it.
Title: Re: SoundSense-RS: SoundSense clone, written in Rust
Post by: prixt on February 09, 2020, 11:13:17 am
It seems the main draw for my version of SoundSense is its low memory usage... Interesting.
I was looking into swapping the GUI crate this uses, but changing to something that doesn't use webview pretty much doubles the binaries memory.
What features do you think I should prioritize?
Also, jecowa reported the GUI not displaying on their OSX; do other people have problems with it too?
Title: Re: SoundSense-RS: SoundSense clone, written in Rust
Post by: prixt on February 09, 2020, 11:34:37 am
Quote
Any possibility of converting this into a WebAssembly (https://www.rust-lang.org/what/wasm) application which is supported by the Rust build system apparently.

Milo Christiansen did that with his Rubble (http://www.bay12forums.com/smf/index.php?topic=154304.0) modding system for DF, as a way to streamline the deployment and the debugging of the UI of his application over the many OS supported by DFHACK (Windows, Linux, OSX).

Then; only one application wasm package would be usable in all the 3 OS.
SoundSense-RS uses a lot of dependent crates, and in order to target WASM, all of the crates must be able to target WASM. So I don't think this will be practically possible.
Title: Re: SoundSense-RS: SoundSense clone, written in Rust
Post by: jecowa on February 09, 2020, 08:12:54 pm
Hey, prixt. I just wanted to let you know I'm including SoundSense-RS in the Lazy Mac Pack.

I tested it on a Debian/Ubuntu-based Linux machine. I got the same problem with the GUI as on Mac, except the Linux version also gave me an error message: Failed to load module "appmenu-gtk-module".

I like that it doesn't use disk space and doesn't need third-party software to run. It looks like the current memory usage is ~25 MB and the disk usage is 2.5 MB. If these doubled, I don't think it would be a big deal. I don't mind not having volume controls, but it would be kind of nice.
Title: Re: SoundSense-RS: SoundSense clone, written in Rust
Post by: prixt on February 10, 2020, 02:05:49 am
Hey, prixt. I just wanted to let you know I'm including SoundSense-RS in the Lazy Mac Pack.

I tested it on a Debian/Ubuntu-based Linux machine. I got the same problem with the GUI as on Mac, except the Linux version also gave me an error message: Failed to load module "appmenu-gtk-module".

I like that it doesn't use disk space and doesn't need third-party software to run. It looks like the current memory usage is ~25 MB and the disk usage is 2.5 MB. If these doubled, I don't think it would be a big deal. I don't mind not having volume controls, but it would be kind of nice.
Thank you for the inclusion!
Title: Re: SoundSense-RS: SoundSense clone, written in Rust
Post by: jecowa on February 11, 2020, 06:15:18 pm
Mac GUI:

(https://i.imgur.com/oeA6uIp.png)
Title: Re: SoundSense-RS: SoundSense clone, written in Rust
Post by: prixt on February 12, 2020, 12:11:44 am
Mac GUI: ...
Cool! Can I use it on the repos README?
Title: Re: SoundSense-RS: SoundSense clone, written in Rust
Post by: jecowa on February 12, 2020, 12:50:22 am
Yes, it's fine with me.

How does it determine if something is Weather or Music?
Title: Re: SoundSense-RS: SoundSense clone, written in Rust
Post by: prixt on February 12, 2020, 04:18:24 am
How does it determine if something is Weather or Music?
Each sound entry can have a channel parameter(music, weather, swords, etc.). If it doesn't have any, its put into the misc channel.
Title: Re: SoundSense-RS: SoundSense clone, written in Rust
Post by: jecowa on February 12, 2020, 06:50:34 am
Currently the "Swords" channel is unused outside of the sample.xml in the Default Pack. And I think that's just an example pack that's meant to be deleted.

Currently none of the stuff in the Battle Pack from the "Official Pack" uses a channel, so I moved everything from the Battle Pack on the "Swords" channel. I'm not very experienced with SoundSense, so if you have any suggestions, I'm interested.

Nice thing about sound packs on GitHub is that you can get updates without downloading the whole thing every time. https://github.com/jecowa/soundsensepack/releases
Title: Re: SoundSense-RS: SoundSense clone, written in Rust
Post by: prixt on February 12, 2020, 08:29:01 am
Nice. Added a link to your soundpack fork in the README and in SoundSense-rs.
btw, you can add other arbitrary channel names(ex. emotion, industry, ipsum) that are not in the original soundpack, and SoundSense-rs will create a new channel for it!
Title: Re: SoundSense-RS: SoundSense clone, written in Rust
Post by: Alatun on February 12, 2020, 08:43:58 am
Tested this tool for two days now (Windows 10). Works pretty well, so far.

Yesterday it suddenly stopped (program terminated) after the "season is autumn" notification. I examined my sound configuration files and found a reference to an invalid path (drive does not longer exist) Probably this caused the program termination. Will try to reproduce again today.

It would also be helpful, if the settings could also be stored in a settings file (which is expected in the program directory, or in the $HOME dir for *nix like OS). This could make it easier for tools like "PyLNP" that simply start a couple of programs (without any commandline).
Title: Re: SoundSense-RS: SoundSense clone, written in Rust
Post by: jecowa on February 12, 2020, 05:49:16 pm
Nice. Added a link to your soundpack fork in the README and in SoundSense-rs.
btw, you can add other arbitrary channel names(ex. emotion, industry, ipsum) that are not in the original soundpack, and SoundSense-rs will create a new channel for it!

Thank you, that's good to know. It looks like "music", "weather", "trade", and "swords" are all hard-coded. Since SoundSense-RS creates channels for any declared channels, is there any reason to have these hard-coded? It would be nice to move all the stuff on the "swords" channel to a "combat" channel, but then there will be an unused swords channel in the menu. Also the really basic mini sound pack that I'm include in LNPs doesn't have any music or weather (in order to keep file size down).
Title: Re: SoundSense-RS: SoundSense clone, written in Rust
Post by: prixt on February 12, 2020, 06:12:47 pm
Good point  :P. Guess I'll just set all, music, and misc as default and let soundsense-rs do the rest.
Title: Re: SoundSense-RS: SoundSense clone, written in Rust
Post by: jecowa on February 12, 2020, 11:17:39 pm
Do you have any idea what playbackThreshhold is? Here's what the wiki says about it:

Quote
playbackThreshhold - number, 0-4, defines level of filter which is applied to this sound.

I don't know what that means.
Title: Re: SoundSense-RS: SoundSense clone, written in Rust
Post by: prixt on February 12, 2020, 11:28:16 pm
Neither do I. :-\ Maybe has to do with processing the sound using filters?
Currently, soundsense-rs ignores ansiFormat, ansiPattern, and playbackThreshold parameters.

Also, I just released v1.4.0, which implements default configs.
Title: Re: SoundSense-RS: SoundSense clone, written in Rust
Post by: jecowa on February 13, 2020, 12:06:18 am
The new save settings features from 1.4.0 are working for me on Mac. The settings files are saved to `~/Library/Preferences/soundsense-rs/`.

It looks like Threshold was a feature to block certain sounds. It doesn't seem very useful since you can already control volumes of channels.

from Java SoundSense source:
      if (this.playbackTheshhold < sound.getPlaybackTheshhold()) {
         LOGGER.fine("Sound " + sound.toString() + " filtered because it's threshold is " + sound.getPlaybackTheshhold() + " while global threshold is "
               + this.playbackTheshhold + ".");
         return;
      }

public enum Threshold {

   EVERYTHING(4L, "Everything"),
   FLUFF(3L, "Messages and enviromental sounds"),
   IMPORTANT(2L, "Important messages"),
   CRITICAL(1L, "Only critical messages"),
   NOTHING(0L, "Nothing");

Title: Re: SoundSense-RS: SoundSense clone, written in Rust
Post by: jecowa on February 14, 2020, 06:47:32 pm
Zwei said when too many things are playing at once, it would prioritize playing sounds with a lower PlaybackThreshold setting. He also said "weather" and "music" channels were set to only be able to play one thing at a time.
Title: Re: SoundSense-RS: SoundSense clone, written in Rust
Post by: Abadrausar on February 15, 2020, 08:31:20 am
Zwei said when too many things are playing at once, it would prioritize playing sounds with a lower PlaybackThreshold setting. He also said "weather" and "music" channels were set to only be able to play one thing at a time.

I believe that some play sound files libraries have the concept of mixer, where some channels to play things are able to accept and mix in real time many sound flows over one unique channel, SDL preinstalled with DF has a mixer as described but i do not know the extent of its capabilities. Some mixers are able to use coefficients to mix the different sound flows in an asymmetrical way.

For example: last flow in has normal volume, but the volume of the rest of the flows already in the mix channel is decreased at each new incorporation by some threshold...

That enables the most recent events to have more sound trace than the older events but the mix process assures that the idea of many things happening simultaneously is translated to the user, The true quirk is tinkering with the coefficients until the right desirable properties are attained. 
Title: Re: SoundSense-RS: SoundSense clone, written in Rust
Post by: prixt on February 17, 2020, 03:48:40 am
Hello! I'm currently tweaking the sound channel player so I can incorporate the features mentioned above.
v1.4.4-alpha4 (https://github.com/prixt/soundsense-rs/releases/tag/v1.4.4-alpha4) is out, so if anyone could test it that would be great!
Title: Re: SoundSense-RS: SoundSense clone, written in Rust
Post by: prixt on February 17, 2020, 01:23:00 pm
Hello again. Just released v1.4.4-alpha5 (https://github.com/prixt/soundsense-rs/releases/tag/v1.4.4-alpha5), which includes a huge performance improvement!
By removing the mistake by past-me. Shame on him.
Sounds should play almost realtime now, even if there are a lot of log messages!
Title: Re: SoundSense-RS: SoundSense clone, written in Rust
Post by: prixt on February 18, 2020, 08:51:26 am
v1.4.4 (https://github.com/prixt/soundsense-rs/releases/tag/v1.4.4) is out!
Title: Re: SoundSense-RS: SoundSense clone, written in Rust
Post by: prixt on February 19, 2020, 12:35:50 am
(https://i.imgur.com/3PjhqEs.png)
Made an icon for the app. Thoughts?
Title: Re: SoundSense-RS: SoundSense clone, written in Rust
Post by: jecowa on February 19, 2020, 01:15:39 am
Some more pixels would be nice so it doesn't look blurry. My 12-inch laptop displays them as 256x256 icons, but it might be larger for people with larger displays. The icon I was using before is 1024x1024, which is the maximum allowed.

Title: Re: SoundSense-RS: SoundSense clone, written in Rust
Post by: prixt on February 19, 2020, 02:03:39 am
(https://i.imgur.com/Un8W8gJ.png)
Also, updated the experiment (https://github.com/prixt/soundsense-rs/tree/experiment) branch, which includes svg, ico, & icns files.
Title: Re: SoundSense-RS: SoundSense clone, written in Rust
Post by: jecowa on February 19, 2020, 02:27:54 am
Yeah, that looks sharp.
Title: Re: SoundSense-RS: SoundSense clone, written in Rust
Post by: prixt on February 19, 2020, 09:18:18 pm
...
Right, other dependecies :P. So far, the dependencies need are: libasound2, libgtk-3, libwebkit2gtk-4.0
There may be other dependencies hidden somewhere, but these are the libraries I had to instruct CI builders like travis and github actions to install to get it to compile.

$ dpkg -l | grep asound
ii   libasound2:amd64         1.1.9-0ubuntu1      amd64    shared library for ALSA applications
ii   libasound2:i386         1.1.9-0ubuntu1      i386    shared library for ALSA applications
ii   libasound2-data         1.1.9-0ubuntu1      all    Configuration files and profiles for ALSA drivers
ii   libasound2-plugins:amd64         1.1.9-0ubuntu1      amd64    ALSA library additional plugins
ii   libasound2-plugins:i386         1.1.9-0ubuntu1      i386    ALSA library additional plugins
Moved discussion about linux compatibility here.
Title: Re: SoundSense-RS: SoundSense clone, written in Rust
Post by: feelotraveller on February 20, 2020, 01:13:29 am
I can't get it to run on linux.  I think this is the same error jecowa had in the other thread but I'm surely out of my depth.

Full backtrace

Code: [Select]
./soundsense-rs-v1.4.4-linux
thread 'sound_thread' panicked at 'called `Result::unwrap()` on an `Err` value: Os { code: 2, kind: NotFound, message: "No such file or directory" }', src/libcore/result.rs:1188:5
stack backtrace:
   0:     0x5567aca30336 - backtrace::backtrace::libunwind::trace::heb43798aede8bd30
                               at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.40/src/backtrace/libunwind.rs:88
   1:     0x5567aca30336 - backtrace::backtrace::trace_unsynchronized::had2ba7dec4bd2732
                               at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.40/src/backtrace/mod.rs:66
   2:     0x5567aca30336 - std::sys_common::backtrace::_print_fmt::hda61f46e822731b2
                               at src/libstd/sys_common/backtrace.rs:84
   3:     0x5567aca30336 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hfe37fa5de6572965
                               at src/libstd/sys_common/backtrace.rs:61
   4:     0x5567ac9cd15c - core::fmt::write::h74887d18db27282c
                               at src/libcore/fmt/mod.rs:1025
   5:     0x5567aca2fc56 - std::io::Write::write_fmt::h6808f3d5eceed5e5
                               at src/libstd/io/mod.rs:1426
   6:     0x5567aca2f938 - std::sys_common::backtrace::_print::hcc0fd4b3552039ef
                               at src/libstd/sys_common/backtrace.rs:65
   7:     0x5567aca2f938 - std::sys_common::backtrace::print::h1c9c5c1c0505592d
                               at src/libstd/sys_common/backtrace.rs:50
   8:     0x5567aca2f938 - std::panicking::default_hook::{{closure}}::hefb6085c1ab83a59
                               at src/libstd/panicking.rs:193
   9:     0x5567aca2f2e1 - std::panicking::default_hook::h1b037d2bf0657ab3
                               at src/libstd/panicking.rs:210
  10:     0x5567aca2f2e1 - std::panicking::rust_panic_with_hook::h787d7f532b084b9a
                               at src/libstd/panicking.rs:471
  11:     0x5567aca2eead - rust_begin_unwind
                               at src/libstd/panicking.rs:375
  12:     0x5567ac9cb47d - core::panicking::panic_fmt::h76b979c035808e69
                               at src/libcore/panicking.rs:84
  13:     0x5567ac9cdba6 - core::result::unwrap_failed::hca6a012bfa3eb903
                               at src/libcore/result.rs:1188
  14:     0x5567ac99579c - core::result::Result<T,E>::unwrap::h26c7f1f119097740
  15:     0x5567ac9aeb57 - soundsense_rs::sound::sound_manager::SoundManager::new::{{closure}}::hf34f98142644c281
  16:     0x5567ac9af7ac - soundsense_rs::sound::sound_manager::SoundManager::new::visit_dir::hcd7efecf9ac2fe5b
  17:     0x5567ac9af723 - soundsense_rs::sound::sound_manager::SoundManager::new::visit_dir::hcd7efecf9ac2fe5b
  18:     0x5567ac9b4cf4 - soundsense_rs::sound::run::{{closure}}::h89aecbd80bb9d859
  19:     0x5567ac98db8a - std::sys_common::backtrace::__rust_begin_short_backtrace::h3c80febc8ed33890
  20:     0x5567ac990613 - core::ops::function::FnOnce::call_once{{vtable.shim}}::h6367b8115e412243
  21:     0x5567aca3cbde - <alloc::boxed::Box<F> as core::ops::function::FnOnce<A>>::call_once::h7bfd6e98bcf6c67e
                               at /rustc/5e1a799842ba6ed4a57e91f7ab9435947482f7d8/src/liballoc/boxed.rs:1022
  22:     0x5567aca3e138 - <alloc::boxed::Box<F> as core::ops::function::FnOnce<A>>::call_once::h9979661149bbc525
                               at /rustc/5e1a799842ba6ed4a57e91f7ab9435947482f7d8/src/liballoc/boxed.rs:1022
  23:     0x5567aca3e138 - std::sys_common::thread::start_thread::had0bb4166c065276
                               at src/libstd/sys_common/thread.rs:13
  24:     0x5567aca3e138 - std::sys::unix::thread::Thread::new::thread_start::hbc75223688f972da
                               at src/libstd/sys/unix/thread.rs:80
  25:     0x7ff3e7ab946f - start_thread
  26:     0x7ff3e79cf3d3 - clone
  27:                0x0 - <unknown>
Aborted (core dumped)

Does that help at all?
Title: Re: SoundSense-RS: SoundSense clone, written in Rust
Post by: prixt on February 20, 2020, 02:15:16 am
I can't get it to run on linux.  I think this is the same error jecowa had in the other thread but I'm surely out of my depth.

Full backtrace

Code: [Select]
./soundsense-rs-v1.4.4-linux
thread 'sound_thread' panicked at 'called `Result::unwrap()` on an `Err` value: Os { code: 2, kind: NotFound, message: "No such file or directory" }', src/libcore/result.rs:1188:5
stack backtrace:
   0:     0x5567aca30336 - backtrace::backtrace::libunwind::trace::heb43798aede8bd30
                               at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.40/src/backtrace/libunwind.rs:88
   1:     0x5567aca30336 - backtrace::backtrace::trace_unsynchronized::had2ba7dec4bd2732
                               at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.40/src/backtrace/mod.rs:66
   2:     0x5567aca30336 - std::sys_common::backtrace::_print_fmt::hda61f46e822731b2
                               at src/libstd/sys_common/backtrace.rs:84
   3:     0x5567aca30336 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hfe37fa5de6572965
                               at src/libstd/sys_common/backtrace.rs:61
   4:     0x5567ac9cd15c - core::fmt::write::h74887d18db27282c
                               at src/libcore/fmt/mod.rs:1025
   5:     0x5567aca2fc56 - std::io::Write::write_fmt::h6808f3d5eceed5e5
                               at src/libstd/io/mod.rs:1426
   6:     0x5567aca2f938 - std::sys_common::backtrace::_print::hcc0fd4b3552039ef
                               at src/libstd/sys_common/backtrace.rs:65
   7:     0x5567aca2f938 - std::sys_common::backtrace::print::h1c9c5c1c0505592d
                               at src/libstd/sys_common/backtrace.rs:50
   8:     0x5567aca2f938 - std::panicking::default_hook::{{closure}}::hefb6085c1ab83a59
                               at src/libstd/panicking.rs:193
   9:     0x5567aca2f2e1 - std::panicking::default_hook::h1b037d2bf0657ab3
                               at src/libstd/panicking.rs:210
  10:     0x5567aca2f2e1 - std::panicking::rust_panic_with_hook::h787d7f532b084b9a
                               at src/libstd/panicking.rs:471
  11:     0x5567aca2eead - rust_begin_unwind
                               at src/libstd/panicking.rs:375
  12:     0x5567ac9cb47d - core::panicking::panic_fmt::h76b979c035808e69
                               at src/libcore/panicking.rs:84
  13:     0x5567ac9cdba6 - core::result::unwrap_failed::hca6a012bfa3eb903
                               at src/libcore/result.rs:1188
  14:     0x5567ac99579c - core::result::Result<T,E>::unwrap::h26c7f1f119097740
  15:     0x5567ac9aeb57 - soundsense_rs::sound::sound_manager::SoundManager::new::{{closure}}::hf34f98142644c281
  16:     0x5567ac9af7ac - soundsense_rs::sound::sound_manager::SoundManager::new::visit_dir::hcd7efecf9ac2fe5b
  17:     0x5567ac9af723 - soundsense_rs::sound::sound_manager::SoundManager::new::visit_dir::hcd7efecf9ac2fe5b
  18:     0x5567ac9b4cf4 - soundsense_rs::sound::run::{{closure}}::h89aecbd80bb9d859
  19:     0x5567ac98db8a - std::sys_common::backtrace::__rust_begin_short_backtrace::h3c80febc8ed33890
  20:     0x5567ac990613 - core::ops::function::FnOnce::call_once{{vtable.shim}}::h6367b8115e412243
  21:     0x5567aca3cbde - <alloc::boxed::Box<F> as core::ops::function::FnOnce<A>>::call_once::h7bfd6e98bcf6c67e
                               at /rustc/5e1a799842ba6ed4a57e91f7ab9435947482f7d8/src/liballoc/boxed.rs:1022
  22:     0x5567aca3e138 - <alloc::boxed::Box<F> as core::ops::function::FnOnce<A>>::call_once::h9979661149bbc525
                               at /rustc/5e1a799842ba6ed4a57e91f7ab9435947482f7d8/src/liballoc/boxed.rs:1022
  23:     0x5567aca3e138 - std::sys_common::thread::start_thread::had0bb4166c065276
                               at src/libstd/sys_common/thread.rs:13
  24:     0x5567aca3e138 - std::sys::unix::thread::Thread::new::thread_start::hbc75223688f972da
                               at src/libstd/sys/unix/thread.rs:80
  25:     0x7ff3e7ab946f - start_thread
  26:     0x7ff3e79cf3d3 - clone
  27:                0x0 - <unknown>
Aborted (core dumped)

Does that help at all?

Got this error after I ran soundsense-rs on an ubuntu VM.
For some reason, the `emotion/emotion.xml` can't be read. If you remove the file or delete its contents soundsense-rs loads the pack no problem, but if you rename the file, or copy its content into another file, it fails. This is the case for both the original pack and jecowa's pack.
I have no idea why. This doesn't happen on Windows. I'm still looking into it.

However, don't think this and jecowa's error is the same. Their error is related to dependecy issue. This is... something else.
Title: Re: SoundSense-RS: SoundSense clone, written in Rust
Post by: prixt on February 20, 2020, 03:39:57 am
Found it! In emotion.xml, the playlist for bold voice lines is `voices/Bold.m3u`, but the actual file name is `voice/bold.m3u`.
On Windows, it ignored the case, but on Linux it borked. You should be able to fix this by editing emotion.xml accordingly.

...
Right, other dependecies :P. So far, the dependencies need are: libasound2, libgtk-3, libwebkit2gtk-4.0
There may be other dependencies hidden somewhere, but these are the libraries I had to instruct CI builders like travis and github actions to install to get it to compile.

$ dpkg -l | grep asound
ii   libasound2:amd64         1.1.9-0ubuntu1      amd64    shared library for ALSA applications
ii   libasound2:i386         1.1.9-0ubuntu1      i386    shared library for ALSA applications
ii   libasound2-data         1.1.9-0ubuntu1      all    Configuration files and profiles for ALSA drivers
ii   libasound2-plugins:amd64         1.1.9-0ubuntu1      amd64    ALSA library additional plugins
ii   libasound2-plugins:i386         1.1.9-0ubuntu1      i386    ALSA library additional plugins

I'm trying to find all the dependencies soundsense-rs needs. Give me some time.
Title: Re: SoundSense-RS: SoundSense clone, written in Rust
Post by: feelotraveller on February 20, 2020, 04:24:37 am
Found it! In emotion.xml, the playlist for bold voice lines is `voices/Bold.m3u`, but the actual file name is `voice/bold.m3u`.
On Windows, it ignored the case, but on Linux it borked. You should be able to fix this by editing emotion.xml accordingly.

Thanks, this fixed it for me.  :)  So actually a soundpack issue...

Can't help with the dependencies since it ran for me without needing anything additional on my archlinux setup - but I already have a lot installed for other applications.

As a data point here is my ldd:

Spoiler (click to show/hide)

The names of some libraries are slightly different (e.g. libasound).

Edit: running 'objdump -p /path/to/app | grep NEEDED' gives a more concise list

Code: [Select]
  NEEDED               libwebkit2gtk-4.0.so.37
  NEEDED               libgtk-3.so.0
  NEEDED               libgdk-3.so.0
  NEEDED               libjavascriptcoregtk-4.0.so.18
  NEEDED               libgobject-2.0.so.0
  NEEDED               libglib-2.0.so.0
  NEEDED               libasound.so.2
  NEEDED               libdl.so.2
  NEEDED               librt.so.1
  NEEDED               libpthread.so.0
  NEEDED               libgcc_s.so.1
  NEEDED               libc.so.6
  NEEDED               libm.so.6


Title: Re: SoundSense-RS: SoundSense clone, written in Rust
Post by: prixt on February 20, 2020, 08:11:51 am
Found it! In emotion.xml, the playlist for bold voice lines is `voices/Bold.m3u`, but the actual file name is `voice/bold.m3u`.
On Windows, it ignored the case, but on Linux it borked. You should be able to fix this by editing emotion.xml accordingly.

Thanks, this fixed it for me.  :)  So actually a soundpack issue...

Can't help with the dependencies since it ran for me without needing anything additional on my archlinux setup - but I already have a lot installed for other applications.

As a data point here is my ldd:

Spoiler (click to show/hide)

The names of some libraries are slightly different (e.g. libasound).

Edit: running 'objdump -p /path/to/app | grep NEEDED' gives a more concise list

Code: [Select]
  NEEDED               libwebkit2gtk-4.0.so.37
  NEEDED               libgtk-3.so.0
  NEEDED               libgdk-3.so.0
  NEEDED               libjavascriptcoregtk-4.0.so.18
  NEEDED               libgobject-2.0.so.0
  NEEDED               libglib-2.0.so.0
  NEEDED               libasound.so.2
  NEEDED               libdl.so.2
  NEEDED               librt.so.1
  NEEDED               libpthread.so.0
  NEEDED               libgcc_s.so.1
  NEEDED               libc.so.6
  NEEDED               libm.so.6

wow those are some useful commands I didn't know about. Thank you!
Title: Re: SoundSense-RS: SoundSense clone, written in Rust
Post by: PeridexisErrant on February 20, 2020, 08:35:15 am
Nice!  I'll add this to my pack in a future version  :D
Title: Re: SoundSense-RS: SoundSense clone, written in Rust
Post by: prixt on February 20, 2020, 09:04:07 am
Woot! Thank you for the inclusion!
Title: Re: SoundSense-RS: SoundSense clone, written in Rust
Post by: jecowa on February 20, 2020, 09:24:16 am
Found it! In emotion.xml, the playlist for bold voice lines is `voices/Bold.m3u`, but the actual file name is `voice/bold.m3u`.
On Windows, it ignored the case, but on Linux it borked. You should be able to fix this by editing emotion.xml accordingly.

Thanks for the report! Macs ignore case by-default too. I used to run it in case-sensitive mode, but it caused problems with some apps.
Title: Re: SoundSense-RS: SoundSense clone, written in Rust
Post by: feelotraveller on February 21, 2020, 06:33:00 am
I'm trying to find all the dependencies soundsense-rs needs. Give me some time.

I think you have already more or less stated them correctly.  My reasoning follows, someone can feel free to point out my mistake if I've made one  :).

The concise list I posted above contains the libraries that the soundsense-rs executable (linux 144 version) calls directly.  Working through them on my system (archlinux) gives me:

  libm, libc, libpthread, librt and libdl are provided by glibc
  libcc_s is provided by gcc-libs
  libglib-2 and libgobject-2.0 are provided by glib2

These can be be taken for granted as being present on (nearly?) all linux systems - a problem here, though rare, is likely one of version compatibility.

  libasound2 is provided by alsa-libs
  libjavascriptcregtk-4.0 and libwebkit2gtk-4.0 are provided by webkit2gtk
  libgdk-3 and libgtk-3 are provided by gtk3

Though it should be noted that these libraries could be provided by different packages (or differently named packages) on other distributions, for an arch system - and I think also debian-based systems - the dependent packages are alsa-libs, webkit2gtk and gtk3.  And that is pretty much what the intial post says.  8)



Title: Re: SoundSense-RS: SoundSense clone, written in Rust
Post by: prixt on February 21, 2020, 07:42:45 am
I think you have already more or less stated them correctly.  My reasoning follows, someone can feel free to point out my mistake if I've made one  :).

The concise list I posted above contains the libraries that the soundsense-rs executable (linux 144 version) calls directly.  Working through them on my system (archlinux) gives me:

  libm, libc, libpthread, librt and libdl are provided by glibc
  libcc_s is provided by gcc-libs
  libglib-2 and libgobject-2.0 are provided by glib2

These can be be taken for granted as being present on (nearly?) all linux systems - a problem here, though rare, is likely one of version compatibility.

  libasound2 is provided by alsa-libs
  libjavascriptcregtk-4.0 and libwebkit2gtk-4.0 are provided by webkit2gtk
  libgdk-3 and libgtk-3 are provided by gtk3

Though it should be noted that these libraries could be provided by different packages (or differently named packages) on other distributions, for an arch system - and I think also debian-based systems - the dependent packages are alsa-libs, webkit2gtk and gtk3.  And that is pretty much what the intial post says.  8)

Thank you for the concise list and reasonings! Just to be sure, I updated the dependency list to include libgdk-3 and libjavascriptcregtk-4.0.
Title: Re: SoundSense-RS: SoundSense clone, written in Rust
Post by: Nopenope on February 21, 2020, 07:58:13 am
I'm interested to try this instead of the traditional soundsense. Does it support the extra gamelog events from DFHack?
Title: Re: SoundSense-RS: SoundSense clone, written in Rust
Post by: prixt on February 21, 2020, 08:01:04 am
I'm interested to try this instead of the traditional soundsense. Does it support the extra gamelog events from DFHack?
As long as the soundpack you're using includes dfhack patterns, sure! I've been using it with the Windows Starter Pack, and it works with no problems.
Title: Re: SoundSense-RS: SoundSense clone, written in Rust
Post by: thurin on February 27, 2020, 12:46:23 am
I'm having an issue on both windows and macos where soundsense-rs is grabbing 100% of a cpu core.  Is this unique to me or is anyone else also experiencing?

Any info I can provide to try and track the issue down?
Title: Re: SoundSense-RS: SoundSense clone, written in Rust
Post by: prixt on February 27, 2020, 12:53:36 am
What version of Windows/MacOS are you using? What are your machine's specs?
How did you profile the cpu usage? Does it use the cpu at 100% all the time, or some of the time?
How are you opening DF? Which version of the soundpack are you using? Could you upload the gamelog.txt somewhere?
If possible, could you open an issue on the github repository?
Title: Re: SoundSense-RS: SoundSense clone, written in Rust
Post by: thurin on February 27, 2020, 01:11:35 am
What version of Windows/MacOS are you using? Does it use the cpu at 100% all the time, or some of the time?
How are you opening DF? Which version of the soundpack are you using?
If possible, could you open an issue on the github repository?

MacOS is Catalina 10.15.3.  I've tried with both the 1.4.5 that's included in the Lazy Mac Pack alpha and downloaded 1.4.6 from github.  I've also cloned it from github and run it via cargo.  It hits 100% as soon as it fires up and is constant.  It works, at least until the fans kick in and drown out the sound.  I've tried both opening DF from the LNP and running ./dfhack from terminal and starting soundsense-rs from LNP and from terminal as well.

Windows 10.  I'm not at that system so can't get specifics on version but see the same constant 100%
Title: Re: SoundSense-RS: SoundSense clone, written in Rust
Post by: prixt on February 27, 2020, 01:59:28 am
Just released v1.4.7 (https://github.com/prixt/soundsense-rs/releases/tag/v1.4.7)
This should reduce CPU usage. Guess running two loops in parallel constantly does that :P
Thank you for bringing this issue up!
Title: Re: SoundSense-RS: SoundSense clone, written in Rust
Post by: thurin on February 27, 2020, 02:06:53 am
Just released v1.4.7 (https://github.com/prixt/soundsense-rs/releases/tag/v1.4.7)
This should reduce CPU usage. Guess running two loops in parallel constantly does that :P
Thank you for bringing this issue up!

I grabbed the commit and it's tons better!  Thanks!
Title: Re: SoundSense-RS: SoundSense clone, written in Rust
Post by: jecowa on February 27, 2020, 05:10:50 am
Probably doesn't matter any more, but the high CPU usage started with v1.4.4 release. (1.4.4 alpha 5 was normal CPU usage.)
Title: Re: SoundSense-RS: SoundSense clone, written in Rust
Post by: prixt on February 27, 2020, 08:04:50 am
Yeah, that makes sense. Previously I've been using a crate(library) to monitor whether the gamelog was altered, which created a bottleneck.
I've replaced it with a simple buffered reader. This made things faster, but apparently made the sound loop run constantly without break...
Title: Re: SoundSense-RS: SoundSense clone, written in Rust
Post by: Alatun on February 27, 2020, 02:40:29 pm
SoundSense RS is working pretty well for me so far. Maybe an idea for improvement:

What I noticed: each time a save it being loaded the same music file gets played. Because I'm saving at the beginning of each season (and loading this save immediately), this means I don't ever hear the sounds associated with each season. It also get a bit annoying to always hear the same sounds.

Perhaps an idea for getting some variation into playing sounds. I don't know how SoundSense works internally. So I'm just guessing: Each time SoundSense starts it collects information from the XML files and depending on certain events written to the game log a sound is chosen and being played. Probably there are sounds associated with "short events" (an animal gets butchered, poults are hatching, ...) and "longer events" (season spring has started) these sounds may be played simultaneously.

Perhaps it would be possible to track, which of the files for "longer events" have been played during this session and choosing a sound that has not been played (or has been played less often) during the current session. With "session" I mean the time SoundSense is running. Maybe it's also possibly to detect if a sound for a "longer event" got interrupted and this file can be resumed (happens when saving and loading this save).

Title: Re: SoundSense-RS: SoundSense clone, written in Rust
Post by: jecowa on February 27, 2020, 03:34:58 pm
As a workaround, you could write a shell script for each season that writes the season change message to your gamelog.txt. After saving the game, reload the save, pause it (if it isn't already), and run the script for the appropriate season to start the music.
Title: Re: SoundSense-RS: SoundSense clone, written in Rust
Post by: prixt on February 27, 2020, 05:30:32 pm
I think DFHack already does that; on load, it checks the latest season and weather and writes it into the game log, so SoundSense plays seasonal music.

I'll see what I can do when playing 'vanilla' DF.
Title: Re: SoundSense-RS: SoundSense clone, written in Rust
Post by: Alatun on February 28, 2020, 06:13:21 am
Thanks for taking a look. I'm using dfhack already. Do you need to configure something in dfhack to enable the mentioned feature? Or should it work "out of the box"? I just copied the alpha of dfhack into the DF directory and renamed the example config file and I'm experiencing the behavior noted above.

Title: Re: SoundSense-RS: SoundSense clone, written in Rust
Post by: Nopenope on February 28, 2020, 09:22:28 am
A lot of the "new" gamelog announcements don't have sound effects at all ("new" is used loosely, since there haven't been any additions since 2016). This includes modified announcements, like completed strange moods where the dwarf "claims it as a family heirloom" and such. What are some good sources of CC/public domain sound effects to add? It would be nice to put together an updated soundpack for the current game.
Title: Re: SoundSense-RS: SoundSense clone, written in Rust
Post by: prixt on February 28, 2020, 09:45:39 am
I'm currently using PerdaxisErrant's Starter Pack preview. Think previous versions of the Starter Pack also had this functionality.
Not sure about non-Windows Starter Packs.
And I'll still look into handling this in vanilla DF. I believe the SoundCense(C#) had this function...
Title: Re: SoundSense-RS: SoundSense clone, written in Rust
Post by: Alatun on February 28, 2020, 02:16:45 pm
I think DFHack already does that; on load, it checks the latest season and weather and writes it into the game log, so SoundSense plays seasonal music.

I'll see what I can do when playing 'vanilla' DF.

I think I found what you were talking of: http://expwnent.github.io/dfhack/docs/Scripts.html#soundsense-season

But it seems this script is missing:
Quote
[DFHack]# soundsense-season
soundsense-season is not a recognized command.

I also checked my old installation (0.44.12) which is based on the LNP pack. It's the same there. Probably the documentation on the website is outdated or the script was destroyed by some mighty creature ;-)
Title: Re: SoundSense-RS: SoundSense clone, written in Rust
Post by: thurin on February 28, 2020, 02:43:14 pm
Writing season to log on save load (and other things) is now handled by the modtools/extra-gamelog script and is enabled by default in the dfhack.init-example

# write extra information to the gamelog
modtools/extra-gamelog enable
Title: Re: SoundSense-RS: SoundSense clone, written in Rust
Post by: thurin on February 28, 2020, 03:42:28 pm
And I guess I should confirm that this is working in soundsense-rs with the dfhack script enabled.  Saved a game when it was in rain.  Loaded the save file.  Season and Rain get written to the gamelog and rain sound is playing.
Title: Re: SoundSense-RS: SoundSense clone, written in Rust
Post by: Alatun 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
Title: Re: SoundSense-RS: SoundSense clone, written in Rust
Post by: prixt 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 (https://github.com/prixt/soundsense-rs/releases/tag/v1.4.7)
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.
Title: Re: SoundSense-RS: SoundSense clone, written in Rust
Post by: Alatun 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.
Title: Re: SoundSense-RS: SoundSense clone, written in Rust
Post by: prixt 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`.
Title: Re: SoundSense-RS: SoundSense clone, written in Rust
Post by: Alatun 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.
Title: Re: SoundSense-RS: SoundSense clone, written in Rust
Post by: jecowa 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:
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.
Title: Re: SoundSense-RS: SoundSense clone, written in Rust
Post by: prixt 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.
Title: Re: SoundSense-RS: SoundSense clone, written in Rust
Post by: Alatun 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
Title: Re: SoundSense-RS: SoundSense clone, written in Rust
Post by: prixt 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?
Title: Re: SoundSense-RS: SoundSense clone, written in Rust
Post by: Alatun 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.
Title: Re: SoundSense-RS: SoundSense clone, written in Rust
Post by: prixt on March 05, 2020, 09:02:09 am
Hi! Just pre-released v1.5.0 (https://github.com/prixt/soundsense-rs/releases/tag/v1.5.0)!
Try it out if you're interested, and if there are no big problems, I'll set it as released!
Title: Re: SoundSense-RS: SoundSense clone, written in Rust
Post by: thurin on March 05, 2020, 10:43:31 am
Working for me on mac.  pause and skip are a nice touch.
Title: Re: SoundSense-RS: SoundSense clone, written in Rust
Post by: Alatun 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!
Title: Re: SoundSense-RS: SoundSense clone, written in Rust
Post by: prixt 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.
Title: Re: SoundSense-RS: SoundSense clone, written in Rust
Post by: jecowa 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.
Title: Re: SoundSense-RS: SoundSense clone, written in Rust
Post by: prixt on March 05, 2020, 07:25:06 pm
Fixed threshold not working properly, and "all" not being a valid channelSetting.playType with v1.5.1 (https://github.com/prixt/soundsense-rs/releases/tag/v1.5.1).

Thank you for the report, and for the screenshot jecowa. Don't think I can fix the load button being highlighted. That is a html/css rendering issues/quirk, and I'm not touching that.
Title: Re: SoundSense-RS: SoundSense clone, written in Rust
Post by: jecowa on March 05, 2020, 08:16:32 pm
Thank you. v1.5.1 fixs combat sounds.

The "skip" button works as-expected, but the Play/Pause button acts more like a mute than a pause button. Maybe the mute emoji (https://emojipedia.org/muted-speaker/) would make it more clear?

If you could make the "music" channel not be hard-coded, that would be kind of cool. My tiny sound pack for including with noob packs doesn't really include any music, so if possible it would be nice if it didn't show up unless there was a music channel in the sound pack.

Oh, I just noticed there's pop-up menus to change the thresholds of each channel if you mouse over the channel names.
Title: Re: SoundSense-RS: SoundSense clone, written in Rust
Post by: prixt on March 05, 2020, 08:32:40 pm
Well, the play/pause button pauses the looping sounds, and sliences one-shot sounds from playing, so small sound effects will start and end. When you play, the loop will resume where it paused.
But maybe that isn't clear, and users will use it as a mute button? idk

The music channel is added so it doesn't get reordered alphabetically after other channels. I thought this isn't a big issue, but I'll change it.
[EDIT: Updated v1.5.1 binaries. Music channel is now optional.]
Title: Re: SoundSense-RS: SoundSense clone, written in Rust
Post by: jecowa on March 09, 2020, 07:10:29 pm
Thank you for making the music channel optional!

A new bug report: Ever since v1.3.5, SoundSense-RS hasn't worked in macOS 10.13 High Sierra. (It crashes when it tries to play a sound.)
Spoiler: GitHub Actions (click to show/hide)

Maybe changing some settings in GitHub workflow can make it work on High Sierra?

Here's the error report:
SoundSense-RS never starts.  If I start it manually, it doesn't do anything except crash if I try to load a soundpack.  The only thing I seem to be able to do "successfully" is load the gamelog.txt file if I do that manually.

Last login: Mon Mar  9 18:56:14 on ttys003
Urist:~ Kogan$ /Applications/Lazy\ Mac\ Pack\ v0.47.04\ dfhack-a1/LNP/Utilities/SoundSense-RS/SoundSense-RS ; exit;
objc[27393]: Class FIFinderSyncExtensionHost is implemented in both /System/Library/PrivateFrameworks/FinderKit.framework/Versions/A/FinderKit (0x7fff8b151cd0) and /System/Library/PrivateFrameworks/FileProvider.framework/OverrideBundles/FinderSyncCollaborationFileProviderOverride.bundle/Contents/MacOS/FinderSyncCollaborationFileProviderOverride (0x112b99cd8). One of the two will be used. Which one is undefined.
thread 'sound_thread' panicked at 'No device name: BackendSpecific { err: BackendSpecificError { description: "core foundation unexpectedly returned null string" } }', src/libcore/result.rs:1188:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
Abort trap: 6
logout
Saving session...
...copying shared history...
...saving history...truncating history files...
...completed.

[Process completed]
MacOS version is 10.13.6 (which is terminal for this hardware).

Thank you!
Title: Re: SoundSense-RS: SoundSense clone, written in Rust
Post by: Nilsolm on March 12, 2020, 11:52:18 am
I've noticed a typo in the GitHub readme under Dependencies. The package name is libjavascriptcoregtk-4.0
Title: Re: SoundSense-RS: SoundSense clone, written in Rust
Post by: prixt on March 13, 2020, 12:52:31 am
Noted, just fixed the typo. Thanks for letting me know.
Title: Re: SoundSense-RS: SoundSense clone, written in Rust
Post by: manboricua on April 08, 2020, 10:18:24 pm
Hi guys. Need to know how do I run the Linux version. I have the files downloaded but no idea were to place them. I did got the dependencies pointed on the main page but that's about all I know. Any help is appreciated.
Title: Re: SoundSense-RS: SoundSense clone, written in Rust
Post by: prixt on April 08, 2020, 10:45:50 pm
Hi guys. Need to know how do I run the Linux version. I have the files downloaded but no idea were to place them. I did got the dependencies pointed on the main page but that's about all I know. Any help is appreciated.
The linux version is a single executable binary. You can execute it from the terminal (.\soundsense-rs), similar to how you execute DF in linux.
The position of the binary shouldn't matter, as you will be able to select the necessary files/directories from within the UI, then save the file directories Soundsense-rs will use. It will look for some files (gamelog.txt, soundpack folder, ignore.txt) in the current working directory if none are set.
Title: Re: SoundSense-RS: SoundSense clone, written in Rust
Post by: manboricua on April 08, 2020, 11:08:53 pm
Spoiler (click to show/hide)
Yay! Got it running. Great, awesome reply. It's midnight here, gotta see if I can play a quick fort with sound at last! I really do appreciate it thanks.
Title: Re: SoundSense-RS: SoundSense clone, written in Rust
Post by: SuperPluck on June 24, 2020, 03:54:38 am
Hey. Is there a way to force music to start?

I normally load Soundsense only after the fortress has been loaded
Title: Re: SoundSense-RS: SoundSense clone, written in Rust
Post by: prixt on June 27, 2020, 07:40:01 am
Hey. Is there a way to force music to start?

I normally load Soundsense only after the fortress has been loaded
Currently, no. Maybe in later versions, soundsense-rs could retroactively read the logs, but sadly not now.
Title: Re: SoundSense-RS: SoundSense clone, written in Rust
Post by: Iklistkel on December 10, 2020, 01:07:33 pm
well, hi everyone ...

i already used this cool software on windows 7 sometime ago.
He cames witha a syntax error: just a ' ; ' missing somewhere, but worked anyway.
Now, i came back to play DF in linux (ubuntu/xubuntu) using the soundsense-rs, but he return the error:

ERROR] SoundThreadError:
    Os { code: 2, kind: NotFound, message: "No such file or directory" }


i don't know what to do. I read this was some problem related with directories but...
Title: Re: SoundSense-RS: SoundSense clone, written in Rust
Post by: Iklistkel on December 10, 2020, 01:11:16 pm
well, hi everyone ...

i already used this cool software on windows 7 sometime ago.
He cames witha a syntax error: just a ' ; ' missing somewhere, but worked anyway.
Now, i came back to play DF in linux (ubuntu/xubuntu) using the soundsense-rs, but he return the error:

ERROR] SoundThreadError:
    Os { code: 2, kind: NotFound, message: "No such file or directory" }


i don't know what to do. I read this was some problem related with directories but...

aaaaaaaannnd... because of this error the soundpack does not load.
Title: Re: SoundSense-RS: SoundSense clone, written in Rust
Post by: Iklistkel on December 10, 2020, 04:53:11 pm
well, hi everyone ...

i already used this cool software on windows 7 sometime ago.
He cames witha a syntax error: just a ' ; ' missing somewhere, but worked anyway.
Now, i came back to play DF in linux (ubuntu/xubuntu) using the soundsense-rs, but he return the error:

ERROR] SoundThreadError:
    Os { code: 2, kind: NotFound, message: "No such file or directory" }


i don't know what to do. I read this was some problem related with directories but...

aaaaaaaannnd... because of this error the soundpack does not load.

ok, i just used the unofficial soundpack of jecowa and has worked...
.. satrange. On windows 7 i've used the official soundpack.
Title: Re: SoundSense-RS: SoundSense clone, written in Rust
Post by: prixt on December 17, 2020, 06:43:35 am
This is probably because on linux file paths are case sensitive, while on Windows its not.
jecowa's soundpack fixed a typo, so it works.

Which version are you using? I thought this kind of error would only raise a warning and not a full error.
Title: Re: SoundSense-RS: SoundSense clone, written in Rust
Post by: ldog on January 28, 2021, 08:21:42 pm
So I've got a couple issues. It works sometimes. I can't find any logs or config files. I know there is a config stored somewhere, because my volume settings are saved.
Ignore file format is my other, if I can't filter out sparring then any sound program for DF is useless to me, because it is like the "boy who cried wolf" and I just start ignoring the combat sounds.
By year 2 there is never not sparring happening at any given time.
Title: Re: SoundSense-RS: SoundSense clone, written in Rust
Post by: jecowa on March 13, 2021, 06:47:38 pm
Config files on Windows are located at \Users\username\AppData\Roaming\soundsense-rs\

But if you want to disable sparing sounds, and you're using my miniSoundPack, open the \battle\battle.xml file in Notepad++ (or BBEdit for Mac users), and delete everything from:
Code: [Select]
    <!--
        Sparring Sounds Begin
    -->
to
Code: [Select]
    <!--
        Sparring Sounds End
    -->

Linux users can use vi or whatever.
Title: Re: SoundSense-RS: SoundSense clone, written in Rust
Post by: Mr Crabman on May 04, 2021, 03:22:37 pm
I'm having an issue with this on Ubuntu (in LinuxDwarfPack); it spawns a process called "WebKitWebProcess 7 16", which uses absurd amounts of CPU (like 60-70%, even if the game isn't running, and I have 6 cores).
Title: Re: SoundSense-RS: SoundSense clone, written in Rust
Post by: ArmokGoB on October 27, 2021, 11:17:01 am
There's an issue where the total volume isn't saved when you relaunch the application. Someone on GitHub fixed it (https://github.com/prixt/soundsense-rs/pull/13), but I don't know if this is still being maintained.