packages feed

spade-0.1.0.9: docs/functions/sound.md

### Sound Functions

#### makesound

Prepares a sound sample using a callback. The callback should accept
an integer value, and return a sample value.

The samples should be a floating point value between -1 and 1.

The sampling frequency is 44100 Hz.

#### maketone

Prepares a sound sample of the frequency given in the argument.


#### loadsound

Loads a sound from the WAV file at path provided in the argument.

#### playsound

Plays the sample prepared by `loadsound` or `maketone` or `makesound`
at the given channel. There are 8 available channels.

Example:

```
graphics()
let s = maketone(255) -- Make a tone of frequency 255
playsound(s, 0) -- Play it on channel 0
waitforkey()
```

#### setvolume

Sets the sound volume of the channel specified by the first argument.
The volume is specified in the second argument, as a value from 0 to 128.

#### setvolumelr

Sets the sound volume of the channel specified by the first argument.
The left, right volumes are specified using the second and thrird arguments, as a value from 0 to 128.