Closed i8x3 closed 6 months ago
As far as I'm aware, if your browser supports the codec/format diffuse can stream it. Please try opening the same track in your browser directly for playback.
I don't understand what you mean by opening the same track in your browser (using Chrome), but I do see that the codec (OPUS) is supported by Chromium/Chrome here. I also saw that where the audio codecs are listed in this project, the OPUS codec is not listed (link). I am currently compiling a version which I am trying to get the OPUS format supported, and I will let you know once it is done.
Thanks again, vyoln
Thanks, I’ll add it to the list of accepted file formats when I can find some time. If you do plan on making your own build of Diffuse you’ll also need to add the file extension here: https://github.com/icidasset/diffuse/blob/d3ee3295eb9acab31b9c7a642a3b98c645dbb779/src/Library/Sources/Pick.elm#L28
I have a follow-up question: is there anyway to use local files as the source (as my system is pretty slow and all sources are getting stuck at 5%)?
Thanks, vyoln
I have a follow-up question: is there anyway to use local files as the source (as my system is pretty slow and all sources are getting stuck at 5%)?
Thanks, vyoln
See https://github.com/icidasset/diffuse/discussions/328
And yeah it can take a while to process the first time around.
Thanks for your reply! It was much faster! I have an update on the support:
With that being said, I have one question. How do playing songs work in Diffuse/what files/libraries do the playing?
Thanks again, vyoln
Edit: Tested out just playing the audio through an HTML file, it is not a browser problem. This is the code I used:
<!DOCTYPE html>
<html>
<head></head>
<body>
<audio controls src="songname.opus">
</body>
</html>
Please ignore my last reply ^^
I've been researching, and I keep seeing that .opus is actually a mimetype of audio/ogg. Now, after I changed one song from ".opus" to ".ogg", it now works in Diffuse. So, my new problem is getting an opus file, and changing it into an ogg file in Diffuse natively. If you know how to do this that would be great, but for now I will try and mess around with "common.ts" and "Pick.elm" to do this.
Thanks, vyoln
It does seem like .opus
is used as a file extension, so I can add it.
my new problem is getting an opus file, and changing it into an ogg file in Diffuse
Adding the .opus
file extension to Pick.elm
and common.ts
is by far the easiest solution. If you'd instead replace the file extension then the syncing mechanism wouldn't work anymore.
If that is the case, then the .opus files were showing up but not playing (from my other reply). Would you possibly know why it is like that or any hunches on why it is not playing?
Thanks again, vyoln
Please ignore my last reply again ^^
It now seems like the OPUS files are working. I don't know what I did but they now work and the metadata is still there. I'm going to double check this, and then maybe issue a pull request with the updated code. I have one unrelated question, that is is there any way to view the songs individually versus using albums or artists (with their individual track images)?
Thanks, vyoln
I have more updates! It seems like OPUS file support is really unstable, as it only worked that one time and not anymore. I'm not sure what is wrong, as I hadn't changed any of the source code. I will keep looking into it in the time being, but for now OPUS files are basically not working.
Thanks, vyoln
I believe I have found the solution. I will list the code changes I have made to get OPUS support (it makes the OPUS file act like an OGG file but not change any extensions)
common.ts:
// ...
switch (audioId) {
case "mp3": return "mp3";
case "mpeg": return "mp3";
case "mp4a-latm": return "m4a";
case "mp4": return "m4a";
case "x-m4a": return "m4a";
case "flac": return "flac";
case "x-flac": return "flac";
case "ogg": return "ogg";
case "wav": return "wav";
case "wave": return "wav";
case "webm": return "webm";
case "opus": return "ogg"; // Line added
}
}
// ... (there is nothing changed after this)
Pick.elm:
-- ...
musicFileRegex : Regex.Regex
musicFileRegex =
"\\.(mp3|mp4|m4a|flac|ogg|wav|webm|opus)$" -- "opus" added here
|> Regex.fromStringWith { caseInsensitive = True, multiline = False }
|> Maybe.withDefault Regex.never
Please test this on your own computer and see if they work, as I'm still not too sure if they 100% work.
Thanks again, vyoln
Thanks for all the notes.
How do playing songs work in Diffuse/what files/libraries do the playing?
It just uses the browser's <audio>
element.
See https://github.com/icidasset/diffuse/blob/main/src/Javascript/audio-engine.ts#L81
So yeah it mostly depends on the browser I'd say. There's always the small possibility that it's a server or Diffuse issue though, eg. Google Drive sometimes messes up mime types.
have one unrelated question, that is is there any way to view the songs individually versus using albums or artists (with their individual track images)?
There's no cover view for individual tracks at the moment, just the regular list view.
Please test this on your own computer and see if they work, as I'm still not too sure if they 100% work.
Will do at some point 👍 What browser and source type are you using? And is the playback now working better?
I tested this on Chrome and Firefox with a local WebDav server, and the playback works fully! (the metadata can sometimes get messed up, but that could be a file problem or it not being in a specific album)
Thanks, vyoln
I've now tested with my full music library (Amazon S3), and OPUS files work!
Thanks again, vyoln
Live on https://nightly.diffuse.sh/
I tested this with my Amazon S3 bucket, and it was not working. After further inspection, I realized that line 51 in common.ts (case "opus": return "opus";
) was supposed to be case "opus": return "ogg";
. If you do this, then line 68 in common.ts (case "opus": return "audio/opus";
) is also not necessary.
Thanks once again, vyoln
Thanks for testing this @vyoln !
I'm not entirely sure what the correct solution here is since the opus and ogg mime types are used interchangeably. But I'll do some more testing to make sure it works, including trying out your solution. Could you send me an opus file to test with? 🙏 Just to be sure I'm seeing the same results as you are. You can mail it to icid.asset@gmail.com
if you don't want to link it here.
By the way, sorry if you already know this, but if you were testing on nightly.diffuse.sh
, be sure to click the update button on the settings page and check the build timestamp to make sure you are on the latest version.
Sure, here is an opus file to test with! https://www.dropbox.com/scl/fi/np2tjrhx1cr8dib9go6a2/KICK-BACK.opus?rlkey=i2jq3ed7rjphxc8sa9mfo8lmm&dl=0 (can't upload through github)
On the settings page, it says Built on Feb 9th 2024, 11:23:54
, so I believe that it is the latest version.
Thanks, vyoln
Thanks! Found out what the issue is, apparently Chromium doesn't like it when you set the audio element type to audio/opus
🙈 The file you provided now gets scanned and played 👍 Although the scanning takes forever because I think it's missing the correct metadata.
Thanks for your response! How do you think it could process faster and get the metadata?
Thanks again, vyoln
I should test with other opus files to be sure, but I think if the opus file had all the required metadata it should process faster. That's things like the track title, artist, album, track nr, etc. The file you sent me didn't have any of that.
Here is the same song with metadata for testing! https://www.dropbox.com/scl/fi/a96c3fr5m99cdeslsp3l6/KICK-BACK-with-metadata.opus?rlkey=gxaqo1khglapubcdzcblqfi8t&dl=0
Thanks, vyoln
Right now, as far as I can see, there is no support for the OPUS file format. If you could add support for OPUS files, that would be greatly appreciated.
Thanks in advance, vyoln