Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #82697
| From | "Jacob Kruger" <jacob@blindza.co.za> |
|---|---|
| Subject | RE: Simple background sound effect playback |
| Date | 2014-12-20 16:02 +0200 |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.17071.1419084197.18130.python-list@python.org> (permalink) |
[Multipart message — attachments visible in raw view] - view raw
Ok, thanks - the following seemed to work perfectly:
#start code
import pygame, time
pygame.mixer.init(frequency=22050, size=-16, channels=2, buffer=4096)
song = pygame.mixer.Sound("bird.ogg")
channel = pygame.mixer.Sound.play(song)
channel.set_volume(0, 1)
time.sleep(1)
channel.set_volume(1, 0)
channel = pygame.mixer.Sound.play(song)
time.sleep(1)
#end code
Will now just have to double-check/test compilation of something including something like this, using something like cx_freeze, etc., but, thanks again.
Stay well
Jacob Kruger
Blind Biker
Skype: BlindZA
...Roger Wilco wants to welcome you, to the space janitor's closet...
---original message---
<catalinfest@gmail.com> wrote in message news:e5f211da-d16a-4351-8094-55ba9d2d35a8@googlegroups.com...
> See this :
>
>>>> pygame.mixer.init(frequency=22050, size=-16, channels=2, buffer=4096)
>>>> song = pygame.mixer.Sound("bird.ogg")
>>>> pygame.mixer.Sound.play(song)
> and then use the
>>>> channel.set_volume(0, 1)
>>>> time.sleep(1)
>
>
> On Wednesday, December 17, 2014 10:02:30 PM UTC+2, Jacob Kruger wrote:
>>
>>
>> Ok, trying simple code from a pygame tutorial
>> snippet - nothing happens - just silent, but with no errors being
>> returned:
>> # import the pygame module
>> import pygame
>> # start pygame
>> pygame.init()
>> # load a sound file into memory
>> sound = pygame.mixer.Sound("bird.ogg")
>> channel = sound.play()
> --
> https://mail.python.org/mailman/listinfo/python-list
>
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
RE: Simple background sound effect playback "Jacob Kruger" <jacob@blindza.co.za> - 2014-12-20 16:02 +0200
csiph-web