Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OPUS Support (Feature Request for Nora) #242

Closed
HelveticAlex opened this issue May 10, 2024 · 7 comments · May be fixed by #258
Closed

OPUS Support (Feature Request for Nora) #242

HelveticAlex opened this issue May 10, 2024 · 7 comments · May be fixed by #258
Assignees
Labels
wontfix This will not be worked on

Comments

@HelveticAlex
Copy link

Is your feature request related to a problem? Please describe.
As .OPUS is becoming increasingly relevant and serves as a direct replacement for .MP3, its absence limits the usability of the platform for users who prefer or require .OPUS for its superior efficiency and quality.

Describe the solution you'd like
I would like Nora to implement support for the .OPUS audio codec..

Describe alternatives you've considered
An alternative solution could be continuing to convert .OPUS files to other supported formats like .MP3 or .AAC, but this results in a loss of quality and/or increased file sizes, which is not ideal. Native .OPUS support would be a much more efficient and quality-preserving option.

Additional context
Adding .OPUS support could also align Nora with modern audio standards and practices, as more devices and platforms are beginning to adopt .OPUS due to its advantages over other audio formats. This enhancement would not only improve functionality but also future-proof the platform as media standards evolve.

@Sandakan
Copy link
Owner

@HelveticAlex,
I have tried to enable support for other codecs on Nora.

But the main problem is that chromium only comes with a handful of audio codecs to work with and I have no idea how to integrate more codecs to it.

@HelveticAlex
Copy link
Author

HelveticAlex commented May 11, 2024

Chromium should support Opus (and Vorbis). They themselves popularized this audio codec. Now as for the implementation, unfortunately I don't know either... but I do know that it's possible given that it's "built-in"!

https://www.chromium.org/audio-video/

Since it's an electron-based app, it should even have opus enabled by default.

<audio controls>
    <source src="path_to_audio_file.ogg" type="audio/ogg; codecs=opus">
    Your browser does not support the audio element.
</audio>

For Advanced Processing, like using an EQ or something, the Web Audio API should be enough. Opus uses "AudioContext" to decode it's thing.

async function playOpusAudio(audioUrl: string) {
    const audioContext = new AudioContext();
    const response = await fetch(audioUrl);
    const arrayBuffer = await response.arrayBuffer();
    const audioBuffer = await audioContext.decodeAudioData(arrayBuffer);
    
    const source = audioContext.createBufferSource();
    source.buffer = audioBuffer;
    source.connect(audioContext.destination);
    source.start();
}

^

((Example in TypeScript, DO NOT COPY, it probably won't work with the structure of this app))

@Sandakan
Copy link
Owner

@HelveticAlex,
It does work. But it won't support metadata editing because the package I'm using only supports mp3.

@HelveticAlex
Copy link
Author

Mhmm, what about https://www.npmjs.com/package/music-metadata-browser ?

It requires a little more work, but given the number of metadata supported, it could be incredible for Nora !

@Sandakan
Copy link
Owner

Mhmm, what about https://www.npmjs.com/package/music-metadata-browser ?

It requires a little more work, but given the number of metadata supported, it could be incredible for Nora !

I'm already using its nodejs implementation and it only supports reading metadata.

@HelveticAlex
Copy link
Author

HelveticAlex commented May 12, 2024

Until finding a solution for editing the metadata, simply implementing the codec is enough (at least for my case) (and if I need to change the metadata of any files, I'll just do it with Mp3tag).

It would be a pleasure to deliver this patch as soon as possible (or the next one) !

Sandakan added a commit that referenced this issue Jun 2, 2024
- Updated the build workflow to fix a bug for Nora app missing sharp dependencies in Linux environments.
- Added experimental playback support for m4a and opus songs. Fixes #247, #242.
- Fully converted Nora to an ESM package.
- Added support for fetching lyrics from LRCLIB. Fixes #252.
- Fixed a bug where the correct lyrics line won't scroll to the center of the screen if the song is paused.
- Fixed a bug where items in ArtistPage, AlbumPage, PlaylistPage, GenrePage are not centered in their grid cells.
@Sandakan Sandakan linked a pull request Jun 2, 2024 that will close this issue
19 tasks
Copy link

stale bot commented Jul 11, 2024

Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

@stale stale bot added the wontfix This will not be worked on label Jul 11, 2024
@stale stale bot closed this as completed Jul 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants