Skip to content

Implementation for LRC Lyrics Export Functionality #27852

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

Open
wants to merge 16 commits into
base: master
Choose a base branch
from

Conversation

glopezsalgado
Copy link

Resolves: #24813

This implements LRC file export for lyrics, including timestamps and metadata. The exporter appears in MuseScore's export dialog and generates standard .lrc files with [mm:ss.xx] formatted lyrics. Handles repeats and preserves score metadata (title/composer). Tested manually

  • I signed the CLA
  • The title of the PR describes the problem it addresses
  • Each commit's message describes its purpose and effects, and references the issue it resolves
  • If changes are extensive, there is a sequence of easily reviewable commits
  • The code in the PR follows the coding rules
  • There are no unnecessary changes
  • The code compiles and runs on my machine, preferably after each commit individually
  • I created a unit test or vtest to verify the changes I made (if applicable)

…ule dependency, to add the LRC file export feature.
…format (.lrc) in export writers, to add the LRC lyrics file export feature.
…at const TYPES and added the following test steps for LRC export workflow: Open export dialog, Select LRC format, Execute export, Verify output file.
…rt modules, implementing INotationWriter interface for LRC format, and registering the exporter in imagesexport module. The implemented INotationWriter interface for LRC format extracts lyrics with timestamps from the score, formats output in standard LRC format, and handles metadata (title, composer).
…d lyrics extraction from score, formatted output in standard LRC format, and implemented the INotationWriter interface.
…d lyrics extraction from score, formatted output in standard LRC format, and implemented the INotationWriter interface.
@cbjeukendrup
Copy link
Member

It looks like you used an editor that automatically formats every file you open or touch, but not according to our code style. You will have to undo these formatting changes unfortunately.

Also, there is currently a conflict between your branch and the master branch. To fix it, you have to rebase your branch, and then force-push:

git pull --rebase upstream master
# At this point, you'll have to resolve the conflicts.
# After the rebase has been completed successfully, run:
git push -f

@@ -21,20 +21,23 @@
*/

#include "notationwritersregister.h"
#include "importexport/lyrics/exportlrc.h"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This include does nothing. Instead, you need to register the lyrics writer from the lyrics export module file (which you will have to create), like how it's done in imagesexportmodule.cpp

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You have src/importexport/midi/internal/midiexport/exportLRC.{h,cpp} and you have src/importexport/lyrics/exportlrc.{h,cpp}, which look almost identical. It looks like only the latter should be kept.

@@ -0,0 +1,126 @@
// CREATED BHY
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file does not have the correct copyright header. Look at other files what it should be.

Comment on lines +2 to +7
#include "exportLRC.h"
#include "engraving/dom/chordrest.h"
#include "engraving/dom/lyrics.h"
#include "engraving/dom/masterscore.h"
#include "engraving/compat/midi/compatmidirender.h"
#include <QFile>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sort the includes like this:

  1. The header file corresponding to the cpp file
  2. blank line
  3. std includes
  4. blank line
  5. Qt includes
  6. blank line
  7. other includes, alphabetically
Suggested change
#include "exportLRC.h"
#include "engraving/dom/chordrest.h"
#include "engraving/dom/lyrics.h"
#include "engraving/dom/masterscore.h"
#include "engraving/compat/midi/compatmidirender.h"
#include <QFile>
#include "exportLRC.h"
#include <QFile>
#include "engraving/compat/midi/compatmidirender.h"
#include "engraving/dom/chordrest.h"
#include "engraving/dom/lyrics.h"
#include "engraving/dom/masterscore.h"

(EDIT: I see I posted this comment on the wrong file, namely the one in midiexport, while only the one in lyrics should be kept. But it applies to that one as well.)

@@ -0,0 +1,30 @@
#ifndef EXPORTLRC_H
#define EXPORTLRC_H
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here about the copyright header and the order of the includes. And additionally, nowadays we prefer using #pragma once in new files, instead of #ifndef....

Comment on lines +5 to +6
project
notation
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think linking to project and notation is necessary

@@ -0,0 +1,8 @@
declare_module(iex_lyrics)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copyright header, again

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of naming the module folder just lyrics and the module just iex_lyrics, I would call the folder lyricsexport and the module iex_lyricsexport.

@@ -0,0 +1,8 @@
declare_module(iex_lyrics)
set(MODULE_SRC exportlrc.cpp exportlrc.h)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You will have to add lyricsexportmodule.{h,cpp} files here, just like imagesexportmodule.{h,cpp}. You will also need make sure that the main executable is linked to iex_lyricsexport (see src/app/CMakeLists.txt) and that the module is loaded at runtime (see appfactory.cpp).

writers->reg({"pdf"}, std::make_shared<PdfWriter>(iocContext()));
writers->reg({"svg"}, std::make_shared<SvgWriter>(iocContext()));
writers->reg({"png"}, std::make_shared<PngWriter>(iocContext()));
writers->reg({"lrc"}, std::make_shared<mu::iex::lrc::ExportLRC>());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not the right place for this. The lyrics export has nothing to do with the images export module.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement exporting of LRC lyric files
2 participants