Skip to content

Instantly share code, notes, and snippets.

View rustyconover's full-sized avatar
🕶️
The future is so bright.

Rusty Conover rustyconover

🕶️
The future is so bright.
View GitHub Profile
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@rustyconover
rustyconover / listen.js
Created January 12, 2021 16:12
Listen to Icecast Stream
function listenToStream(stream_id: number, description: string) {
const options = {
hostname: 'broadcastify.cdnstream1.com',
port: 443,
headers: {
'sec-ch-ua-mobile': '?0',
'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36',
'Accept': '*/*',
'Origin': 'https://www.broadcastify.com',
@rustyconover
rustyconover / load-and-analyze-samples.js
Created January 12, 2021 18:17
Load and Analyze PCM samples
// Keep an array of indexes of loud samples.
const loud_indexes = [0];
{
const pcm_data = fs.readFileSync(pcm_output, { encoding: null });
const pcm_values = new Int16Array(pcm_data.buffer);
// The first segment may be longer than normal due to Icecast
// buffering.
if (pcm_values.length > (window_length / 1000) * sample_rate * 1.2) {
return;