rmacarone
Posts: 3
Joined: Tue Mar 12, 2013 9:55 am

glibc detected

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!

rmacarone
Posts: 3
Joined: Tue Mar 12, 2013 9:55 am

Re: glibc detected

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...

User avatar
alexeames
Forum Moderator
Forum Moderator
Posts: 2807
Joined: Sat Mar 03, 2012 11:57 am
Location: UK
Contact: Website

Re: glibc detected

Tue Mar 12, 2013 4:54 pm

can you use the pygame music player to play an mp3?
Alex Eames RasPi.TV, RasP.iO

rmacarone
Posts: 3
Joined: Tue Mar 12, 2013 9:55 am

Re: glibc detected

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!

texy
Forum Moderator
Forum Moderator
Posts: 4991
Joined: Sat Mar 03, 2012 10:59 am
Location: Berkshire, England

Re: glibc detected

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' :
http://www.raspberrypi.org/phpBB3/viewt ... 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

jokonda
Posts: 1
Joined: Wed Nov 18, 2015 2:40 am

Re: glibc detected

Wed Nov 18, 2015 2:44 am

Using GoldWave to encode wav files from signed 16 bit to unsigned 8bit would cover this problem.

User avatar
elParaguayo
Posts: 1849
Joined: Wed May 16, 2012 12:46 pm
Location: London, UK

Re: glibc detected

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.

Return to “Python”

Who is online

Users browsing this forum: scotty101 and 20 guests