How to Convert Audio to AAC in Node.JS

Seen as the successor to the popular MP3 audio file format, Advanced Audio Coding (AAC) offers high-quality, compressed audio files used as the default format on Apple devices. If your goal is optimization for sound, and your projects require you to move toward this newer, enhanced audio format, Cloudmersive can help you get up to date. The following tutorial will show you how you can convert any audio file to AAC using Node.JS, so you won’t have to worry about extracting the sounds you need.

Image for post
Image for post
npm install cloudmersive-video-api-client –save
"dependencies": {
"cloudmersive-video-api-client": "^2.0.1
var CloudmersiveVideoApiClient = require('cloudmersive-video-api-client');
var defaultClient = CloudmersiveVideoApiClient.ApiClient.instance;
// Configure API key authorization: Apikey
var Apikey = defaultClient.authentications['Apikey'];
Apikey.apiKey = 'YOUR API KEY';

var apiInstance = new CloudmersiveVideoApiClient.AudioApi();
var opts = {
'inputFile': Buffer.from(fs.readFileSync("C:\\temp\\inputfile").buffer), // File | Input file to perform the operation on.
'fileUrl': "fileUrl_example", // String | Optional; URL of an audio file being used for conversion. Use this option for files larger than 2GB.
'bitRate': 56 // Number | Optional; Specify the desired bitrate of the converted audio file in kilobytes per second (kB/s). Value may be between 48 and 1,411. By default, the optimal bitrate will be chosen automatically.
var callback = function(error, data, response) {
if (error) {
} else {
console.log('API called successfully. Returned data: ' + data);
apiInstance.audioConvertToAac(opts, callback);

Written by

There’s an API for that. Cloudmersive is a leader in Highly Scalable Cloud APIs.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store