Speech in the space: Difference between revisions

From NURDspace
(node module code added)
Line 63: Line 63:


== nodejs quickfix ==
== nodejs quickfix ==
<code>
<pre>
var espeak = require('espeak');
var espeak = require('espeak');
var fs = require('fs')
var fs = require('fs')
Line 100: Line 100:


server.listen(16016, '0.0.0.0');
server.listen(16016, '0.0.0.0');
</code>
</pre>

Revision as of 23:11, 19 August 2017

Speech in the space
Speech.gif
Participants User:buzz, Dennis
Skills Coding
Status Production
Niche Software
Purpose Fun
Tool No
Location
Cost
Tool category

Speech in the space

Speech.gif {{#if:No | [[Tool Owner::{{{ProjectParticipants}}} | }} {{#if:No | [[Tool Cost:: | }}

This page is documentation on the 'let's annoy the space vocally' project.

History

buZz coded a small text-2-speech irc bot. was on http://pastebin.com/3kj2BJ5U. Flok then rm -rf /* all files with it. After this it was decided it was a bad idea for now (or at least nobody picked it up). Months later Tall0ak wrote a plugin for jsonbot (aka NURDbot) in python. This set-up was broken when we moved to the current location. The_Niz wrote a new plugin for Nurdbot which connects to Slab and Smokescreen. This is currently active.

A new service has been written around espeak - https://git.nurd.space/g-j-s-dawes/espeak-server . This service listens on port 16016 for strings and, if present, interprets tab-separated constants as speech variables. It is fed from nurdbot via vinculum, so that a single message can be split across multiple receivers. The code for nurdbot is in the git repo.

This service is started via init.d, service espeak-server. The code is in the git repo.

Additionally, vinculum forwards the strings and users to the bigledpanel for display in the space.

Available commands

  • !speak <text>

This command outputs <text> as speech in the space via festival.

  • !espeak <text>

This command outputs <text> as speech in the space via espeak.

  • !espreek <text>

This command outputs <text> as speech in the space via espeak with a Dutch accent.

  • !esprech <text>

This command outputs <text> as speech in the space via espeak with a German accent.

  • !edire <text>

This command outputs <text> as speech in the space via espeak with a French accent.

  • !espeak-settings <text>

By default each new IRC user gets a randomly assigned voice. This command allows you to configure these settings.

Hark hark hark hark

!espreek ick hab here un brief for min moodar
!espreek dee hoog in the himmel is 
!speak dee zeh brief binned ick fast oop min fliger
!speak mar fuck then mar up, mit je zalm
!speak noik yow ick do need what yaj maaj sekt
!speak HOORAAA
!speak yah rhine stah pahnahcook are eye, zack ick yah
!speak domini keh ni keh ni keh
!speak sahn ahllait toot simpelemahmn
!speak rootjay pohfre ay sjahmn tahmn
!speak weir hahben S neeght kuh woost?


nodejs quickfix

var espeak = require('espeak');
var fs = require('fs')
var Sound = require('aplay');

// de+m1	160	0	100	50	username	test
// [
//   'de+m1',
//   '160',
//   '0',
//   '100',
//   '50',
//   'nooitaf',
//   'test\n'
// ]

var net = require('net');

var server = net.createServer(function(socket) {
  socket.on('data', function(data) {
    var d = data.toString().split('\t')
    var opt1 = '-v ' + d[0].split('+')[0]
    var opt2 = '-g ' + d[1]
    var opt3 = '-k ' + d[2]
    var opt4 = '-s ' + d[3]
    var opt5 = '-a 100'
    espeak.speak(d[6], [opt5], function(err, wav) {
      if (err) console.log(err)
      fs.writeFile("./speak.wav", wav.buffer, function(err) {
        if (err) console.log(err)
        new Sound().play('./speak.wav');
      })
    });
  });
});

server.listen(16016, '0.0.0.0');