Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4341498
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T11:29:35+00:00 2026-05-21T11:29:35+00:00

I am removing events from a MIDI Track and I assumed that by doing

  • 0

I am removing events from a MIDI Track and I assumed that by doing so the total duration of the Track would reduce accordingly, If there are no events in the Track then I thought that the size of the Track would be 0.

Unfortunately it seems it is not the case, even though the events are removed the size in Ticks does not change and only increases as more are added.

Is this normal MIDI/Java behaviour?

Edit:

This is the method that removes all of the events from the Track:

public static boolean Remove() {
    //TODO: Test the bejeezus out of it.

    if(_sequencer.isRunning()){
        _sequencer.stop();
    }

    for (int i = 0; i < _track.size(); i++) {
        if (!_track.remove(_track.get(i))) {
            Logger.Add("MIDI Event not removed");
            return false;
        }
    }

    //Used for debugging purposes
    long z = _track.ticks();
}

Yet when I use some crude debugging techniques and check the amount of ticks directly after removing the events, I find this;

enter image description here

It seemingly makes no difference, I don’t really understand why it’s doing it. I assumed that the size of Ticks depends on the amount of events in the Track, therefore if there were 10 events in a track the tick size would be 10 (As I set the tick length to 1 when adding them to the track) likewise if there were no events the size would be 0.

Adding events:

public static void AddMessage(int channel, int pitch, long tick, int velocity) {
        _track.add(CreateNoteOnEvent(channel, pitch, tick, velocity));
        _track.add(CreateNoteOffEvent(channel, pitch tick, velocity));
    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T11:29:36+00:00Added an answer on May 21, 2026 at 11:29 am

    After many hours debugging I managed to track the bug down, the way I was removing events meant that half of them would never be considered which led to the size of the track never reaching zero.

    Any event I added would then be placed after the already existing events which would explain why I was hearing multiple notes in certain parts.

    The answer to that question (and this one) can be found here: Unable to Remove Events from Track

    Thanks for your time, I greatly appreciate it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Removing annotations from my map view in the following way: if ([[self.mapView annotations] count]
For removing trailing part is I use the code str.substring(0,str.length -2) Is there a
After removing hash from URL using window.location.hash='' page getting reloaded in firefox. EDIT Example:
I am having problems removing index.php from codeigniter-2. I remember using the same code
I know that removing whitespaces is as easy as String.trim(). But my string contains
In IE8 when dynamically removing TR elements from a table inside a DIV with
When removing the selected attribute from options in a multiselect using .removeAttr(selected), the options
I want to know how do I go about removing individual delegates from the
Generally when you unload an swf from another swf you would follow a cleanup
I am working on a site that users can add and delete videos from

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.