https://github.com/miyako/4d-plugin-sfml-audio
Record and play back wave audio
https://github.com/miyako/4d-plugin-sfml-audio
4d-plugin audio
Last synced: over 1 year ago
JSON representation
Record and play back wave audio
- Host: GitHub
- URL: https://github.com/miyako/4d-plugin-sfml-audio
- Owner: miyako
- License: mit
- Created: 2017-06-27T00:40:49.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2021-11-28T02:14:57.000Z (over 4 years ago)
- Last Synced: 2025-01-08T17:57:02.260Z (over 1 year ago)
- Topics: 4d-plugin, audio
- Language: C++
- Homepage:
- Size: 56 MB
- Stars: 0
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README


[](LICENSE)

# 4d-plugin-sfml-audio
Record and play wave audio.
Using [Simple and Fast Multimedia Library](https://www.sfml-dev.org/index.php).
Updated to SFML ``2.5.1``
The plugin can **play** one audio file at a time. Support file formats are ``WAV``, ``OGG/Vorbis``, and ``FLAC``. You can load the data using either ``IMPORT AUDIO FILE`` or ``SOUND SET DATA``.
The plugin can **record** from one audio capture device at a time. Every time the recording is stopped, a BLOB of sampling frames is returned. You can concatenate such BLOBs with ``COPY BLOB``. When done, use the ``EXPORT AUDIO FILE`` command to create a ``WAV``, ``OGG/Vorbis``, or ``FLAC`` file.
### Remarks for Apple Silicon
* accept arm64 as valid architecture (or just fix in Xcode)
```
# only the default architecture (i.e. 64-bit) is supported
if(NOT CMAKE_OSX_ARCHITECTURES STREQUAL "arm64")
message(FATAL_ERROR "Only 64-bit architecture is supported")
endif()
```
* fetch codec bottles
```
brew fetch --bottle-tag=arm64_big_sur libao
brew fetch --bottle-tag=arm64_big_sur libogg
brew fetch --bottle-tag=arm64_big_sur libvorbis
brew fetch --bottle-tag=arm64_big_sur flac
```
### Screenshot

## Syntax
```
GET RECORDING DEVICES (devices)
```
Parameter|Type|Description
------------|------------|----
devices|ARRAY TEXT|
```
device:=Get default recording device
```
Parameter|Type|Description
------------|------------|----
device|TEXT|
```
error:=SOUND Start recording (params)
```
Parameter|Type|Description
------------|------------|----
params|TEXT|JSON
error|LONGINT|``-1`` if recording is not available
```
data:=SOUND Stop recording (params)
```
Parameter|Type|Description
------------|------------|----
params|TEXT|JSON
data|BLOB|Sample frame data (array of ``Int16``)
```
SOUND STOP
SOUND PAUSE
SOUND PLAY
```
```
SOUND SET DATA (data)
data:=SOUND Get data
```
Parameter|Type|Description
------------|------------|----
data|BLOB|``WAV``, ``OGG/Vorbis``, or ``FLAC`` data
```
SOUND SET PITCH (pitch)
pitch:=SOUND Get pitch
```
Parameter|Type|Description
------------|------------|----
pitch|REAL|Perceived fundamental frequency of a sound. Default is ``1``. Changing the pitch modifies the playing speed too.
```
SOUND SET VOLUME (volume)
volume:=SOUND Get volume
```
Parameter|Type|Description
------------|------------|----
volume|REAL|Volume between ``0`` (mute) and ``100`` (full volume).
```
SOUND SET POSITION (position)
position:=SOUND Get position
```
Parameter|Type|Description
------------|------------|----
position|LONGINT|Current playing position milliseconds
```
IMPORT AUDIO FILE (path;data)
```
Parameter|Type|Description
------------|------------|----
path|TEXT|
```
EXPORT AUDIO FILE (path;data;sampleRate;channelCount)
```
Parameter|Type|Description
------------|------------|----
path|TEXT|
data|BLOB|Sample frame data (array of ``Int16``)
sampleRate|LONGINT|
channelCount|LONGINT|
```
status:=SOUND Get status
```
Parameter|Type|Description
------------|------------|----
status|LONGINT|``Sound status stopped 0``, ``Sound status paused 1``, ``Sound status playing 2``
```
SOUND SET LOOP (loop)
loop:=SOUND Get loop
```
Parameter|Type|Description
------------|------------|----
loop|LONGINT|
duration:=SOUND Get duration
Parameter|Type|Description
------------|------------|----
duration|LONGINT|Duration in milliseconds
```
sampleRate:=SOUND Get sample rate
```
Parameter|Type|Description
------------|------------|----
sampleRate|LONGINT|
```
channelCount:=SOUND Get channel count
```
Parameter|Type|Description
------------|------------|----
channelCount|LONGINT|