0.0.19 • Published 2 days ago

@aitube/clap v0.0.19

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

@aitube/clap

Types and helpers to manipulate .clap files

Introduction

This library is used to manipulate Clap files, the file format used to describe AI scenes for AiTube.

It in an open interchange format that other people can use freely for their own projects.

Design and capabilities

A Clap file (.clap) is a compressed YAML stream of documents that describe all aspects of a scene.

(to be continued)

Roadmap

  • Create a DRAFT for the specification
  • Use it in production
  • First working implementation for NodeJS

Implementations:

  • C++ library (for native binding): TODO
  • Python (in progress): py-aitube-clap
  • NodeJS (released): aitube-clap
  • Swift: TODO
  • G TODO
  • Java TODO
  • Haskell TODO

Installation

To install the package, run the following command:

npm install @aitube/clap

Getting Started

import {
  // types
  ClapSegmentCategory,
  ClapOutputType,
  ClapSegmentStatus,
  ClapAuthor,
  ClapAssetSource,
  ClapEntityGender,
  ClapEntityAppearance,
  ClapEntityRegion,
  ClapEntityTimbre,
  ClapEntityAudioEngine,
  ClapSegmentFilteringMode,
  ClapVoice,
  ClapHeader,
  ClapMeta,
  ClapSceneEvent,
  ClapScene,
  ClapSegment,
  ClapEntity,
  ClapProject, 
  ClapMediaOrientation,

// defaults
  defaultMediaOrientation,

  // factories
  newClap,
  newEntity,
  newSegment,

  // main input/output handlers
  parseClap,
  serializeClap,
  fetchClap,
  updateClap,

  // utilities
  filterSegments,
  filterSegmentsWithinRange,
  generateSeed,
  getClapAssetSourceType,
  getValidNumber,
  isValidNumber,
  parseMediaOrientation,
  parseOutputType,
  parseSegmentCategory,
  parseSegmentStatus,
  UUID,

  // converters
  blobToDataUri,
  dataUriToBlob,
  clapToDataUri,

  // helpers
  generateClapFromSimpleStory,
  getEmptyClap,
  buildEntityIndex
} from "@aitube/clap"


// fetch a Clap file
const res = await fetch("https://..../file.clap")
const file = await res.blob()

// open the Clap file
const clap: ClapProject = await parseClap(file)

// perform arbitrary changes in the project

clap.segments.at(64).assetUrl = await generateVideoWithAI(....)

const segment: ClapSegment = clap.segments.at(42)
segment.prompt = "a camel in the desert, medium-shot, award-winning, 4k, Canon EOS"

const storyboards = clap.segment.filter(s => s.category === ClapSegmentCategory.STORYBOARD)

// save the Clap file
const newFile: ClapProject = await serializeClap(clap)

Build Instructions

Install Bun

Run the following commands:

bun install

bun run build

To publish:

bun run build

bun run build:declaration

bun run publish

Contributing

We welcome contributions! Please feel free to submit a pull request.

License

This package is under the MIT License. See LICENSE file for more details.

0.0.18

2 days ago

0.0.19

2 days ago

0.0.17

12 days ago

0.0.15

13 days ago

0.0.16

13 days ago

0.0.11

15 days ago

0.0.12

15 days ago

0.0.13

15 days ago

0.0.14

15 days ago

0.0.10

19 days ago

0.0.9

19 days ago

0.0.8

19 days ago

0.0.7

23 days ago

0.0.6

26 days ago

0.0.5

26 days ago

0.0.4

26 days ago

0.0.3

26 days ago

0.0.2

26 days ago

0.0.1

26 days ago

0.0.0

26 days ago