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

  • Home
  • SEARCH
  • 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 4545372
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T15:48:15+00:00 2026-05-21T15:48:15+00:00

I would like to build an audio multitrack sequencer similar to a drum machine.

  • 0

I would like to build an audio multitrack sequencer similar to a drum machine.
What do you think is the best way to implement this?

At the moment I have 2 tracks represented by 2 arrays: 2 x [tick, samplePointer].
I merge these 2 tracks in a main array to be played [tick, samplePointer] and sort it by tick.
An audio callback fires every tick (4 ticks per beat) and checks the first element in the array and if its tick is equal to the global song position (in ticks) then i play it.
If I add or delete a note in one of the 2 tracks(arrays) i then merge both tracks(arrays) and sort them again.

It works but I have the feeling that there is a better way to do it.
What would be the best practice to implement such a project? How would a professional app like Logic, Ableton, Cubase, Reason etc implement audio/midi event lists and manage what has been played, what needs to be played?

Thank you in advance for your thoughts.

Brice

  • 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-21T15:48:16+00:00Added an answer on May 21, 2026 at 3:48 pm

    Would need more details to better answer you. What language are you using? What tempo range are you targeting? What audio interface will you be programming against (important to know when it comes to the latency you will be dealing with).

    Also, is it just a drum sequencer? Or is it something more complex? How many “instruments”/”voices” are you planning on supporting? If you are going to be supporting <32 voices, it’s possible to have a single array of [int(tick), int(voices)]. Each individual voice is a bit in the 32-bit number. Then to determine whether a voice is playing, you just need to “&” the voice flag against the voices int in the array. This would avoid the array sorting/copying/building.

    Latency is an important issue to understand here. If you have a tempo of 240bpm for instance, and four “ticks” per beat (really, we’re talking about one measure with each beat subdivided into sixteenth notes):

    • There are 4 beats per second (240 beats per minute / 60 seconds)
      -> Each beat occurs every 250 milliseconds
      -> Each “tick” occurs every 62.5 milliseconds

    If the audio interface has a high latency (for example, shared mode WASAPI in Windows Vista+ has a latency of around 30ms), you will have different “windows” that will need to be generated.

    If you’re processing MIDI events, this becomes even more important because you can be receiving MIDI events within individiual ticks.

    Most DAWs (Digital Audio Workstations) I have worked with typically think of the world in two different “types”: audio data, and midi data. Audio data tends to be more “realtime” (or as realtime as you can get, hence the importance for sub-3ms latencies). Midi is still fairly “fast paced”. Eventually, you’ll likely be thinking in terms of midi data.

    However, the best way to get started on a project like this is to build a very simple drum sequencer. Take four drums, and the stuff you are doing, and go from there :). Good luck!

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

Sidebar

Related Questions

I would like to build an application that will run on a web, this
I would like to do remote deployment from my build machine onto a server.
I would like to implement a post build event that performs the following actions
I would like to build a regexp in Java that would be passed in
Basically, I would like to build a list comprehension over the cartesian product of
Inspired by Eric Sink's interview on the stackoverflow podcast I would like to build
I would like to ask you which automated build environment you consider better, based
I would like to be able to build test applications (e.g. the nightly Minefield/Firefox)
I would like to add a BuildListener to my headless build process, which is
I would like to hear other people's advice on when one should build a

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.