-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
MIDI Export feature (issue #258) #1686
Conversation
Why is there python code in this commit? Not every platform comes with python. That's an additional dependency that seems unnecessary to add. I don't think we can merge this as it is now... It would be a better idea to implement this as a file-export plugin. At the very least, get rid of the python... |
The python script is a standalone utility to convert mmp files to MIDI. The LMMS program has no dependency on it. |
If it's standalone, then I'm not sure if it should be in our main source tree... maybe a separate repository for it would be a better idea. |
@@ -0,0 +1,317 @@ | |||
#ifndef __MIDIFILE_HPP | |||
#define __MIDIFILE_HPP |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
leading underscores in header guards is a no-no. Also, we don't use the .hpp extension, all our headers are .h
cool, I'll make a new pull request with the script removed. |
Also, it'd be better to implement this functionality as a plugin. Look at how midi-import is implemented, IIRC it's done as a file-import plugin. Midi-export can be implemented as a file-export-plugin. This improves modularity of code and makes it easier to change and develop things later... |
sounds good, yet I've no more time to invest in LMMS atm. |
You also do not need to create another pull request. You can make the On Sun, Jan 25, 2015 at 12:41 AM, Mohamed Abdel Maksoud <
Jonathan Aquilina |
Thanks eagles, I noticed my commits appear here. |
@mohamed--abdel-maksoud this feature would be tremendous to have ready for stable-1.2 testing. A few things... Travis seems to have some win32 compilation errors as seen here: As @diizy mentioned, we would also need the code moved to |
@tresf the error on win32 is trivial, I just fixed it. |
I apologize if this is seen as too far off topic, but: @mohamed, THANK YOU! I know that this can be a pain to redo, and I want to From what I see, it would be best implemented as a plugin. I just want you to know I am very excited to see this feature happen. You /tangent
|
Thanks @dednikko (: I've been looking to see this feature implemented for some time, too. |
This is going to be a serious improvement to LMMS, thank you for getting
|
Hi @mohamed--abdel-maksoud, it's not exactly required but could you try to squash some commits together and rename others? Keeping our git history sane is very important so that we are able to track regressions in an easy way. There is a nice tutorial on how to use Some references: |
midiout.writeRawData((char *)buffer, size); | ||
|
||
// midi tracks | ||
foreach( Track* track, tracks ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you think we can modularize this so that we are able to export individual tracks in the future?
@badosu I just pushed a change where midi export is a plugin, I think this modularizes the part in question. |
qDebug() << "failed to load midi export filter!"; | ||
return; | ||
} | ||
exf->tryExport(tracks, Engine::getSong()->getTempo(), export_filename); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! In case we need to implement single track MIDI export feature this will come handy.
34031b2
to
d6349c3
Compare
it builds fine now, I tried to organize the commits but I guess I didn't do it right. If this is an issue I'll create a new fork and commit the changes anew. |
Hi mohamed, I noticed something has happened there and the history got all messed up. So I took all your changes and created a patch file for them, it's here: https://gist.github.com/badosu/120eaf72dc3847049ce0. I made some commands so that you are able to restore your changes to an incorrupt state: git checkout upstream/master
git checkout -b add-midi-export
curl https://gist.githubusercontent.com/badosu/120eaf72dc3847049ce0/raw/35020a3c0d325d451864b5f68621ce9558419e16/gistfile1.diff | git apply Now you should be able to add files and commit them the way you want and open a new PR with everything fixed. Or you can fix the current PR as well. |
thanks @badosu, I applied the commands, merged them and pushed to master, I'm not sure though how to delete my prior commits (I'm used to svn, so git can be challenging at times) |
you can do a git reset which should clear out those other commits. On Wed, Feb 4, 2015 at 1:50 PM, Mohamed Abdel Maksoud <
Jonathan Aquilina |
5deac06
to
af0f997
Compare
thanks @eagles051387 , git reset seems to do the trick |
// events are sorted by their time | ||
inline bool operator < (const Event& b) const { | ||
if (this->time < b.time) return true; | ||
#if 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am a little ignorant about C++, what does this mean?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh I was experimenting with the ordering of MIDI events, basically any thing between #if 0 and #endif is discarded, this part could be cleaned.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you clean this up?
Remember that you don't have to create additional commits, after you've done your changes and added them you can use git commit --amend
instead of the regular one to ammend your changes to the last commit.
You'll have to push with -f
later. This is not an issue since this branch is only yours.
Really nice work @mohamed--abdel-maksoud, let me test this feature. |
@mohamed--abdel-maksoud It's missing the changes on the See https://gist.github.com/badosu/120eaf72dc3847049ce0#file-gistfile1-diff-L684 |
@badosu sorry, the cmake cache deceived me, the latest push should restore the changes |
{ | ||
QDomElement note = nn.toElement(); | ||
if (note.attribute("len", "0") == "0" || note.attribute("vol", "0") == "0") continue; | ||
#if 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mohamed--abdel-maksoud Another one here...
@mohamed--abdel-maksoud I am seeing some seemingly debug messages, is it related to this PR? |
|
||
void MidiExport::error() | ||
{ | ||
//qDebug() << "MidiExport error: " << m_error ; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mohamed--abdel-maksoud I guess you wanted to implement something here?
@badosu yes, I cleaned that locally, let me know if there're more of such small fixes before I group them in one commit |
So, I just exported a big track to MIDI and it looks like it works! (https://github.com/SecondFlight/lmms/raw/master/data/projects/CoolSongs/Greippi%20-%20Krem%20Kaakkuja%20%28Second%20Flight%20Remix%29.mmpz) There are some possible improvements though, it looks like everything is Grand Piano and we may be able to extract some information from the tracks and changing their type, but should be a posterior improvement. Also another possible improvement can be on how we show the "Export to MIDI" button, we can show this as a new option on the already existent Export Panel instead of a File menu option, that's arguable though. I tried opening the generated MIDI file on Drumstick (http://sourceforge.net/projects/drumstick/) and it's crashing, I don't know if this is a problem with the file exactly. Opening on a normal audio player with MIDI support works. |
@badosu Thanks for trying out the feature Amadeus! I just tested with this song and it seems to trigger a bug (the output MIDI has some out of range notes), I'll look into this one of the following days. |
Thanks for following up Mohamed! |
Things look good here, good work on modularizing the code |
@diizy I was still expecting some feedback from @mohamed--abdel-maksoud, but I guess he can send a PR later to address these issues. |
@mohamed--abdel-maksoud it seems that commits mohamed--abdel-maksoud@e048035 and mohamed--abdel-maksoud@9a40363 were added to your branch after this PR was merged and closed, so they aren't in the upstream master branch. Could you issue a new PR that adds these commits? |
@mohamed--abdel-maksoud @Umcaruje These commits seem to be unmerged still. I can't test them right now but I cherry-picked them and they compile fine. |
@Umcaruje @mohamed--abdel-maksoud Three tracks exported and the resulting track imported below. The output is the correct notes Here is the same project exported with commits commits mohamed--abdel-maksoud/lmms@e048035 and mohamed--abdel-maksoud/lmms@9a40363. |
Background: #258
This is an implementation of a basic MIDI export feature in LMMS.
Remarks:
Your feedback is welcome.