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

Fix MIDI export #3733

Merged
merged 8 commits into from
Sep 13, 2017
Merged

Fix MIDI export #3733

merged 8 commits into from
Sep 13, 2017

Conversation

PhysSong
Copy link
Member

Fixes #2384.
Zero-length note support needs some work, per #2074. See #2074 (comment).
Also MidiFile.hpp needs correct copyright information. See #2384 (comment).

@PhysSong PhysSong added this to the 1.2.0 milestone Jul 29, 2017
@zonkmachine
Copy link
Member

Wonderful!

Issues:
An exported track opens in MusE transposed down 2 octaves. The demo project c3.mmp has one note, c3. It will export as midi note 36 (c3.mid) which, by the most adopted standard, translates to c1. c3 should probably export as note 60. The c3 in c3.mmp seem to be the correct pitch ~130Hz.

c3.mmp.zip c3.mid.zip

http://computermusicresource.com/midikeys.html
Related: #1857

@PhysSong
Copy link
Member Author

PhysSong commented Jul 30, 2017

#1857 (comment)
Possible (temporary) fix: add 12 to every note pitch.

Another issue of this PR: actually master pitch is ignored now. I'll put master pitch support if needed.

@zonkmachine
Copy link
Member

Possible (temporary) fix: add 12 to every note pitch.

👍

Another issue of this PR: actually master pitch is ignored now. I'll put master pitch support if needed.

Yes. I think master pitch needs to go in there.

@zonkmachine
Copy link
Member

I tried automation of master pitch. Maybe this isn't intended to work yet but here goes...

Automation of master pitch: midimasterpitch.mmp.zip
Note pitch comes out with the same pitch modulation as is presently when you press export MIDI.
To reproduce. Play and pause at random positions. Right click on master pitch fader and read off the value copy value(..). Export MIDI...
Expected: modulated from original C4 over a larger range, same result every time and not depending of start position.

@PhysSong
Copy link
Member Author

Yes. Processing automation is difficult, so current method(based on previous one) only exports notes.
I'll try to include these automations or merge it without master pitch support.

@zonkmachine
Copy link
Member

or merge it without master pitch support.

Maybe that's a good idea actually. The basic functions are there and midi export works.

@PhysSong
Copy link
Member Author

PhysSong commented Aug 2, 2017

I need to change some things:

  • Instrument pitch should be exported as a MIDI CC.
  • It is not clear whether MIDI export should transpose notes according to base notes, or not.
  • MidiFile.hpp doesn't support MIDI CC. In order to export automation patterns, I should modify this file a lot, or add some more functions.
  • Moreover, exporting automation patterns is complicated and difficult. For complete MIDI export, such things must be implemented.

So there's two choices about automation:

  1. Merge this PR without automation support and implement it later.
  2. Postpone merging until full automation support is implemented.

@zonkmachine
Copy link
Member

zonkmachine commented Aug 2, 2017

  1. Merge this PR without automation support and implement it later.

I vote this. With 'later' here meaning in master.

@Umcaruje
Copy link
Member

Umcaruje commented Aug 4, 2017

Merge this PR without automation support and implement it later.

I vote on this too, midi automation can happen when we expose the midi CC messages in the instruments #1159 (part of #1472)

It is not clear whether MIDI export should transpose notes according to base notes, or not.

That's a tricky one, I usually use the base note to tune the actual instrument, but I also sometimes use it to actually shift an instrument a couple of octaves up or down, so I don't really know about this, we could do it as an option, but midi export doesn't have any dialog so far.

@PhysSong
Copy link
Member Author

PhysSong commented Aug 5, 2017

I'm trying to implement automation export. If it is finished before rc4 is released, I'll merge this PR with automation support.
If not, this PR should be merged without automation support.

I vote this. With 'later' here meaning in master.

It should be. However, MIDI export without automation support will be buggy for some projects.
When it have been tested enough and works well, we can(and should, in my opinion) backport it later.

@PhysSong
Copy link
Member Author

It is not clear whether MIDI export should transpose notes according to base notes, or not.

That's a tricky one

InstrumentTrack::processOutEvent() applies both base note and master pitch. According to this, I think the answer should be "yes".

I want to remove MidiFile.hpp from this project and write a new class for this purpose. That file doesn't support MIDI CC and have some bugs. I want to implement a better exporting plug-in :)
If the schedule matters, I'll instrument pitch support and merge it.

@zonkmachine
Copy link
Member

I want to remove MidiFile.hpp from this project and write a new class for this purpose. That file doesn't support MIDI CC and have some bugs. I want to implement a better exporting plug-in :)
If the schedule matters, I'll instrument pitch support and merge it.

I think you should solve this the simplest possible way and leave rewrites to a later release.

@PhysSong
Copy link
Member Author

Do I need to update README.md in this PR?

@tresf
Copy link
Member

tresf commented Aug 24, 2017

Do I need to update README.md in this PR?

Good catch. Sure.

@PhysSong
Copy link
Member Author

PhysSong commented Sep 3, 2017

Is there anything to do?

@ghost
Copy link

ghost commented Sep 5, 2017

A way to choose the exported instrument for each track would be really useful. It could be selected in the misc section, below the master pitch toggle, along with a check for the track to be exported in the first place.

@PhysSong
Copy link
Member Author

PhysSong commented Sep 5, 2017

It will be a good feature, but won't be in this PR because it is a fix for broken MIDI export, not a enhancement. Furthermore, it will be merged into stable-1.2, which is on a feature freeze now.

However it can be done in master later.

@zonkmachine
Copy link
Member

Is there anything to do?

I think it's good enough to merge.

Just one observation when exporting shorties/Crunk(Demo).
You may want to take a look at the note length of the last beat note in a pattern. It gets a length of one whole measure. It would probably make more sense to have them cut off at the end of the measure.

Tracks Kick 01 and Clap 04 (Imported intor MusE) extends to measure 9.

crunklmms

@PhysSong
Copy link
Member Author

PhysSong commented Sep 7, 2017

Yes. I will take a look at it and fix it soon.

@PhysSong
Copy link
Member Author

PhysSong commented Sep 9, 2017

This is the only thing left for rc4 now. I will fix the issue above and merge it tomorrow. No objection?

@zonkmachine
Copy link
Member

zonkmachine commented Sep 9, 2017

This is the only thing left for rc4 now. I will fix the issue above and merge it tomorrow. No objection?

No objection.

There is also the issue with recording single stream instruments.

@PhysSong
Copy link
Member Author

As a simple workaround, I'm considering cutting notes at the end of last BBTCO, or something similar.

@zonkmachine
Copy link
Member

As a simple workaround, I'm considering cutting notes at the end of last BBTCO, or something similar.

I'm not that bothered by it. I think we can ship RC4 without a fix for this. MIDI export is a complex function and there will be a bunch of things that needs to be fixed anyway.

@zonkmachine
Copy link
Member

I'm considering cutting notes at the end of last BBTCO

... Sounds like a good idea. 👍

@PhysSong
Copy link
Member Author

there will be a bunch of things that needs to be fixed anyway.

Yes, maybe. Anyway, cutting notes at the end of last BBTCO or whole song will be much better. More things should be done in master and can be backported whenever needed.

@PhysSong
Copy link
Member Author

May I merge it tomorrow?

@zonkmachine
Copy link
Member

If you are happy with the last commit I think you should just go ahead and merge it now.

@PhysSong PhysSong merged commit c0682c9 into LMMS:stable-1.2 Sep 13, 2017
@PhysSong PhysSong deleted the midiexport branch September 13, 2017 23:10
sdasda7777 pushed a commit to sdasda7777/lmms that referenced this pull request Jun 28, 2022
* Re-enable MIDI export

* Fix logic for processing BB tracks and BB notes

* Consider master pitch and base note in MIDI export.

* Cut BB notes at the end of BB pattern.
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.

4 participants