- This week, most of the time is spent on researching how to play sound using Python/Pyqt4. The methods I've tried include QSound, Phonon, PyGraphics' sound_media.py, pygame, and finally system alert sound.
- QSound simply did not play a sound on Ubuntu Linux.
- Phonon did play the sound correctly, except that it sits in the event loop and won't exit. So I added some signals code and '''app.connect(media, SIGNAL("finished()"), app, SLOT("quit()"))''' to make it quit after the sound file finished playing. Now the program exited, but gives me a segmentation fault.
- PyGraphics' sound_media.py loads and plays sounds well when I try it in the python shell, but if I move the code to a py file, then run it, it did't play a sound.
- After attempting to fix the issues above and failing, I tried pygame. Referencing the code snippets from http://stackoverflow.com/questions/7746263/how-play-mp3-with-pygame I got the reminder sound to work! However, asking around on IRC, a mentor informed me that generally we should not store external binary data in source control, and suggested using system notification sounds instead.
- So eventually, I switched to using the system alert sound. I found that the code is very simple. There are advantages and drawbacks for this method though. The advantage is that we don't need to store an external sound file. The drawback are, 1: in order for the sound to work, we need to ensure that each laptop doing the recording does not have the system alert sound disabled. 2: the system alert sounds are different across different platforms, so some of them may not sound like alerts, some of the alert sounds may have volumes that are hard to hear, etc.
- Last week I speculated that the countdown display text may have been set to an absolution position, which is undesirable. However, my investigation into the issue shows that I did indeed use relative position (for example http://zetcode.com/gui/pyqt4/layoutmanagement/).
- Reset the alignment of the display text to be centred.
Plans for next week
- Fully test the auto-recording feature, by designing and implementing more comprehensive test cases.
Problems
None.
No comments:
Post a Comment