On this page
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
getAudioEffectNames
Signature | hs.sound.getAudioEffectNames() -> table |
---|---|
Type | Function |
Description | Gets a table of installed Audio Units Effect names. |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/sound/libsound.m line 62 |
soundFileTypes
Signature | hs.sound.soundFileTypes() -> table |
---|---|
Type | Function |
Description | Gets the supported sound file types |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/sound/libsound.m line 200 |
soundTypes
Signature | hs.sound.soundTypes() -> table |
---|---|
Type | Function |
Description | Gets the supported UTI sound file formats |
Parameters |
|
Returns |
|
Source | extensions/sound/libsound.m line 184 |
systemSounds
Signature | hs.sound.systemSounds() -> table |
---|---|
Type | Function |
Description | Gets a table of available system sounds |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/sound/libsound.m line 150 |
Constructors
getByFile
Signature | hs.sound.getByFile(path) -> sound or nil |
---|---|
Type | Constructor |
Description | Creates an |
Parameters |
|
Returns |
|
Source | extensions/sound/libsound.m line 128 |
getByName
Signature | hs.sound.getByName(name) -> sound or nil |
---|---|
Type | Constructor |
Description | Creates an |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/sound/libsound.m line 103 |
Methods
currentTime
Signature | hs.sound:currentTime([seekTime]) -> soundObject | seconds |
---|---|
Type | Method |
Description | Get or set the current seek offset within an |
Parameters |
|
Returns |
|
Source | extensions/sound/libsound.m line 435 |
device
Signature | hs.sound:device([deviceUID]) -> soundObject | UID string |
---|---|
Type | Method |
Description | Get or set the playback device to use for an |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/sound/libsound.m line 400 |
duration
Signature | hs.sound:duration() -> seconds |
---|---|
Type | Method |
Description | Gets the length of an |
Parameters |
|
Returns |
|
Source | extensions/sound/libsound.m line 457 |
isPlaying
Signature | hs.sound:isPlaying() -> bool |
---|---|
Type | Method |
Description | Gets the current playback state of an |
Parameters |
|
Returns |
|
Source | extensions/sound/libsound.m line 496 |
loopSound
Signature | hs.sound:loopSound([loop]) -> soundObject | bool |
---|---|
Type | Method |
Description | Get or set the looping behaviour of an |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/sound/libsound.m line 316 |
name
Signature | hs.sound:name([soundName]) -> soundObject | name string |
---|---|
Type | Method |
Description | Get or set the name of an |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/sound/libsound.m line 370 |
pause
Signature | hs.sound:pause() -> soundObject | bool |
---|---|
Type | Method |
Description | Pauses an |
Parameters |
|
Returns |
|
Source | extensions/sound/libsound.m line 253 |
play
Signature | hs.sound:play() -> soundObject | bool |
---|---|
Type | Method |
Description | Plays an |
Parameters |
|
Returns |
|
Source | extensions/sound/libsound.m line 228 |
resume
Signature | hs.sound:resume() -> soundObject | bool |
---|---|
Type | Method |
Description | Resumes playing a paused |
Parameters |
|
Returns |
|
Source | extensions/sound/libsound.m line 274 |
setCallback
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 |
|
Source | extensions/sound/libsound.m line 513 |
stop
Signature | hs.sound:stop() -> soundObject | bool |
---|---|
Type | Method |
Description | Stops playing an |
Parameters |
|
Returns |
|
Source | extensions/sound/libsound.m line 295 |
stopOnReload
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 |
|
Source | extensions/sound/libsound.m line 341 |
volume
Signature | hs.sound:volume([level]) -> soundObject | number |
---|---|
Type | Method |
Description | Get or set the playback volume of an |
Parameters |
|
Returns |
|
Source | extensions/sound/libsound.m line 474 |
© 2014–2017 Hammerspoon contributors
Licensed under the MIT License.
https://www.hammerspoon.org/docs/hs.sound.html