#hs.sound
Load/play/manipulate sound files
#API Overview
Functions - API calls offered directly by the extension
Constructors - API calls which return an object, typically one that offers API methods
Methods - API calls which can only be made on an object returned by a constructor
#API Documentation
#Functions
Signature | hs.sound.getAudioEffectNames() -> table |
Type | Function |
Description | Gets a table of installed Audio Units Effect names. |
Parameters |
|
Returns |
|
Notes |
|
Examples | None |
Source | extensions/sound/libsound.m line 62 |
Signature | hs.sound.soundFileTypes() -> table |
Type | Function |
Description | Gets the supported sound file types |
Parameters |
|
Returns |
|
Notes |
|
Examples | None |
Source | extensions/sound/libsound.m line 200 |
Signature | hs.sound.soundTypes() -> table |
Type | Function |
Description | Gets the supported UTI sound file formats |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | extensions/sound/libsound.m line 184 |
Signature | hs.sound.systemSounds() -> table |
Type | Function |
Description | Gets a table of available system sounds |
Parameters |
|
Returns |
|
Notes |
|
Examples | None |
Source | extensions/sound/libsound.m line 150 |
#Constructors
Signature | hs.sound.getByFile(path) -> sound or nil |
Type | Constructor |
Description | Creates an hs.sound object from a file |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | extensions/sound/libsound.m line 128 |
Signature | hs.sound.getByName(name) -> sound or nil |
Type | Constructor |
Description | Creates an hs.sound object from a named sound |
Parameters |
|
Returns |
|
Notes |
|
Examples | None |
Source | extensions/sound/libsound.m line 103 |
#Methods
Signature | hs.sound:currentTime([seekTime]) -> soundObject | seconds |
Type | Method |
Description | Get or set the current seek offset within an hs.sound object. |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | extensions/sound/libsound.m line 435 |
Signature | hs.sound:device([deviceUID]) -> soundObject | UID string |
Type | Method |
Description | Get or set the playback device to use for an hs.sound object |
Parameters |
|
Returns |
|
Notes |
|
Examples | None |
Source | extensions/sound/libsound.m line 400 |
Signature | hs.sound:duration() -> seconds |
Type | Method |
Description | Gets the length of an hs.sound object |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | extensions/sound/libsound.m line 457 |
Signature | hs.sound:isPlaying() -> bool |
Type | Method |
Description | Gets the current playback state of an hs.sound object |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | extensions/sound/libsound.m line 496 |
Signature | hs.sound:loopSound([loop]) -> soundObject | bool |
Type | Method |
Description | Get or set the looping behaviour of an hs.sound object |
Parameters |
|
Returns |
|
Notes |
|
Examples | None |
Source | extensions/sound/libsound.m line 316 |
Signature | hs.sound:name([soundName]) -> soundObject | name string |
Type | Method |
Description | Get or set the name of an hs.sound object |
Parameters |
|
Returns |
|
Notes |
|
Examples | None |
Source | extensions/sound/libsound.m line 370 |
Signature | hs.sound:pause() -> soundObject | bool |
Type | Method |
Description | Pauses an hs.sound object |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | extensions/sound/libsound.m line 253 |
Signature | hs.sound:play() -> soundObject | bool |
Type | Method |
Description | Plays an hs.sound object |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | extensions/sound/libsound.m line 228 |
Signature | hs.sound:resume() -> soundObject | bool |
Type | Method |
Description | Resumes playing a paused hs.sound object |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | extensions/sound/libsound.m line 274 |
Signature | hs.sound:setCallback(function) -> soundObject |
Type | Method |
Description | Set or remove the callback for receiving completion notification for the sound object. |
Parameters |
|
Returns |
|
Notes |
|
Examples | None |
Source | extensions/sound/libsound.m line 513 |
Signature | hs.sound:stop() -> soundObject | bool |
Type | Method |
Description | Stops playing an hs.sound object |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | extensions/sound/libsound.m line 295 |
Signature | hs.sound:stopOnReload([stopOnReload]) -> soundObject | bool |
Type | Method |
Description | Get or set whether a sound should be stopped when Hammerspoon reloads its configuration |
Parameters |
|
Returns |
|
Notes |
|
Examples | None |
Source | extensions/sound/libsound.m line 341 |
Signature | hs.sound:volume([level]) -> soundObject | number |
Type | Method |
Description | Get or set the playback volume of an hs.sound object |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | extensions/sound/libsound.m line 474 |