Skip to content

Instantly share code, notes, and snippets.

View alexeybondarenko's full-sized avatar

Alexey Bondarenko alexeybondarenko

View GitHub Profile
@alexeybondarenko
alexeybondarenko / fe-readme.md
Created April 12, 2018 14:26
Example of Vue Frontend architecture readme

Example of Vue Frontend architecture readme

Technologies

  • VueJS
  • Vuex
  • Webpack
  • ESLint

Build Setup

@alexeybondarenko
alexeybondarenko / fe_architecture_example_readme.md
Created February 16, 2018 09:15
Frontend Architecture. Example of Readme

Readme example

Technologies

  • VueJS
  • Vuex
  • Webpack
  • ESLint

Build Setup

const server = app.listen(app.get('PORT'), (error) => {
if (error) {
console.log('Server started with an error', error);
process.exit(1);
}
console.log(`Server started and is listening at http://localhost:${app.get('PORT')}`);
});
const socket = new binaryServer({
server: server,
path: '/socket',
var client = new BinaryClient(location.origin.replace('http', 'ws').replace('https', 'ws') + '/socket');
stream.on('data', (data) => {
console.log(data);
const tone = data.readInt8(1);
Object.keys(socket.clients).map(
i => playTone(tone, socket.clients[i].createStream())
);
});
client.on('open', function () {
MIDIStream = client.createStream();
});
client.on('stream', function (stream) {
stream.on('data', handleReceiveAudioData);
stream.on('end', handleEndAudioStream);
}
function playSound(audioBuffer) {
var source = context.createBufferSource();
source.buffer = audioBuffer;
source.connect(context.destination);
source.start(0);
console.timeEnd('send');
}
function handleMidiMessage(e) {
if (!MIDIStream || e.data[0] !== 0x90) return;
console.log(e);
const socket = new binaryServer({
port: 3001,
});
function playTone(tone, stream) {
if (tone > 61 || tone < 1) {
console.log('undefined tone', tone);
return;
}
const filePath = path.resolve(__dirname, 'wav', `${tone}.wav`);
const binaryServer = require('binaryjs').BinaryServer;
const socket = new binaryServer({
port: 3001,
});
socket.on('connection', (client) => {
client.on('stream', (stream, meta) => {
stream.on('data', (data) => {
console.log(data);
function handleMidiMessage(e) {
console.log(e);
if (!MIDIStream || e.data[0] !== 0x90) return;
MIDIStream.write(e.data);
}