21st April - The JS SDK!
JavaScript SDK
After launching AudioStack API & Python SDK, we've continuously worked on more features to free up your engineering resources. Now you can easily integrate our API using our new JS SDK, a lightweight library that makes it easy to create professional audio assets within seconds.
We've design it to simplify the coding process - create a script, choose one of our 600+ voices, add a sound design and voila - you can encode your audio file as a high quality mp3 and download it. This allows you to focus on creating great audio experiences without having to worry about the underlying code. π π―
https://www.npmjs.com/package/@aflr/audiostack You can find it on NPM here
You can see an example here - https://stackblitz.com/edit/node-rwvl9n?file=example.js
How to install it!
npm install @aflr/audiostack
# or
yarn install @aflr/audiostack
How to use it
/**
* Audiostack Hello World Example
*
* Add your API key on line 12 and run
* node example.js
*/
// Import the library
const { Audiostack } = require('@aflr/audiostack');
// Provide your api key from the Audiostack Console
const apiKey = 'your_api_key';
/**
* This example demonstrates how to produce and download a file using the Audiostack API.
*/
const example = async () => {
// Create a new instance of Audiostack
const AS = new Audiostack(apiKey);
// Create a script asset with our hello text
const script = await AS.Content.Script.create({
scriptText:
'Hello from Audiostack. This is a test script. I hope you enjoy it.',
});
// Create a speech asset using our script and the voice "sara"
const tts = await AS.Speech.Tts.create({
scriptId: script.scriptId,
voice: 'sara',
});
// Create a mix with our speech asset and add the sound template "3am"
const mix = await AS.Production.Mix.create({
speechId: tts.speechId,
soundTemplate: '3am',
});
// Encode the file to high quality mp3
const encode = await AS.Delivery.Encoder.encodeMix({
productionId: mix.productionId,
preset: 'mp3_high',
});
// Download the file to the project directory
const path = await encode.download();
// Print the path to the file
console.log(`File downloaded to: ${path}`);
};
// Run the example
example();
We look forward to seeing feedback and seeing what YOU build with our SDK.