How to play many audio-files simultaneously?
What is the best way to trigger and play many audio-files simultaneously AND maintain a good audio quality?
I want to play 20-40 audio-files, they won't all be triggered at exactly the same time but will overlay each other a lot. The files are quite small, mostly only between 1-3 seconds long.
Right now i have the same amount of [sfplay~] objects as audio-files (aiff - 320kbps), and they all connect to one [dac~] object. Playing a few works fine, yet more than ~10 produce audio clicks and noise. And it also seems to interfere with stereo, as one channel goes almost quiet besides some occasional clicks...
Should i rather implement a solution using [buffer~] objects?
Is there a limit as to how many files can be played at once?
A couple of questions.
What is the total size in MB of all of your audio files together? Playing from buffer~ will play them from RAM and you want to make sure you have enough RAM to get the job done. I would think that if you have the ram the buffer~/groove~ solution would be the most efficient performance wise.
The issue you are having could also be a mixing problem. It seems feasible to me that sfplay~ could have issues playing that many files but depending on how you are mixing the sounds together the problem could just be that it is getting too loud. Could you post your patch so I can look at it and maybe help you out?
hey saul!
thanks for answering!
all files together might be only 5-8MB, as the files are really short.
my patch is a beast of a patch, so it's hard to post it here, but i can tell you that right now i have:
42 [sfplay~] boxes: 21 with only 1 file, 21 with 3 files (2 in preload queue). the output has individual [*~] volume control on it and then goes into 2 [send~] objects (ch1, ch2).
on the global level i have two [receive~] objects that collect all the signal from 21 [send~] objects. --- POSSIBLE THAT THIS CAUSES A PROBLEM?
and then i have another global [*~] volume control on there before it goes into [dac~]
hope this is sorta descriptive..
much appreciated!
Eva
If you are using sfplay 21 times to play one sound file you may as well use buffer~ and multiple groove~ or play~ objects. It sounds like you would only need 4 buffer~ objects maximum. It would be a total pain to have to swap out all of those sfplay~ objects but you should get a performance boost if you do it. I don't know what your patch involves but poly~ could be worth your time as well.
As far as the mixing. have you tried dialing back all of those ringmods? Like [*~ 0.1] for each one except the main? Worst case scenario it's just too quiet.
ok i did a mock up with buffer~ and groove~. The sounds were pretty clear.
oops double post.
thanks for the mock-up!
i will have to play a minimum of 21*(1+3)= 84 files though, and not only 4. sorry for the misunderstanding. but the patch already taught me some more about buffers. will look into it some more, and also experiment with different [*~] volume values.
thanks!!
Oh, ok, well. good luck with that. If you have the RAM it shouldn't be an issue.
damn. still noisy.
i implemented the buffer objects. and tweaked the volume,
but i still get breaks and clicks in the overall sound.
i mostly trigger 21 [buffer~] objects. each sound is only ~1000ms long. Each buffer gets played via the [play~] object, the call happens repeatedly about every 2-3seconds (interval is changing, therefor no looping sound).
mm... any other idea what the problem could be?
What does your DSP status say about your cpu utilization etc.?
playing ~21 sounds at intervals from buffers,
the CPU Utilization is only ~5-8%,
- no CPU limit
- signals used: 4
- function calls: 385
- vector optimization: x
thanks for still following up on this!
oh and playing with the vector size values, i realized that might be an issue:
original setting:
i/o vector size: 512
signal vector size: 16
sampling rate: 44100 hz
scheduler in overdrive: -
in audio interrupt: -
if i increase the signal vector size to ~1024,
most of the noise seems to disappear.
and also, all the files seems to be played with their correct stereo pan (instead of just being played on one channel).
the noise and the stereo-issue appear again of course, if i push up the overall volume.
It might have been the sound-files fault after all!
The ones i used before were mono files, but had good quality and displayed no problems when played in small groups.
Now i tested with stereo files, with a longer duration and less compression, and the result was a lot better immediately. I can even turn up the volume quite high before distortions appear.
Good deal, glad it worked out. Post a sound file or something when your done with it.
It's super old topic but maybe somehow could help with a similar problem?