Subj : Re: Python To : echicken From : Mortifis Date : Mon Dec 10 2018 15:13:06 > Re: Re: Python > By: Mortifis to Minex on Mon Dec 10 2018 11:37:55 > Mo> What is need is a counter so that the GPIO pins blink only for the > Mo> length of an mp3 then automagically shutdown when the song is over > What value does audio.info.length represent? Duration of the song in > seconds / milliseconds / something else? File size? yes, audo.info.length is the time of the mp3 in seconds, int(audio.info.length) makes it a whole number > I doubt if a counter is the right way to go. Seems like you could store the > start time prior to entering the loop, and then make your While condition > something like 'current_time - start_time < song_duration', so that the loop > breaks once that amount of time has passed. isn't that just a counter of sorts as well? I discover the error of my ways, I was putting an unnecessary while: ahead of everything, the easy-for-me solution to self-terminate when the song finished playing was mP3 = sys.argv[1] from mutagen.mp3 import MP3 audio = MP3(mP3) cycle = int(audio.info.length) x = 0 for i in seq: GPIO.setup(i, GPIO.OUT) GPIO.output(i, GPIO.HIGH) seq.reverse() try: while True and x < cycle: for i in seq: GPIO.output(i, GPIO.LOW) time.sleep(SleepTimeS); GPIO.output(i, GPIO.HIGH) time.sleep(SleepTimeS); GPIO.output(i, GPIO.LOW) time.sleep(SleepTimeS); GPIO.output(i, GPIO.HIGH) time.sleep(SleepTimeL); # 4 seconds to cycle loop x = int(x + ((SleepTimeS + SleepTimeL) * 3.5)) --- þ Synchronet þ The Empty Keg BBS emptykeg.synchro.net:82 Lake Echo NS Canada .