IceFLYER 0 Posted April 21, 2006 Thanks in advance all! How do you get one of your music files, or sound files to gradually get louder as you walk close to the source (as in a radio or person talking) and then have it get quieter as you walk away? There is a default BIS sound or music that does this already ..to find it ...place a "trigger", press the "effects" button, and under the "trigger" area there is a sound or music titled "music" ...it's that one jingle jinglely type of music, or sounds like a marching band, or something with chimes....well, when you walk close to it it gets louder, and wehn you walk away from it it gets quieter...how do you do that with the music and sounds that I make myself? I appreciate all your help, I really do! Thanks all! ---IceFLYER Share this post Link to post Share on other sites
mandoble 1 Posted April 21, 2006 You can do it with a simple script: For example, place a radio at your music source desired position, name it radio1, into its init field write <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">[]exec"radio1.sqs" And create radio1.sqs as follows: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> #waitforinrange @(player distance radio1) <= 20.0 0 fadeMusic 0 playMusic "Track15" #checkrange _dist = player distance radio1 ? _dist > 20.0: 0 fadeMusic 0;goto "waitforinrange" _vol = 1.0 - _dist/20.0 0 fadeMusic _vol ~0.05 goto "checkrange" exit Share this post Link to post Share on other sites
IceFLYER 0 Posted April 21, 2006 thanks my friend ---IceFLYER breaking to the games, until I hunger for reality again ...should take a few minutes Share this post Link to post Share on other sites
Trapper 0 Posted April 22, 2006 What you're really looking for is the creation of an engine based sound effect with dynamic range, not a script. 1. Lets say your custom sound is radiomusic.ogg. If you want to create more than one, think about normalizing all of the files. 2. You'll need this part in your description.ext<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> class CfgSounds { class radiomusic{name = "";sound[] = {"radiomusic.ogg", db-55, 1.0};titles[] = {0};}; }; The most important part in this case is the db value. It represents virtual db's in OFP's island world. Start with 0 and adjust it to the positive or negative by trial and error in game. The lower the value the less it's gone to be heared over distance. Important: When you make changes to the description.ext, you have to reload the mission in the editor for the changes to take effect. Btw when you make use of name = "radiomusic" you can find your own sound easily in the trigger effects menu, too. 3. Place an object somewhere that emits the sound. For now I'll name it radio. Or use objectID to let any tree ect be the source. 4. Create a script to loop your sound.<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> #l1 if (player distance radio < 100) then {radio say "radiomusic"} ~10 goto "l1" This script will also stop playing the sound when the player is too far away to hear anything (100 meters). ~10 has to be the lenght of radiomusic.ogg in seconds. If you don't need a looped sound the simple command line radio say radiomusic will play it once. Share this post Link to post Share on other sites
IceFLYER 0 Posted April 23, 2006 Trapper, I appreciate it.  I have not gotten a chance to try out your method yet. Mandoble, I admit your method did work, but not exactly in the way I was looking for.  Namely, the sound almost, "almost" came on instantly, rather than progressed louder as the player got closer to the sound source.  Nor did it fade smoothly as I left the sound source.  It did fade and rise smothly but only for a short distance of about 2 or 3 steps (the speed as in when weapon is carried on back).  It did what I was looking for, but not in a gradual effect kind of way. I tried extensivly to play around with the numbers in the script, but I got no love heheh back, and I tried a lot of things, even duplicating lines (and I know nothing about the scripting language, but it sort of makes sense in an "if this than that" kind of way) I am ignorant to the fact of "what does this number in the script actually represent in-game" so, Mandoble if your scripts does what I am looking for and all I need to do is tweak a few number then   please do explain and I will pass on the know how to others  as you all do for me Trapper, I will try your method tommorrow (as it is REALLY LATE) but I will reply with the result, and if what I have said here changes any of what you already supplied, let me know =o) thanks guys and I do appreciate it. ---IceFLYER Off to the reality of sleep so I can indulge in the fantasy of dreams... does that make sense? oh well, my quotes are an on the spot kind of thing... =o) Share this post Link to post Share on other sites
mandoble 1 Posted April 23, 2006 IceFLYER, I tested it and it smoothly increases or decreases in volumen from 0 to 1. I will comment every line of code so you can tweak it better: For example <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> [radio1, 50.0, "Track15", 0.0, 0.05]exec"radio1.sqs" <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> ;Usage: ;[object, maxsoundrange, track, time_to_reach_cacl_vol, loopdelay]exec"radio1.sqs" ; Object generating music _object = _this select 0 ; Range in meters to have any volume _meters = _this select 1 ; Music track to be played _music = _this select 2 ; Time in seconds to reach the calculated volume _fadetime = _this select 3 ; Time to wait between checks _delay = _this select 4 #waitforinrange ;Is player inside sound range? @(player distance radio1) <= _meters ;As soon as you get in range, you get 0 volume ; set 0 volume in 0 seconds (vol fademusic secs) 0 fadeMusic 0 ; Lets start playing this track (you may try any other) ; Initially at volume 0 playMusic _music ;Now that we are in range, lets regulate volumen ;depending on range #checkrange _dist = player distance _object ;If we get out of range, volume 0 again and ;goto initial check point ? _dist > _meters: 0 fadeMusic 0;goto "waitforinrange" ;If we are still into range we calculate the corresponding ;volume (maximum 1.0 for range near 0m, ;minimum 0 for range = _meters) _vol = 1.0 - _dist/_meters ;Change the music vol in the indicated time _fadetime fadeMusic _vol ~_delay goto "checkrange" exit Take into consideration that some music tracks starts also with a very low volume (they are composed this way). If you have time and some patience, you should try Trapper method too, this way the sound source will be really placed in the OFP world. You will not have only an increase of the sound as you aproach the sound source, but also the sound will reach you focused from the indicated coordinates. Share this post Link to post Share on other sites
.COMmunist 0 Posted April 24, 2006 http://www.flashpoint1985.com/cgi-bin/ikonboard311/ikonboard.cgi?act=ST;f=7;t=26723;st=15 Share this post Link to post Share on other sites
Heatseeker 0 Posted April 24, 2006 I went searching for this too recently,Trappers way is what i got to work, simple and efective. I edited the sound to make it small and feel continuous. give the radio a name (radio). use a small loop script to keep it playing: #loop radio say "radiosong" ~56 goto "loop" Radiosong is the name of the sound file, 56 seconds is the duration of the sound i used. Call it on a trigger like: this exec "whateveryounamedyourscript.sqs". And like he said adjust the db in the sound or in the description file (dont forget the saving part). Simple, nice and functional . Share this post Link to post Share on other sites
IceFLYER 0 Posted April 25, 2006 Thanks Mandoble, Trapper, heatseeker, and .com. I do have the DB area set to +60 and +30 for all my stuff as default, so tweaking that helped and knowing what each portion of the script helped out a lot. I appredciate all those notes explaining the script ---IceFLYER Share this post Link to post Share on other sites
mattxr 9 Posted August 6, 2006 What you're really looking for is the creation of an engine based sound effect with dynamic range, not a script.1. Lets say your custom sound is radiomusic.ogg. If you want to create more than one, think about normalizing all of the files. 2. You'll need this part in your description.ext<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> class CfgSounds { class radiomusic{name = "";sound[] = {"radiomusic.ogg", db-55, 1.0};titles[] = {0};}; }; The most important part in this case is the db value. It represents virtual db's in OFP's island world. Start with 0 and adjust it to the positive or negative by trial and error in game. The lower the value the less it's gone to be heared over distance. Important: When you make changes to the description.ext, you have to reload the mission in the editor for the changes to take effect. Btw when you make use of name = "radiomusic" you can find your own sound easily in the trigger effects menu, too. 3. Place an object somewhere that emits the sound. For now I'll name it radio. Or use objectID to let any tree ect be the source. 4. Create a script to loop your sound.<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> #l1 if (player distance radio < 100) then {radio say "radiomusic"} ~10 goto "l1" This script will also stop playing the sound when the player is too far away to hear anything (100 meters). ~10 has to be the lenght of radiomusic.ogg in seconds. If you don't need a looped sound the simple command line radio say radiomusic will play it once. you make it sound soo simple i followed your rules to the exact dot, but it still doesnt seem to work its exactly what i need.. Could anyone do a demo mission or something becuase this is doing my head in.. the ogg file is called AirRaid1.ogg and the radio is called radio. Share this post Link to post Share on other sites
mattxr 9 Posted August 6, 2006 well Mandobles version worked.. He is my God lol Share this post Link to post Share on other sites
Silverguy82 0 Posted September 19, 2006 I went searching for this too recently,Trappers way is what i got to work, simple and efective. I edited the sound to make it small and feel continuous. give the radio a name (radio). use a small loop script to keep it playing: #loop radio say "radiosong" ~56 goto "loop" Radiosong is the name of the sound file, 56 seconds is the duration of the sound i used. Call it on a trigger like: this exec "whateveryounamedyourscript.sqs". And like he said adjust the db in the sound or in the description file (dont forget the saving part). Simple, nice and functional . I keep getting this message everytime I get close to the radio code i'am using in the Radio2.sqs file is... <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">#loop radio say "Track15" ~56 goto "loop" just trying to play a standard BIS track, anyone have suggestions? Share this post Link to post Share on other sites
IceFLYER 0 Posted September 20, 2006 well here's something that will also work but only in one direction...as in approaching or leaving an area.... but is very very very very tedious ... make a script and use the fadeMusic or fadeSound command and seperate each command with a ~.001 (or smaller). make sure the sound and volume levels are very small increments and in small decreasing or increasing increments Share this post Link to post Share on other sites
IceFLYER 0 Posted September 20, 2006 with all the methods one thing is the DB level ...when recording the .ogg I've tried recording in very low volume levels which work best Share this post Link to post Share on other sites
Metal Heart 0 Posted September 20, 2006 Quote[/b] ]code i'am using in the Radio2.sqs file is...Code Sample #loop radio say "Track15" ~56 goto "loop" just trying to play a standard BIS track, anyone have suggestions? Say only works with sounds (mono, directional & dynamic sound), not with music (stereo, played directly as is). You play music files with playmusic "Track15". To play the track as a sound, you'd convert it to mono (or split it into separate left and right files) and define it in CfgSounds in the description.ext file. Share this post Link to post Share on other sites
Silverguy82 0 Posted September 21, 2006 Quote[/b] ]code i'am using in the Radio2.sqs file is...Code Sample #loop radio say "Track15" ~56 goto "loop" just trying to play a standard BIS track, anyone have suggestions? Say only works with sounds (mono, directional & dynamic sound), not with music (stereo, played directly as is). You play music files with playmusic "Track15". To play the track as a sound, you'd convert it to mono (or split it into separate left and right files) and define it in CfgSounds in the description.ext file. hmmmm....this may explain a lot of problems I have had with sound latley.... so what your saying Metal Heart is that if you are going to play them as sound files they need to be in mono not stereo? I got 2 recording programs, so I could easily change them to mono for sound. Share this post Link to post Share on other sites
Metal Heart 0 Posted September 22, 2006 I'm not sure if stereo sounds are accepted but at the very least they're a waste of space and cpu cycles since they'll be played as mono anyways. Share this post Link to post Share on other sites