From 1cfda53712d611eb7d3279c941184370292b414a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabian-Robert=20St=C3=B6ter?= Date: Sun, 19 May 2019 15:54:21 +0200 Subject: [PATCH] add mimetype support --- README.md | 29 ++++++++++++++++++++++++++++- src/App.vue | 3 ++- src/components/player/player.js | 4 ++-- 3 files changed, 32 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 4a1d55b..53f96cc 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # open-unmix-demo -Standalone Source Separation Demo Player +Standalone Source Separation Demo Player that loads pre-processed multitrack audio files. ## Project setup ``` @@ -16,3 +16,30 @@ npm run electron:serve ``` npm run electron:build ``` + +## Example config file + +Lets assume we a folder with subfolders for each audio tracks, separated into different sources: + +``` +tracks/track_1/vocals.m4a +tracks/track_1/bass.m4a +tracks/track_1/drums.m4a +tracks/track_1/other.m4a +... +``` + +Specifying a `config.json` file like following would be sufficient to load the files into the demo player. Note that `audiopath` is a relative path with respect to the path of the config file. + +```json +{ + "title": "Open-Unmix Demo", + "audiopath": "tracks", + "tagline": "my great separation method", + "tracks": [ + { "path": "track_1", "name": "Artist - Title"}, + ], + "targets": ["bass", "drums", "other", "vocals"], + "extension": [".m4a"], "mimetype": "audio/mp4" +} +``` \ No newline at end of file diff --git a/src/App.vue b/src/App.vue index 9aa153c..7c44567 100644 --- a/src/App.vue +++ b/src/App.vue @@ -130,9 +130,10 @@ export default { 'customClass': target, 'solo': false, 'mute': false, + 'type': this.config.mimetype, 'file': path.join( audio_root, - this.selectedTrack, target + this.config.ext + this.selectedTrack, target + this.config.extension ) } ) diff --git a/src/components/player/player.js b/src/components/player/player.js index 6850c6e..7c289da 100644 --- a/src/components/player/player.js +++ b/src/components/player/player.js @@ -28,7 +28,7 @@ Player.prototype.loadTargets = function(trackurls) { var tracksToLoad = [] for (let track of trackurls) { var buffer = fs.readFileSync(track.file) - var blob = new Blob([buffer]); + var blob = new Blob([buffer], { type: track.type }); tracksToLoad.push( { "src": blob, @@ -44,7 +44,7 @@ Player.prototype.loadTargets = function(trackurls) { Player.prototype.addTrack = function(track) { var buffer = fs.readFileSync(track.file) - var blob = new Blob([buffer]); + var blob = new Blob([buffer], { type: track.type }); this.playlist.load([ {