Skip to content

Commit

Permalink
Now using inline RecorderWorker, recording with the offline version n…
Browse files Browse the repository at this point in the history
…ow works
  • Loading branch information
Eliastik committed Jan 10, 2021
1 parent c250f50 commit 73883ec
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 158 deletions.
4 changes: 2 additions & 2 deletions dist/SimpleVoiceChanger.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"bootstrap.native": "^2.0.27",
"i18next": "^19.8.4",
"i18next-browser-languagedetector": "^6.0.1",
"recorderjs": "git+https://github.com/Eliastik/Recorderjs.git#081e597",
"recorderjs": "git+https://github.com/Eliastik/Recorderjs.git#37dfc2c",
"soundtouchjs": "^0.1.24"
}
}
}
1 change: 0 additions & 1 deletion service-worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ const CACHE_URLS = [
"assets/img/icon_192.png",
"assets/img/icon_512.png",
"assets/img/favicon.png",
"src/recorderWorker.js",
"dist/SimpleVoiceChanger.js",
"assets/sounds/impulse_response.wav",
"assets/sounds/modulator.mp3"
Expand Down
14 changes: 8 additions & 6 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import i18next from "i18next";
import Limiter from "./Limiter";
import BSN from "bootstrap.native/dist/bootstrap-native.min.js";
import vocoder from "./Vocoder";
import Recorder from "recorderjs";
import { Recorder, getRecorderWorker } from "recorderjs";
import modulator_mp3 from "../assets/sounds/modulator.mp3";
import impulse_response_default_lite from "../assets/sounds/impulse_response.mp3";

Expand Down Expand Up @@ -1856,7 +1856,7 @@ function saveBuffer(buffer) {

if(typeof(Worker) !== "undefined" && Worker != null) {
try {
worker = new Worker("src/recorderWorker.js");
worker = getRecorderWorker.default();
} catch(e) {
launchPause();
alert(i18next.t("script.workersErrorLoading"));
Expand All @@ -1867,6 +1867,12 @@ function saveBuffer(buffer) {
}

if('AudioContext' in window && !audioContextNotSupported && worker) {
worker.onmessage = function(e) {
if(e.data.command == 'exportWAV') {
downloadAudioBlob(e.data.data);
}
};

worker.postMessage({
command: "init",
config: {
Expand All @@ -1875,10 +1881,6 @@ function saveBuffer(buffer) {
}
});

worker.onmessage = function(e) {
downloadAudioBlob(e.data);
};

worker.postMessage({
command: "record",

Expand Down
147 changes: 0 additions & 147 deletions src/recorderWorker.js

This file was deleted.

0 comments on commit 73883ec

Please sign in to comment.