-
-
Notifications
You must be signed in to change notification settings - Fork 12
Writing Wave Files
spessasus edited this page Aug 7, 2024
·
2 revisions
SpessaSynth has a helper function for writing wave files.
Converts an audio buffer into a fully valid wave file.
const file = audioBufferToWav(audioBuffer, normalizeAudio = true, channelOffset = 0, metadata = {});
-
audioBuffer
-AudioBuffer
- the buffer to write. -
normalizeAudio
- optionalboolean
- if true, the gain of the entire song will be adjusted so the max sample is always 32767 or min is always -32768 (whichever is greater). Recommended. -
channelOffset
- optionalnumber
- if the buffer has more than 2 channels, you can specify the channel offset to use. This is especially useful in one output mode -
metadata
- optionalObject
described below. All options are string and are optional:-
title
- the song's title -
artist
- the song's artist -
album
- the song's album -
genre
- the song's genre
-
The metadata uses the INFO
chunk to write the information. It is encoded with utf-8
.
Tip
If you encounter any errors in this documentation, please open an issue!
Warning
Make sure you always update worklet_processor.min.js
along with the npm package!