Mohammed Irfan told the High Court in Glasgow he was driving through the Duddingston area of the capital when he heard three booms which he was later told were gunshots.
The 34-year-old said: “I never thought it would be happening here. It was like something you hear in the movies.
“I couldn’t believe it would be shots. I heard three loud bangs, which I found out the next day were shots.”
The trial has previously heard that an automatic sub-machine pistol, a revolver and a bloodied baseball bat were found in undergrowth close to the scene.
Another witness described chaotic scenes in which men were “running about screaming”, some armed with weapons.
Mr Irfan was giving evidence at the trial of Mohamud Mohamud, 30, Ahmed Ahmed, 28, Cadil Huseen, 23, Hussein Ali, 26, Liban Ahmed, 30 – also known as Jama – Said Fadal, 32, and Said Tarabi, 27.
They all deny murdering Mohamed Abdi, 25, on 26 May, 2013.
Advocate depute Iain McSporran, prosecuting, asked Mr Irfan: “How far apart were the bangs spaced?”
He replied: “It was like continuous for one or two seconds. I asked my passenger if he had heard them, but he was drunk.”
Colin McKirdy, 44, a butcher from Prestonpans, East Lothian, told the jury that he was driving near Abercorn Avenue at around 1am when he heard what he thought were gunshots.
Mr McKirdy said: “I heard one bang then a couple of bangs, then I said to myself, that sounded like a gun.
“I used to do shooting years ago and you kind of know. To me, it was a gun.”
He stopped his car near Abercorn Avenue and could see someone lying in the street.
Mr McKirdy added: “I was very wary and got back in my car and drove down the road and phoned 999.”
Another witness, Paul Coleman, 24, said he was driving along Willowbrae Road when he came across what looked like a car accident.
He said there was one car in the middle of Abercorn Avenue and another embedded in railings beside Abercorn Sports Club.
Mr Coleman said he saw a number of men running around and said one of them was carrying a knife and another a baseball bat.
He added: “I heard a sound like a gun, but it wasn’t loud. I just thought it was a machine gun because I’ve heard it on TV before.”
Mr McSporran asked Mr Coleman: “Was there anything else going on when you heard the gunfire?”
He replied: “A lot of screaming. I saw people running about screaming. I was in shock.”
The jury has already heard that Mr Abdi was shot three times and died from a wound to his chest.
It is alleged that the seven accused repeatedly fired a sub-machine pistol and a revolver after a car chase along Duddingston Road West, Willowbrae Road and Abercorn Avenue.
The seven are accused of forcing the car occupied by Mr Abdi, Mohamed Farah and Abdulrakim Abdulrahman to stop, by colliding with it and repeatedly shooting at the occupants, murdering Mr Adbi and attempting to murder the other two men. Mohamud and the others are also accused of assault, of being concerned in the supply of cocaine and firearms charges.
All seven deny all the charges against them.
The trial before judge Lord Turnbull continues.