Jump to content

Realistic sound box script help


Ryosuke

Recommended Posts

English : Hello everyone, I would like a little help on a realistic sound box system. see the link how it would work, if possible help I thank

Português : Ola a todos , gostaria de uma pequena ajuda em um sistema de caixa de som realista . vejam no link como funcionaria , se possível ajudar eu  agradeço 

see the image  (vejam a imagem ) : https://imgur.com/a/Ccuwm

The system will work using  

bindKey("r","down",
    function()
     if cone1 then 
     stopSound(cone1) 
     else 
      local cone1 playSound("IP STREAM RADIO") --- the object moves in the rhythm of the sound
      local theVeh = getPedOccupiedVehicle(localPlayer)local getComponent = getVehicleComponents(theVeh) 
      if (theVeh) then
      for k in pairs (getComponent) do
      local x, y, z = getVehicleComponentPosition(theVeh, cone) 
      cone1 = setVehicleComponentPosition(theVeh, cone, x+1, y+1, z+1) 
      end
      end
    end
)
Link to comment
2 minutes ago, Elvis Willian said:

I do know however how to modify for a component of the vehicle?

table getSoundFFTData ( element sound, int iSamples [, int iBands = 0 ] )


Use the function and save the return value into a table, then loop through the table (the amount of times you loop through depends on what iSample you pass), then using the table value set the vehicle component to open a small amount with some calculations.
 

local stream = playSound("http://mystream/") --- URL to the stream.
local x, y, z = getVehicleComponentPosition(theVehicle, stream)
local fftTable = getSoundFFTData(stream, 2048, 257)

if not (fftTable) then return false end
for i = 1, 256 do -- 256 because iBands is 257, so we iBands - 1
  -- setVehicleComponentPosition here using the fftTable[i] and some maths.
end

 

Link to comment
6 minutes ago, Skully said:

table getSoundFFTData ( element sound, int iSamples [, int iBands = 0 ] )


Use the function and save the return value into a table, then loop through the table (the amount of times you loop through depends on what iSample you pass), then using the table value set the vehicle component to open a small amount with some calculations.
 


local stream = playSound("http://mystream/") --- URL to the stream.
local x, y, z = getVehicleComponentPosition(theVehicle, stream)
local fftTable = getSoundFFTData(stream, 2048, 257)

if not (fftTable) then return false end
for i = 1, 256 do -- 256 because iBands is 257, so we iBands - 1
  -- setVehicleComponentPosition here using the fftTable[i] and some maths.
end

 

Thank you, I'm going to work and test.

Link to comment
28 minutes ago, Skully said:

table getSoundFFTData ( element sound, int iSamples [, int iBands = 0 ] )


Use the function and save the return value into a table, then loop through the table (the amount of times you loop through depends on what iSample you pass), then using the table value set the vehicle component to open a small amount with some calculations.
 


local stream = playSound("http://mystream/") --- URL to the stream.
local x, y, z = getVehicleComponentPosition(theVehicle, stream)
local fftTable = getSoundFFTData(stream, 2048, 257)

if not (fftTable) then return false end
for i = 1, 256 do -- 256 because iBands is 257, so we iBands - 1
  -- setVehicleComponentPosition here using the fftTable[i] and some maths.
end

 


function musicStartFunc()
local stream = playSound("http://92.222.66.160:80/") 
 local theVeh = getPedOccupiedVehicle(localPlayer)
  local getComponent = getVehicleComponents(theVeh) 
   if (theVeh) then
    for k in pairs (getComponent) do
     local x, y, z = getVehicleComponentPosition(theVeh, stream)
      local fftTable = getSoundFFTData(theVeh,stream, 2048, 257)
       if not (fftTable) then return false end
       
        for i = 1, 256 do 
        setVehicleComponentPosition(fftTable,'bump_rear_dummy', x+5, y+0, z+0)
        end
end
end
end
bindKey("9","down",musicStartFunc)

 

 

What is problem ?? Help pls 

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...