Code Monkey home page Code Monkey logo

m5stack-avatar's Introduction

M5Stack-Avatar

Powered By PlatformIO Build Status

M5Stack-Avatar

Video: https://www.youtube.com/watch?v=C1Hj9kfY5qc

日本語

Features

  • 😐 Draw avatar face
  • 😄 Expression(Happy, Angry, Sad etc.)
  • 😺 Customize face
  • 💋 Lip sync
  • 🎨 Color Palette
  • 🔃 Move, Zoom and Rotation

Installation

Prerequisites

Using Arduino IDE

  • On Arduino IDE, Select "Sketch > Include Library > Manage Libraries..."
  • Search "m5stack avatar"
  • Select "M5Stack_Avatar" from the results then click "Install"
  • The library gets installed

Using Platform IO

  • Initialize your Platform IO project
mkdir my-avatar
cd my-avatar
platformio init -d . -b m5stack-core-esp32
  • Install the library and its dependency
platformio lib install M5Stack
platformio lib install M5Stack-Avatar
  • The library gets downloaded from repository to .piolibdeps directory

Usage

#include <M5Stack.h>
#include <Avatar.h>

using namespace m5avatar;

Avatar avatar;

void setup()
{
  M5.begin();
  avatar.init(); // start drawing
}

void loop()
{
  // avatar's face updates in another thread
  // so no need to loop-by-loop rendering
}

Using LipSync

  • setup AquesTalk-ESP32 (http://blog-yama.a-quest.com/?eid=970195).

    • (For parsing Kainji statement) Copy the dictionary file from above link to the microSD card.
    • You don't need to copy AquesTalkTTS files. They are included in this library.
  • Write below to open avatar mouth according to the audio output.

#include <AquesTalkTTS.h>
#include <M5Stack.h>
#include <Avatar.h>
#include <tasks/LipSync.h>

using namespace m5avatar;

// AquesTalk License Key
// NULL or wrong value is just ignored
const char* AQUESTALK_KEY = "XXXX-XXXX-XXXX-XXXX";
Avatar avatar;

void setup() {
  int iret;
  M5.begin();
  // For Kanji-to-speech mode (requires dictionary file saved on microSD)
  // iret = TTS.createK(AQUESTALK_KEY);
  iret = TTS.create(AQUESTALK_KEY);
  avatar.init();
  avatar.addTask(lipSync, "lipSync");
}

void loop() {
  M5.update();
  if (M5.BtnA.wasPressed()) {
    // For Kanji-to-speech mode
    // TTS.play("こんにちは。", 80);
    TTS.play("konnichiwa", 80);
  }
}

Further usage

see examples directory.

m5stack-avatar's People

Contributors

meganetaaan avatar

Watchers

James Cloos avatar N37W0RK 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.