GithubHelp home page GithubHelp logo

Comments (3)

melanchall avatar melanchall commented on July 3, 2024 1

Oh sorry, I forgot to set Channel property on event returned by GetProgramEvent:

var programChangeEvent = (ProgramChangeEvent)GeneralMidiProgram.Pad8.GetProgramEvent();
programChangeEvent.Channel = (FourBitNumber)1;
chordTrackChunk.Events.Insert(0, programChangeEvent);

@meckzqz, can the issue be closed?

from drywetmidi.

melanchall avatar melanchall commented on July 3, 2024

Hi,

I confirm the issue. I've fixed it in develop branch and the fix will be available in next release of the library. At now you have several options to work around the issue:

  • Build the library from sources of the develop branch

  • Wait for the next release

  • Insert ProgramChangeEvent at start of track chunk after ToTrackChunk call:

    var trackChunk = patternBuilder.Build().ToTrackChunk(TempoMap.Default, (FourBitNumber)1);
    trackChunk.Events.Insert(0, GeneralMidiProgram.Accordion.GetProgramEvent());

from drywetmidi.

meckzqz avatar meckzqz commented on July 3, 2024

Hello,

The quick turnaround time on this is much appreciated. I have tried using the solution you've proposed, and the results are unchanged from my previous report.

The code in question:

var trackChunk = patternBuilder.Build().ToTrackChunk(TempoMap.Default, (FourBitNumber)0);
trackChunk.Events.Insert(0, GeneralMidiProgram.Accordion.GetProgramEvent());
var chordTrackChunk = chordPatternBuilder.Build().ToTrackChunk(TempoMap.Default, (FourBitNumber)1);
chordTrackChunk.Events.Insert(0, GeneralMidiProgram.Pad8.GetProgramEvent());
MidiFile midiFile = new MidiFile(new[]
{
    trackChunk,
    chordTrackChunk
});

I'm prepared to switch to the develop branch for now, but I'm confused as to why this code isn't functioning as expected.

EDIT: I now realize your proposed solution understandably assumes a program change on a single TrackChunk, and likely doesn't account for this specific case.

EDIT2: Trying out the develop code now, and everything seems to be working as expected. Kudos!

from drywetmidi.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.