glibc detected


7 posts
by rmacarone » Tue Mar 12, 2013 10:47 am
This is my first post...

I am having trouble and I can't seem to find help?
http://learn.adafruit.com/sitcom-sfx-door-trigger
Code: Select all
#!/usr/bin/env python

from time import sleep

import pygame.mixer
import RPi.GPIO as GPIO

GPIO.setmode(GPIO.BCM)

door_switch_pin = 23
motion_sensor_pin = 24

#Set up inputs
GPIO.setup(door_switch_pin, GPIO.IN)
GPIO.setup(motion_sensor_pin, GPIO.IN)

motion_LED_pin = 18
door_LED_pin = 25

#Set up output LED indicators
GPIO.setup(door_LED_pin, GPIO.OUT)
GPIO.setup(motion_LED_pin, GPIO.OUT)

pygame.mixer.init(44100, -16, 2, 1024)

prev_door = False

#sound files expect to be in the same directory as script
enter = pygame.mixer.Sound("./enter.wav")
exit = pygame.mixer.Sound("./exit.wav")

while True:
    #Update sensor and LED states each loop
   door = GPIO.input(door_switch_pin)
   motion = GPIO.input(motion_sensor_pin)

   GPIO.output(motion_LED_pin, motion)
   GPIO.output(door_LED_pin, door)
   
#When the door is opened, if there is movement outside, it means that someone is entering. If not, someone is exiting      
   if door and not prev_door:      
      if motion:
         enter.play()
      else:
         exit.play()
         
   prev_door = door
   
   sleep(0.01)


When I try to run the script I always get this error;
*** glibc detected *** python: double free or corruption (!prev): 0x015ae258 ***

or some variation on the last number...

I did try with
Occidentalis v0.1 and v0.2, with and without the added electronics.
Always with the same results.

Any help you could offer would be greatly appreciated!
Thank you in advance!
Posts: 3
Joined: Tue Mar 12, 2013 9:55 am
by rmacarone » Tue Mar 12, 2013 4:34 pm
Figured it out.. the size of the .wav files must remain under 500k each.
yes it sucks, going to look for a solution that plays mp3 files. that would solve the memory issue.

Post if you do have any solutions please...
Posts: 3
Joined: Tue Mar 12, 2013 9:55 am
by alexeames » Tue Mar 12, 2013 4:54 pm
can you use the pygame music player to play an mp3?
Alex Eames RasPi.TV, RasP.iO
User avatar
Forum Moderator
Forum Moderator
Posts: 2807
Joined: Sat Mar 03, 2012 11:57 am
Location: UK
by rmacarone » Tue Mar 12, 2013 5:04 pm
alexeames wrote:can you use the pygame music player to play an mp3?


very limited mp3 playback, i have tried with no luck. Thanks!
Posts: 3
Joined: Tue Mar 12, 2013 9:55 am
by texy » Wed Mar 13, 2013 7:53 am
alexeames wrote:can you use the pygame music player to play an mp3?


The documentation suggests it can :
http://www.pygame.org/docs/ref/music.html

..and this thread suggests it 'plays quite well' :
viewtopic.php?f=32&t=33847

Texy
Various male/female 40- and 26-way GPIO header for sale here ( IDEAL FOR YOUR PiZero ):
https://www.raspberrypi.org/forums/viewtopic.php?f=93&t=147682#p971555
Forum Moderator
Forum Moderator
Posts: 4959
Joined: Sat Mar 03, 2012 10:59 am
Location: Berkshire, England
by jokonda » Wed Nov 18, 2015 2:44 am
Using GoldWave to encode wav files from signed 16 bit to unsigned 8bit would cover this problem.
Posts: 1
Joined: Wed Nov 18, 2015 2:40 am
by elParaguayo » Thu Nov 19, 2015 7:36 am
I've had little joy with pygame and mp3 files in the past. I convert my files to ogg first and then it works perfectly.
RPi Information Screen: plugin based system for displaying weather, travel information, football scores etc.
User avatar
Posts: 1793
Joined: Wed May 16, 2012 12:46 pm
Location: London, UK