-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmake_audio.js
More file actions
25 lines (23 loc) · 842 Bytes
/
Copy pathmake_audio.js
File metadata and controls
25 lines (23 loc) · 842 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
const fs = require('fs');
var ffmpeg = require('fluent-ffmpeg');
let audio_dir = "E:\\Documents\\Academia\\Studies\\Synth single Notes\\12EDO\\"
const make_audio = function (stimuli,path) {
return new Promise(function (resolve, reject) {
// merge file
let adage = 20
let file = stimuli[0] + adage + ".wav"
let audio = ffmpeg(audio_dir+ file)
for(let i=1;i<stimuli.length;i++) {
file = stimuli[i]+adage + ".wav"
audio.input(audio_dir+file)
}
audio.mergeToFile(path).on('progress', function(progress) {
// console.log('Processing: ' + progress.percent + '% done');
}).on('end', function () {
resolve("Audio generated")
}).on('error',function(e) {
reject(e)
});
})
}
module.exports = make_audio