Active Topics

 


Reply
Thread Tools
Posts: 292 | Thanked: 131 times | Joined on Dec 2009
#1
Hello folks

What is the best approach to play more than one sample at the same time on the N900? I'm open to Python, plain C/C++ or QT.

Using pyGame I can play a sound file, but it seems to allow just one at a time.

I can write a code in C that mixes many files into a buffer and then sends that to the appropriate (however it may be) sound device. But I'm wondering if there is already something done or more appropriate.

The ideal solution would be a simple API call that started the playing in background, returning immediately to the calling program.

Any hints?
 
mikec's Avatar
Posts: 1,366 | Thanked: 1,185 times | Joined on Jan 2006
#2
pygmae channel.play . upto 500 channels on N900. have a look at maesynth in extras dev, which is fully polyphonic, though has some slight timing issues.
__________________
N900_Email_Options Wiki Page
 
Posts: 292 | Thanked: 131 times | Joined on Dec 2009
#3
Originally Posted by mikec View Post
pygmae channel.play . upto 500 channels on N900. have a look at maesynth in extras dev, which is fully polyphonic, though has some slight timing issues.
Thanks. I've found out that there is this small delay, too. How do you do to pre-cache the file so that it plays on time?
 
mikec's Avatar
Posts: 1,366 | Thanked: 1,185 times | Joined on Jan 2006
#4
Originally Posted by soeiro View Post
Thanks. I've found out that there is this small delay, too. How do you do to pre-cache the file so that it plays on time?
You need to set the buffer size on the mixer a bit smaller. The bigger it is the bigger the delay. also helps to have you wav file at 48000 sample rate.

Where you want two samples playing at exactly the same time, I'am having to premix two sounds using sndarrays before I play them. Works pretty good, and surprisingly fast using python Numeric. Numpy would be great but is currently broken on the N900 on pygame.
__________________
N900_Email_Options Wiki Page

Last edited by mikec; 2010-07-02 at 19:32.
 
Reply


 
Forum Jump


All times are GMT. The time now is 22:37.