mirror of
				https://github.com/musix-org/musix-oss
				synced 2025-11-04 06:49:31 +00:00 
			
		
		
		
	Updated
This commit is contained in:
		
							
								
								
									
										50
									
								
								node_modules/node-opus/bin/opusdec-js.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										50
									
								
								node_modules/node-opus/bin/opusdec-js.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,50 @@
 | 
			
		||||
#!/usr/bin/env node
 | 
			
		||||
 | 
			
		||||
"use strict";
 | 
			
		||||
 | 
			
		||||
var opus = require('../');
 | 
			
		||||
var ogg = require('ogg');
 | 
			
		||||
var fs = require('fs');
 | 
			
		||||
var program = require('commander');
 | 
			
		||||
var packagejson = require('../package.json');
 | 
			
		||||
 | 
			
		||||
function toInt( n ) { return parseInt( n ); }
 | 
			
		||||
 | 
			
		||||
program
 | 
			
		||||
    .version( packagejson.version )
 | 
			
		||||
    .option('--bitrate [N.nnn]',
 | 
			
		||||
        'Set target bitrate in kbit/sec (6-256 per channel, default: 64)',
 | 
			
		||||
        toInt, 64 )
 | 
			
		||||
    .option('--rate [N]',
 | 
			
		||||
        'Set sampling rate for raw input (default: 48000)',
 | 
			
		||||
        toInt, 48000 )
 | 
			
		||||
    .option('--channels [N]',
 | 
			
		||||
        'Set sampling channels for raw input (default: 2)',
 | 
			
		||||
        toInt, 48000 )
 | 
			
		||||
    .arguments( '<input> <output>' )
 | 
			
		||||
    .parse( process.argv );
 | 
			
		||||
 | 
			
		||||
if( program.args.length !== 2 )
 | 
			
		||||
    program.help();
 | 
			
		||||
 | 
			
		||||
// Open the output streams.
 | 
			
		||||
var input_raw = fs.createReadStream( program.args[ 0 ] );
 | 
			
		||||
var output = fs.createWriteStream( program.args[ 1 ] );
 | 
			
		||||
 | 
			
		||||
var oggDecoder = new ogg.Decoder();
 | 
			
		||||
oggDecoder.on( 'stream', function( stream ) {
 | 
			
		||||
 | 
			
		||||
    // Create the decoder based on the command parameters.
 | 
			
		||||
    var decoder = new opus.Decoder( program.rate, program.channels );
 | 
			
		||||
	decoder.on( 'format', function( format ) {
 | 
			
		||||
		decoder.pipe( output );
 | 
			
		||||
	});
 | 
			
		||||
	decoder.on( 'error', function( err ) {
 | 
			
		||||
		console.error( err );
 | 
			
		||||
	});
 | 
			
		||||
 | 
			
		||||
	stream.pipe( decoder );
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
input_raw.pipe( oggDecoder )
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										43
									
								
								node_modules/node-opus/bin/opusenc-js.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										43
									
								
								node_modules/node-opus/bin/opusenc-js.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,43 @@
 | 
			
		||||
#!/usr/bin/env node
 | 
			
		||||
 | 
			
		||||
"use strict";
 | 
			
		||||
 | 
			
		||||
var opus = require('../');
 | 
			
		||||
var ogg = require('ogg');
 | 
			
		||||
var fs = require('fs');
 | 
			
		||||
var program = require('commander');
 | 
			
		||||
var packagejson = require('../package.json');
 | 
			
		||||
 | 
			
		||||
function toInt( n ) { return parseInt( n ); }
 | 
			
		||||
 | 
			
		||||
program
 | 
			
		||||
    .version( packagejson.version )
 | 
			
		||||
    .option('--serial [serialno]',
 | 
			
		||||
        'Set the serial number for the stream instead of using random. Meant for debugging.',
 | 
			
		||||
        toInt, null )
 | 
			
		||||
    .option('--framesize [size]',
 | 
			
		||||
        'Set maximum frame size in milliseconds (2.5, 5, 10, 20, 40, 60, default: 20)',
 | 
			
		||||
        toInt, 20 )
 | 
			
		||||
    .option('--raw-rate [N]',
 | 
			
		||||
        'Set sampling rate for raw input (default: 48000)',
 | 
			
		||||
        toInt, 48000 )
 | 
			
		||||
    .option('--raw-chan [N]',
 | 
			
		||||
        'Set number of channels for raw input (default: 2)',
 | 
			
		||||
        toInt, 2 )
 | 
			
		||||
    .arguments( '<input> <output>' )
 | 
			
		||||
    .parse( process.argv );
 | 
			
		||||
 | 
			
		||||
if( program.args.length !== 2 )
 | 
			
		||||
    program.help();
 | 
			
		||||
 | 
			
		||||
// Create the encoder based on the command parameters.
 | 
			
		||||
var framebytes = program.rawRate * program.framesize / 1000;
 | 
			
		||||
var encoder = new opus.Encoder( program.rawRate, program.rawChan, framebytes );
 | 
			
		||||
 | 
			
		||||
// Open the output streams.
 | 
			
		||||
var input_raw = fs.createReadStream( program.args[ 0 ] );
 | 
			
		||||
var output = fs.createWriteStream( program.args[ 1 ] );
 | 
			
		||||
 | 
			
		||||
var oggEncoder = new ogg.Encoder();
 | 
			
		||||
input_raw.pipe( encoder ).pipe( oggEncoder.stream( program.serial ) )
 | 
			
		||||
oggEncoder.pipe( output )
 | 
			
		||||
		Reference in New Issue
	
	Block a user