Add atracdenc logging. Add sample rate conversion
44100Hz sample rate is required for atracdenc encoding
This commit is contained in:
parent
4fb407454b
commit
18c7f91c89
|
@ -38,12 +38,14 @@ if (typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScop
|
|||
(self as any).Module().then((m: any) => {
|
||||
Module = m;
|
||||
self.postMessage({ action: 'init' });
|
||||
Module.setLogger((msg: string, stream: string) => console.log(`${stream}: ${msg}`));
|
||||
});
|
||||
} else if (action === 'encode') {
|
||||
const { bitrate, data } = others;
|
||||
const inWavFile = `inWavFile.wav`;
|
||||
const outAt3File = `outAt3File.aea`;
|
||||
Module.FS.writeFile(`${inWavFile}`, new Uint8Array(data));
|
||||
const dataArray = new Uint8Array(data);
|
||||
Module.FS.writeFile(`${inWavFile}`, dataArray);
|
||||
Module.callMain([`-e`, `atrac3`, `-i`, inWavFile, `-o`, outAt3File, `--bitrate`, bitrate]);
|
||||
|
||||
// Read file and trim header (96 bytes)
|
||||
|
|
|
@ -87,7 +87,7 @@ export class FFMpegAudioExportService implements AudioExportService {
|
|||
return data.buffer;
|
||||
} else {
|
||||
const outFileName = `${this.outFileNameNoExt}.wav`;
|
||||
await this.ffmpegProcess.transcode(this.inFileName, outFileName, '-f wav');
|
||||
await this.ffmpegProcess.transcode(this.inFileName, outFileName, '-f wav -ar 44100');
|
||||
let { data } = await this.ffmpegProcess.read(outFileName);
|
||||
let bitrate: string = `0`;
|
||||
switch (format) {
|
||||
|
|
Loading…
Reference in New Issue