## Sample(filename)

Constructor

#### # new Sample(filename)

Load a WAV-file.

##### Parameters:

Name | Type | Description
--- | --- | ---
`filename` | `string` |

# Members

Type: `number`

#### # bits

Sound resolution.

Type: `string`

#### # filename

Name of the WAV.

Type: `number`

#### # frequency

Sound frequency.

Type: `number`

#### # length

Sound length.

Type: `bool`

#### # stereo

mono/stereo indicator.

# Methods

#### # Get(idx) → {number}

Get sample data.

##### Parameters:

Name | Type | Description
--- | --- | ---
`idx` | `number` | index to return.

Returns:

The sample value at that position. The sample data are always in unsigned format.

Type: `number`

#### # Play(volume, panning, loop) → {number}

Play the WAV.

##### Parameters:

Name | Type | Description
--- | --- | ---
`volume` | `number` | between 0-255.
`panning` | `number` | between (left) 0-255 (right).
`loop` | `boolean` | true := sample will loop, false := sample will only be played once.

Returns:

used voice number or null if not played.

Type: `number`

#### # Stop()

Stop playing.