Drum Toy

Hi Gary, Alan,

I just tried the SEEK idea and while it’s not bad, it’s not perfect. I can’t really tell if it’s helping or not.

Here is the project folder, including the 16ms delayed audio hihat:

http://www.alkex.com/wp-content/uploads/BPM-TEST.zip

Maybe you can have a look in case I did something wrong?

Thanks so much for getting us this far! We’re already accurate enough for a lot of audio applications

Cheers
Alex

EDIT: I also tried the 17 audio file technique and it doesn’t appear to be any better than the SEEK.Maybe I’m doing something wrong?

Here is my folder for that approach:
http://www.alkex.com/wp-content/uploads/BPM-TEST-17files.zip

Thanks!!! [import]uid: 66618 topic_id: 13881 reply_id: 93653[/import]

Alex, thanks for trying. I already published my results and there is no doubt the multiple files method worked for me. I have kind of forgotten about this thread as my problem is solved for my purposes.

However, yes, there are several things I can see you are doing wrong. To help others I’ll list them a bit.

**But** I don’t want this thread to become a conversation about all the things you were doing wrong… so *please* if you would like further clarification please contact me directly. Thanks!

a) You are playing the audio and then seeking in the next line, which is the wrong order. You would seek first, then play. Right?
b) Your files are 48 kHz they should be 44.1 to match the audio system. You are creating extra work for the system by making it convert to 44.1 which is the default. You could try adding “audioPlayFrequency = 48000” to config.lua to try to tell openAL to use that sample rate, but I’d just stick to 44.1 and define audioPlayFrequency as 44100 in your config.lua as well for sake of completeness.
c) In your audio files, after the Hi Hat sound there are a lot of samples worth of trailing silence. You should trim all the silence off from the sound file so you don’t needlessly tax the audio system… although I guess there isn’t going to be mixing going on because you have the sounds playing on the same channel which will cut the currently playing sound off and start again (it won’t layer/overlap the sounds)

Also, you didn’t use my sounds… (you could have used the 16 ms of padding tick sound I had for a 1:1 comparison between my method and the seek method). It may also be that an extremely short 10ms tick sound like mine-- which doesn’t tax the audio system much in terms of having to mix overlapping sounds from different channels-- may have something to do with my success.

And, aside from using 44.1 kHz sounds you may also want to consider using mono sounds instead of stereo further efficiency.

You didn’t mention as well the method you are using to measure the performance difference. Are you recording the sound output of your app into to a sequencer?

Also, for the multiple files example, you are using 16 if then end statements to play the right file, and they aren’t even arranged as if elseif elseif end, they are all separate ifs, one after the other which is worse and might itself insert a tiny amount of time.

Instead you should have put all the audio files as elements 0 to 16 in an array called click so you can just execute one line, e.g.

audio.play(click[index])

Again, I don’t want this thread to become a discussion of what you were doing wrong, so please contact me directly, and then if you have later success post here again :slight_smile:

I should also mention that I don’t have much time to spend on this research these days, as I am concentrating on the other logic in my app…

Cheers,

Gary
[import]uid: 106887 topic_id: 13881 reply_id: 93802[/import]

Thanks, Gary

Couldn’t figure out how to write to you personally but you’ve given me plenty to sink my teeth into.
The url to your clicks seems to be dead but I can certainly fix my audios.

Once again i really appreciate the time you put into explaining this.
All the best
Alex [import]uid: 66618 topic_id: 13881 reply_id: 93856[/import]

Wowza! I haven’t stopped by in a while due to a crushingly massive project at work. (Sadly not involving Corona). Anyhow, what a fascinating read. I’m thrilled and inspired by all the great convo and ideas this thread has collected. Massive shoutout to you all for your generosity! Looking forward to a time when I might actually have the cycles to dive back into implementation. - Robby

http://www.youtube.com/user/RobbyKilgore
[import]uid: 56133 topic_id: 13881 reply_id: 105429[/import]

Just read this thread top to toe, great stuff gary. Your method was exactly how someone else years back crushed flashes audio latency issues, they were much worse than corona’s.

I tried to make a drum machine on it, i could probably get better results now Im better at OOP.

Check it out here if interested:

http://www.newgrounds.com/portal/view/464751

I appropriately named it rusty drummer. I never finished as it was not worth the battle.

I will be using your info to assist with audio based app im planning on working on.

Many thanks.
[import]uid: 118379 topic_id: 13881 reply_id: 110260[/import]