londonhackspace / Doorbot

old RFID door entry bot, now mostly just door announcers
26 stars 10 forks source link

Make Glados less annoying #27

Closed filthy-hipster closed 9 years ago

filthy-hipster commented 11 years ago

Hi all,

Had idea and spoke to few people about it and they like the idea.

Basically have a check on the card sounds, as we now have the yard and people will be coming in and out to get stuff. Can we add a line of code that when you tap in it checks if the audio has been played in the last hour, if it has been played, do not play again, if not, play audio.

Regards Chris Hipster

marksteward commented 11 years ago

Sounds like a plan. We should maybe also limit the length of tracks (15s or so).

Jonty commented 11 years ago

I was actually going to do two things in addition to this:

That should stop it being irritating for people in the main room, and people in the rest of the space.

marksteward commented 11 years ago

Perhaps we should just rate limit sounds by length? A coin ding would fine for every entrance, a 1-up every hour and a 15s theme tune twice a day? That'll encourage people to use shorter sounds without breaking everything.

Jonty commented 11 years ago

That is a good plan. I like that plan. Some kind of scaled timeout based on sound length that kicks in over 5s?

benjojo commented 10 years ago

So I did a find *.wav | xargs soxi -D in the /home/glados/wavefiles/members to figure out what was the avg length of the files in there

Percentile Length (Sec)
1th 0.225
5th 0.397
25th (LQ) 0.605
50th (Median) 1.01
75th (UQ) 6.12
90th 13.5
marksteward commented 9 years ago

Possible solution from Cadmus:

import subprocess

# Working Sox Pipe
# time sox /media/library/Music/The_Terrible_Secret_Of_Space.mp3 -t wav - trim 0 00:05 | --norm sox -t wav - -t wav - | aplay

trunc_p = subprocess.Popen(["sox", "/media/library/Music/The_Terrible_Secret_Of_Space.mp3", "-t", "wav", "-", "trim", "0", "00:05"], stdout=subprocess.PIPE)
norm_p = subprocess.Popen(["sox", "--norm", "-t", "wav", "-", "-t", "wav", "-"], stdin=trunc_p.stdout, stdout=subprocess.PIPE)
play_p = subprocess.Popen(["aplay"], stdin=norm_p.stdout)

play_p.wait()
marksteward commented 9 years ago

Also apparently just a single sox command works: "sox --norm file.foo -t wav - trim 0 00:05 | mplay".

And you can do sox -qd to play it.

marksteward commented 9 years ago

Looks like we also need remote volume control, as the required volume varies a lot between a Tuesday evening and a quiet afternoon.