Giter VIP home page Giter VIP logo

Comments (3)

viveknimkarde avatar viveknimkarde commented on August 30, 2024

Hi Allen,
Thanks for reaching out.

Currently DeepAffects.Audio.fromFile("LOCAL_FILE_PATH"); function expects a valid audio path on the file system, so blob url might not work here.

For your use case You can do few things as follows:

  • Download blob as file and the pass it to DeepAffects.Audio.fromFile("LOCAL_FILE_PATH");
  • Convert blob to base64 and and pass it as content parameter in the request body, thats what .fromFIle does under the hood.

Thanks
DeepAffects

from deepaffects-node.

ChunAllen avatar ChunAllen commented on August 30, 2024

Hi @viveknimkarde I'll use the conversion of blob to base64 because I'm planning to deploy the application to Heroku which don't have a file storage folder.
So currently the blob I'm getting is this:

var url = URL.createObjectURL(AudioBLOB);
console.log(url);

the snippet above returns
blob:http://localhost:3001/fcd3f823-5254-4909-9702-e58ded38ce09

so you mean if I convert the result above to base64 so I should be able to pass it in the .fromFile function?

from deepaffects-node.

viveknimkarde avatar viveknimkarde commented on August 30, 2024

@ChunAllen Browser can directly give you base64 converted audio as follows

var reader = new FileReader();
 reader.readAsDataURL(blob); 
 reader.onloadend = function() {
     base64data = reader.result;                
     console.log(base64data);
 }

just use it as content parameter for request body.
no need to use .fromFile in the browser

from deepaffects-node.

Related Issues (4)

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.