Sequencing

First of all, thanks for an incredible framework. I started playing around with Core Audio a while ago and nearly gave up before I found TAAE. Now I've made a couple of fun projects and now I've started building a more advanced app and it's coming along nicely. However for the last couple of weeks I've been overheating my brain trying to get a sequencer to work.

What I'm trying to do is to use an AUSampler to play samples that may or may not have sequenced elements in them (like a 1 bar hihat-loop). I'm triggering the sampler from a sequencer and I've tried a couple of different approaches due to reading about that counting frames would be the most accurate thing vs. using timers and mach_wait_until(). Right now I'm using the timingReceiverCallback.

For quite a while now I've ben trying to understand how to get this working. My approach has been to count the frames but since the frames mostly are 512, depending on bpm, i get more or less matching results. I rarely get an on beat hit, rather I get a last tick just before the beat and then a first slightly past.

Hit before beat: 0.998458
Playhead: 44032
Time since beat: 0.010068
Playhead: 44544

So what I've been trying to do is to make the sequencer wait those last 0.001542 seconds so that it makes the AUSampler play at the exact beat but this seems to be trickier than I thought.

This would probably not be a problem if I didn't have samples that are sequenced but because of this, when the sampler starts ahead and plays a sequenced sample, when the counting catches up, then the first sample is triggered a little ahead of time and the second sample is triggered more accurate a glitch occurs.

Am I going in the right direction? A little input would be fantastic, I've been going crazy about this for weeks and don't know if I should scrap everything and start with a different solution?

Best,
Joel

Comments

  • Thanks heaps for the kind words @triplej!

    You might be interested in this, instead of having to reinvent the wheel: http://forum.theamazingaudioengine.com/discussion/921/a-sequencer#latest

    Best,
    Michael

  • Thanks for the reply @Michael, this looks promising! I'll play around with it and hopefully get better timing than with my previous attempts :)

    Thanks again for making a very fun and inspiring framework!

  • Hehe okay, so after a bit of testing I'm still getting mixed result. The timing got a little bit better with the use of MusicSequences but it led to some other bugs, like when the click occurred to close to the beat it didn't play at all which sort of defeated the functionality I'm looking for. I'm rather trying to build some sort of pad-instrument rather than a sequencer so striking a pad right at the beat has to work.

    I've tried some other solutions as well and it works decently. The thing is.. I'm working with loops and I went over to using mach_absolute_time() for the timing but sometimes it feels like the loop is finished before the timing and sometimes after. Is there a way to output the audioBuffers in regard to the logical time or is this a horrible idea?

  • @triplej said:
    Hehe okay, so after a bit of testing I'm still getting mixed result. The timing got a little bit better with the use of MusicSequences but it led to some other bugs, like when the click occurred to close to the beat it didn't play at all which sort of defeated the functionality I'm looking for. I'm rather trying to build some sort of pad-instrument rather than a sequencer so striking a pad right at the beat has to work.

    I've tried some other solutions as well and it works decently. The thing is.. I'm working with loops and I went over to using mach_absolute_time() for the timing but sometimes it feels like the loop is finished before the timing and sometimes after. Is there a way to output the audioBuffers in regard to the logical time or is this a horrible idea?

    Same question~~ :'(

Sign In or Register to comment.