Sitelet https://github.com/bspaans/python-mingus/issues/90
Skip to content

How to play different instruments at the same time using a composition? #90

Description

@epbonacina

I've been trying to play different tracks using different instruments, but all tracks play the same instrument.
When I execute the example below, the only thing I can hear is the Acoustic Grand Piano playing both tracks.

    instrument = MidiInstrument("Acoustic Grand Piano")
    instrument2 = MidiInstrument("Oboe")
  
    track_container = Track(instrument)
    track_container_2 = Track(instrument2)
    track_container.add_notes(['C-6', 'E-6', 'G-6', 'B-6'])
    track_container_2.add_notes(['E-6', 'G#-6', 'B-6', 'D-6'])

    composition = Composition()
    composition.add_track(track_container)
    composition.add_track(track_container_2)

    fluidsynth.play_Composition(composition, bpm=60)

If I switch the composition.add_track methods, as in the example below, the Oboe becomes the only audible instrument.


    instrument = MidiInstrument("Acoustic Grand Piano")
    instrument2 = MidiInstrument("Oboe")

    track_container = Track(instrument)
    track_container_2 = Track(instrument2)
    track_container.add_notes(['C-6', 'E-6', 'G-6', 'B-6'])
    track_container_2.add_notes(['E-6', 'G#-6', 'B-6', 'D-6'])

    composition = Composition()
    composition.add_track(track_container_2)
    composition.add_track(track_container)

    fluidsynth.play_Composition(composition, bpm=60)

If I pass the channels parameter to the fluidsynth.play_Composition method, nothing changes.

What is wrong with my codes? A composition should be able to play multiple instruments, right?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions