New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@fonos/marytts

Package Overview
Dependencies
Maintainers
1
Versions
147
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@fonos/marytts - npm Package Compare versions

Comparing version 0.0.79 to 0.0.81

dist/types.d.ts

41

dist/mary_tts.d.ts

@@ -1,2 +0,3 @@

import { AbstractTTS } from '@fonos/tts';
import { AbstractTTS } from "@fonos/tts";
import { MaryTTSConfig, MarySynthOptions } from "./types";
/**

@@ -8,5 +9,5 @@ * @classdesc The default TTS engine in a Fonos deployment.

*
* const MaryTTS = require('@fonos/tts/marytts')
* const Storage = require('@fonos/storage')
* const { transcodeSync } = require('@fonos/tts/utils')
* const MaryTTS = require("@fonos/tts/marytts");
* const Storage = require("@fonos/storage");
* const { transcodeSync } = require("@fonos/tts/utils");

@@ -16,11 +17,11 @@ *

* module.exports = chan => {
* const storage = new Storage()
* const tts = new MaryTTS()
* const pathToFile = tts.synthesizeSync('Hello World')
* const pathToTranscodedFile = transcodeSync(pathToFile)
* const url = storage.uploadFileSync('hello-world.wav', pathToTranscodedFile)
* chan.play(url)
* const storage = new Storage();
* const tts = new MaryTTS();
* const pathToFile = tts.synthesizeSync("Hello World");
* const pathToTranscodedFile = transcodeSync(pathToFile);
* const url = storage.uploadFileSync("hello-world.wav", pathToTranscodedFile);
* chan.play(url);
* }
*/
declare class MaryTTS extends AbstractTTS {
export default class MaryTTS extends AbstractTTS {
serviceUrl: string;

@@ -31,9 +32,21 @@ /**

* @see module:tts:AbstractTTS
* @param {DefaultConfig} config - Configuration of the marytts
*/
constructor(options?: any);
constructor(config: MaryTTSConfig);
/**
* Init of the marytts constructor
*
* @param {DefaultConfig} config - Configuration of the marytts
*/
init(config: MaryTTSConfig): void;
/**
* @inherit
*
* @param {string} text - Text that will be synthesized
* @param {OptionsInterface} options - Options of the marytts, locale and voice
* @return {Promise<String>}
* For more information: http://marytts.phonetik.uni-muenchen.de:59125/documentation.html
* Advice: On windows the command "which" that sox library uses is not the same. In windows is "where" instead
*/
synthesize(text: string, options?: any): Promise<string>;
synthesize(text: string, options?: MarySynthOptions): Promise<string>;
}
export default MaryTTS;

@@ -6,2 +6,20 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
/*
* Copyright (C) 2021 by Fonoster Inc (https://fonoster.com)
* http://github.com/fonoster/fonos
*
* This file is part of Project Fonos
*
* Licensed under the MIT License (the "License");
* you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* https://opensource.org/licenses/MIT
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
const http_1 = __importDefault(require("http"));

@@ -18,5 +36,5 @@ const fs_1 = __importDefault(require("fs"));

*
* const MaryTTS = require('@fonos/tts/marytts')
* const Storage = require('@fonos/storage')
* const { transcodeSync } = require('@fonos/tts/utils')
* const MaryTTS = require("@fonos/tts/marytts");
* const Storage = require("@fonos/storage");
* const { transcodeSync } = require("@fonos/tts/utils");

@@ -26,8 +44,8 @@ *

* module.exports = chan => {
* const storage = new Storage()
* const tts = new MaryTTS()
* const pathToFile = tts.synthesizeSync('Hello World')
* const pathToTranscodedFile = transcodeSync(pathToFile)
* const url = storage.uploadFileSync('hello-world.wav', pathToTranscodedFile)
* chan.play(url)
* const storage = new Storage();
* const tts = new MaryTTS();
* const pathToFile = tts.synthesizeSync("Hello World");
* const pathToTranscodedFile = transcodeSync(pathToFile);
* const url = storage.uploadFileSync("hello-world.wav", pathToTranscodedFile);
* chan.play(url);
* }

@@ -40,28 +58,31 @@ */

* @see module:tts:AbstractTTS
* @param {DefaultConfig} config - Configuration of the marytts
*/
constructor(options) {
super('mary-tts');
const defaultConfig = {
host: process.env.TTS_ENGINE_HOST || 'localhost',
port: process.env.TTS_ENGINE_PORT || 59125,
locale: 'EN_US'
};
// :(
const merge = require('deepmerge');
const opts = merge(defaultConfig, options || {});
if (!opts.host)
throw new Error('host field is required');
if (!opts.port)
throw new Error('port field is required');
const q = `INPUT_TYPE=TEXT&AUDIO=WAVE_FILE&OUTPUT_TYPE=AUDIO&LOCALE=${opts.locale}`;
this.serviceUrl = `http://${opts.host}:${opts.port}/process?${q}`;
logger_1.default.log('debug', `@fonos/tts.MaryTTS.constructor [initializing with config: ${JSON.stringify(opts)}]`);
logger_1.default.log('verbose', `@fonos/tts.MaryTTS.constructor [serviceUrl: ${this.serviceUrl}]`);
constructor(config) {
super("mary-tts");
this.init(config);
}
/**
* Init of the marytts constructor
*
* @param {DefaultConfig} config - Configuration of the marytts
*/
init(config) {
const q = `INPUT_TYPE=TEXT&AUDIO=WAVE_FILE&OUTPUT_TYPE=AUDIO&LOCALE=${config.locale}`;
this.serviceUrl = `http://${config.host}:${config.port}/process?${q}`;
logger_1.default.log("debug", `@fonos/tts.MaryTTS.constructor [initializing with config: ${JSON.stringify(config)}]`);
logger_1.default.log("verbose", `@fonos/tts.MaryTTS.constructor [serviceUrl: ${this.serviceUrl}]`);
}
/**
* @inherit
*
* @param {string} text - Text that will be synthesized
* @param {OptionsInterface} options - Options of the marytts, locale and voice
* @return {Promise<String>}
* For more information: http://marytts.phonetik.uni-muenchen.de:59125/documentation.html
* Advice: On windows the command "which" that sox library uses is not the same. In windows is "where" instead
*/
synthesize(text, options = {}) {
const pathToFile = path_1.default.join('/tmp', tts_1.computeFilename(text, options));
logger_1.default.log('debug', `@fonos/tts.MaryTTS.synthesize [text: ${text}, options: ${JSON.stringify(options)}]`);
synthesize(text, options = { locale: "EN_US", voice: "" }) {
const pathToFile = path_1.default.join("/tmp", tts_1.computeFilename(text, options));
logger_1.default.log("debug", `@fonos/tts.MaryTTS.synthesize [text: ${text}, options: ${JSON.stringify(options)}]`);
return new Promise((resolve, reject) => {

@@ -72,3 +93,3 @@ const query = tts_1.optionsToQueryString(options);

if (statusCode !== 200) {
reject(`Request failed status code: ${statusCode}`);
reject(new Error(`Request failed status code: ${statusCode}`));
return;

@@ -75,0 +96,0 @@ }

{
"name": "@fonos/marytts",
"version": "0.0.79",
"version": "0.0.81",
"description": "Concrete implementation of AbstractTTS",

@@ -8,4 +8,4 @@ "author": "Pedro Sanders <sanderspedro@gmail.com>",

"license": "MIT",
"main": "dist/index",
"types": "dist/index",
"main": "dist/mary_tts",
"types": "dist/mary_tts",
"scripts": {

@@ -33,4 +33,4 @@ "prebuild": "rimraf ./dist tsconfig.tsbuildinfo",

"dependencies": {
"@fonos/logger": "^0.0.79",
"@fonos/tts": "^0.0.79",
"@fonos/logger": "^0.0.81",
"@fonos/tts": "^0.0.81",
"deepmerge": "^4.2.2"

@@ -43,3 +43,3 @@ },

},
"gitHead": "9e434071d70d54b903a0ef48f101fc4fc639883f"
"gitHead": "983ae83264743dc9696719ed1ca9c01d6a392ff9"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc