Piano Player - Staccato Audio Clicking and Glitching
I'm just in the process of getting to know TAAE2, as I am looking to build a Piano App - having moved from TAAE1.
The performance improvements from 1 to 2 have been amazing! A lot more notes can be played simultaneously without having a bad impact on performance. It appears to have worked wonders in that regard, so many thanks to you - you certainly know your stuff when it comes to audio!
However there are some problems with audio clicking if the user playing in Staccato - I am getting audio clicking and it is not exactly fading out as I require it. I tried to implement the microfadeFrames but if I make that number too large, part of the beginning of the note is cut off. What would be cool is to have separate microfadeFrames values for the start and finish of audio files.
Just wondering if anyone has encountered the problems I have mentioned?
I was thinking of writing a module just for handling fading of audio, but I don't know how long that would take, or where to start!
How are you triggering the piano samples? Are you using AEAudioFilePlayerModule? If so, you may achieve better results using the AUSampler. The AUSampler would also allow you to use fewer samples and alter their pitches within a specific MIDI note number range.
Is the audio clicking occurring at the beginning of the trigger? Can you please provide some sample code?
This is all I do to start playing, In Michael's examples I see he has fades of 32 frames but that didn't do it for me, so I used trial and error to get to 1000.
I have set it up so that there are multiple mixers, each note contains several AEAudioFilePlayerModules pre-initialised with note samples. getAvaialbleAudioFileFromMixer just fetches an AEAudioFilePlayerModule that isn't playing for the specific note.
Perhaps that way of doing it is slightly flawed, what do you think?
It seems to work quite well on the whole, though - giving great performance on even small devices like the 4s, but just gives a large memory overhead.
Only some audio samples are having the issue, so maybe I cropped them incorrectly.
Is this a full 88-key piano app with sound samples for each note? Will there by MIDI in/out with velocity, continuous control, and program changes events, etc? Are you using a MIDI library such as the one from Audeonic?
I highly recommend it, due to its flexibility, feature set, and author support.
Yes, I would definitely check your audio samples, and make sure that the issue isn't with the cropping.
Eep - if you're not using AUSampler, I'm afraid you're doing it wrong Also, I'd recommend checking AudioKit, which may suit your needs better.
@Michael after some tweaking, i took another route completely with how it is being implemented, optimised my own code and it works like a charm, with great performance improvements without the use of AUSampler, but in fact still used AEAudioFilePlayerModules.
Again Michael, thanks for TAAE2, It's really quite something! Makes the process a whole lot easier. Without it, I don't think I could have got as far as I have with the app.
@markjeschke I checked the audio files, all seems well. I don't need to control specific things.