[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [pygame] write sound to file for fast loading?
- To: pygame-users@xxxxxxxx
- Subject: Re: [pygame] write sound to file for fast loading?
- From: Shadd <itashadd@xxxxxxxxx>
- Date: Wed, 03 Feb 2010 23:28:46 +0100
- Delivered-to: archiver@xxxxxxxx
- Delivered-to: pygame-users-outgoing@xxxxxxxx
- Delivered-to: pygame-users@xxxxxxxx
- Delivery-date: Wed, 03 Feb 2010 17:28:57 -0500
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:subject:references:in-reply-to :content-type:content-transfer-encoding; bh=bv35/nVgeR/O23UWNK7neCiYlaSbanEaffp0x/yhvMM=; b=A2ovfxNj2AzqOyoW7dCJpedSN5zOzfcOzdpOfMaDTT0v0N/AYL8vzROD/4frnNURFM M3fmUZSYSCfAp2k7e3X5l0z+gMd9pE+/H4arZhIVKsNDmqys8bbmYi1CcHzgZ/bZ4zhs 4yFqSJpDsq3XiouH3zIFYoIdTfatHolEEeFeI=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; b=QOJ8fbji+BtT/HsXoDZNCVBx7xedCzpNlG/W0BJ0luYgVFRIgdeTw9wXpg0E3Bz4/t SLbMYQt95ecIfjvv+pY4NK9j0J94a79PFLIZZ+8Sz6x4eLwZHcFG7+VIjs7TRYtAcuzk IE5Zf4awy7wUn071nZq5rng8V/ZO9libqhiSQ=
- In-reply-to: <5f89b79c1002012232g705e8f71iad113752f695fd4@xxxxxxxxxxxxxx>
- References: <5f89b79c1002012232g705e8f71iad113752f695fd4@xxxxxxxxxxxxxx>
- Reply-to: pygame-users@xxxxxxxx
- Sender: owner-pygame-users@xxxxxxxx
- User-agent: Thunderbird 2.0.0.23 (X11/20090817)
I think it would be easier to simply use a loading screen before a part
of the game (f.e. entering an area) and there load any sounds that might
come in use into that part. It surely would be nicer to see than lag
during the gameplay.
Of course this could not be the best solution, but if there are not
better options, this would be the better to use.
Howdy, folks.
I have a problem I've been studying a while and I can't figure out a
solution. Pygame or SDL--not sure which--is pretty slow at loading
sounds. For large sounds, like songs, this means significant pauses in
your game; or very long loading times at startup if you have a few of
them to load.
I tried using a thread to load a song, but as expected that only
resulted in a very laggy game for the duration.
So I was thinking it might be faster to pre-process a song: load it
via the mixer, write the buffer to a data file, then later load it
into an array and feed the array to the mixer. I can see that part of
that idea is implemented in _sndarray.py, but I didn't really want to
require numpy and I couldn't see how to convert that module's code to
my purpose anyhow.
I'm strikin' out. Is this even feasible, or is it a hair-brained
scheme doomed to failure? Has anyone solved this problem, and would
s/he be willing to share? :)
Gumm