Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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; |
OlderNewer