All Projects โ†’ Kagami โ†’ Vmsg

Kagami / Vmsg

Licence: other
๐ŸŽต Library for creating voice messages

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Vmsg

Rust Wasm Webpack Tutorial
Finished example project for my guide on setting up a Webpack project with Rust and WebAssembly
Stars: โœญ 122 (-52.53%)
Mutual labels:  emscripten, webassembly
Opus Media Recorder
MediaRecorder polyfill for Opus recording using WebAssembly
Stars: โœญ 159 (-38.13%)
Mutual labels:  emscripten, webassembly
Modern Wasm Starter
๐Ÿ›ธ Run C++ code on web and create blazingly fast websites! A starter template to easily create WebAssembly packages using type-safe C++ bindings with automatic TypeScript declarations.
Stars: โœญ 140 (-45.53%)
Mutual labels:  emscripten, webassembly
Webassembly Raytracer
a performance comparison of a simple raytracer in JavaScript, asm.js, WebAssembly, and GLSL
Stars: โœญ 102 (-60.31%)
Mutual labels:  emscripten, webassembly
TypeScriptXX
๐Ÿงท Stay safe! Type-safe scripting for C++ using TypeScriptToLua and CMake with auto-generated declarations.
Stars: โœญ 33 (-87.16%)
Mutual labels:  webassembly, emscripten
Miniaudio
Single file audio playback and capture library written in C.
Stars: โœญ 1,889 (+635.02%)
Mutual labels:  emscripten, mp3
Crosswindow
๐Ÿ’ป๐Ÿ“ฑ A cross platform system abstraction library written in C++ for managing windows and performing OS tasks.
Stars: โœญ 155 (-39.69%)
Mutual labels:  emscripten, webassembly
Emscripten Docker
Docker image with Emscripten to compile ASM.js and WebAssembly
Stars: โœญ 92 (-64.2%)
Mutual labels:  emscripten, webassembly
Imguizmo.quat
ImGui GIZMO widget - 3D object manipulator / orientator
Stars: โœญ 187 (-27.24%)
Mutual labels:  emscripten, webassembly
Magnum Examples
Examples for the Magnum C++11/C++14 graphics engine
Stars: โœญ 180 (-29.96%)
Mutual labels:  emscripten, webassembly
Cobol Js Emscripten
Stars: โœญ 101 (-60.7%)
Mutual labels:  emscripten, webassembly
magnum-integration
Integration libraries for the Magnum C++11/C++14 graphics engine
Stars: โœญ 75 (-70.82%)
Mutual labels:  webassembly, emscripten
Dcmjs
dcmjs is a javascript cross-compile of dcmtk (dcmtk.org).
Stars: โœญ 92 (-64.2%)
Mutual labels:  emscripten, webassembly
Opengl cmake skeleton
โค๏ธ A ready to use cmake skeleton using GLFW, Glew and glm. ๐Ÿ‘
Stars: โœญ 118 (-54.09%)
Mutual labels:  emscripten, webassembly
Assortedwidgets
OpenGL GUI library
Stars: โœญ 92 (-64.2%)
Mutual labels:  emscripten, webassembly
Indigo
Universal cheminformatics libraries, utilities and database search tools
Stars: โœญ 146 (-43.19%)
Mutual labels:  emscripten, webassembly
Opus Stream Decoder
Instantly decode Ogg Opus audio streams in chunks with JavaScript & WebAssembly (Wasm)
Stars: โœญ 80 (-68.87%)
Mutual labels:  emscripten, webassembly
Wasmer
๐Ÿš€ The leading WebAssembly Runtime supporting WASI and Emscripten
Stars: โœญ 11,047 (+4198.44%)
Mutual labels:  emscripten, webassembly
Webassembly Examples
From Simple To Complex. A complete collection of webassembly examples.
Stars: โœญ 177 (-31.13%)
Mutual labels:  emscripten, webassembly
koder
QR/bar code scanner for the Browser
Stars: โœญ 73 (-71.6%)
Mutual labels:  webassembly, emscripten

vmsg npm

vmsg is a small library for creating voice messages. While traditional way of communicating on the web is via text, sometimes it's easier or rather funnier to express your thoughts just by saying it. Of course it doesn't require any special support: record your voice with some standard program, upload to file hosting and share the link. But why bother with all of that tedious stuff if you can do the same in browser with a few clicks.

๐ŸŽŠ ๐ŸŽ‰ DEMO ๐ŸŽ‰ ๐ŸŽŠ

Features

  • No dependencies, framework-agnostic, can be easily added to any site
  • Small: ~73kb gzipped WASM module and ~3kb gzipped JS + CSS
  • Uses MP3 format which is widely supported
  • Works in all latest browsers

Supported browsers

  • Chrome 32+
  • Firefox 27+
  • Safari 11+
  • Edge 12+

Usage

npm install vmsg --save
import { record } from "vmsg";

someButton.onclick = function() {
  record(/* {wasmURL: "/static/js/vmsg.wasm"} */).then(blob => {
    console.log("Recorded MP3", blob);
    // Can be used like this:
    //
    // const form = new FormData();
    // form.append("file[]", blob, "record.mp3");
    // fetch("/upload.php", {
    //   credentials: "include",
    //   method: "POST",
    //   body: form,
    // }).then(resp => {
    // });
  });
};

That's it! Don't forget to include vmsg.css and vmsg.wasm in your project. For browsers without WebAssembly support you need to also include wasm-polyfill.js.

See demo directory for a more feasible example.

A minimal React example for using Recorder with your own UI can be found here.

See also non React demo and Recording mp3 audio in HTML5 using vmsg article.

Development

  1. Install Emscripten SDK.
  2. Install latest LLVM, Clang and LLD with WebAssembly backend, fix LLVM_ROOT variable of Emscripten config.
  3. Make sure you have a standard GNU development environment.
  4. Activate emsdk environment.
  5. git clone --recurse-submodules https://github.com/Kagami/vmsg.git && cd vmsg
    make clean all
    npm install
    npm start
    

These instructions are very basic because there're a lot of systems with different conventions. Docker image would probably be provided to fix it.

Technical details for nerds

vmsg uses LAME encoder underneath compiled with Emscripten to WebAssembly module. LAME build is optimized for size, weights only little more than 70kb gzipped and can be super-efficiently fetched and parsed by browser. It's like a small image.

Access to microphone is implemented with Web Audio API, data samples sent to Web Worker which is responsibe for loading WebAssembly module and calling LAME API.

Module is produced with modern LLVM WASM backend and LLD linker which should become standard soon, also vmsg has own tiny WASM runtime instead of Emscripten's to decrease overall size and simplify architecture. Worker code is included in the main JS module so end-user has to care only about 3 files: vmsg.js, vmsg.css and vmsg.wasm. CSS can be inlined too but IMO that would be ugly.

In order to support browsers without WebAssembly, WebAssembly polyfill is being used. It translates binary module into semantically-equivalent JavaScript on the fly (almost asm.js compatible but doesn't fully validate yet) so we don't need separate asm.js build and can use standard WebAssembly API. It's not as effecient but for audio encoding should be enough.

See also: Creating WebAssembly-powered library for modern web article.

Why not MediaRecorder?

MediaStream Recording API is great but:

  • Works only in Firefox and Chrome
  • Provides little to no options, e.g. VBR quality can't be specified
  • Firefox/Chrome encode only to Opus which can't be natively played in Safari and Edge

But you can use e.g. ogv.js polyfill!

  • It make things more complicated, now you need both encoder and decoder
  • Opus gives you ~2x bitrate win but for 500kb per minute files it's not that much
  • MP3 is much more widespread, so even while compression is not best compatibility matters

License

vmsg is licensed under CC0.
LAME is licensed under LGPL.
MP3 patents seems to have expired since April 23, 2017.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].