1.1.7 • Published 14 days ago

@aflr/audiostack v1.1.7

Weekly downloads
-
License
MIT
Repository
github
Last release
14 days ago

📝 Table of Contents

🧐 About

This repository is actively maintained by AudioStack. For examples, recipes and api reference see the AudioStack docs. Feel free to get in touch with any questions or feedback!

🧑‍💻 Maintainers

📝 License

This project is licensed under the MIT License

📖 Changelog

You can view here our updated Changelog.

🏁 Getting Started

Installation

To install the SDK into your project, run the following command:

npm install @aflr/audiostack

# or

yarn install @aflr/audiostack

Authentication

This library needs to be configured with your account's api-key which is available in Audiostack Platform.

Configuration

Once you have your api-key, you can configure a new instance of Audiostack by using:

// CommonJS Syntax
const { Audiostack } = require("@aflr/audiostack");

// Create a new instance of Audiostack
const AS = new Audiostack("your_api_key");

You may also use the ES6 syntax:

// ES6 Module Syntax
import { Audiostack } from '@aflr/audiostack';

// Create a new instance of Audiostack
const AS = new Audiostack("your_api_key");

You can now use the Audiostack instance to access the API.

🚀 Hello World

Try it out on StackBlitz: https://stackblitz.com/edit/node-rwvl9n?file=example.js

In a new directory, run the following command to initalize a new project with NPM:

npm init -y

Install the SDK:

npm install @aflr/audiostack

Create a new file called example.ts and add the following code with your api key:

// 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: "<as:section soundSegment=main>Hello from Audiostack. This is a test script. I hope you enjoy it.</as:section>",
    });

    // 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: "funky_summer",
    });

    // 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();

To run the example, run the following command:

node example.js

Reference - Currently Available:

const AS = new AudioStack(apiKey, {options})

Content

Script

AS.Content.Script.create()
AS.Content.Script.get()
AS.Content.Script.update()
AS.Content.Script.list()
AS.Content.Script.listProjects()
AS.Content.Script.listModules()
AS.Content.Script.generateAdvert()
AS.Content.Script.editAdvert()

Recommend

AS.Content.Recommend.recommendBestMatch()
AS.Content.Recommend.recommendMood()
AS.Content.Recommend.recommendTone()

ScriptItem

Item.update()
Item.delete()

AdItem

Item.getScriptItem()
Item.delete()

File

AS.Content.File.createFolder()
AS.Content.File.getFolder()
AS.Content.File.deleteFolder()
AS.Content.File.createFile()
AS.Content.File.createAndUploadFile()
AS.Content.File.getFile()
AS.Content.File.editFile()
AS.Content.File.deleteFile()
AS.Content.File.search()

FolderItem

Item.createFile()
Item.createAndUploadFile()
Item.createFolder()
Item.update()
Item.delete()

FileItem

Item.update()
Item.edit()
Item.download()

FileUploadItem

Item.upload()

Media (deprecated)

AS.Content.Media.create()
AS.Content.Media.createUploadUrl()
AS.Content.Media.get()
AS.Content.Media.delete()
AS.Content.Media.list()

MediaItem (deprecated)

Item.delete()
Item.download()

Speech

Voice

AS.Speech.Voice.list()
AS.Speech.Voice.getVoiceData()
AS.Speech.Voice.getParameters()
AS.Speech.Voice.select()
Tts
AS.Speech.Tts.create()
AS.Speech.Tts.createSection()
AS.Speech.Tts.fastPreview()
AS.Speech.Tts.get()
AS.Speech.Tts.delete()
AS.Speech.Tts.list()
AS.Speech.Tts.reduceLength()
AS.Speech.Tts.removeSilence()
AS.Speech.Tts.annotate()

TtsItem

Item.download()
Item.delete()

Predict

AS.Speech.Predict.listVoices()
AS.Speech.Predict.predictLength()

Diction

AS.Speech.Diction.list()
AS.Speech.Diction.listCustom()
AS.Speech.Diction.listCustomWords()
AS.Speech.Diction.createWord()
AS.Speech.Diction.deleteWord()

VoiceClone

AS.Speech.VoiceClone.createInstantClone()

Production

Mix

AS.Production.Mix.create()
AS.Production.Mix.validate()
AS.Production.Mix.get()
AS.Production.Mix.delete()
AS.Production.Mix.list()
AS.Production.Mix.listPresets()

MixItem

Item.download()
Item.delete()

Sound

AS.Production.Sound.list()
AS.Production.Sound.get()
AS.Production.Sound.select()
AS.Production.Sound.create()
AS.Production.Sound.delete()
AS.Production.Sound.addSoundSegment()

Suite

AS.Production.Suite.evaluate()

Delivery

Encoder

AS.Delivery.Encoder.encodeMix()
AS.Delivery.EncoderlistPresets()

EncoderItem

Item.download() 
1.1.7

14 days ago

1.1.6

1 month ago

1.1.5

1 month ago

1.1.4

2 months ago

1.1.3

2 months ago

1.1.1

2 months ago

1.1.2

2 months ago

1.1.0

2 months ago

1.0.11

2 months ago

1.0.10

2 months ago

1.0.9

3 months ago

1.0.8

3 months ago

1.0.6

3 months ago

1.0.5

4 months ago

1.0.4

5 months ago

1.0.3

5 months ago

1.0.2

6 months ago

1.0.1

6 months ago

1.0.0

6 months ago

0.0.11

10 months ago

0.0.12

10 months ago

0.0.13

9 months ago

0.0.14

8 months ago

0.0.15

7 months ago

0.0.10

11 months ago

0.0.9

12 months ago

0.0.8

12 months ago

0.0.7

12 months ago

0.0.6

1 year ago

0.0.5

1 year ago

0.0.4

1 year ago

0.0.3

1 year ago

0.0.2

1 year ago

0.0.1

1 year ago