# SoundResource

Kind: Class · Namespace: Sansar.Simulation · Assembly: Sansar.Simulation.dll · Script API 47.10.0

<div class="api-meta">
<span class="api-kind api-kind-class" data-pagefind-filter="kind:Class">Class</span>
<span data-pagefind-filter="namespace:Sansar.Simulation">Namespace <a href="/scripting/api/sansar.simulation"><code>Sansar.Simulation</code></a></span>
<span>Inherits <a href="/scripting/api/sansar.script/instanceinterface">Sansar.Script.InstanceInterface</a></span>
</div>

<span id="T:Sansar.Simulation.SoundResource"></span>

The SoundResource class represents a sound that could be added to the scene.

```csharp
public class SoundResource : Sansar.Script.InstanceInterface
```

## Members at a glance

| Kind | Members |
|---|---|
| **Methods** | [GetDurationInSeconds](#getdurationinseconds) · [GetName](#getname) |

## Methods

### GetDurationInSeconds

<div class="api-card">
<span id="M:Sansar.Simulation.SoundResource.GetDurationInSeconds"></span>
<span id="M:Sansar.Simulation.SoundResource.GetDurationInSeconds()"></span>

```csharp signature
public float GetDurationInSeconds()
```

Returns the duration in seconds.

**Returns:** [float](https://learn.microsoft.com/dotnet/api/system.single)

</div>

### GetName

<div class="api-card">
<span id="M:Sansar.Simulation.SoundResource.GetName"></span>
<span id="M:Sansar.Simulation.SoundResource.GetName()"></span>

```csharp signature
public string GetName()
```

Returns the name of the resource.

**Returns:** [string](https://learn.microsoft.com/dotnet/api/system.string)

</div>


## Used in examples

- [BanHammerExample.cs](https://github.com/Wookey-Technologies/sansar-script-starter/blob/66af8b516b701088d043e4615acfcf5779356604/examples/official/BanHammerExample.cs)
- [EventExample.cs](https://github.com/Wookey-Technologies/sansar-script-starter/blob/66af8b516b701088d043e4615acfcf5779356604/examples/official/EventExample.cs)
- [PewPewExample.cs](https://github.com/Wookey-Technologies/sansar-script-starter/blob/66af8b516b701088d043e4615acfcf5779356604/examples/official/PewPewExample.cs)
- [ScriptLibrary/Scene/Sound.cs](https://github.com/Wookey-Technologies/sansar-script-starter/blob/66af8b516b701088d043e4615acfcf5779356604/examples/official/ScriptLibrary/Scene/Sound.cs)

<p class="api-generated" data-pagefind-ignore>Generated from the Sansar 47.10.0 client ScriptApi snapshot.</p>