Timing Lights to flash on/off with music?

Avatar
metroid101
79 Posts
Posted Jul 29, 2013
The title says it all folks, I want to know if it's possible to make lights (just normal lights in the room) flash on and off to the beat of music. If it is possible a step-by-step tutorial on doing so would be nice.

Also I followed the method of entering custom sounds to the letter, and I haven't gotten any of them to play in the map at all!

Advertisement
Registered users don’t see ads! Register now!
Avatar
zivi7
649 Posts
Posted Jul 30, 2013
Replied 30 minutes later
First, about the custom music:

You need to pack the .wav/.mp3 into the mapfile by using a program like Pakrat, else they won't play unless you rebuild the soundcache.

About turning lights on and off: I would use logic_timers. Depending on your music you could have the light go out and on after a specific amount of time or in a random fashion.

I won't go into detail though. You can find step-by-step-guides for as good as everything when you just google for the entity at hands and add "hammer" or if needed "portal 2". Also, instructions how to use these entities in other source games like Counter-Strike work for Portal 2 as well. This one for example: CSSBANANA: Playing sounds with a logic timer.

Avatar
protoborg
288 Posts
Posted Jul 30, 2013
Replied 9 hours later
Timers are wonderful things if you happen to know the second by second beat of the music. By that, I mean if you know the exact beat the music follows from one second to the next then timers are a great way to go. The only problem is that you need a lot of timers to pull it off.

On the other hand, if you use an object which is able to respond to the music directly, you have a much better chance of getting the effect you are looking for. However, as far as I know, there is no such object in the game.

Avatar
Dafflewoctor
415 Posts
Posted Jul 30, 2013
Replied 14 minutes later
Just a warning: it's not necessarily bad, but naming lights and switching them on and off a lot can be bad for your map, sometimes it causes visual problems in the map if you have too many named/switched lights.
Avatar
FelixGriffin
2,680 Posts
Posted Jul 30, 2013
Replied 55 minutes later
If you name all your flashing lights the same thing, though, they'll only use one lightmap page. It's a lot better for your map.
Avatar
metroid101
79 Posts
Posted Jul 30, 2013
Replied 51 minutes later
I really am not going to be timing everything to the music as that would make the boss battle too complex. Lights will activate in the room according to the first few seconds of the song. Lasers will start and stop etc. I don't know exactly how I'm going to pull it off, but the song is "The Final Countdown" from Europe.

Of course I have to get the music to PLAY in my maps first ...
I can get them to preview inside hammer, but when I play them in-game nothing happens...just silence and standard game sounds...

Avatar
FelixGriffin
2,680 Posts
Posted Jul 30, 2013
Replied 8 hours later
Sorry to burst your bubble, but the song is copyrighted and you aren't allowed to distribute it.
Avatar
metroid101
79 Posts
Posted Jul 30, 2013
Replied 10 minutes later

FelixGriffin wrote:
Sorry to burst your bubble, but the song is copyrighted and you aren't allowed to distribute it.

I'm not making money off of distributing it, and it's only usable in the map files.
SO
It's not much of a problem to use copyrighted stuff, it's under the "Fair use" segment of the copyright laws. My projects are all non-for-profit and I'm not making money off of add revenue. The close to zero chance of them even finding my content(Or caring about it...) is also a factor.

Avatar
FelixGriffin
2,680 Posts
Posted Jul 30, 2013
Replied 1 hour later
No, the closest fair use gets to that is that you can use either 10 seconds or 5% (whichever is shorter) of a copyrighted song so long as it's for a personal, noncommercial, educational purpose. It's easy to rip the music out of the map as well, so you are redistributing the file.
Avatar
Skotty
671 Posts
Posted Jul 30, 2013
Replied 36 minutes later
This song is his problem and not part of this topic I'm sure.
I suggest to keep talking about his problem.

Sounds added by user aren't recognized in the game automatically (since Portal 2's Source Engine).
You either need to rebuild your sound cache or (which is the better I mean) put that sound file into your map via Packrat.
How to do so -> search it in the forums. It's explained. Or use google.

Avatar
metroid101
79 Posts
Posted Jul 30, 2013
Replied 1 hour later

Skotty wrote:
This song is his problem and not part of this topic I'm sure.
I suggest to keep talking about his problem.

Sounds added by user aren't recognized in the game automatically (since Portal 2's Source Engine).
You either need to rebuild your sound cache or (which is the better I mean) put that sound file into your map via Packrat.
How to do so -> search it in the forums. It's explained. Or use google.

My point about copyrighted songs in my maps is that they would have to be EXTENSIVELY searching through millions if portal 2 maps to find my maps which is unlikely. Copyright infringement prevention sites only monitor streaming websites like youtube close enough to give a damn, but a small map series on a lesser known (except to portal modding fans) website like Thinking With Portals, yeah, no real threat there...

Also I have tried DaMaGeppy's method to the letter, and I also used packrat after doing so, and I STILL can't get the sounds to play when I load the map. The sound files are all in the folder directories and whatnot and everything's straight, so what am I missing? If I keep failing at this I may have to have someone help me do so manually...

Avatar
josepezdj
2,386 Posts
Posted Jul 31, 2013
Replied 2 hours later

metroid101 wrote:
Also I have tried DaMaGeppy's method to the letter, and I also used packrat after doing so, and I STILL can't get the sounds to play when I load the map. The sound files are all in the folder directories and whatnot and everything's straight, so what am I missing? If I keep failing at this I may have to have someone help me do so manually...

Did you read what I posted in that thread yesterday? :biggrin: Check out and if you STILL can't achieve it, just post your map and the audio file here.

Even though you can't hear your song in hammer, it doesn't mean that you can't hear it in the game :wink: As Skotty said it's needed to update the sound cache though, try in the console:

snd_updateaudiocache
OR
snd_rebuildaudiocache

But if you packed the audio file correctly into the .BSP, none of these commands are necessary, the game will play your music.

And btw, are you aware that you are talking of the same issue in 3 differnet threads (including Damagepy's)? >.<

Avatar
protoborg
288 Posts
Posted Jul 31, 2013
Replied 54 minutes later

FelixGriffin wrote:
Sorry to burst your bubble, but the song is copyrighted and you aren't allowed to distribute it.

Actually, if he were to perform it himself, it would be allowed as a tribute to the original. Look at youtube. People do tributes to songs all the time and those videos are not taken down. Distribution is only relevant if you use the original recording.

Also, as long as the song is not the primary thing being given out, it is NOT an issue to include it. Again, look at youtube.

There is also the fact that the song is 30 years old. I very much doubt BMI is going to bother to enforce copyright on a song that old.

Avatar
metroid101
79 Posts
Posted Jul 31, 2013
Replied 8 hours later

josepezdj wrote:
metroid101 wrote:

Also I have tried DaMaGeppy's method to the letter, and I also used packrat after doing so, and I STILL can't get the sounds to play when I load the map. The sound files are all in the folder directories and whatnot and everything's straight, so what am I missing? If I keep failing at this I may have to have someone help me do so manually...

Did you read what I posted in that thread yesterday? :biggrin: Check out and if you STILL can't achieve it, just post your map and the audio file here.

Even though you can't hear your song in hammer, it doesn't mean that you can't hear it in the game :wink: As Skotty said it's needed to update the sound cache though, try in the console:

snd_updateaudiocache
OR
snd_rebuildaudiocache

But if you packed the audio file correctly into the .BSP, none of these commands are necessary, the game will play your music.

And btw, are you aware that you are talking of the same issue in 3 differnet threads (including Damagepy's)? >.<

I can get it to play in hammer though.....
I'll try those however (and yes, discusing the problem in multiple topic means a larger likely hood of an answer! :lol: )

@ Protobug: All the songs I intend to use are almost thirty years old. (What is Love, Eye Of The Tiger, spoon full of sugar, the slide song from mario 64 etc, basically songs that will psychologically scar the player. At least while trying to solve portal maps, if you have any songs like this please suggest some! >=3 ) And there are people on youtube who upload the song IN FULL, without getting copyright, just because the video is the name of the song..
Youtube copyright laws are stupid that way <_<

Avatar
metroid101
79 Posts
Posted Jul 31, 2013
Replied 1 hour later
Okay, I've done everything to the letter.....and....now instead of going to the custom map it loads where I was in the main game....
Avatar
protoborg
288 Posts
Posted Jul 31, 2013
Replied 2 hours later

metroid101 wrote:
@ Protobug: All the songs I intend to use are almost thirty years old. (What is Love, Eye Of The Tiger, spoon full of sugar, the slide song from mario 64 etc, basically songs that will psychologically scar the player. At least while trying to solve portal maps, if you have any songs like this please suggest some! >=3 )

"What is Love"? Really?
"Eye of the Tiger"? Wow.
"Spoon Full of Sugar"? From "Mary Poppins"?
What music from Mario is going to scar people?
The only way those songs could psychologically scar you is if they are sudden and jarring in their presentation.
A few songs come to mind; "Maxwell's Silver Hammer" by the Beatles and "Artificial Flowers" by Bobby Darin. "Mack the Knife", also by Bobby Darin, is another one. "Beyond the Sea" (again Bobby Darin) might fit in with your "theme" better as it is fairly innocuous by itself.

metroid101 wrote:
And there are people on youtube who upload the song IN FULL, without getting copyright, just because the video is the name of the song..
Youtube copyright laws are stupid that way <_<

Exactly my point. Plus, when was the last time you heard of anyone being sued over distribution copyright stuff? The record labels have better things to do than search out every single bloody case of copyright infringement, especially for something 30 years old. I say don't even worry about copyright crap for the songs you want to use.

Avatar
FelixGriffin
2,680 Posts
Posted Jul 31, 2013
Replied 4 hours later
My university got sued when someone had copyrighted music in the background of their web page. It ended up costing the school a huge amount of money, and I think the student in question was suspended. Since then I've always been very careful about this.

If nothing else you should at least give credit somewhere in the map (try a game_text), and preferably trim the file down at least a little bit in length.

Avatar
metroid101
79 Posts
Posted Jul 31, 2013
Replied 50 minutes later

protoborg wrote:
metroid101 wrote:

@ Protobug: All the songs I intend to use are almost thirty years old. (What is Love, Eye Of The Tiger, spoon full of sugar, the slide song from mario 64 etc, basically songs that will psychologically scar the player. At least while trying to solve portal maps, if you have any songs like this please suggest some! >=3 )

"What is Love"? Really?
"Eye of the Tiger"? Wow.
"Spoon Full of Sugar"? From "Mary Poppins"?
What music from Mario is going to scar people?
The only way those songs could psychologically scar you is if they are sudden and jarring in their presentation.
A few songs come to mind; "Maxwell's Silver Hammer" by the Beatles and "Artificial Flowers" by Bobby Darin. "Mack the Knife", also by Bobby Darin, is another one. "Beyond the Sea" (again Bobby Darin) might fit in with your "theme" better as it is fairly innocuous by itself.
metroid101 wrote:

And there are people on youtube who upload the song IN FULL, without getting copyright, just because the video is the name of the song..
Youtube copyright laws are stupid that way <_<

Exactly my point. Plus, when was the last time you heard of anyone being sued over distribution copyright stuff? The record labels have better things to do than search out every single bloody case of copyright infringement, especially for something 30 years old. I say don't even worry about copyright crap for the songs you want to use.

You kind of misunderstood my statement about "Scarring" them.
The custom voice clip mentions scarring the test subject, but really the songs are meant a distraction. Something that makes it difficult to solve the already complex tests. For example, try playing something like the Nyan Cat song while trying to play some of the harder portal 2 custom maps, tough and frustrating.

For eye of the tiger, Glados hacks the speakers of one hallway just before the boss fight to motivate the player for the battle and get them pumped for taking down the lameness core (Yes a lameness core...they have an 'adventure' core and a 'space' core so I don't see why not...)

What Is Love: Something you wouldn't expect to hear in aperature. Since it's test subjects get anything but love from management. It's the first chamber, so it's not that distracting, just annoying.

Spoon Full Of Sugar: The song itself is harmless, trying to do puzzle solving in death trap chambers of death is meant more for irony. As the joyful song is the only 'sugar' you get during this test. It's the second test chamber, and it fits with the whole 'sarcasm meant to annoy Chell' theme of the game.

Also, considering the slide song( http://www.youtube.com/watch?v=M-otEdq-Ozo) only played in the slides, during the red cap unlocking stage, and in rainbow road and tick tock clock levels...which are by far the most frustrating, it seemed fitting.

I don't want to "Scar" a player, I want to annoy them to the very brink of ragequitrawer. And to me some of these songs do that. For example....Never Gonna Give You Up, on a constant loop....

Also, certain parts of the tests will be "Timed" to the music to make things even more challenging. Every test chamber starts out pitch black with no lights on, the second the player steps in the lights start and the music does too. The hallways inbetween each chamber will be soundless.

For never gonna give you up, you're promised an escape route in this chamber, instead a companion cube and another very difficult test is presented xD so in a sense, you get rick rolled which can be frustrating if presented right...

Advertisement
Registered users don’t see ads! Register now!
Avatar
ChickenMobile
2,460 Posts
Posted Aug 01, 2013
Replied 23 hours later

Have you ever played around with this entity? The output I'm most interested in is: Soundlevel.

https://developer.valvesoftware.com/wik ... ve_trigger

Hammer time!

EDIT: so it cannot detect the soundlevel of an ambient generic... disappointing.