Procedural Engine Sound

From TrainzOnline
(Difference between revisions)
Jump to: navigation, search
(Created page with "Procedural Engine Sound synthesis is achieved through use of the Graph Editor. The Graph Editor is a pre-release feature of Trainz. It has been discussed publicly in the T...")
 
 
(One intermediate revision by one user not shown)
Line 3: Line 3:
 
This feature is only usable within the Graph Editor for now, however as development continues it will obviously be possible to use the result from within the game environment as well.
 
This feature is only usable within the Graph Editor for now, however as development continues it will obviously be possible to use the result from within the game environment as well.
  
 +
= Simple Synthesiser Tutorial =
 
To create a sound synthesiser graph, select an existing Engine Sound asset and open it in the Graph Editor. The following steps allow you to create an extremely trivial synthesiser:
 
To create a sound synthesiser graph, select an existing Engine Sound asset and open it in the Graph Editor. The following steps allow you to create an extremely trivial synthesiser:
  
Line 13: Line 14:
 
* Connect the "Constant" node output to the right input of the "Sampler" node. This determines the playback rate for the sampler.
 
* Connect the "Constant" node output to the right input of the "Sampler" node. This determines the playback rate for the sampler.
 
* Add an "Output" node at the bottom of the graph panel.
 
* Add an "Output" node at the bottom of the graph panel.
* Connect the "Sampler" node output to the "Output" node input.
+
* Connect the leftmost "Sampler" node output to the "Output" node input.
  
 
At this point, you should begin to hear the idle sound playing. You can adjust the "constant" value to vary the playback rate of the sample. You should adjust your system volume (outside Trainz) to a comfortable level since you're going to be hearing a lot of repeating (and sometimes uncomfortable) sounds while editing the graph. You can also temporarily disconnect the sound output by clicking on the input connector of the "Output" node for some peace and quiet while making changes. Any changes you make to the graph will take effect immediately.
 
At this point, you should begin to hear the idle sound playing. You can adjust the "constant" value to vary the playback rate of the sample. You should adjust your system volume (outside Trainz) to a comfortable level since you're going to be hearing a lot of repeating (and sometimes uncomfortable) sounds while editing the graph. You can also temporarily disconnect the sound output by clicking on the input connector of the "Output" node for some peace and quiet while making changes. Any changes you make to the graph will take effect immediately.
  
 
Since there are no true external inputs in the editing environment, you can simulate any inputs (such as throttle notch, or train velocity) by creating "Constant" nodes and adjusting their values on demand.
 
Since there are no true external inputs in the editing environment, you can simulate any inputs (such as throttle notch, or train velocity) by creating "Constant" nodes and adjusting their values on demand.
 +
 +
[[File:Simple Procedural Engine Sound sample.png]]
 +
 +
= Sound Synthesis Nodes =
 +
A number of Node Types have been created for working with sound data and processing logic states. These are for testing purposes and by no means reflect the final functionality of the Procedural Engine Sound system.
 +
 +
== Output Node ==
 +
 +
The Output Node offers a single input. It reads sound waveform data from the input and plays it through the computer's sound output device. Only one output node should be present in each Procedural Engine Sound graph; if multiple outputs are desired then these should be mixed by the graph logic and fed into the single output node.
 +
 +
Future Plans: none.
 +
 +
 +
== Sample Node ==
 +
 +
The Sample Node offers a single output. It reads sound waveform data from a specified file on disk. A "WAV File" property is available to indicate the name of the wav file to read from disk.
 +
 +
Future Plans: none.
 +
 +
 +
== Sampler Node ==
 +
 +
The Sampler Node offers two inputs (the sample and a playback rate) and two outputs (the waveform and a wrap trigger). Playback rate can be varied in realtime between 0.0 and 10.0. The wrap trigger output is normally zero, but spikes high whenever the input wraps. This can be used to stop playback at the end of the parent sound sample, for example.
 +
 +
Future Plans: none.
 +
 +
 +
== Math Node ==
 +
 +
The Math Node offers two inputs and one output, and performs a simple mathematical operation (*, /, +, -) on the inputs. An "Output Scale" property can also be used to further scale the result.
 +
 +
Future Plans:
 +
* Additional input nodes to allow multiple operations from a single node (for example, mixing several input values rather than just two).
 +
 +
 +
== Constant Node ==
 +
 +
The Constant Node offers a single output, which remains at a constant value. The "constant" property can be modified in the editor in order to adjust the output value.
 +
 +
Future Plans:
 +
* A similar "Input" node which acts as a real input binding when used in-game, but which provides a "constant"-like function when used in the Graph Editor. Input nodes should offer some form of switch/dial user interface within the Graph panel to allow rapid adjustment within a defined range for testing purposes. For now, the "constant" node can do all of this albeit with a little more effort on the part of the user.
 +
 +
 +
== Threshold Node ==
 +
 +
The threshold node is probably obsolete; it offers no real advantages over the Map Node. It performs mapping between input and output values as defined by its properties.
 +
 +
Future Plans:
 +
* This node type will likely be removed.
 +
 +
 +
== Toggle Node ==
 +
 +
The toggle node allows for a flip-flop logic operation. It offers two inputs ("set" and "reset") and one output. At any given time the node is either "high" or "low". When the "set" input is pulled high, the toggle switches into the "high" state. When the "reset" input is pulled high, the toggle switches into the "low" state.
 +
 +
Additional "Auto Trigger" and "Auto Reset" values exist which cause the toggle to swap into the specified state after a specified number of seconds in the opposite state; a zero duration here disables the timed effect.
 +
 +
Under normal operation, the output value is determined based on the high/low state and the "Low Value" / "High Value" properties. An "Output Spike Only" property causes the output to instead spike the intended value but immediate return to zero.
 +
 +
Future Plans:
 +
* Unknown, but we can probably take this one further.
 +
 +
 +
== Map Node ==
 +
 +
The map node allows a custom mapping to be created. The mapping is edited by double clicking on the Node, clicking the "Edit" button, then drawing on the map. The horizontal axis corresponds with the input value. The vertical axis defines the corresponding output value. The map node also offers properties defining the range of the input values; values outside this range are clamped.
 +
 +
Future Plans:
 +
* Improved user interface.
 +
* Multiple outputs, with a single input having multiple output mappings.
 +
 +
 +
== Meter Node ==
 +
 +
The meter node displays the current value of its input. This is used for diagnostic purposes within the Graph Editor; it has no runtime effect.
 +
 +
Future Plans:
 +
* Improved user interface.
 +
 +
 +
= Limitations and Work-in-Progress =
 +
 +
The implementation of both the Graph Editor and the Procedural Engine Sound synthesis nodes is a prototype only. There are many obvious features which would need to be present in a final implementation which are currently missing. The system lacks any polish whatsoever; it is simply a minimal implementation necessary to test various concepts. Many instructions, labels, and other user interface components are missing from what would be expected of a final implementation.

Latest revision as of 16:32, 10 January 2017

Procedural Engine Sound synthesis is achieved through use of the Graph Editor. The Graph Editor is a pre-release feature of Trainz. It has been discussed publicly in the TrainzDev forums and is summarised on this page, however users should understand that no release schedule has been provided for this feature. All discussions and details are speculative in nature and may not accurately reflect the final form of this feature.

This feature is only usable within the Graph Editor for now, however as development continues it will obviously be possible to use the result from within the game environment as well.

Contents

[edit] Simple Synthesiser Tutorial

To create a sound synthesiser graph, select an existing Engine Sound asset and open it in the Graph Editor. The following steps allow you to create an extremely trivial synthesiser:

  • Create a new "Sample" node near the top left of the graph panel.
  • Edit the "WAV File" property on the "Sample" node to "idle 1.wav" (it is assumed that your Engine Sound asset already contains this file).
  • Create a new "Constant" node near the top right of the graph panel.
  • Edit the "Constant" property of the "Constant" node to "1.0".
  • Add a "Sampler" node in the center of the graph panel.
  • Connect the "Sample" node output to the left input of the "Sampler" node. This determines the input waveform for the sampler.
  • Connect the "Constant" node output to the right input of the "Sampler" node. This determines the playback rate for the sampler.
  • Add an "Output" node at the bottom of the graph panel.
  • Connect the leftmost "Sampler" node output to the "Output" node input.

At this point, you should begin to hear the idle sound playing. You can adjust the "constant" value to vary the playback rate of the sample. You should adjust your system volume (outside Trainz) to a comfortable level since you're going to be hearing a lot of repeating (and sometimes uncomfortable) sounds while editing the graph. You can also temporarily disconnect the sound output by clicking on the input connector of the "Output" node for some peace and quiet while making changes. Any changes you make to the graph will take effect immediately.

Since there are no true external inputs in the editing environment, you can simulate any inputs (such as throttle notch, or train velocity) by creating "Constant" nodes and adjusting their values on demand.

Simple Procedural Engine Sound sample.png

[edit] Sound Synthesis Nodes

A number of Node Types have been created for working with sound data and processing logic states. These are for testing purposes and by no means reflect the final functionality of the Procedural Engine Sound system.

[edit] Output Node

The Output Node offers a single input. It reads sound waveform data from the input and plays it through the computer's sound output device. Only one output node should be present in each Procedural Engine Sound graph; if multiple outputs are desired then these should be mixed by the graph logic and fed into the single output node.

Future Plans: none.


[edit] Sample Node

The Sample Node offers a single output. It reads sound waveform data from a specified file on disk. A "WAV File" property is available to indicate the name of the wav file to read from disk.

Future Plans: none.


[edit] Sampler Node

The Sampler Node offers two inputs (the sample and a playback rate) and two outputs (the waveform and a wrap trigger). Playback rate can be varied in realtime between 0.0 and 10.0. The wrap trigger output is normally zero, but spikes high whenever the input wraps. This can be used to stop playback at the end of the parent sound sample, for example.

Future Plans: none.


[edit] Math Node

The Math Node offers two inputs and one output, and performs a simple mathematical operation (*, /, +, -) on the inputs. An "Output Scale" property can also be used to further scale the result.

Future Plans:

  • Additional input nodes to allow multiple operations from a single node (for example, mixing several input values rather than just two).


[edit] Constant Node

The Constant Node offers a single output, which remains at a constant value. The "constant" property can be modified in the editor in order to adjust the output value.

Future Plans:

  • A similar "Input" node which acts as a real input binding when used in-game, but which provides a "constant"-like function when used in the Graph Editor. Input nodes should offer some form of switch/dial user interface within the Graph panel to allow rapid adjustment within a defined range for testing purposes. For now, the "constant" node can do all of this albeit with a little more effort on the part of the user.


[edit] Threshold Node

The threshold node is probably obsolete; it offers no real advantages over the Map Node. It performs mapping between input and output values as defined by its properties.

Future Plans:

  • This node type will likely be removed.


[edit] Toggle Node

The toggle node allows for a flip-flop logic operation. It offers two inputs ("set" and "reset") and one output. At any given time the node is either "high" or "low". When the "set" input is pulled high, the toggle switches into the "high" state. When the "reset" input is pulled high, the toggle switches into the "low" state.

Additional "Auto Trigger" and "Auto Reset" values exist which cause the toggle to swap into the specified state after a specified number of seconds in the opposite state; a zero duration here disables the timed effect.

Under normal operation, the output value is determined based on the high/low state and the "Low Value" / "High Value" properties. An "Output Spike Only" property causes the output to instead spike the intended value but immediate return to zero.

Future Plans:

  • Unknown, but we can probably take this one further.


[edit] Map Node

The map node allows a custom mapping to be created. The mapping is edited by double clicking on the Node, clicking the "Edit" button, then drawing on the map. The horizontal axis corresponds with the input value. The vertical axis defines the corresponding output value. The map node also offers properties defining the range of the input values; values outside this range are clamped.

Future Plans:

  • Improved user interface.
  • Multiple outputs, with a single input having multiple output mappings.


[edit] Meter Node

The meter node displays the current value of its input. This is used for diagnostic purposes within the Graph Editor; it has no runtime effect.

Future Plans:

  • Improved user interface.


[edit] Limitations and Work-in-Progress

The implementation of both the Graph Editor and the Procedural Engine Sound synthesis nodes is a prototype only. There are many obvious features which would need to be present in a final implementation which are currently missing. The system lacks any polish whatsoever; it is simply a minimal implementation necessary to test various concepts. Many instructions, labels, and other user interface components are missing from what would be expected of a final implementation.

Personal tools