Code Monkey home page Code Monkey logo

flacmetadataeditor's Introduction

FLACMetadataEditor

Script allows you to edit metadata in FLAC files

inspired by egoroof's Browser ID3 Writer

Usage:

// # Creating editor instance:
const editor = new FLACMetadataEditor(ArrayBuffer);

// # Get version:
const editorVersion = editor.scriptVersion; // <- e.g. '0.0.2.1'

// # Editing tags:
// List with standard field names: https://xiph.org/vorbis/doc/v-comment
editor.addComment('ARTIST=Laibach');
editor.addComment('ARTIST', 'Laibach');

// All properties are facultative except "data"
// Default values (except "data", of course) presented in example:
editor.addPicture({
    APICtype: 3,
    MIMEType: 'image/jpeg',
    colorDepth: 0,
    colorNumber: 0,
    data: ImageDataAsArrayBuffer,
    description: '',
    width: 0,
    height: 0
});

// remove single atrist
editor.removeComment('ARTIST', 'Laibach');
// remove all atrists
editor.removeComment('ARTIST');
// remove ALL comments
editor.removeComment();

// # Writing changes
editor.serializeMetadata();

// # Convert result to blob
const resultArrayBuffer = editor.arrayBuffer;
const blob = new Blob([resultArrayBuffer], {type: 'audio/flac'});
const url = URL.createObjectURL(blob);

What else?

Editable full FLAC metadata except CUESHEET

May be accessed through editor.metadata

Do console.log(editor) to explore it. Structures have self-descriptive names

Chains

As all public functions return this, we are able to create trains. e.g. this returns changed ArrayBuffer with only one comment โ€” TITLE=The Whistleblowers

new FLACMetadataEditor(ArrayBuffer).removeComment().addComment('TITLE','The Whistleblowers').serializeMetadata().arrayBuffer;

TODO:

  • More debug output
  • METADATA_BLOCK_CUESHEET parsing (most forums don't recommend use it. Use tag CUESHEET instead. And honestly, even metaflac cannot embed all of my .cue into flacs. Nevermind)

flacmetadataeditor's People

Contributors

ahohnmyc avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.