I've posted a sound engine I've been working on along with a demo of
how to use it under the files section (see URL below). The zip file
contains an Xcode project based on cocos2d 0.72RC.
The sound engine is based on OpenAL. The main differences from the
Aeterius sound engine are:
a) Non positional - just uses a simple pan model and sounds can be
isolated to left or right channels,
b) Allows playback of multiple instances of the same sound with
different pitch, pan and gain settings
It is designed for fast playback of many short sounds, it is not meant
for something like background music.
The license is a bit different to the cocos2d one, if you are
independent it is essentially the same but if you are rich (or working
for someone rich) you must donate some money to the cocos2d iphone
project.
On May 2, 12:33 am, Carpy <javier.dava...@gmail.com> wrote:
> Thank you steve <3<3<3<3
> Is it faster than the current experimental sound engine in cocos
> 0.7.2?
I don't think there is any noticeable difference in speed. The main
problem with the experimental sound engine for me was single sound
playback - in technical terms it ties a sound source to a single
buffer. The Denshion engine allows a source to use any buffer so you
can have up to 32 voices playing back the same sound all with
different pitch, pan and gain settings if you want.
Yeah that sucks about it. but i commented out the part where it only
allows one sound to play and it kinda works fine. My problem with it
right now is that it's only playing a certain kind of wav formats. i
haven't played around with it but its working at 44k hz and its a
little bit too much for me, i want to use less memory to store my
sounds. Trying to get my .app to be less than 10 megs so it can be
downloaded over 3g.
On May 1, 9:04 pm, Steve Oldmeadow <st...@smoco.com> wrote:
> On May 2, 12:33 am, Carpy <javier.dava...@gmail.com> wrote:
> > Thank you steve <3<3<3<3
> > Is it faster than the current experimental sound engine in cocos
> > 0.7.2?
> I don't think there is any noticeable difference in speed. The main
> problem with the experimental sound engine for me was single sound
> playback - in technical terms it ties a sound source to a single
> buffer. The Denshion engine allows a source to use any buffer so you
> can have up to 32 voices playing back the same sound all with
> different pitch, pan and gain settings if you want.
The Aeterius sound engine allows Ogg Vorbis files to be loaded, there
was an issue with them but Riq fixed it. Both the Aeterius and
Denshion engines should work with wave files with lower sample rates
than 44kHz. I did some testing with as low as 11025. You can use
8bit wave files with Denshion but there is a bug with the way the
iPhone handles 8bit wave files which results in a clicking noise at
the end of playback so they are not recommended.
Also don't forget to use mono sounds unless you need stereo - that
will cut your file size in half.
> The Aeteriussoundengineallows Ogg Vorbis files to be loaded, there
> was an issue with them but Riq fixed it. Both the Aeterius and
> Denshion engines should work with wave files with lower sample rates
> than 44kHz. I did some testing with as low as 11025. You can use
> 8bit wave files with Denshion but there is a bug with the way the
> iPhone handles 8bit wave files which results in a clicking noise at
> the end of playback so they are not recommended.
> Also don't forget to use mono sounds unless you need stereo - that
> will cut your file size in half.
Thanks for this, Steve! I had a play with it last night and it seems really good. Haven't delved into sounds yet so this was nice and easy. I just need to investigate what formats are available because I could only seem to get WAVs to load.
At the moment it only supports 8 and 16 bit little endian PCM in
stereo and mono. Wave and caf files in that format should work.
Those are the only formats OpenAL on the iPhone can play. I don't
recommend 8 bit though as there are some nasty audio artifacts at the
end of playback (known bug on the device).
I am using AVAudioPlayer for mp3 playback in conjunction with the
Denshion engine and that works well.
The only advantage of using compressed formats with Denshion would be
reduced package download size but at the cost of reduced sound quality
and increased load times. I do plan to eventually support loading
buffers from Ogg and IMA4 but it is not a high priority for me at the
moment.
Another advantage of Denshion, that I recently realised, is that it
will support more than 32 sounds. There is a limit of 32 simultaneous
sources (or voices) on the device. If you bind the buffers (sound
data) to a single source then that limits you to 32 sounds. With
Denshion you can have as many sounds as the memory can load and play
back up to 32 of them simultaneously.
Denshion is great, I integrated it in a matter of minutes in my game.
I was wondering if you have any idea why sometime, the first time a
sound is played, it will do a slight pause (less than a sec, but
still) ?
My understanding is that the sound was pre-loaded as soon as possible?
Seb
On 19 mai, 04:33, Steve Oldmeadow <st...@smoco.com> wrote:
> At the moment it only supports 8 and 16 bit little endian PCM in
> stereo and mono. Wave and caf files in that format should work.
> Those are the only formats OpenAL on the iPhone can play. I don't
> recommend 8 bit though as there are some nasty audio artifacts at the
> end of playback (known bug on the device).
> I am using AVAudioPlayer for mp3 playback in conjunction with the
> Denshion engine and that works well.
> The only advantage of using compressed formats with Denshion would be
> reduced package download size but at the cost of reduced sound quality
> and increased load times. I do plan to eventually support loading
> buffers from Ogg and IMA4 but it is not a high priority for me at the
> moment.
> Another advantage of Denshion, that I recently realised, is that it
> will support more than 32 sounds. There is a limit of 32 simultaneous
> sources (or voices) on the device. If you bind the buffers (sound
> data) to a single source then that limits you to 32 sounds. With
> Denshion you can have as many sounds as the memory can load and play
> back up to 32 of them simultaneously.
I haven't seen this happen. Can you give me more details? What
device? Does it happen for every sound the first time it is played or
only the first sound that is played?
> I haven't seen this happen. Can you give me more details? What
> device? Does it happen for every sound the first time it is played or
> only the first sound that is played?
On Sun, May 24, 2009 at 10:54 PM, Patrick Otten <phato...@gmail.com> wrote:
> Has anyone else experienced the problem when the device is shutoff in
> the middle of the game and then turned back on, the sounds don't work
> anymore?
> On May 18, 9:56 pm, Steve Oldmeadow <st...@smoco.com> wrote:
> > I haven't seen this happen. Can you give me more details? What
> > device? Does it happen for every sound the first time it is played or
> > only the first sound that is played?
I'm currently implementing the code Andy posted so that the sound
engine will handle interruption and resumption. I will release a 1.1
of CocosDenshion when I'm done.
> I'm currently implementing the code Andy posted so that the sound
> engine will handle interruption and resumption. I will release a 1.1
> of CocosDenshion when I'm done.
I posted over in that thread, but basically, I implemented the code,
but after the first sound fires, no sounds after that get called. ugh,
I'm no audio guy.
On May 25, 9:13 am, Patrick Otten <phato...@gmail.com> wrote:
> On May 25, 1:26 am, Steve Oldmeadow <st...@smoco.com> wrote:
> > I'm currently implementing the code Andy posted so that the sound
> > engine will handle interruption and resumption. I will release a 1.1
> > of CocosDenshion when I'm done.
Patrick (and all future Denshion bug posters) it would be a great help
if you can tell me what device, what firmware and whether the device
is standard or jailbroken when reporting issues. Also if an issue
occurs it would be handy to know the values of the functioning and
lastError properties of the CDSoundEngine instance.
I've placed an updated version of CocosDenshion in the files area.
Basically it handles audio session interruption using the code posted
by Andy Fitter and Ben Britten. Many thanks to Andy for researching
this, it is a very tricky area that I'm sure many apps do not get
right (I tested Pocket God and Sway and neither handled it). If you
want to test if your app handles audio session interruption use the
clock to set an alarm to go off while you are playing your game. If
you lose audio after the alarm goes off then you are not handling
audio session interruption.
@Patrick. I don't think your problem is caused by audio session
interruption though. Powering off the device does not trigger an
audio session interruption. I'm guessing you are testing on the 3.0
beta since you just released a game? I'm not seeing the behavior you
describe on a 2.2.1 iPod Touch so I'm guessing it may be a problem
with the 3.0 beta. Unfortunately I don't have a 3.0 device to test on
so can't help at the moment.
then the sound engine will automatically handle audio session
interruption for you.
If you are using another api (such as AVAudioPlayer) in addition to
CocosDenshion then you will need to handle audio session interruption
yourself and stop and resume the other api as well as OpenAL. You can
look at how Denshion handles things to work out what needs to be
done. In this case you don't pass in an audioSessionCategory when you
initialise the sound engine.
Also, it seems that if you're using MPMoviePlayerController, you need to
manually pause and resume your sound either side of the movie - It didn't
seem to happen automatically.
Andy.
On 26/05/2009 09:50, "Steve Oldmeadow" <st...@smoco.com> wrote:
> then the sound engine will automatically handle audio session
> interruption for you.
> If you are using another api (such as AVAudioPlayer) in addition to
> CocosDenshion then you will need to handle audio session interruption
> yourself and stop and resume the other api as well as OpenAL. You can
> look at how Denshion handles things to work out what needs to be
> done. In this case you don't pass in an audioSessionCategory when you
> initialise the sound engine.
Would you be interested in that Denshion ships within cocos2d ? If so, could you commit the Denshion engine in experimental/sound-engine-denshion ? And also could you commit the example ?
I only really separated it because I wanted it to have a different
license. Basically, I thought it was bs that apps were using cocos2d
and not acknowledging it within the app (like Tic Tac). I also didn't
want the sound engine to get used in other engines or by non
independent developers without them acknowledging cocos2d and,
hopefully, donating some money to cocos2d (if they are rich).
If you are happy for it to go in the main source tree with those
restrictions then I'll add it in.
I've been playing around with your sound engine but I can't seem to
find how to release a previously loaded sound, except to load a new
one using the same id.
Would it make sense to have a new method to allow us to renew the
buffer, without having to load a new sound into it, refactoring the
code from the loadBuffer method?
Thanks,
Joćo
On May 1, 11:02 am, Steve Oldmeadow <st...@smoco.com> wrote:
> I've posted a sound engine I've been working on along with a demo of
> how to use it under the files section (see URL below). The zip file
> contains an Xcode project based on cocos2d 0.72RC.
> The sound engine is based on OpenAL. The main differences from the
> Aeterius sound engine are:
> a) Non positional - just uses a simple pan model and sounds can be
> isolated to left or right channels,
> b) Allows playback of multiple instances of the same sound with
> different pitch, pan and gain settings
> It is designed for fast playback of many short sounds, it is not meant
> for something like background music.
> The license is a bit different to the cocos2d one, if you are
> independent it is essentially the same but if you are rich (or working
> for someone rich) you must donate some money to the cocos2d iphone
> project.