• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
RE: Editing a looping MusicTrack as it plays
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Editing a looping MusicTrack as it plays


  • Subject: RE: Editing a looping MusicTrack as it plays
  • From: Neil Wallace <email@hidden>
  • Date: Sat, 21 Jan 2012 14:18:34 +0000
  • Thread-topic: Editing a looping MusicTrack as it plays

I have created a little sample that will manifest this problem:

https://gist.github.com/1652885

I create all the midi playback stuff in InitMIDI and this little loop plays quite happily. In touchesBegan I clear the track and then repopulate it with the same data. If you repeatedly tap the screen you will find that sometimes the track cuts out - this seems to be related to tapping near to the loop point (you can verify this by setting loop_length to something much higher and you will find you can happily tap away without a problem).

Has anyone got any ideas whats going wrong here? Or am I doing something obviously wrong when setting the track loop properties?

Cheers,

Neil


From: Neil Wallace
Sent: 13 January 2012 10:10
To: email@hidden
Subject: Editing a looping MusicTrack as it plays

Hi,

 

I am just getting to grips with MusicPlayer, MusicSequence et al on iOS5 and as a first app I thought I’d write a little drum machine. I have loaded the drums into an AUSampler from a .aupreset file and then I create a MusicTrack for each drum (so that I can mute/solo each) I set the tracks kSequenceTrackProperty_LoopInfo and kSequenceTrackProperty_TrackLength appropriately. So far so good – I now have my drum loop playing nicely.

 

The problem comes when I start to edit the track as it plays – occasionally when I add or remove a note from the track the entire track will stop playing. After quite a bit of testing to try and find a pattern the way that I can get this to happen most regularly is to add or remove a note to start of the track just at it loops or slightly before it loops (it does not seem to occur if I do this just after the track has looped). There also seems to be a link between the length of the recorded sample and size of the zone where toggling a note on/off will cause problems – the closed hi-hat which is short has a much smaller ‘problem zone’ than the longer kick drum (in all cases however the duration of the MidiNoteMessage added to the track is the same).

 

When adding a new note to the track I just use a call to MusicTrackNewMIDINoteEvent. When removing a note I have tried both calling MusicTrackClear and re-adding all the notes for that track as well as iterating over the events in the track and removing the specific one at the correct time step. I also tried re-setting the loop info and track length after editing a track in case this was getting lost in the edit.

 

Am I doing something fundamentally wrong here? I have tried everything that I can think off to fix this problem but haven’t come up with anything that helps.

 

Thanks in advance,

 

Neil

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Prev by Date: Audio Units & Airplay & MPVolumeView & Wifi lags (over buffering?)
  • Next by Date: RE: Editing a looping MusicTrack as it plays
  • Previous by thread: Editing a looping MusicTrack as it plays
  • Next by thread: RE: Editing a looping MusicTrack as it plays
  • Index(es):
    • Date
    • Thread