fix normalization on library songs
This commit is contained in:
parent
2dd13756b4
commit
be6ccbada7
4 changed files with 92 additions and 77 deletions
|
@ -33,7 +33,6 @@
|
||||||
"express": "^4.17.2",
|
"express": "^4.17.2",
|
||||||
"get-port": "^5.1.1",
|
"get-port": "^5.1.1",
|
||||||
"lastfmapi": "^0.1.1",
|
"lastfmapi": "^0.1.1",
|
||||||
"media-metadata": "^2.1.0",
|
|
||||||
"mpris-service": "^2.1.2",
|
"mpris-service": "^2.1.2",
|
||||||
"music-metadata": "^7.11.4",
|
"music-metadata": "^7.11.4",
|
||||||
"react": "^17.0.2",
|
"react": "^17.0.2",
|
||||||
|
|
|
@ -234,7 +234,6 @@ const CiderBase = {
|
||||||
try {
|
try {
|
||||||
const metadata = await mm.parseBuffer(buffer, 'audio/x-m4a');
|
const metadata = await mm.parseBuffer(buffer, 'audio/x-m4a');
|
||||||
SoundCheckTag = metadata.native.iTunes[1].value
|
SoundCheckTag = metadata.native.iTunes[1].value
|
||||||
console.log(SoundCheckTag)
|
|
||||||
win.webContents.send('SoundCheckTag',SoundCheckTag)
|
win.webContents.send('SoundCheckTag',SoundCheckTag)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error.message);
|
console.error(error.message);
|
||||||
|
|
|
@ -464,7 +464,6 @@ const app = new Vue({
|
||||||
MusicKit.getInstance().videoContainerElement = document.getElementById("apple-music-video-player")
|
MusicKit.getInstance().videoContainerElement = document.getElementById("apple-music-video-player")
|
||||||
|
|
||||||
ipcRenderer.on('SoundCheckTag', (event, tag) => {
|
ipcRenderer.on('SoundCheckTag', (event, tag) => {
|
||||||
console.log(tag)
|
|
||||||
let replaygain = self.parseSCTagToRG(tag)
|
let replaygain = self.parseSCTagToRG(tag)
|
||||||
try {
|
try {
|
||||||
CiderAudio.audioNodes.gainNode.gain.value = (Math.min(Math.pow(10, (replaygain.gain / 20)), (1 / replaygain.peak)))
|
CiderAudio.audioNodes.gainNode.gain.value = (Math.min(Math.pow(10, (replaygain.gain / 20)), (1 / replaygain.peak)))
|
||||||
|
@ -484,15 +483,33 @@ const app = new Vue({
|
||||||
self.$refs.queue.updateQueue();
|
self.$refs.queue.updateQueue();
|
||||||
}
|
}
|
||||||
this.currentSongInfo = a
|
this.currentSongInfo = a
|
||||||
|
|
||||||
|
|
||||||
|
if (app.cfg.audio.normalization) {
|
||||||
|
// get unencrypted audio previews to get SoundCheck's normalization tag
|
||||||
|
try {
|
||||||
|
let previewURL = null
|
||||||
|
try {
|
||||||
|
previewURL = app.mk.nowPlayingItem.previewURL
|
||||||
|
} catch (e) { }
|
||||||
|
if (!previewURL) {
|
||||||
|
app.mk.api.song(app.mk.nowPlayingItem._songId ?? app.mk.nowPlayingItem.relationships.catalog.data[0].id).then((response) => {
|
||||||
|
previewURL = response.attributes.previews[0].url
|
||||||
|
if (previewURL)
|
||||||
|
ipcRenderer.send('getPreviewURL', previewURL)
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
if (previewURL)
|
||||||
|
ipcRenderer.send('getPreviewURL', previewURL)
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (e) { }
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
a = a.item.attributes;
|
a = a.item.attributes;
|
||||||
} catch (_) {
|
} catch (_) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (app.cfg.audio.normalization){
|
|
||||||
try{ ipcRenderer.send('getPreviewURL', self.mk.nowPlayingItem.previewURL)} catch(e){}
|
|
||||||
}
|
|
||||||
|
|
||||||
let type = (self.mk.nowPlayingItem != null) ? self.mk.nowPlayingItem["type"] ?? '' : '';
|
let type = (self.mk.nowPlayingItem != null) ? self.mk.nowPlayingItem["type"] ?? '' : '';
|
||||||
|
|
||||||
if (type.includes("musicVideo") || type.includes("uploadedVideo") || type.includes("music-movie")) {
|
if (type.includes("musicVideo") || type.includes("uploadedVideo") || type.includes("music-movie")) {
|
||||||
|
@ -916,8 +933,9 @@ const app = new Vue({
|
||||||
window.location.hash = `${kind}/${id}`
|
window.location.hash = `${kind}/${id}`
|
||||||
document.querySelector("#app-content").scrollTop = 0
|
document.querySelector("#app-content").scrollTop = 0
|
||||||
} else if (!kind.toString().includes("radioStation") && !kind.toString().includes("song") && !kind.toString().includes("musicVideo") && !kind.toString().includes("uploadedVideo") && !kind.toString().includes("music-movie")) {
|
} else if (!kind.toString().includes("radioStation") && !kind.toString().includes("song") && !kind.toString().includes("musicVideo") && !kind.toString().includes("uploadedVideo") && !kind.toString().includes("music-movie")) {
|
||||||
|
let params = { extend: "editorialVideo" }
|
||||||
app.page = (kind) + "_" + (id);
|
app.page = (kind) + "_" + (id);
|
||||||
app.getTypeFromID((kind), (id), (isLibrary), { extend: "editorialVideo" });
|
app.getTypeFromID((kind), (id), (isLibrary), params);
|
||||||
window.location.hash = `${kind}/${id}`
|
window.location.hash = `${kind}/${id}`
|
||||||
document.querySelector("#app-content").scrollTop = 0
|
document.querySelector("#app-content").scrollTop = 0
|
||||||
} else {
|
} else {
|
||||||
|
@ -2525,7 +2543,6 @@ const app = new Vue({
|
||||||
numbers.shift()
|
numbers.shift()
|
||||||
let gain = Math.log10((Math.max(numbers[0], numbers[1]) ?? 1000) / 1000.0) * -10
|
let gain = Math.log10((Math.max(numbers[0], numbers[1]) ?? 1000) / 1000.0) * -10
|
||||||
let peak = Math.max(numbers[6], numbers[7]) / 32768.0
|
let peak = Math.max(numbers[6], numbers[7]) / 32768.0
|
||||||
console.log(gain,peak)
|
|
||||||
return {
|
return {
|
||||||
gain: gain,
|
gain: gain,
|
||||||
peak: peak
|
peak: peak
|
||||||
|
|
|
@ -6,11 +6,11 @@
|
||||||
<h3>Home</h3>
|
<h3>Home</h3>
|
||||||
<div class="well profile-well">
|
<div class="well profile-well">
|
||||||
<div class="user-icon">
|
<div class="user-icon">
|
||||||
<mediaitem-artwork shadow="none" :url="profile.attributes.artwork.url"
|
<mediaitem-artwork shadow="none" :url="(profile && profile.attributes && profile.attributes.artwork) ? profile.attributes.artwork.url : ''"
|
||||||
size="300"></mediaitem-artwork>
|
size="300"></mediaitem-artwork>
|
||||||
</div>
|
</div>
|
||||||
<h3 class="name">{{ profile.attributes.name }}</h3>
|
<h3 class="name" >{{ (profile && profile.attributes && profile.attributes.name) ? profile.attributes.name : "" }}</h3>
|
||||||
<h4 class="handle">@{{ profile.attributes.handle }}</h4>
|
<h4 class="handle">@{{ (profile && profile.attributes && profile.attributes.handler) ? profile.attributes.handle : "" }}</h4>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col">
|
<div class="col">
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue