npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@aflr/audiostack

v1.1.7

Published

Audiostack Javascript SDK

Downloads

354

Readme

📝 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

  • https://github.com/timcoggins

📝 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()