<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://dwarffortresswiki.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Vyznev</id>
	<title>Dwarf Fortress Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://dwarffortresswiki.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Vyznev"/>
	<link rel="alternate" type="text/html" href="https://dwarffortresswiki.org/index.php/Special:Contributions/Vyznev"/>
	<updated>2026-06-23T17:40:07Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.35.11</generator>
	<entry>
		<id>https://dwarffortresswiki.org/index.php?title=v0.31:Aquifer&amp;diff=153164</id>
		<title>v0.31:Aquifer</title>
		<link rel="alternate" type="text/html" href="https://dwarffortresswiki.org/index.php?title=v0.31:Aquifer&amp;diff=153164"/>
		<updated>2011-09-20T16:10:11Z</updated>

		<summary type="html">&lt;p&gt;Vyznev: /* The modding method */ that regexp would hose your raws completely -- add backslashes to fix it, plus some general improvements&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{quality|Masterwork|15:52, 30 September 2010 (UTC)}}{{av}}&lt;br /&gt;
An '''aquifer''' is a subterranean layer of {{l|water|groundwater}}-bearing rock or {{l|soil}}. Attempts to mine through the layer will result in the mined-out squares immediately filling with {{l|water}}, effectively halting excavation at or below their level. This, in conjunction with the fact that they are often located in areas rich in {{l|loam}}, and {{l|sand}}, makes it difficult to find great quantities of {{l|stone}} in areas with aquifers, making for more challenging gameplay.&lt;br /&gt;
&lt;br /&gt;
Aquifers can't be drained - the groundwater is limitless. {{l|stone detailing|Smoothed}} aquifer stone stops producing water. Aquifers located in {{l|water#Salt_Water|saltwater}} areas will produce salty water. Aquifers do not only produce water - if the incoming water is pressurized, an aquifer tile may instead absorb it. Just like with water production, this ability will not be disabled no matter how much water it absorbs. &lt;br /&gt;
&lt;br /&gt;
== Where they are found ==&lt;br /&gt;
&lt;br /&gt;
Aquifers are less likely to be found near and in mountains.{{verify}}&lt;br /&gt;
&lt;br /&gt;
Layers which CAN contain aquifers:&lt;br /&gt;
*{{L|sandy clay loam}}&lt;br /&gt;
*{{L|silty clay loam}}&lt;br /&gt;
*{{L|loam}}&lt;br /&gt;
*{{L|sandy loam}}&lt;br /&gt;
*{{L|silt loam}}&lt;br /&gt;
*{{L|loamy sand}}&lt;br /&gt;
*{{L|silt}}&lt;br /&gt;
*{{L|sand (tan)|sand}}&lt;br /&gt;
*{{L|yellow sand}}&lt;br /&gt;
*{{L|white sand}}&lt;br /&gt;
*{{L|black sand}}&lt;br /&gt;
*{{L|red sand}}&lt;br /&gt;
*{{L|peat}}&lt;br /&gt;
*{{L|pelagic clay}}&lt;br /&gt;
*{{L|calcareous ooze}}&lt;br /&gt;
*{{L|siliceous ooze}}&lt;br /&gt;
*{{L|sandstone}}&lt;br /&gt;
*{{L|conglomerate}}&lt;br /&gt;
*{{L|puddingstone}}&lt;br /&gt;
Layers which CAN'T contain aquifers, despite their names suggesting otherwise:&lt;br /&gt;
*{{L|clay}}&lt;br /&gt;
*{{L|silty clay}}&lt;br /&gt;
*{{L|sandy clay}}&lt;br /&gt;
*{{L|clay loam}}&lt;br /&gt;
*{{L|siltstone}}&lt;br /&gt;
*{{L|mudstone}}&lt;br /&gt;
&lt;br /&gt;
== What they do ==&lt;br /&gt;
&lt;br /&gt;
Aquifers are tiles which produce water in their ''neighboring'' tiles -- north, south, east, west, and below.  They do not produce water in diagonally adjacent tiles, or in the tile above them.&lt;br /&gt;
&lt;br /&gt;
If you are digging an up/down staircase in the downward direction, and you hit an aquifer, the aquifer tile will be revealed as damp soil or stone, and the digging job will be un-designated for that tile.&lt;br /&gt;
&lt;br /&gt;
If you are digging an up/down staircase in the ''upward'' direction, and you hit an aquifer from below, the aquifer tile will immediately start producing water in the stairwell.&lt;br /&gt;
&lt;br /&gt;
== Dealing with aquifers ==&lt;br /&gt;
&lt;br /&gt;
===Digging at a change in level===&lt;br /&gt;
&lt;br /&gt;
Though an aquifer seems a daunting obstacle, it ''is'' possible to dig through it, given an ample supply of building material (rock or wood) and any unevenness in the depth of the aquifer.  The basic facts:&lt;br /&gt;
&lt;br /&gt;
* An aquifer layer will ''absorb'' an unlimited amount of water draining in from above.&lt;br /&gt;
&lt;br /&gt;
* With an up/down stairway or channel designation, a dwarf can break through the floor of the cell ''beneath'' him.  That means a dwarf can stand on top of an aquifer layer, dig an up/down stairway, and make it drain into the layer beneath it, if that layer is also an aquifer or has an open path to an aquifer layer nearby.&lt;br /&gt;
&lt;br /&gt;
* A stairway may be swamped to dangerous levels with water draining in from the squares around it, but many stairways in a clump mean that the drainage to the next layer wins out.&lt;br /&gt;
&lt;br /&gt;
* Constructing a wall, up/down stairway, or channel in an aquifer layer prevents any water from originating in that square.  A wall prevents water from draining down into the next layer from any source, while the stairway or channel lets it come in from other squares and drain.&lt;br /&gt;
&lt;br /&gt;
These points support the following method:&lt;br /&gt;
&lt;br /&gt;
# Dig around at the level just above where you encountered the aquifer, placing up/down or down stairways according to your preferred city grid plan.  Training up a few miners in this way will help later.  Spot some points where the next level (as seen from down stairways) varies in wetness from one spot to another.&lt;br /&gt;
# For the following, pause the game after every square dug out and make sure the miners dig both layers at the same rate and redesignate when they cancel your plans automatically.  Dig a 5x5 hollow square of up/down stairways at the change in level, going down as far as you can.  The lower aquifer should accept water from the upper aquifer, allowing you to drain the upper aquifer (at least partway).  Then gradually take on the area in the middle, building walls and/or staircases to fill in and stop the flow as you expand.  Eventually you should get command over the source of flow, and can dig a hole in the center of the bottom-most layer surrounded by a 3x3 ring of impermeable rock.&lt;br /&gt;
&lt;br /&gt;
* ''Caveat: sometimes only the top of the aquifer changes depth, but the bottom stays at the same level.  In this case you will get nowhere.  Sometimes the aquifer is two or more layers thick and it doesn't offset enough to let you all the way through - in this case, sometimes you can use the cave-in method to get through one layer, then use this method to get through the next.  And sometimes you'll just find a hole right through when you investigate the change in level, because you're at a biome boundary and it's not aligned perfectly.&lt;br /&gt;
&lt;br /&gt;
===The ore method===&lt;br /&gt;
On maps where the aquifer is not held in a layer of soil, but instead is held in a {{L|sedimentary layer}} such as sandstone, it may be possible to tunnel down through deposits of ore such as magnetite. For this to work you have to find a spot where there is coincidentally an ore deposit on each Z-level you need to dig through.  This is only possible through tiresome trial and error, or through the use of a utility like reveal.exe.  The trial and error method can be accomplished somewhat more easily by digging up/down stairs to reveal the layer underneath them without actually digging into the underlying layer.  This method is more complicated with aquifers located in layers of {{L|conglomerate}}, as large clusters of {{L|puddingstone}} will support the aquifer and thus cannot be used to provide a path through it.&lt;br /&gt;
&lt;br /&gt;
===The magma/obsidian method===&lt;br /&gt;
If you have access to a supply of magma, you can create your own obsidian caissons. By channeling into the aquifer layer and then filling these channels with magma, it is possible to create a wall of obsidian between your working area and the {{l|water}}-bearing rock or {{l|soil}}. However, changes to world generation with the last version have made this method more difficult than it once was, as it is now harder to find magma vents that extend above the aquifer level.&lt;br /&gt;
&lt;br /&gt;
===The cave-in method===&lt;br /&gt;
If there are enough layers above the aquifer, then letting non aquifer rock fall into the aquifer layer gives an area of diggable rock. This requires at least 2 natural dry layers. If multiple aquifer layers are to be breached, things get more complicated. First {{l| channel}} out the area of aquifer that will be replaced. Then dig out all connecting floors and walls to the block that will fall (build a  support to hold it until you are ready for collision). A {{l| burrow}} may be useful to assign unnecessary dwarves to a safe area. When everyone is clear, de-construct the support with a lever. (If you forgot to bring stone, then you may instead build a constructed floor to support it, designate it to be destroyed, and have a {{l|hospital}} standing ready in case the unlucky one survives.)&lt;br /&gt;
&lt;br /&gt;
After the collapse, do not dig out the outer edge of the fallen rock.&lt;br /&gt;
&lt;br /&gt;
This does not work with {{l| wood}} walls since they deconstruct on cave-in.&lt;br /&gt;
&lt;br /&gt;
If you build many rings inside one another in your top drop layer, you can breach multi-level aquifers with as little as 2 natural layers of dry soil above it.  Drop the rings from the outside to the inside using constructed arms to hold the center rings in place.  Once a ring drops into the water below it, pump out the water in the center and dig down another layer.  When that is complete, drop the next ring and continue the process until you are through.  Since you start dropping rings from the outside it is necessary to know how many levels deep the aquifer is before you begin.&amp;lt;br&amp;gt;&lt;br /&gt;
Tutorial for more than one Aquifier can be found here: [[User:Rhenaya/HowtoDualAquifer]]&lt;br /&gt;
&lt;br /&gt;
Some might regard this method as cheating, so use it at your own risk.&lt;br /&gt;
&lt;br /&gt;
'''Note:''' There is a bug that may prevent this method from working, collapsed layers may turn into the aquifer layer type that was dug out at that level. So, for example: We have three layers, layer 1 has the caving in section, and is not an aquifer. Layer 2 is a dug out layer that is also not a aquifer. And Layer 3 which is dug out and is an aquifer. Now, the bug, say layer 1's cave-in section lands on layer 3's dug out area, sometimes layer 1's caved in section may change into layer 3's soil type. Making it an aquifer too. Thus making the cave-in method impossible for that area.&lt;br /&gt;
&lt;br /&gt;
====Cave-In Example====&lt;br /&gt;
&lt;br /&gt;
[[File:Aquifer-Plug.png|frame|none|Note: Side View]]&lt;br /&gt;
&lt;br /&gt;
*Dig stairs down to the aquifer. Dig over the aquifer layer but under your &amp;quot;plug&amp;quot;. You'll need a 5x5 landmass. (Slide 2)&lt;br /&gt;
*Channel out the area the plug will fall into. (Slide 3)&lt;br /&gt;
*Leave a single floor tile on top of the plug and dig out the outer layer of your plug. The plug should be a 3x3 landmass now. The single floor tile must keep the plug from falling. (Slide 3)&lt;br /&gt;
*Channel out the floor tile holding up the plug. (Slides 4 &amp;amp; 5)&lt;br /&gt;
*Construct floor tiles to reach the plug and dig through the middle to get under the aquifer. (Slide 6)&lt;br /&gt;
&lt;br /&gt;
===The freezing method===&lt;br /&gt;
&lt;br /&gt;
If you are playing in a freezing or very cold landscape, where it snows in winter and instantly freezes water on the map, you can dig out a 3x3 hole in the ground using {{l|channel}}s, and make it deeper and deeper until you reach the aquifer level. Once you reach the damp rock, tunnel into it with an up/down staircase - the incoming water will freeze after a few moments. The central square of the 3x3 hole should be tunnelable ice, so you can get to the rock beneath. If there are two aquifer levels, for example, you can just make a larger initial hole, and make a smaller one for the level after. &lt;br /&gt;
&lt;br /&gt;
If your fortress is in a zone that gets warm, build walls around the inside of the hole to stop the water coming in once the ice melts.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: There is a bug that may prevent this from working, sometimes ice walls don't produce an ice floor tile above them, instead leaving it as &amp;quot;open space&amp;quot; which prevents the player from digging downwards. &lt;br /&gt;
Simplest method is to construct a wooden (or stone, if you have any) floor and then remove it. After the floor is removed, a natural ice floor will remain.&lt;br /&gt;
An alternative means that will work is to set the tile 1 z-level '''ABOVE''' your missing ice floor tile as a {{l|pond}}, and '''FILL IT'''. The first {{l|bucket}} of water that goes on it will create that missing ice floor tile the instant the water is dumped on it, and you will receive a cancellation message that the pond has gone away. Dezone the pond {{l|activity zone}}, and get back to work breaching that ice. Keep in mind that you will need an '''unfrozen water source''' to use to fill your bucket. Luckily you have an aquifer, so you can just dig into it somewhere underground.&lt;br /&gt;
&lt;br /&gt;
===The pump method===&lt;br /&gt;
&lt;br /&gt;
The pumping method uses multiple {{L|screw pump|pumps}} to keep an area dry long enough to smooth or {{l|wall}} off the edges, stopping the flow of water.  It requires no special environment or resources, other than wood and dwarves (and patience).  Most commonly, a moderately sized section of the aquifer layer is channeled out and several screw pumps are built facing it.  Directly behind each of the screw pumps a few tiles are channeled out to receive and dispose of the pumped water.  When the pumps are activated, they should pump water faster than the aquifer can produce it, allowing masons to smooth or build walls around your future staircase.  You ''will'' get job cancellations during this process, as stray 2/7's of water interrupt the building process.  Just unsuspend the construction when this happens, as long a dwarf manages to touch the wall before canceling, it will move incrementally toward completion and eventually finish.  Depending on the availability of screw pumps and dwarves, you may need to wall off one corner or side at a time, then move the pumps and repeat.  When drilling through more than one aquifer layer, be sure to leave yourself enough room to build additional layers of pumps and water disposal channels on lower levels. &lt;br /&gt;
&lt;br /&gt;
Things to consider: &lt;br /&gt;
* Flowing water will cause parents to drop their infants, leading to job cancellations and occasionally [[fun]].&lt;br /&gt;
* Mechanical {{l|power}} may come in handy, but dwarf power works just fine and is much more portable.&lt;br /&gt;
* Channels can sometimes be used in place of walls, causing water produced by by the aquifer on one level to immediately fall and be consumed by the aquifer on the level below.&lt;br /&gt;
* This method may take a while.&lt;br /&gt;
* Aquifers do not create water in diagonal tiles, but do create water in hollow tiles directly below them. Therefore, you will want to dig two z-levels below the lowest aquifer layer before continuing with your fortress.&lt;br /&gt;
&lt;br /&gt;
Two [http://www.bay12forums.com/smf/index.php?topic=79224.0 pump-based implementations] have been tested and found to meet dwarven standards of excellence. &amp;lt;!-- At some point, put these on the wiki directly. --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The modding method===&lt;br /&gt;
&lt;br /&gt;
By editing the the raws and removing the [AQUIFER] tag from all of the appropriate entries in inorganic_stone_layer.txt, inorganic_stone_mineral.txt, and inorganic_stone_soil.txt it is possible to remove all aquifers from the world.  This can be done before creating a new world or after, if you find a particularly neat location ruined only by the presence of an aquifer. In order to modify an existing world, you must delete the [AQUIFER] tag from the raws in the savegame's folder.&lt;br /&gt;
&lt;br /&gt;
On Linux:&lt;br /&gt;
&lt;br /&gt;
 cd df_linux/raw/objects/&lt;br /&gt;
 sed -i 's/\[AQUIFER\]/(AQUIFER)/g' inorganic_stone_*.txt&lt;br /&gt;
&lt;br /&gt;
and generate world.  To edit an already generated world, run the &amp;lt;code&amp;gt;sed&amp;lt;/code&amp;gt; command in the &amp;lt;tt&amp;gt;df_linux/data/save/''regionNN''/raw/objects&amp;lt;/tt&amp;gt; folder instead.  If you want to restore the tags later, you can do it with the command:&lt;br /&gt;
&lt;br /&gt;
 sed -i 's/(AQUIFER)/[AQUIFER]/g' inorganic_stone_*.txt&lt;br /&gt;
&lt;br /&gt;
===Digging with help from below===&lt;br /&gt;
&lt;br /&gt;
So say you sneak down below the aquifer through an ore vein or something, but you still want to punch a tunnel through a part of the aquifer that does ''not'' afford such luxury. With a typical double-layer aquifer (with an unsafe layer beneath it that fills from above) it is not easy to push through a stairwell where you'd like, even if you have access to the space beneath.  Start by ensuring 24 building materials (wood or stone) are available close by on the layer above the top aquifer, and that a ''large'' space (at least 25x25 or so, preferably larger) is available on the top safe layer under the aquifer, four layers beneath the first.    Dig or build an up-down stair at the same position on the upper and lower safe levels, and surround the top up-down stair with 8 down-stairs for better access.  Have at least three legendary diggers and half a dozen moderately skilled masons close by and idle.  It also helps to have a stairway or open space leading down from the lower level to relieve water buildup at the point you'll make the hole.&lt;br /&gt;
&lt;br /&gt;
Start by digging an up/down stairway upward from the bottom safe stairway into the bottom (third) layer.  Water will start pouring out into the bottom level.  Designate the next two squares up (on the aquifer levels) as up-down stairs to link the two, and wait until the diggers get started on them.  Then designate a 3x3x3 block around these as up-down stairs on the two aquifer levels and the unsafe level beneath.  Once they're built very large amounts of water will be pouring down into the lower space.  ''Warning:'' unlike in the previous version, diggers now make a habit of canceling designations that they feel they can't get to, such as if the lower level is too flooded for them to approach.  Make sure all 27 up-down stairs are dug out ASAP.  Then wall six squares on the top level (leaving two to be walled once the corners are filled in), and proceed downward from completed walls until you've walled squares on all three levels.  After you finish, I'm not sure if it's technically necessary to construct up-down stairs in the space you dug out by designation in order to stop all water leakage.&lt;br /&gt;
&lt;br /&gt;
===Going around===&lt;br /&gt;
&lt;br /&gt;
If your embark site is covered by multiple biomes, there is a chance the aquifer is not present in every biome.  In some maps this may be indicated by an outcropping of stone in a landscape otherwise composed of soil; in other maps the change in biome might be visible as a change in soil type or vegetation type or density.  You might be able to dig down through a biome that doesn't have an aquifer, to a Z-level below the aquifer, and then (if you wish) tunnel beneath the aquifer to the previously inaccessible region.&lt;br /&gt;
&lt;br /&gt;
Even if all the biomes of your site contain aquifers, they might not all be at the same Z-level.  So you still might be able to dig down in one biome, reaching a Z-level beneath the aquifer in another biome.&lt;br /&gt;
&lt;br /&gt;
== Benefits of aquifers ==&lt;br /&gt;
While annoying, aquifers can be useful for building a self-sufficient fortress, and for water-related {{l|megaprojects}}. Since an aquifer can absorb an infinite amount of water, it can function as a drain for anything above it. For instance, digging a pit in a lower Z level of an aquifer, then connecting it to a breached aquifer a level above through a channel dug a level above ''that'' will create a permanently flowing, compact, secure water/power source completely contained within the fortress.  &lt;br /&gt;
&lt;br /&gt;
Aquifers outside {{l|ocean}} biomes also contain fresh water. Since aquifers are almost always located close to the surface, freshwater aquifers can easily be turned into a source of infinite, secure, non-freezing drinking water for your dwarves, eliminating the need for a {{l|cistern}}. While both of these roles can also be filled by {{l|Caverns|cavern}} features, an aquifer allows you to get the same advantages without exposing yourself to potentially dangerous cavern creatures.&lt;br /&gt;
&lt;br /&gt;
== External links ==&lt;br /&gt;
&lt;br /&gt;
* [http://www.bay12forums.com/smf/index.php?topic=79224.15 QuantumMenace's two-slit method] for breaching aquifers of any depth - Illustrated guide&lt;br /&gt;
&lt;br /&gt;
{{World}}&lt;br /&gt;
&lt;br /&gt;
[[Category:World]]&lt;/div&gt;</summary>
		<author><name>Vyznev</name></author>
	</entry>
	<entry>
		<id>https://dwarffortresswiki.org/index.php?title=Utility:SoundSense&amp;diff=152809</id>
		<title>Utility:SoundSense</title>
		<link rel="alternate" type="text/html" href="https://dwarffortresswiki.org/index.php?title=Utility:SoundSense&amp;diff=152809"/>
		<updated>2011-09-03T20:14:54Z</updated>

		<summary type="html">&lt;p&gt;Vyznev: add some nicer formatting&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=SoundSense=&lt;br /&gt;
&lt;br /&gt;
Discussion: http://www.bay12forums.com/smf/index.php?topic=60287.0&lt;br /&gt;
Homepage: http://df.zweistein.cz/soundsense/&lt;br /&gt;
&lt;br /&gt;
==Installation==&lt;br /&gt;
&lt;br /&gt;
Installing and configuring software can be intimidating if you are not an IT nerd. And this&lt;br /&gt;
is no exception with SoundSense. But bear with me and it can actually be pretty easy.&lt;br /&gt;
&lt;br /&gt;
'''Non-scary instructions:'''&lt;br /&gt;
&lt;br /&gt;
* Install the java runtime&lt;br /&gt;
* Download and extract SoundSense (It does not matter where.)&lt;br /&gt;
* Download soundpack.zip and extract the &amp;quot;packs&amp;quot; folder to SoundSense directory&lt;br /&gt;
* Run soundsense.cmd or soundsense.exe&lt;br /&gt;
&lt;br /&gt;
First, you need to have the java runtime installed. It can be downloaded from the java &lt;br /&gt;
homepage. To determine if your computer already has the correct installation of java, go &lt;br /&gt;
to the Start button, left click &amp;quot;Run...&amp;quot; from the bottom of the menu, type in &amp;quot;cmd&amp;quot; in the &lt;br /&gt;
dialog that opens, and press the [OK] button. A dark windows pops up and you will be at a &lt;br /&gt;
command prompt. Type in &amp;quot;java -version&amp;quot; and press [Enter].&lt;br /&gt;
&lt;br /&gt;
A few lines starting with [java version &amp;quot;1.6.0_14&amp;quot;] or something similar should apear. If &lt;br /&gt;
that case is the case, you are good to go. But if you see [java version &amp;quot;1.5.x_xx&amp;quot; or an &lt;br /&gt;
earlier version (lower number), you will need to download and install the latest java.&lt;br /&gt;
&lt;br /&gt;
If something similar to ['java' is not recognized as an internal or external command] &lt;br /&gt;
appears, either java has not been installed yet or it was not installed correctly. If &lt;br /&gt;
your case is the latter, it may be possible to work around the problem by editing the &lt;br /&gt;
soundSense.cmd (in your SoundSense directory). Open it with Notepad and find line line &lt;br /&gt;
starting with &amp;quot;java -Dja...&amp;quot; and replace the &amp;quot;java&amp;quot; part with the full path for your java &lt;br /&gt;
installation. For example: &amp;quot;C:\Program Files\Java\jdk1.6.0_20\bin\java.exe&amp;quot;&lt;br /&gt;
&lt;br /&gt;
That was the hard part.&lt;br /&gt;
&lt;br /&gt;
Now, where to install it? SoundSense expects to be in a sub-directory that is inside your &lt;br /&gt;
Dwarf Fortress directory. So, for example, if you have Dwarf Fortress in F:/df_31_18_win/,&lt;br /&gt;
you should unpack the contents of SoundSense zip to F:/df_31_18_win/soundsense/. By &lt;br /&gt;
default, you want to make sure that the .cmd file you use to launch SoundSense is inside a &lt;br /&gt;
sub-directory of (i.e., below) the DF folder where gamelog.txt is located.&lt;br /&gt;
&lt;br /&gt;
If you want to install to a different location, you need to edit configuration.xml and &lt;br /&gt;
edit the &amp;lt;gamelog path=&amp;quot;../gamelog.txt&amp;quot;/&amp;gt; line. Replace &amp;quot;../gamelog.txt&amp;quot; with the path to &lt;br /&gt;
where Dwarf Fortress is located. For example: &amp;quot;F:/df_31_18_win/gamelog.txt&amp;quot;&lt;br /&gt;
&lt;br /&gt;
SoundSense is now all set up and ready to run. But you still need the actual sounds and &lt;br /&gt;
music that it will play. So download soundpack.zip and unzip the &amp;quot;packs&amp;quot; directory and all &lt;br /&gt;
the contents inside that to the SoundSense directory.&lt;br /&gt;
&lt;br /&gt;
You can start SoundSense by launching (double left-clicking) either soundSense.cmd or &lt;br /&gt;
soundSenseExe.cmd. (Using the latter should give you clearer error messages regarding a &lt;br /&gt;
bad java installation.) If you like, you can create a shortcut to soundSense.cmd, rename &lt;br /&gt;
it &amp;quot;SoundSense&amp;quot; and move it to your desktop for easy access.&lt;br /&gt;
&lt;br /&gt;
Finally, remember that SoundSense needs to run in the background. Ideally, you should &lt;br /&gt;
start SoundSense BEFORE you start Dwarf Fortress.&lt;br /&gt;
&lt;br /&gt;
==Known Issues==&lt;br /&gt;
&lt;br /&gt;
===Moments of Silence===&lt;br /&gt;
&lt;br /&gt;
Occationally, the music in SoundSense will stop for a short period (10, 20, or 30 seconds) &lt;br /&gt;
before resuming. This is not a bug - it is intentional. This was done to let ears rest a &lt;br /&gt;
bit between tracks. (Research shows that ears which get a rest have time to recover and &lt;br /&gt;
are less likely to be damaged.) Also, a few tracks have a silent start and, at low volume, &lt;br /&gt;
may take a minute or longer to become audible. If in doubt, you can see what is currently &lt;br /&gt;
playing in GUI under the volume slider. During periods of silence, this will typically &lt;br /&gt;
show &amp;quot;10s silence&amp;quot; or similar.&lt;br /&gt;
&lt;br /&gt;
===Game Loads and the Music is Random===&lt;br /&gt;
&lt;br /&gt;
When a game is loaded, SoundSense picks a random seasonal music track to play. This is not &lt;br /&gt;
a bug - it is intentional. There is no way for SoundSense to detect what season it is when &lt;br /&gt;
a game is loaded, so a random soundtrack is chosen. But when the season next changes, it &lt;br /&gt;
will choose the correct soundtrack.&lt;br /&gt;
&lt;br /&gt;
===Adventure Mode - A Bit Lacking===&lt;br /&gt;
&lt;br /&gt;
Adventure Mode kind of works. The battle sounds function quite well because they are &lt;br /&gt;
mostly the same as those in Fortress Mode. But SoundSense is still a bit lacking in other &lt;br /&gt;
adventure sounds. The problem is that Adventure Mode does not log many other usefull &lt;br /&gt;
events. For example, encountering a megabeast or a quest mob is resolved in chat, leaving &lt;br /&gt;
no message in the game log to trigger SoundSense.&lt;br /&gt;
&lt;br /&gt;
Improvements in how DF handles logging could benfit both SoundSense and DF as a whole. &lt;br /&gt;
Such suggestions have already been posted in the official Dwarf Fortress forums: &lt;br /&gt;
http://www.bay12forums.com/smf/index.php?topic=64834.0&lt;br /&gt;
&lt;br /&gt;
===Event Detection: Better Late Than Never?===&lt;br /&gt;
&lt;br /&gt;
In some cases, by the time SoundSense detects conditions to trigger an alert, it may be &lt;br /&gt;
too late to react to the situation. For example, a &amp;quot;Tantrum Spiral&amp;quot; might already be over &lt;br /&gt;
before the player can be alerted.&lt;br /&gt;
&lt;br /&gt;
Part of this is a balance between detecting too many false positives and ignoring events &lt;br /&gt;
until it is too late to do anything. For example, a soldier might lose a pet and report &lt;br /&gt;
feeling like blowing off some steam... but instead of throwing a tantrum they calm down.&lt;br /&gt;
&lt;br /&gt;
Another problem is FPS sensitivity. A specific sequence of events may trigger certain &lt;br /&gt;
alert sounds in a high FPS situation, but it might not trigger with low FPS. The sequence &lt;br /&gt;
of events might &amp;quot;time out&amp;quot;. Also, pausing the game could cause similar problems.&lt;br /&gt;
&lt;br /&gt;
===Compatible With DF Mods - Should Work, But NO PROMISES===&lt;br /&gt;
&lt;br /&gt;
SoundSense was mainly designed for &amp;quot;vanilla&amp;quot; (unmodified) Dwarf Fortress. It should work &lt;br /&gt;
fine with most mods. However, I can not guarantee compatibility. Some mods, especially &lt;br /&gt;
&amp;quot;major&amp;quot; or &amp;quot;full conversions&amp;quot;, may create unusual behavior and involve dangerous events &lt;br /&gt;
that SoundSense was not designed to detect.&lt;br /&gt;
&lt;br /&gt;
Another words, SoundSense may lack sounds for certain mod-specific events. (E.g.; you &lt;br /&gt;
should NOT expect SoundSense to include gunshot sounds for mods that add guns! But you CAN &lt;br /&gt;
modify SoundSense yourself to do this.) Conversely, some events that work normally in &lt;br /&gt;
vanilla DF may trigger so frequently with a mod as to be very annoying.&lt;br /&gt;
&lt;br /&gt;
===On some Linux===&lt;br /&gt;
&lt;br /&gt;
====Error on 'soundSense.sh' call: &amp;quot;/bin/sh^M : wrong interpret&amp;quot;====&lt;br /&gt;
&lt;br /&gt;
File &amp;quot;soundSense.sh&amp;quot; has CR+LF characters at lines ending.&lt;br /&gt;
Convert these characters to a more suitable form, with a tool like &amp;quot;[http://en.wikipedia.org/wiki/Unix2dos dos2unix]&amp;quot;:&lt;br /&gt;
  dos2unix soundSense.sh&lt;br /&gt;
Shell script should then be run without previous error.&lt;br /&gt;
&lt;br /&gt;
Also using sed you can try this:&lt;br /&gt;
  # IN UNIX ENVIRONMENT: convert DOS newlines (CR/LF) to Unix format.&lt;br /&gt;
  sed -i -e 's/\r$//' ./soundSense.sh&lt;br /&gt;
IF launching .sh file after that, says that something is wrong on the last line, when you try to launch sh. Just check, if &amp;quot;fi&amp;quot; is present there instead of &amp;quot;f&amp;quot; or smth like that.&lt;br /&gt;
&lt;br /&gt;
====Error at playing any MP3 file: &amp;quot;javax.sound.sampled.UnsupportedAudioFileException: could not get audio input stream from input file: could not get audio input stream from input file&amp;quot;====&lt;br /&gt;
&lt;br /&gt;
Your Java virtual machine failed at reading MP3 files as audio stream. This could fix by adding to JVM an extra plugin: [http://www.oracle.com/technetwork/java/javase/download-137625.html JMF MP3 Plugin].&lt;br /&gt;
Download plugin, and put *.jar files into your JVM &amp;quot;lib/ext/&amp;quot; directory.&lt;br /&gt;
&lt;br /&gt;
====Error at playing any MP3 file: &amp;quot;javax.sound.sampled.LineUnavailableException: Audio Device Unavailable&amp;quot;====&lt;br /&gt;
&lt;br /&gt;
Whereas your JVM succeeded in reading MP3 file as audio stream, it failed to access to an audio device. If your audio system uses [http://fr.wikipedia.org/wiki/Advanced_Linux_Sound_Architecture Alsa], you could install &amp;quot;aoss&amp;quot; utility, and &amp;quot;soundSense.sh&amp;quot; will call it. On Debian, package &amp;quot;alsa-oss&amp;quot; provides this utility.&lt;br /&gt;
&lt;br /&gt;
====Goddammit I'm using pulseaudio and I still can't hear anything!====&lt;br /&gt;
&lt;br /&gt;
Try to install osspd OR use padsp wrapper. While padsp wrapper wouldn't work everytime for me, osspd daemon worked just fine. (''[https://wiki.archlinux.org/index.php/Pulseaudio#OSS Archlinux Pulseaudio user]'')&lt;br /&gt;
&lt;br /&gt;
===Any Other Issues? Post Feedback===&lt;br /&gt;
&lt;br /&gt;
There is a thread at the official Dwarf Fortress forums. Feel free to post any issues, &lt;br /&gt;
suggestions, and contributions there:&lt;br /&gt;
http://www.bay12forums.com/smf/index.php?topic=60287.0&lt;br /&gt;
&lt;br /&gt;
When providing feedback about your experience with SoundSense, please specify which mods &lt;br /&gt;
(if any) you are using. If SoundSense seems to behave weirdly only for you, it just might &lt;br /&gt;
be from using certain mods.&lt;br /&gt;
&lt;br /&gt;
==Customization==&lt;br /&gt;
&lt;br /&gt;
You can insert additional sounds and music into SoundSense by adding entries to an .xml &lt;br /&gt;
configuration file. logPattern=&amp;quot;regexp&amp;quot; is a regular expression which, if matched, will &lt;br /&gt;
cause a random soundFile from a list to be played. (Details on how java uses regular &lt;br /&gt;
expressions: http://java.sun.com/j2se/1.4.2/docs/api/java/util/regex/Pattern.html )&lt;br /&gt;
&lt;br /&gt;
===Sound element attributes:===&lt;br /&gt;
&lt;br /&gt;
* ''logPattern'' - regular expression matching log line (see link above)&lt;br /&gt;
* ''channel'' - string; Specifies a channel on which sound is played. Sounds played on a channel can be looped or stopped prematurely.&lt;br /&gt;
* ''loop'' - string; Specifying &amp;quot;start&amp;quot; will start looping a sound on a channel until an expression with &amp;quot;stop&amp;quot; is triggered or until a different loop sound is played on the same channel. (If a non-looped sound is triggered on the same channel, this loop will resume when the non-looped is done playing.)&lt;br /&gt;
* ''concurency'' - number; The number of concurrent (i.e., simultaneous) sounds allowed to be played besides this sound. If SoundSense is currently playing more than this, the sound is ignored. The default is unlimited.&lt;br /&gt;
* ''timeout'' - number; This initiates a time out during which this particular sound is prevented from playing again. This is measured in milliseconds and the default is 0.&lt;br /&gt;
* ''delay'' - number; Adds a delay before the sound is played. This is measured in milliseconds and the default is 0.&lt;br /&gt;
* ''haltOnMatch'' - boolean; If this is set to True and more than one equivalent logPattern exists, SoundSense will only process the first logPattern expression. If it is False, it will continue to process matching (e.g., identical) logPatterns. The default is True.&lt;br /&gt;
* ''speech'' - boolean; If this is set to True, SoundSense will echo the gamelog text line (containing the logPattern) with a speech synthesizer instead of playing a sound. The default is False.&lt;br /&gt;
* ''playbackThreshhold'' - number, 0-4, defines level of filter which is applied to this sound.&lt;br /&gt;
&lt;br /&gt;
===SoundFile element attributes:===&lt;br /&gt;
&lt;br /&gt;
* ''fileName'' - the path to and name of the sound/music file&lt;br /&gt;
* ''weight'' - number; This controls the likelihood of a sound being chosen. Default is 100.&lt;br /&gt;
* ''volumeAdjustment'' - number; This can be used to adjust the volume of the sample. The value can range from -40 to +6 decibles and the default is 0.&lt;br /&gt;
* ''randomBalance'' - boolean, if set to true will randomply distribute sound betweem stereo channels.&lt;br /&gt;
* ''balanceAdjustment'' - number, adjusts stereo channel, can range for -1 (full left) to 1 (full right).&lt;br /&gt;
&lt;br /&gt;
SoundSense supports these audio formats for soundFiles:&lt;br /&gt;
&lt;br /&gt;
* mp3   (SoundSense can normalize the sound volume with this format)&lt;br /&gt;
* ogg   (works, but SoundSense can not normalize the sound volume)&lt;br /&gt;
* wav   (See note below. SoundSense only supports &amp;quot;Windows PCM&amp;quot; encoded .wav files)&lt;br /&gt;
* aiff&lt;br /&gt;
* au&lt;br /&gt;
&lt;br /&gt;
Note: Not all .wav files are supported...&lt;br /&gt;
&lt;br /&gt;
SoundSense supports .wav encoded in the &amp;quot;Windows PCM&amp;quot; format. However, some files with the &lt;br /&gt;
.wav extention are actually encoded in some other proprietary format. A sound format &lt;br /&gt;
conversion utility (such as FormatFactory) could be used to fix them.&lt;br /&gt;
&lt;br /&gt;
===Some Tips:===&lt;br /&gt;
&lt;br /&gt;
; Control of Randomness: Each logPattern expression can contain several soundFile elements. When it is triggered, one of them is randomly chosen to play. You can control the probability of each sound being chosen by adding the weight=&amp;quot;number&amp;quot; attribute.&lt;br /&gt;
; Simultaneous Sounds: By default, only one sound will play for a given logPattern, even if there are several expression using identical logPatterns. (Only the first expression is processed.) But you can allow more than one sound to be played for same pattern by giving the first one the haltOnMatch=&amp;quot;false&amp;quot; attribute. They will all start at same time (unless one or more of them also has a delay). An example is in Seasons.&lt;br /&gt;
; Sequential Sounds: Two (or more) sounds can be played sequentially (one after the other) for the same logPattern by using the haltOnMatch=&amp;quot;false&amp;quot; tip above and including a delay attribute for one of them with a delay that surpasses the length of the other.&lt;br /&gt;
&lt;br /&gt;
===Helpful files:===&lt;br /&gt;
&lt;br /&gt;
* packSkeletons.zip ( http://df.zweistein.cz/soundsense/packSkeletons.zip ) - This contains .xml files for all known gamelog lines currently without sounds. You can use this as a starting point to expand SoundSense.&lt;br /&gt;
* missingMessages.cmd - Run this program to parse your gamelog.txt file and output all lines your sound packs will not recognize.&lt;br /&gt;
* logging.properties - Edit this file to enable more debug messages from SoundSense. Set &amp;quot;.level = ALL&amp;quot; to view a very verbose output.&lt;br /&gt;
&lt;br /&gt;
===Sources of sound &amp;amp; music:===&lt;br /&gt;
&lt;br /&gt;
The following are some sites of interest, should you want additional sounds/music.&lt;br /&gt;
(Websites with free, creative commons, public domain, and/or GNU GPL licensed audio):&lt;br /&gt;
&lt;br /&gt;
*http://soundbible.com/&lt;br /&gt;
*http://www.freesound.org/searchText.php&lt;br /&gt;
*http://www.musopen.org/&lt;br /&gt;
*http://opengameart.org/browse/audio&lt;br /&gt;
*http://www.incompetech.com/m/c/royalty-free/&lt;br /&gt;
*http://ccmixter.org&lt;br /&gt;
*http://free-loops.com/&lt;br /&gt;
*http://www.pdsounds.org/&lt;br /&gt;
*http://commons.wikimedia.org/wiki/Category:Sound&lt;br /&gt;
*http://www.archive.org/details/opensource_audio&lt;br /&gt;
*http://publicdomainaudiovideo.blogspot.com/&lt;/div&gt;</summary>
		<author><name>Vyznev</name></author>
	</entry>
	<entry>
		<id>https://dwarffortresswiki.org/index.php?title=Utility:SoundSense&amp;diff=152808</id>
		<title>Utility:SoundSense</title>
		<link rel="alternate" type="text/html" href="https://dwarffortresswiki.org/index.php?title=Utility:SoundSense&amp;diff=152808"/>
		<updated>2011-09-03T20:09:32Z</updated>

		<summary type="html">&lt;p&gt;Vyznev: more list item fixes&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=SoundSense=&lt;br /&gt;
&lt;br /&gt;
Discussion: http://www.bay12forums.com/smf/index.php?topic=60287.0&lt;br /&gt;
Homepage: http://df.zweistein.cz/soundsense/&lt;br /&gt;
&lt;br /&gt;
==Installation==&lt;br /&gt;
&lt;br /&gt;
Installing and configuring software can be intimidating if you are not an IT nerd. And this&lt;br /&gt;
is no exception with SoundSense. But bear with me and it can actually be pretty easy.&lt;br /&gt;
&lt;br /&gt;
Non-scary instructions:&lt;br /&gt;
&lt;br /&gt;
* Install the java runtime&lt;br /&gt;
* Download and extract SoundSense (It does not matter where.)&lt;br /&gt;
* Download soundpack.zip and extract the &amp;quot;packs&amp;quot; folder to SoundSense directory&lt;br /&gt;
* Run soundsense.cmd or soundsense.exe&lt;br /&gt;
&lt;br /&gt;
First, you need to have the java runtime installed. It can be downloaded from the java &lt;br /&gt;
homepage. To determine if your computer already has the correct installation of java, go &lt;br /&gt;
to the Start button, left click &amp;quot;Run...&amp;quot; from the bottom of the menu, type in &amp;quot;cmd&amp;quot; in the &lt;br /&gt;
dialog that opens, and press the [OK] button. A dark windows pops up and you will be at a &lt;br /&gt;
command prompt. Type in &amp;quot;java -version&amp;quot; and press [Enter].&lt;br /&gt;
&lt;br /&gt;
A few lines starting with [java version &amp;quot;1.6.0_14&amp;quot;] or something similar should apear. If &lt;br /&gt;
that case is the case, you are good to go. But if you see [java version &amp;quot;1.5.x_xx&amp;quot; or an &lt;br /&gt;
earlier version (lower number), you will need to download and install the latest java.&lt;br /&gt;
&lt;br /&gt;
If something similar to ['java' is not recognized as an internal or external command] &lt;br /&gt;
appears, either java has not been installed yet or it was not installed correctly. If &lt;br /&gt;
your case is the latter, it may be possible to work around the problem by editing the &lt;br /&gt;
soundSense.cmd (in your SoundSense directory). Open it with Notepad and find line line &lt;br /&gt;
starting with &amp;quot;java -Dja...&amp;quot; and replace the &amp;quot;java&amp;quot; part with the full path for your java &lt;br /&gt;
installation. For example: &amp;quot;C:\Program Files\Java\jdk1.6.0_20\bin\java.exe&amp;quot;&lt;br /&gt;
&lt;br /&gt;
That was the hard part.&lt;br /&gt;
&lt;br /&gt;
Now, where to install it? SoundSense expects to be in a sub-directory that is inside your &lt;br /&gt;
Dwarf Fortress directory. So, for example, if you have Dwarf Fortress in F:/df_31_18_win/,&lt;br /&gt;
you should unpack the contents of SoundSense zip to F:/df_31_18_win/soundsense/. By &lt;br /&gt;
default, you want to make sure that the .cmd file you use to launch SoundSense is inside a &lt;br /&gt;
sub-directory of (i.e., below) the DF folder where gamelog.txt is located.&lt;br /&gt;
&lt;br /&gt;
If you want to install to a different location, you need to edit configuration.xml and &lt;br /&gt;
edit the &amp;lt;gamelog path=&amp;quot;../gamelog.txt&amp;quot;/&amp;gt; line. Replace &amp;quot;../gamelog.txt&amp;quot; with the path to &lt;br /&gt;
where Dwarf Fortress is located. For example: &amp;quot;F:/df_31_18_win/gamelog.txt&amp;quot;&lt;br /&gt;
&lt;br /&gt;
SoundSense is now all set up and ready to run. But you still need the actual sounds and &lt;br /&gt;
music that it will play. So download soundpack.zip and unzip the &amp;quot;packs&amp;quot; directory and all &lt;br /&gt;
the contents inside that to the SoundSense directory.&lt;br /&gt;
&lt;br /&gt;
You can start SoundSense by launching (double left-clicking) either soundSense.cmd or &lt;br /&gt;
soundSenseExe.cmd. (Using the latter should give you clearer error messages regarding a &lt;br /&gt;
bad java installation.) If you like, you can create a shortcut to soundSense.cmd, rename &lt;br /&gt;
it &amp;quot;SoundSense&amp;quot; and move it to your desktop for easy access.&lt;br /&gt;
&lt;br /&gt;
Finally, remember that SoundSense needs to run in the background. Ideally, you should &lt;br /&gt;
start SoundSense BEFORE you start Dwarf Fortress.&lt;br /&gt;
&lt;br /&gt;
==Known Issues==&lt;br /&gt;
&lt;br /&gt;
===Moments of Silence===&lt;br /&gt;
&lt;br /&gt;
Occationally, the music in SoundSense will stop for a short period (10, 20, or 30 seconds) &lt;br /&gt;
before resuming. This is not a bug - it is intentional. This was done to let ears rest a &lt;br /&gt;
bit between tracks. (Research shows that ears which get a rest have time to recover and &lt;br /&gt;
are less likely to be damaged.) Also, a few tracks have a silent start and, at low volume, &lt;br /&gt;
may take a minute or longer to become audible. If in doubt, you can see what is currently &lt;br /&gt;
playing in GUI under the volume slider. During periods of silence, this will typically &lt;br /&gt;
show &amp;quot;10s silence&amp;quot; or similar.&lt;br /&gt;
&lt;br /&gt;
===Game Loads and the Music is Random===&lt;br /&gt;
&lt;br /&gt;
When a game is loaded, SoundSense picks a random seasonal music track to play. This is not &lt;br /&gt;
a bug - it is intentional. There is no way for SoundSense to detect what season it is when &lt;br /&gt;
a game is loaded, so a random soundtrack is chosen. But when the season next changes, it &lt;br /&gt;
will choose the correct soundtrack.&lt;br /&gt;
&lt;br /&gt;
===Adventure Mode - A Bit Lacking===&lt;br /&gt;
&lt;br /&gt;
Adventure Mode kind of works. The battle sounds function quite well because they are &lt;br /&gt;
mostly the same as those in Fortress Mode. But SoundSense is still a bit lacking in other &lt;br /&gt;
adventure sounds. The problem is that Adventure Mode does not log many other usefull &lt;br /&gt;
events. For example, encountering a megabeast or a quest mob is resolved in chat, leaving &lt;br /&gt;
no message in the game log to trigger SoundSense.&lt;br /&gt;
&lt;br /&gt;
Improvements in how DF handles logging could benfit both SoundSense and DF as a whole. &lt;br /&gt;
Such suggestions have already been posted in the official Dwarf Fortress forums: &lt;br /&gt;
http://www.bay12forums.com/smf/index.php?topic=64834.0&lt;br /&gt;
&lt;br /&gt;
===Event Detection: Better Late Than Never?===&lt;br /&gt;
&lt;br /&gt;
In some cases, by the time SoundSense detects conditions to trigger an alert, it may be &lt;br /&gt;
too late to react to the situation. For example, a &amp;quot;Tantrum Spiral&amp;quot; might already be over &lt;br /&gt;
before the player can be alerted.&lt;br /&gt;
&lt;br /&gt;
Part of this is a balance between detecting too many false positives and ignoring events &lt;br /&gt;
until it is too late to do anything. For example, a soldier might lose a pet and report &lt;br /&gt;
feeling like blowing off some steam... but instead of throwing a tantrum they calm down.&lt;br /&gt;
&lt;br /&gt;
Another problem is FPS sensitivity. A specific sequence of events may trigger certain &lt;br /&gt;
alert sounds in a high FPS situation, but it might not trigger with low FPS. The sequence &lt;br /&gt;
of events might &amp;quot;time out&amp;quot;. Also, pausing the game could cause similar problems.&lt;br /&gt;
&lt;br /&gt;
===Compatible With DF Mods - Should Work, But NO PROMISES===&lt;br /&gt;
&lt;br /&gt;
SoundSense was mainly designed for &amp;quot;vanilla&amp;quot; (unmodified) Dwarf Fortress. It should work &lt;br /&gt;
fine with most mods. However, I can not guarantee compatibility. Some mods, especially &lt;br /&gt;
&amp;quot;major&amp;quot; or &amp;quot;full conversions&amp;quot;, may create unusual behavior and involve dangerous events &lt;br /&gt;
that SoundSense was not designed to detect.&lt;br /&gt;
&lt;br /&gt;
Another words, SoundSense may lack sounds for certain mod-specific events. (E.g.; you &lt;br /&gt;
should NOT expect SoundSense to include gunshot sounds for mods that add guns! But you CAN &lt;br /&gt;
modify SoundSense yourself to do this.) Conversely, some events that work normally in &lt;br /&gt;
vanilla DF may trigger so frequently with a mod as to be very annoying.&lt;br /&gt;
&lt;br /&gt;
===On some Linux===&lt;br /&gt;
&lt;br /&gt;
====Error on 'soundSense.sh' call: &amp;quot;/bin/sh^M : wrong interpret&amp;quot;====&lt;br /&gt;
&lt;br /&gt;
File &amp;quot;soundSense.sh&amp;quot; has CR+LF characters at lines ending.&lt;br /&gt;
Convert these characters to a more suitable form, with a tool like &amp;quot;[http://en.wikipedia.org/wiki/Unix2dos dos2unix]&amp;quot;:&lt;br /&gt;
  dos2unix soundSense.sh&lt;br /&gt;
Shell script should then be run without previous error.&lt;br /&gt;
&lt;br /&gt;
Also using sed you can try this:&lt;br /&gt;
  # IN UNIX ENVIRONMENT: convert DOS newlines (CR/LF) to Unix format.&lt;br /&gt;
  sed -i -e 's/\r$//' ./soundSense.sh&lt;br /&gt;
IF launching .sh file after that, says that something is wrong on the last line, when you try to launch sh. Just check, if &amp;quot;fi&amp;quot; is present there instead of &amp;quot;f&amp;quot; or smth like that.&lt;br /&gt;
&lt;br /&gt;
====Error at playing any MP3 file: &amp;quot;javax.sound.sampled.UnsupportedAudioFileException: could not get audio input stream from input file: could not get audio input stream from input file&amp;quot;====&lt;br /&gt;
&lt;br /&gt;
Your Java virtual machine failed at reading MP3 files as audio stream. This could fix by adding to JVM an extra plugin: [http://www.oracle.com/technetwork/java/javase/download-137625.html JMF MP3 Plugin].&lt;br /&gt;
Download plugin, and put *.jar files into your JVM &amp;quot;lib/ext/&amp;quot; directory.&lt;br /&gt;
&lt;br /&gt;
====Error at playing any MP3 file: &amp;quot;javax.sound.sampled.LineUnavailableException: Audio Device Unavailable&amp;quot;====&lt;br /&gt;
&lt;br /&gt;
Whereas your JVM succeeded in reading MP3 file as audio stream, it failed to access to an audio device. If your audio system uses [http://fr.wikipedia.org/wiki/Advanced_Linux_Sound_Architecture Alsa], you could install &amp;quot;aoss&amp;quot; utility, and &amp;quot;soundSense.sh&amp;quot; will call it. On Debian, package &amp;quot;alsa-oss&amp;quot; provides this utility.&lt;br /&gt;
&lt;br /&gt;
====Goddammit I'm using pulseaudio and I still can't hear anything!====&lt;br /&gt;
&lt;br /&gt;
Try to install osspd OR use padsp wrapper. While padsp wrapper wouldn't work everytime for me, osspd daemon worked just fine. (''[https://wiki.archlinux.org/index.php/Pulseaudio#OSS Archlinux Pulseaudio user]'')&lt;br /&gt;
&lt;br /&gt;
===Any Other Issues? Post Feedback===&lt;br /&gt;
&lt;br /&gt;
There is a thread at the official Dwarf Fortress forums. Feel free to post any issues, &lt;br /&gt;
suggestions, and contributions there:&lt;br /&gt;
http://www.bay12forums.com/smf/index.php?topic=60287.0&lt;br /&gt;
&lt;br /&gt;
When providing feedback about your experience with SoundSense, please specify which mods &lt;br /&gt;
(if any) you are using. If SoundSense seems to behave weirdly only for you, it just might &lt;br /&gt;
be from using certain mods.&lt;br /&gt;
&lt;br /&gt;
==Customization==&lt;br /&gt;
&lt;br /&gt;
You can insert additional sounds and music into SoundSense by adding entries to an .xml &lt;br /&gt;
configuration file. logPattern=&amp;quot;regexp&amp;quot; is a regular expression which, if matched, will &lt;br /&gt;
cause a random soundFile from a list to be played. (Details on how java uses regular &lt;br /&gt;
expressions: http://java.sun.com/j2se/1.4.2/docs/api/java/util/regex/Pattern.html )&lt;br /&gt;
&lt;br /&gt;
===Sound element attributes:===&lt;br /&gt;
&lt;br /&gt;
* logPattern - regular expression matching log line (see link above)&lt;br /&gt;
* channel - string; Specifies a channel on which sound is played. Sounds played on a channel can be looped or stopped prematurely.&lt;br /&gt;
* loop - string; Specifying &amp;quot;start&amp;quot; will start looping a sound on a channel until an expression with &amp;quot;stop&amp;quot; is triggered or until a different loop sound is played on the same channel. (If a non-looped sound is triggered on the same channel, this loop will resume when the non-looped is done playing.)&lt;br /&gt;
* concurency - number; The number of concurrent (i.e., simultaneous) sounds allowed to be played besides this sound. If SoundSense is currently playing more than this, the sound is ignored. The default is unlimited.&lt;br /&gt;
* timeout - number; This initiates a time out during which this particular sound is prevented from playing again. This is measured in milliseconds and the default is 0.&lt;br /&gt;
* delay - number; Adds a delay before the sound is played. This is measured in milliseconds and the default is 0.&lt;br /&gt;
* haltOnMatch - boolean; If this is set to True and more than one equivalent logPattern exists, SoundSense will only process the first logPattern expression. If it is False, it will continue to process matching (e.g., identical) logPatterns. The default is True.&lt;br /&gt;
* speech - boolean; If this is set to True, SoundSense will echo the gamelog text line (containing the logPattern) with a speech synthesizer instead of playing a sound. The default is False.&lt;br /&gt;
* playbackThreshhold - number, 0-4, defines level of filter which is applied to this sound.&lt;br /&gt;
&lt;br /&gt;
===SoundFile element attributes:===&lt;br /&gt;
&lt;br /&gt;
* fileName - the path to and name of the sound/music file&lt;br /&gt;
* weight - number; This controls the likelihood of a sound being chosen. Default is 100.&lt;br /&gt;
* volumeAdjustment - number; This can be used to adjust the volume of the sample. The value can range from -40 to +6 decibles and the default is 0.&lt;br /&gt;
* randomBalance - boolean, if set to true will randomply distribute sound betweem stereo channels.&lt;br /&gt;
* balanceAdjustment - number, adjusts stereo channel, can range for -1 (full left) to 1 (full right).&lt;br /&gt;
&lt;br /&gt;
SoundSense supports these audio formats for soundFiles:&lt;br /&gt;
&lt;br /&gt;
* mp3   (SoundSense can normalize the sound volume with this format)&lt;br /&gt;
* ogg   (works, but SoundSense can not normalize the sound volume)&lt;br /&gt;
* wav   (See note below. SoundSense only supports &amp;quot;Windows PCM&amp;quot; encoded .wav files)&lt;br /&gt;
* aiff&lt;br /&gt;
* au&lt;br /&gt;
&lt;br /&gt;
Note: Not all .wav files are supported...&lt;br /&gt;
&lt;br /&gt;
SoundSense supports .wav encoded in the &amp;quot;Windows PCM&amp;quot; format. However, some files with the &lt;br /&gt;
.wav extention are actually encoded in some other proprietary format. A sound format &lt;br /&gt;
conversion utility (such as FormatFactory) could be used to fix them.&lt;br /&gt;
&lt;br /&gt;
===Some Tips:===&lt;br /&gt;
&lt;br /&gt;
* Control of Randomness - Each logPattern expression can contain several soundFile elements. When it is triggered, one of them is randomly chosen to play. You can control the probability of each sound being chosen by adding the weight=&amp;quot;number&amp;quot; attribute.&lt;br /&gt;
* Simultaneous Sounds - By default, only one sound will play for a given logPattern, even if there are several expression using identical logPatterns. (Only the first expression is processed.) But you can allow more than one sound to be played for same pattern by giving the first one the haltOnMatch=&amp;quot;false&amp;quot; attribute. They will all start at same time (unless one or more of them also has a delay). An example is in Seasons.&lt;br /&gt;
* Sequential Sounds - Two (or more) sounds can be played sequentially (one after the other) for the same logPattern by using the haltOnMatch=&amp;quot;false&amp;quot; tip above and including a delay attribute for one of them with a delay that surpasses the length of the other.&lt;br /&gt;
&lt;br /&gt;
===Helpful files:===&lt;br /&gt;
&lt;br /&gt;
* packSkeletons.zip ( http://df.zweistein.cz/soundsense/packSkeletons.zip ) - This contains .xml files for all known gamelog lines currently without sounds. You can use this as a starting point to expand SoundSense.&lt;br /&gt;
* missingMessages.cmd - Run this program to parse your gamelog.txt file and output all lines your sound packs will not recognize.&lt;br /&gt;
* logging.properties - Edit this file to enable more debug messages from SoundSense. Set &amp;quot;.level = ALL&amp;quot; to view a very verbose output.&lt;br /&gt;
&lt;br /&gt;
===Sources of sound &amp;amp; music:===&lt;br /&gt;
&lt;br /&gt;
The following are some sites of interest, should you want additional sounds/music.&lt;br /&gt;
(Websites with free, creative commons, public domain, and/or GNU GPL licensed audio):&lt;br /&gt;
&lt;br /&gt;
*http://soundbible.com/&lt;br /&gt;
*http://www.freesound.org/searchText.php&lt;br /&gt;
*http://www.musopen.org/&lt;br /&gt;
*http://opengameart.org/browse/audio&lt;br /&gt;
*http://www.incompetech.com/m/c/royalty-free/&lt;br /&gt;
*http://ccmixter.org&lt;br /&gt;
*http://free-loops.com/&lt;br /&gt;
*http://www.pdsounds.org/&lt;br /&gt;
*http://commons.wikimedia.org/wiki/Category:Sound&lt;br /&gt;
*http://www.archive.org/details/opensource_audio&lt;br /&gt;
*http://publicdomainaudiovideo.blogspot.com/&lt;/div&gt;</summary>
		<author><name>Vyznev</name></author>
	</entry>
	<entry>
		<id>https://dwarffortresswiki.org/index.php?title=Utility:SoundSense&amp;diff=152807</id>
		<title>Utility:SoundSense</title>
		<link rel="alternate" type="text/html" href="https://dwarffortresswiki.org/index.php?title=Utility:SoundSense&amp;diff=152807"/>
		<updated>2011-09-03T20:05:55Z</updated>

		<summary type="html">&lt;p&gt;Vyznev: /* Some Tips: */ rm line breaks to fix bullet points&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=SoundSense=&lt;br /&gt;
&lt;br /&gt;
Discussion: http://www.bay12forums.com/smf/index.php?topic=60287.0&lt;br /&gt;
Homepage: http://df.zweistein.cz/soundsense/&lt;br /&gt;
&lt;br /&gt;
==Installation==&lt;br /&gt;
&lt;br /&gt;
Installing and configuring software can be intimidating if you are not an IT nerd. And this&lt;br /&gt;
is no exception with SoundSense. But bear with me and it can actually be pretty easy.&lt;br /&gt;
&lt;br /&gt;
Non-scary instructions:&lt;br /&gt;
&lt;br /&gt;
* Install the java runtime&lt;br /&gt;
* Download and extract SoundSense (It does not matter where.)&lt;br /&gt;
* Download soundpack.zip and extract the &amp;quot;packs&amp;quot; folder to SoundSense directory&lt;br /&gt;
* Run soundsense.cmd or soundsense.exe&lt;br /&gt;
&lt;br /&gt;
First, you need to have the java runtime installed. It can be downloaded from the java &lt;br /&gt;
homepage. To determine if your computer already has the correct installation of java, go &lt;br /&gt;
to the Start button, left click &amp;quot;Run...&amp;quot; from the bottom of the menu, type in &amp;quot;cmd&amp;quot; in the &lt;br /&gt;
dialog that opens, and press the [OK] button. A dark windows pops up and you will be at a &lt;br /&gt;
command prompt. Type in &amp;quot;java -version&amp;quot; and press [Enter].&lt;br /&gt;
&lt;br /&gt;
A few lines starting with [java version &amp;quot;1.6.0_14&amp;quot;] or something similar should apear. If &lt;br /&gt;
that case is the case, you are good to go. But if you see [java version &amp;quot;1.5.x_xx&amp;quot; or an &lt;br /&gt;
earlier version (lower number), you will need to download and install the latest java.&lt;br /&gt;
&lt;br /&gt;
If something similar to ['java' is not recognized as an internal or external command] &lt;br /&gt;
appears, either java has not been installed yet or it was not installed correctly. If &lt;br /&gt;
your case is the latter, it may be possible to work around the problem by editing the &lt;br /&gt;
soundSense.cmd (in your SoundSense directory). Open it with Notepad and find line line &lt;br /&gt;
starting with &amp;quot;java -Dja...&amp;quot; and replace the &amp;quot;java&amp;quot; part with the full path for your java &lt;br /&gt;
installation. For example: &amp;quot;C:\Program Files\Java\jdk1.6.0_20\bin\java.exe&amp;quot;&lt;br /&gt;
&lt;br /&gt;
That was the hard part.&lt;br /&gt;
&lt;br /&gt;
Now, where to install it? SoundSense expects to be in a sub-directory that is inside your &lt;br /&gt;
Dwarf Fortress directory. So, for example, if you have Dwarf Fortress in F:/df_31_18_win/,&lt;br /&gt;
you should unpack the contents of SoundSense zip to F:/df_31_18_win/soundsense/. By &lt;br /&gt;
default, you want to make sure that the .cmd file you use to launch SoundSense is inside a &lt;br /&gt;
sub-directory of (i.e., below) the DF folder where gamelog.txt is located.&lt;br /&gt;
&lt;br /&gt;
If you want to install to a different location, you need to edit configuration.xml and &lt;br /&gt;
edit the &amp;lt;gamelog path=&amp;quot;../gamelog.txt&amp;quot;/&amp;gt; line. Replace &amp;quot;../gamelog.txt&amp;quot; with the path to &lt;br /&gt;
where Dwarf Fortress is located. For example: &amp;quot;F:/df_31_18_win/gamelog.txt&amp;quot;&lt;br /&gt;
&lt;br /&gt;
SoundSense is now all set up and ready to run. But you still need the actual sounds and &lt;br /&gt;
music that it will play. So download soundpack.zip and unzip the &amp;quot;packs&amp;quot; directory and all &lt;br /&gt;
the contents inside that to the SoundSense directory.&lt;br /&gt;
&lt;br /&gt;
You can start SoundSense by launching (double left-clicking) either soundSense.cmd or &lt;br /&gt;
soundSenseExe.cmd. (Using the latter should give you clearer error messages regarding a &lt;br /&gt;
bad java installation.) If you like, you can create a shortcut to soundSense.cmd, rename &lt;br /&gt;
it &amp;quot;SoundSense&amp;quot; and move it to your desktop for easy access.&lt;br /&gt;
&lt;br /&gt;
Finally, remember that SoundSense needs to run in the background. Ideally, you should &lt;br /&gt;
start SoundSense BEFORE you start Dwarf Fortress.&lt;br /&gt;
&lt;br /&gt;
==Known Issues==&lt;br /&gt;
&lt;br /&gt;
===Moments of Silence===&lt;br /&gt;
&lt;br /&gt;
Occationally, the music in SoundSense will stop for a short period (10, 20, or 30 seconds) &lt;br /&gt;
before resuming. This is not a bug - it is intentional. This was done to let ears rest a &lt;br /&gt;
bit between tracks. (Research shows that ears which get a rest have time to recover and &lt;br /&gt;
are less likely to be damaged.) Also, a few tracks have a silent start and, at low volume, &lt;br /&gt;
may take a minute or longer to become audible. If in doubt, you can see what is currently &lt;br /&gt;
playing in GUI under the volume slider. During periods of silence, this will typically &lt;br /&gt;
show &amp;quot;10s silence&amp;quot; or similar.&lt;br /&gt;
&lt;br /&gt;
===Game Loads and the Music is Random===&lt;br /&gt;
&lt;br /&gt;
When a game is loaded, SoundSense picks a random seasonal music track to play. This is not &lt;br /&gt;
a bug - it is intentional. There is no way for SoundSense to detect what season it is when &lt;br /&gt;
a game is loaded, so a random soundtrack is chosen. But when the season next changes, it &lt;br /&gt;
will choose the correct soundtrack.&lt;br /&gt;
&lt;br /&gt;
===Adventure Mode - A Bit Lacking===&lt;br /&gt;
&lt;br /&gt;
Adventure Mode kind of works. The battle sounds function quite well because they are &lt;br /&gt;
mostly the same as those in Fortress Mode. But SoundSense is still a bit lacking in other &lt;br /&gt;
adventure sounds. The problem is that Adventure Mode does not log many other usefull &lt;br /&gt;
events. For example, encountering a megabeast or a quest mob is resolved in chat, leaving &lt;br /&gt;
no message in the game log to trigger SoundSense.&lt;br /&gt;
&lt;br /&gt;
Improvements in how DF handles logging could benfit both SoundSense and DF as a whole. &lt;br /&gt;
Such suggestions have already been posted in the official Dwarf Fortress forums: &lt;br /&gt;
http://www.bay12forums.com/smf/index.php?topic=64834.0&lt;br /&gt;
&lt;br /&gt;
===Event Detection: Better Late Than Never?===&lt;br /&gt;
&lt;br /&gt;
In some cases, by the time SoundSense detects conditions to trigger an alert, it may be &lt;br /&gt;
too late to react to the situation. For example, a &amp;quot;Tantrum Spiral&amp;quot; might already be over &lt;br /&gt;
before the player can be alerted.&lt;br /&gt;
&lt;br /&gt;
Part of this is a balance between detecting too many false positives and ignoring events &lt;br /&gt;
until it is too late to do anything. For example, a soldier might lose a pet and report &lt;br /&gt;
feeling like blowing off some steam... but instead of throwing a tantrum they calm down.&lt;br /&gt;
&lt;br /&gt;
Another problem is FPS sensitivity. A specific sequence of events may trigger certain &lt;br /&gt;
alert sounds in a high FPS situation, but it might not trigger with low FPS. The sequence &lt;br /&gt;
of events might &amp;quot;time out&amp;quot;. Also, pausing the game could cause similar problems.&lt;br /&gt;
&lt;br /&gt;
===Compatible With DF Mods - Should Work, But NO PROMISES===&lt;br /&gt;
&lt;br /&gt;
SoundSense was mainly designed for &amp;quot;vanilla&amp;quot; (unmodified) Dwarf Fortress. It should work &lt;br /&gt;
fine with most mods. However, I can not guarantee compatibility. Some mods, especially &lt;br /&gt;
&amp;quot;major&amp;quot; or &amp;quot;full conversions&amp;quot;, may create unusual behavior and involve dangerous events &lt;br /&gt;
that SoundSense was not designed to detect.&lt;br /&gt;
&lt;br /&gt;
Another words, SoundSense may lack sounds for certain mod-specific events. (E.g.; you &lt;br /&gt;
should NOT expect SoundSense to include gunshot sounds for mods that add guns! But you CAN &lt;br /&gt;
modify SoundSense yourself to do this.) Conversely, some events that work normally in &lt;br /&gt;
vanilla DF may trigger so frequently with a mod as to be very annoying.&lt;br /&gt;
&lt;br /&gt;
===On some Linux===&lt;br /&gt;
&lt;br /&gt;
====Error on 'soundSense.sh' call: &amp;quot;/bin/sh^M : wrong interpret&amp;quot;====&lt;br /&gt;
&lt;br /&gt;
File &amp;quot;soundSense.sh&amp;quot; has CR+LF characters at lines ending.&lt;br /&gt;
Convert these characters to a more suitable form, with a tool like &amp;quot;[http://en.wikipedia.org/wiki/Unix2dos dos2unix]&amp;quot;:&lt;br /&gt;
  dos2unix soundSense.sh&lt;br /&gt;
Shell script should then be run without previous error.&lt;br /&gt;
&lt;br /&gt;
Also using sed you can try this:&lt;br /&gt;
  # IN UNIX ENVIRONMENT: convert DOS newlines (CR/LF) to Unix format.&lt;br /&gt;
  sed -i -e 's/\r$//' ./soundSense.sh&lt;br /&gt;
IF launching .sh file after that, says that something is wrong on the last line, when you try to launch sh. Just check, if &amp;quot;fi&amp;quot; is present there instead of &amp;quot;f&amp;quot; or smth like that.&lt;br /&gt;
&lt;br /&gt;
====Error at playing any MP3 file: &amp;quot;javax.sound.sampled.UnsupportedAudioFileException: could not get audio input stream from input file: could not get audio input stream from input file&amp;quot;====&lt;br /&gt;
&lt;br /&gt;
Your Java virtual machine failed at reading MP3 files as audio stream. This could fix by adding to JVM an extra plugin: [http://www.oracle.com/technetwork/java/javase/download-137625.html JMF MP3 Plugin].&lt;br /&gt;
Download plugin, and put *.jar files into your JVM &amp;quot;lib/ext/&amp;quot; directory.&lt;br /&gt;
&lt;br /&gt;
====Error at playing any MP3 file: &amp;quot;javax.sound.sampled.LineUnavailableException: Audio Device Unavailable&amp;quot;====&lt;br /&gt;
&lt;br /&gt;
Whereas your JVM succeeded in reading MP3 file as audio stream, it failed to access to an audio device. If your audio system uses [http://fr.wikipedia.org/wiki/Advanced_Linux_Sound_Architecture Alsa], you could install &amp;quot;aoss&amp;quot; utility, and &amp;quot;soundSense.sh&amp;quot; will call it. On Debian, package &amp;quot;alsa-oss&amp;quot; provides this utility.&lt;br /&gt;
&lt;br /&gt;
====Goddammit I'm using pulseaudio and I still can't hear anything!====&lt;br /&gt;
&lt;br /&gt;
Try to install osspd OR use padsp wrapper. While padsp wrapper wouldn't work everytime for me, osspd daemon worked just fine. (''[https://wiki.archlinux.org/index.php/Pulseaudio#OSS Archlinux Pulseaudio user]'')&lt;br /&gt;
&lt;br /&gt;
===Any Other Issues? Post Feedback===&lt;br /&gt;
&lt;br /&gt;
There is a thread at the official Dwarf Fortress forums. Feel free to post any issues, &lt;br /&gt;
suggestions, and contributions there:&lt;br /&gt;
http://www.bay12forums.com/smf/index.php?topic=60287.0&lt;br /&gt;
&lt;br /&gt;
When providing feedback about your experience with SoundSense, please specify which mods &lt;br /&gt;
(if any) you are using. If SoundSense seems to behave weirdly only for you, it just might &lt;br /&gt;
be from using certain mods.&lt;br /&gt;
&lt;br /&gt;
==Customization==&lt;br /&gt;
&lt;br /&gt;
You can insert additional sounds and music into SoundSense by adding entries to an .xml &lt;br /&gt;
configuration file. logPattern=&amp;quot;regexp&amp;quot; is a regular expression which, if matched, will &lt;br /&gt;
cause a random soundFile from a list to be played. (Details on how java uses regular &lt;br /&gt;
expressions: http://java.sun.com/j2se/1.4.2/docs/api/java/util/regex/Pattern.html )&lt;br /&gt;
&lt;br /&gt;
===Sound element attributes:===&lt;br /&gt;
&lt;br /&gt;
* logPattern - regular expression matching log line (see link above)&lt;br /&gt;
* channel - string; Specifies a channel on which sound is played. Sounds played on a &lt;br /&gt;
channel can be looped or stopped prematurely.&lt;br /&gt;
* loop - string; Specifying &amp;quot;start&amp;quot; will start looping a sound on a channel until an &lt;br /&gt;
expression with &amp;quot;stop&amp;quot; is triggered or until a different loop sound is played on the same &lt;br /&gt;
channel. (If a non-looped sound is triggered on the same channel, this loop will resume &lt;br /&gt;
when the non-looped is done playing.)&lt;br /&gt;
* concurency - number; The number of concurrent (i.e., simultaneous) sounds allowed to be &lt;br /&gt;
played besides this sound. If SoundSense is currently playing more than this, the sound is &lt;br /&gt;
ignored. The default is unlimited.&lt;br /&gt;
* timeout - number; This initiates a time out during which this particular sound is &lt;br /&gt;
prevented from playing again. This is measured in milliseconds and the default is 0.&lt;br /&gt;
* delay - number; Adds a delay before the sound is played. This is measured in &lt;br /&gt;
milliseconds and the default is 0.&lt;br /&gt;
* haltOnMatch - boolean; If this is set to True and more than one equivalent logPattern &lt;br /&gt;
exists, SoundSense will only process the first logPattern expression. If it is False, it &lt;br /&gt;
will continue to process matching (e.g., identical) logPatterns. The default is True.&lt;br /&gt;
* speech - boolean; If this is set to True, SoundSense will echo the gamelog text line &lt;br /&gt;
(containing the logPattern) with a speech synthesizer instead of playing a sound. The &lt;br /&gt;
default is False.&lt;br /&gt;
* playbackThreshhold - number, 0-4, defines level of filter which is applied to this sound.&lt;br /&gt;
&lt;br /&gt;
===SoundFile element attributes:===&lt;br /&gt;
&lt;br /&gt;
* fileName - the path to and name of the sound/music file&lt;br /&gt;
* weight - number; This controls the likelihood of a sound being chosen. Default is 100.&lt;br /&gt;
* volumeAdjustment - number; This can be used to adjust the volume of the sample. The &lt;br /&gt;
value can range from -40 to +6 decibles and the default is 0.&lt;br /&gt;
* randomBalance - boolean, if set to true will randomply distribute sound betweem stereo channels.&lt;br /&gt;
* balanceAdjustment - number, adjusts stereo channel, can range for -1 (full left) to 1 (full right).&lt;br /&gt;
&lt;br /&gt;
SoundSense supports these audio formats for soundFiles:&lt;br /&gt;
&lt;br /&gt;
* mp3   (SoundSense can normalize the sound volume with this format)&lt;br /&gt;
* ogg   (works, but SoundSense can not normalize the sound volume)&lt;br /&gt;
* wav   (See note below. SoundSense only supports &amp;quot;Windows PCM&amp;quot; encoded .wav files)&lt;br /&gt;
* aiff&lt;br /&gt;
* au&lt;br /&gt;
&lt;br /&gt;
Note: Not all .wav files are supported...&lt;br /&gt;
&lt;br /&gt;
SoundSense supports .wav encoded in the &amp;quot;Windows PCM&amp;quot; format. However, some files with the &lt;br /&gt;
.wav extention are actually encoded in some other proprietary format. A sound format &lt;br /&gt;
conversion utility (such as FormatFactory) could be used to fix them.&lt;br /&gt;
&lt;br /&gt;
===Some Tips:===&lt;br /&gt;
&lt;br /&gt;
* Control of Randomness - Each logPattern expression can contain several soundFile elements. When it is triggered, one of them is randomly chosen to play. You can control the probability of each sound being chosen by adding the weight=&amp;quot;number&amp;quot; attribute.&lt;br /&gt;
* Simultaneous Sounds - By default, only one sound will play for a given logPattern, even if there are several expression using identical logPatterns. (Only the first expression is processed.) But you can allow more than one sound to be played for same pattern by giving the first one the haltOnMatch=&amp;quot;false&amp;quot; attribute. They will all start at same time (unless one or more of them also has a delay). An example is in Seasons.&lt;br /&gt;
* Sequential Sounds - Two (or more) sounds can be played sequentially (one after the other) for the same logPattern by using the haltOnMatch=&amp;quot;false&amp;quot; tip above and including a delay attribute for one of them with a delay that surpasses the length of the other.&lt;br /&gt;
&lt;br /&gt;
===Helpful files:===&lt;br /&gt;
&lt;br /&gt;
 * packSkeletons.zip ( http://df.zweistein.cz/soundsense/packSkeletons.zip ) - This &lt;br /&gt;
contains .xml files for all known gamelog lines currently without sounds. You can use this &lt;br /&gt;
as a starting point to expand SoundSense.&lt;br /&gt;
 * missingMessages.cmd - Run this program to parse your gamelog.txt file and output all &lt;br /&gt;
lines your sound packs will not recognize.&lt;br /&gt;
 * logging.properties - Edit this file to enable more debug messages from SoundSense. Set &lt;br /&gt;
&amp;quot;.level = ALL&amp;quot; to view a very verbose output.&lt;br /&gt;
&lt;br /&gt;
===Sources of sound &amp;amp; music:===&lt;br /&gt;
&lt;br /&gt;
The following are some sites of interest, should you want additional sounds/music.&lt;br /&gt;
(Websites with free, creative commons, public domain, and/or GNU GPL licensed audio):&lt;br /&gt;
&lt;br /&gt;
http://soundbible.com/&lt;br /&gt;
http://www.freesound.org/searchText.php&lt;br /&gt;
http://www.musopen.org/&lt;br /&gt;
http://opengameart.org/browse/audio&lt;br /&gt;
http://www.incompetech.com/m/c/royalty-free/&lt;br /&gt;
http://ccmixter.org&lt;br /&gt;
http://free-loops.com/&lt;br /&gt;
http://www.pdsounds.org/&lt;br /&gt;
http://commons.wikimedia.org/wiki/Category:Sound&lt;br /&gt;
http://www.archive.org/details/opensource_audio&lt;br /&gt;
http://publicdomainaudiovideo.blogspot.com/&lt;/div&gt;</summary>
		<author><name>Vyznev</name></author>
	</entry>
	<entry>
		<id>https://dwarffortresswiki.org/index.php?title=Utility:SoundSense&amp;diff=152806</id>
		<title>Utility:SoundSense</title>
		<link rel="alternate" type="text/html" href="https://dwarffortresswiki.org/index.php?title=Utility:SoundSense&amp;diff=152806"/>
		<updated>2011-09-03T20:02:08Z</updated>

		<summary type="html">&lt;p&gt;Vyznev: /* Error on 'soundSense.sh' call: &amp;quot;/bin/sh^M : wrong interpret&amp;quot; */ use \r in sed command to make it safe even if there are bare LFs&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=SoundSense=&lt;br /&gt;
&lt;br /&gt;
Discussion: http://www.bay12forums.com/smf/index.php?topic=60287.0&lt;br /&gt;
Homepage: http://df.zweistein.cz/soundsense/&lt;br /&gt;
&lt;br /&gt;
==Installation==&lt;br /&gt;
&lt;br /&gt;
Installing and configuring software can be intimidating if you are not an IT nerd. And this&lt;br /&gt;
is no exception with SoundSense. But bear with me and it can actually be pretty easy.&lt;br /&gt;
&lt;br /&gt;
Non-scary instructions:&lt;br /&gt;
&lt;br /&gt;
* Install the java runtime&lt;br /&gt;
* Download and extract SoundSense (It does not matter where.)&lt;br /&gt;
* Download soundpack.zip and extract the &amp;quot;packs&amp;quot; folder to SoundSense directory&lt;br /&gt;
* Run soundsense.cmd or soundsense.exe&lt;br /&gt;
&lt;br /&gt;
First, you need to have the java runtime installed. It can be downloaded from the java &lt;br /&gt;
homepage. To determine if your computer already has the correct installation of java, go &lt;br /&gt;
to the Start button, left click &amp;quot;Run...&amp;quot; from the bottom of the menu, type in &amp;quot;cmd&amp;quot; in the &lt;br /&gt;
dialog that opens, and press the [OK] button. A dark windows pops up and you will be at a &lt;br /&gt;
command prompt. Type in &amp;quot;java -version&amp;quot; and press [Enter].&lt;br /&gt;
&lt;br /&gt;
A few lines starting with [java version &amp;quot;1.6.0_14&amp;quot;] or something similar should apear. If &lt;br /&gt;
that case is the case, you are good to go. But if you see [java version &amp;quot;1.5.x_xx&amp;quot; or an &lt;br /&gt;
earlier version (lower number), you will need to download and install the latest java.&lt;br /&gt;
&lt;br /&gt;
If something similar to ['java' is not recognized as an internal or external command] &lt;br /&gt;
appears, either java has not been installed yet or it was not installed correctly. If &lt;br /&gt;
your case is the latter, it may be possible to work around the problem by editing the &lt;br /&gt;
soundSense.cmd (in your SoundSense directory). Open it with Notepad and find line line &lt;br /&gt;
starting with &amp;quot;java -Dja...&amp;quot; and replace the &amp;quot;java&amp;quot; part with the full path for your java &lt;br /&gt;
installation. For example: &amp;quot;C:\Program Files\Java\jdk1.6.0_20\bin\java.exe&amp;quot;&lt;br /&gt;
&lt;br /&gt;
That was the hard part.&lt;br /&gt;
&lt;br /&gt;
Now, where to install it? SoundSense expects to be in a sub-directory that is inside your &lt;br /&gt;
Dwarf Fortress directory. So, for example, if you have Dwarf Fortress in F:/df_31_18_win/,&lt;br /&gt;
you should unpack the contents of SoundSense zip to F:/df_31_18_win/soundsense/. By &lt;br /&gt;
default, you want to make sure that the .cmd file you use to launch SoundSense is inside a &lt;br /&gt;
sub-directory of (i.e., below) the DF folder where gamelog.txt is located.&lt;br /&gt;
&lt;br /&gt;
If you want to install to a different location, you need to edit configuration.xml and &lt;br /&gt;
edit the &amp;lt;gamelog path=&amp;quot;../gamelog.txt&amp;quot;/&amp;gt; line. Replace &amp;quot;../gamelog.txt&amp;quot; with the path to &lt;br /&gt;
where Dwarf Fortress is located. For example: &amp;quot;F:/df_31_18_win/gamelog.txt&amp;quot;&lt;br /&gt;
&lt;br /&gt;
SoundSense is now all set up and ready to run. But you still need the actual sounds and &lt;br /&gt;
music that it will play. So download soundpack.zip and unzip the &amp;quot;packs&amp;quot; directory and all &lt;br /&gt;
the contents inside that to the SoundSense directory.&lt;br /&gt;
&lt;br /&gt;
You can start SoundSense by launching (double left-clicking) either soundSense.cmd or &lt;br /&gt;
soundSenseExe.cmd. (Using the latter should give you clearer error messages regarding a &lt;br /&gt;
bad java installation.) If you like, you can create a shortcut to soundSense.cmd, rename &lt;br /&gt;
it &amp;quot;SoundSense&amp;quot; and move it to your desktop for easy access.&lt;br /&gt;
&lt;br /&gt;
Finally, remember that SoundSense needs to run in the background. Ideally, you should &lt;br /&gt;
start SoundSense BEFORE you start Dwarf Fortress.&lt;br /&gt;
&lt;br /&gt;
==Known Issues==&lt;br /&gt;
&lt;br /&gt;
===Moments of Silence===&lt;br /&gt;
&lt;br /&gt;
Occationally, the music in SoundSense will stop for a short period (10, 20, or 30 seconds) &lt;br /&gt;
before resuming. This is not a bug - it is intentional. This was done to let ears rest a &lt;br /&gt;
bit between tracks. (Research shows that ears which get a rest have time to recover and &lt;br /&gt;
are less likely to be damaged.) Also, a few tracks have a silent start and, at low volume, &lt;br /&gt;
may take a minute or longer to become audible. If in doubt, you can see what is currently &lt;br /&gt;
playing in GUI under the volume slider. During periods of silence, this will typically &lt;br /&gt;
show &amp;quot;10s silence&amp;quot; or similar.&lt;br /&gt;
&lt;br /&gt;
===Game Loads and the Music is Random===&lt;br /&gt;
&lt;br /&gt;
When a game is loaded, SoundSense picks a random seasonal music track to play. This is not &lt;br /&gt;
a bug - it is intentional. There is no way for SoundSense to detect what season it is when &lt;br /&gt;
a game is loaded, so a random soundtrack is chosen. But when the season next changes, it &lt;br /&gt;
will choose the correct soundtrack.&lt;br /&gt;
&lt;br /&gt;
===Adventure Mode - A Bit Lacking===&lt;br /&gt;
&lt;br /&gt;
Adventure Mode kind of works. The battle sounds function quite well because they are &lt;br /&gt;
mostly the same as those in Fortress Mode. But SoundSense is still a bit lacking in other &lt;br /&gt;
adventure sounds. The problem is that Adventure Mode does not log many other usefull &lt;br /&gt;
events. For example, encountering a megabeast or a quest mob is resolved in chat, leaving &lt;br /&gt;
no message in the game log to trigger SoundSense.&lt;br /&gt;
&lt;br /&gt;
Improvements in how DF handles logging could benfit both SoundSense and DF as a whole. &lt;br /&gt;
Such suggestions have already been posted in the official Dwarf Fortress forums: &lt;br /&gt;
http://www.bay12forums.com/smf/index.php?topic=64834.0&lt;br /&gt;
&lt;br /&gt;
===Event Detection: Better Late Than Never?===&lt;br /&gt;
&lt;br /&gt;
In some cases, by the time SoundSense detects conditions to trigger an alert, it may be &lt;br /&gt;
too late to react to the situation. For example, a &amp;quot;Tantrum Spiral&amp;quot; might already be over &lt;br /&gt;
before the player can be alerted.&lt;br /&gt;
&lt;br /&gt;
Part of this is a balance between detecting too many false positives and ignoring events &lt;br /&gt;
until it is too late to do anything. For example, a soldier might lose a pet and report &lt;br /&gt;
feeling like blowing off some steam... but instead of throwing a tantrum they calm down.&lt;br /&gt;
&lt;br /&gt;
Another problem is FPS sensitivity. A specific sequence of events may trigger certain &lt;br /&gt;
alert sounds in a high FPS situation, but it might not trigger with low FPS. The sequence &lt;br /&gt;
of events might &amp;quot;time out&amp;quot;. Also, pausing the game could cause similar problems.&lt;br /&gt;
&lt;br /&gt;
===Compatible With DF Mods - Should Work, But NO PROMISES===&lt;br /&gt;
&lt;br /&gt;
SoundSense was mainly designed for &amp;quot;vanilla&amp;quot; (unmodified) Dwarf Fortress. It should work &lt;br /&gt;
fine with most mods. However, I can not guarantee compatibility. Some mods, especially &lt;br /&gt;
&amp;quot;major&amp;quot; or &amp;quot;full conversions&amp;quot;, may create unusual behavior and involve dangerous events &lt;br /&gt;
that SoundSense was not designed to detect.&lt;br /&gt;
&lt;br /&gt;
Another words, SoundSense may lack sounds for certain mod-specific events. (E.g.; you &lt;br /&gt;
should NOT expect SoundSense to include gunshot sounds for mods that add guns! But you CAN &lt;br /&gt;
modify SoundSense yourself to do this.) Conversely, some events that work normally in &lt;br /&gt;
vanilla DF may trigger so frequently with a mod as to be very annoying.&lt;br /&gt;
&lt;br /&gt;
===On some Linux===&lt;br /&gt;
&lt;br /&gt;
====Error on 'soundSense.sh' call: &amp;quot;/bin/sh^M : wrong interpret&amp;quot;====&lt;br /&gt;
&lt;br /&gt;
File &amp;quot;soundSense.sh&amp;quot; has CR+LF characters at lines ending.&lt;br /&gt;
Convert these characters to a more suitable form, with a tool like &amp;quot;[http://en.wikipedia.org/wiki/Unix2dos dos2unix]&amp;quot;:&lt;br /&gt;
  dos2unix soundSense.sh&lt;br /&gt;
Shell script should then be run without previous error.&lt;br /&gt;
&lt;br /&gt;
Also using sed you can try this:&lt;br /&gt;
  # IN UNIX ENVIRONMENT: convert DOS newlines (CR/LF) to Unix format.&lt;br /&gt;
  sed -i -e 's/\r$//' ./soundSense.sh&lt;br /&gt;
IF launching .sh file after that, says that something is wrong on the last line, when you try to launch sh. Just check, if &amp;quot;fi&amp;quot; is present there instead of &amp;quot;f&amp;quot; or smth like that.&lt;br /&gt;
&lt;br /&gt;
====Error at playing any MP3 file: &amp;quot;javax.sound.sampled.UnsupportedAudioFileException: could not get audio input stream from input file: could not get audio input stream from input file&amp;quot;====&lt;br /&gt;
&lt;br /&gt;
Your Java virtual machine failed at reading MP3 files as audio stream. This could fix by adding to JVM an extra plugin: [http://www.oracle.com/technetwork/java/javase/download-137625.html JMF MP3 Plugin].&lt;br /&gt;
Download plugin, and put *.jar files into your JVM &amp;quot;lib/ext/&amp;quot; directory.&lt;br /&gt;
&lt;br /&gt;
====Error at playing any MP3 file: &amp;quot;javax.sound.sampled.LineUnavailableException: Audio Device Unavailable&amp;quot;====&lt;br /&gt;
&lt;br /&gt;
Whereas your JVM succeeded in reading MP3 file as audio stream, it failed to access to an audio device. If your audio system uses [http://fr.wikipedia.org/wiki/Advanced_Linux_Sound_Architecture Alsa], you could install &amp;quot;aoss&amp;quot; utility, and &amp;quot;soundSense.sh&amp;quot; will call it. On Debian, package &amp;quot;alsa-oss&amp;quot; provides this utility.&lt;br /&gt;
&lt;br /&gt;
====Goddammit I'm using pulseaudio and I still can't hear anything!====&lt;br /&gt;
&lt;br /&gt;
Try to install osspd OR use padsp wrapper. While padsp wrapper wouldn't work everytime for me, osspd daemon worked just fine. (''[https://wiki.archlinux.org/index.php/Pulseaudio#OSS Archlinux Pulseaudio user]'')&lt;br /&gt;
&lt;br /&gt;
===Any Other Issues? Post Feedback===&lt;br /&gt;
&lt;br /&gt;
There is a thread at the official Dwarf Fortress forums. Feel free to post any issues, &lt;br /&gt;
suggestions, and contributions there:&lt;br /&gt;
http://www.bay12forums.com/smf/index.php?topic=60287.0&lt;br /&gt;
&lt;br /&gt;
When providing feedback about your experience with SoundSense, please specify which mods &lt;br /&gt;
(if any) you are using. If SoundSense seems to behave weirdly only for you, it just might &lt;br /&gt;
be from using certain mods.&lt;br /&gt;
&lt;br /&gt;
==Customization==&lt;br /&gt;
&lt;br /&gt;
You can insert additional sounds and music into SoundSense by adding entries to an .xml &lt;br /&gt;
configuration file. logPattern=&amp;quot;regexp&amp;quot; is a regular expression which, if matched, will &lt;br /&gt;
cause a random soundFile from a list to be played. (Details on how java uses regular &lt;br /&gt;
expressions: http://java.sun.com/j2se/1.4.2/docs/api/java/util/regex/Pattern.html )&lt;br /&gt;
&lt;br /&gt;
===Sound element attributes:===&lt;br /&gt;
&lt;br /&gt;
* logPattern - regular expression matching log line (see link above)&lt;br /&gt;
* channel - string; Specifies a channel on which sound is played. Sounds played on a &lt;br /&gt;
channel can be looped or stopped prematurely.&lt;br /&gt;
* loop - string; Specifying &amp;quot;start&amp;quot; will start looping a sound on a channel until an &lt;br /&gt;
expression with &amp;quot;stop&amp;quot; is triggered or until a different loop sound is played on the same &lt;br /&gt;
channel. (If a non-looped sound is triggered on the same channel, this loop will resume &lt;br /&gt;
when the non-looped is done playing.)&lt;br /&gt;
* concurency - number; The number of concurrent (i.e., simultaneous) sounds allowed to be &lt;br /&gt;
played besides this sound. If SoundSense is currently playing more than this, the sound is &lt;br /&gt;
ignored. The default is unlimited.&lt;br /&gt;
* timeout - number; This initiates a time out during which this particular sound is &lt;br /&gt;
prevented from playing again. This is measured in milliseconds and the default is 0.&lt;br /&gt;
* delay - number; Adds a delay before the sound is played. This is measured in &lt;br /&gt;
milliseconds and the default is 0.&lt;br /&gt;
* haltOnMatch - boolean; If this is set to True and more than one equivalent logPattern &lt;br /&gt;
exists, SoundSense will only process the first logPattern expression. If it is False, it &lt;br /&gt;
will continue to process matching (e.g., identical) logPatterns. The default is True.&lt;br /&gt;
* speech - boolean; If this is set to True, SoundSense will echo the gamelog text line &lt;br /&gt;
(containing the logPattern) with a speech synthesizer instead of playing a sound. The &lt;br /&gt;
default is False.&lt;br /&gt;
* playbackThreshhold - number, 0-4, defines level of filter which is applied to this sound.&lt;br /&gt;
&lt;br /&gt;
===SoundFile element attributes:===&lt;br /&gt;
&lt;br /&gt;
* fileName - the path to and name of the sound/music file&lt;br /&gt;
* weight - number; This controls the likelihood of a sound being chosen. Default is 100.&lt;br /&gt;
* volumeAdjustment - number; This can be used to adjust the volume of the sample. The &lt;br /&gt;
value can range from -40 to +6 decibles and the default is 0.&lt;br /&gt;
* randomBalance - boolean, if set to true will randomply distribute sound betweem stereo channels.&lt;br /&gt;
* balanceAdjustment - number, adjusts stereo channel, can range for -1 (full left) to 1 (full right).&lt;br /&gt;
&lt;br /&gt;
SoundSense supports these audio formats for soundFiles:&lt;br /&gt;
&lt;br /&gt;
* mp3   (SoundSense can normalize the sound volume with this format)&lt;br /&gt;
* ogg   (works, but SoundSense can not normalize the sound volume)&lt;br /&gt;
* wav   (See note below. SoundSense only supports &amp;quot;Windows PCM&amp;quot; encoded .wav files)&lt;br /&gt;
* aiff&lt;br /&gt;
* au&lt;br /&gt;
&lt;br /&gt;
Note: Not all .wav files are supported...&lt;br /&gt;
&lt;br /&gt;
SoundSense supports .wav encoded in the &amp;quot;Windows PCM&amp;quot; format. However, some files with the &lt;br /&gt;
.wav extention are actually encoded in some other proprietary format. A sound format &lt;br /&gt;
conversion utility (such as FormatFactory) could be used to fix them.&lt;br /&gt;
&lt;br /&gt;
===Some Tips:===&lt;br /&gt;
&lt;br /&gt;
* Control of Randomness - Each logPattern expression can contain several soundFile &lt;br /&gt;
elements. When it is triggered, one of them is randomly chosen to play. You can control &lt;br /&gt;
the probability of each sound being chosen by adding the weight=&amp;quot;number&amp;quot; attribute.&lt;br /&gt;
&lt;br /&gt;
* Simultaneous Sounds - By default, only one sound will play for a given logPattern, even &lt;br /&gt;
if there are several expression using identical logPatterns. (Only the first expression is &lt;br /&gt;
processed.) But you can allow more than one sound to be played for same pattern by giving &lt;br /&gt;
the first one the haltOnMatch=&amp;quot;false&amp;quot; attribute. They will all start at same time (unless &lt;br /&gt;
one or more of them also has a delay). An example is in Seasons.&lt;br /&gt;
&lt;br /&gt;
* Sequential Sounds - Two (or more) sounds can be played sequentially (one after the &lt;br /&gt;
other) for the same logPattern by using the haltOnMatch=&amp;quot;false&amp;quot; tip above and including a &lt;br /&gt;
delay attribute for one of them with a delay that surpasses the length of the other.&lt;br /&gt;
&lt;br /&gt;
===Helpful files:===&lt;br /&gt;
&lt;br /&gt;
 * packSkeletons.zip ( http://df.zweistein.cz/soundsense/packSkeletons.zip ) - This &lt;br /&gt;
contains .xml files for all known gamelog lines currently without sounds. You can use this &lt;br /&gt;
as a starting point to expand SoundSense.&lt;br /&gt;
 * missingMessages.cmd - Run this program to parse your gamelog.txt file and output all &lt;br /&gt;
lines your sound packs will not recognize.&lt;br /&gt;
 * logging.properties - Edit this file to enable more debug messages from SoundSense. Set &lt;br /&gt;
&amp;quot;.level = ALL&amp;quot; to view a very verbose output.&lt;br /&gt;
&lt;br /&gt;
===Sources of sound &amp;amp; music:===&lt;br /&gt;
&lt;br /&gt;
The following are some sites of interest, should you want additional sounds/music.&lt;br /&gt;
(Websites with free, creative commons, public domain, and/or GNU GPL licensed audio):&lt;br /&gt;
&lt;br /&gt;
http://soundbible.com/&lt;br /&gt;
http://www.freesound.org/searchText.php&lt;br /&gt;
http://www.musopen.org/&lt;br /&gt;
http://opengameart.org/browse/audio&lt;br /&gt;
http://www.incompetech.com/m/c/royalty-free/&lt;br /&gt;
http://ccmixter.org&lt;br /&gt;
http://free-loops.com/&lt;br /&gt;
http://www.pdsounds.org/&lt;br /&gt;
http://commons.wikimedia.org/wiki/Category:Sound&lt;br /&gt;
http://www.archive.org/details/opensource_audio&lt;br /&gt;
http://publicdomainaudiovideo.blogspot.com/&lt;/div&gt;</summary>
		<author><name>Vyznev</name></author>
	</entry>
</feed>