Skip to content

Instantly share code, notes, and snippets.

View kbridbur's full-sized avatar

Kyle Bridburg kbridbur

View GitHub Profile
@kbridbur
kbridbur / node_streaming.ts
Created August 16, 2019 02:26
Rev.ai Node Streaming Example
const revai = require('revai-node-sdk');
const fs = require('fs');
var client = new revai.RevAiStreamingClient(YOUR-ACCESS-TOKEN, YOUR-AUDIO-CONFIG);
client.on('close', (code, reason) => { console.log(`Connection closed, ${code}: ${reason}`); });
client.on('httpResponse', code => { console.log(`Streaming client received http response with code: ${code}`); });
client.on('connectFailed', error => { console.log(`Connection failed with error: ${error}`); });
client.on('connect', connectionMessage => { console.log(`Connected with message: ${connectionMessage}`); });
@kbridbur
kbridbur / python_streaming.py
Created August 16, 2019 02:23
Rev.ai Python Streaming Example
from rev_ai.models import MediaConfig
from rev_ai.streamingclient import RevAiStreamingClient
import io
config = MediaConfig(YOUR MEDIA CONTENT TYPE)
streamclient = RevAiStreamingClient(YOUR ACCESS TOKEN, config)
with io.open(YOUR FILE, 'rb') as stream:
MEDIA_GENERATOR = [stream.read()]
@kbridbur
kbridbur / python_example.py
Last active February 18, 2019 00:17
Use the Rev.ai API with Python!
# import rev_ai and create your client using your access token.
from rev_ai import apiclient
client = apiclient.RevAiAPIClient("ACCESS_TOKEN")
# send an audio file to rev.ai
job = client.send_job_url("rev.cm/FTC_Sample_1_-_Single")
# retrieve your transcript
client.get_transcript_json(job.id)
@kbridbur
kbridbur / curl_example.txt
Last active February 18, 2019 00:22
Use the Rev.ai API with curl!
// Send an audio file to Rev.ai
curl -X POST "https://api.rev.ai/revspeech/v1beta/jobs"
-H "Authorization: Bearer <access_token>"
-H "Content-Type: application/json"
-d "{\"media_url\":\"rev.cm/FTC_Sample_1_-_Single"}"
// Retrieve your transcript
curl -X GET "https://api.rev.ai/revspeech/v1beta/jobs/{id}/transcript"
-H "Authorization: Bearer <access_token>"
-H "Accept: application/vnd.rev.transcript.v1.0+json"
@kbridbur
kbridbur / bodyParser.java
Created January 10, 2017 23:31
Portion of a class final project in which we created a parser and player for txt files containing music
package abc.parser;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import abc.sound.Chord;
import abc.sound.EmptyVoice;