I want to add a rotating 3d effect(Haas effect) in mp3. I mean that the audio will seem to change its directions from left to right and vice versa periodically(as shown below) when listened through the headphone. For this, I searched on the Internet and tried to achieve it in the following ways :
- Firstly, I thought, if I change the audio of the left and right channel periodically( Like when the Right channel has full volume(100%), Left channel has low volume(20%) and vice versa) then I can achieve it but it's not like 3D.
- Secondly, When I researched more than found that It is done by creating a delay between the two channels. I found that I can create a delay of 0.0 to 0.8 milliseconds according to requirement. To do this, I use the following commands in FFmpeg :
Step 1: Splitting Audio Channels :
ffmpeg -i D:\ffmpeg\Down.mp3 -map_channel 0.0.0 D:\ffmpeg\L.mp3 -map_channel 0.0.1 D:\ffmpeg\R.mp3
Stem 2: Splitting Left channel into parts :
Note: We will only change the speed of Left channel so we split Left channel into 4 seconds parts.
ffmpeg -i D:\ffmpeg\L.mp3 -f segment -segment_time 4 D:\ffmpeg\Split\%03d.mp3
Step 3: Changing the tempo of each part
Now We change the tempo (speed) of each part so it may feel like the sound is moving from left to right and vice versa
ffmpeg -y -i D:\ffmpeg\Split\000.mp3 -af atempo=1.0008 D:\ffmpeg\Modi\000.mp3
ffmpeg -y -i D:\ffmpeg\Split\001.mp3 -af atempo=1.0000 D:\ffmpeg\Modi\001.mp3
ffmpeg -y -i D:\ffmpeg\Split\002.mp3 -af atempo=0.9992 D:\ffmpeg\Modi\002.mp3
ffmpeg -y -i D:\ffmpeg\Split\003.mp3 -af atempo=1.0000 D:\ffmpeg\Modi\003.mp3
ffmpeg -y -i D:\ffmpeg\Split\004.mp3 -af atempo=1.0008 D:\ffmpeg\Modi\004.mp3
ffmpeg -y -i D:\ffmpeg\Split\005.mp3 -af atempo=1.0000 D:\ffmpeg\Modi\005.mp3
ffmpeg -y -i D:\ffmpeg\Split\006.mp3 -af atempo=0.9992 D:\ffmpeg\Modi\006.mp3
ffmpeg -y -i D:\ffmpeg\Split\007.mp3 -af atempo=1.0000 D:\ffmpeg\Modi\007.mp3
ffmpeg -y -i D:\ffmpeg\Split\008.mp3 -af atempo=1.0008 D:\ffmpeg\Modi\008.mp3
ffmpeg -y -i D:\ffmpeg\Split\009.mp3 -af atempo=1.0000 D:\ffmpeg\Modi\009.mp3
ffmpeg -y -i D:\ffmpeg\Split\010.mp3 -af atempo=0.9992 D:\ffmpeg\Modi\010.mp3
ffmpeg -y -i D:\ffmpeg\Split\011.mp3 -af atempo=1.0000 D:\ffmpeg\Modi\011.mp3
ffmpeg -y -i D:\ffmpeg\Split\012.mp3 -af atempo=1.0008 D:\ffmpeg\Modi\012.mp3
ffmpeg -y -i D:\ffmpeg\Split\013.mp3 -af atempo=1.0000 D:\ffmpeg\Modi\013.mp3
ffmpeg -y -i D:\ffmpeg\Split\014.mp3 -af atempo=0.9992 D:\ffmpeg\Modi\014.mp3
ffmpeg -y -i D:\ffmpeg\Split\015.mp3 -af atempo=1.0000 D:\ffmpeg\Modi\015.mp3
ffmpeg -y -i D:\ffmpeg\Split\016.mp3 -af atempo=1.0008 D:\ffmpeg\Modi\016.mp3
ffmpeg -y -i D:\ffmpeg\Split\017.mp3 -af atempo=1.0000 D:\ffmpeg\Modi\017.mp3
ffmpeg -y -i D:\ffmpeg\Split\018.mp3 -af atempo=0.9992 D:\ffmpeg\Modi\018.mp3
ffmpeg -y -i D:\ffmpeg\Split\019.mp3 -af atempo=1.0000 D:\ffmpeg\Modi\019.mp3
ffmpeg -y -i D:\ffmpeg\Split\020.mp3 -af atempo=1.0008 D:\ffmpeg\Modi\020.mp3
ffmpeg -y -i D:\ffmpeg\Split\021.mp3 -af atempo=1.0000 D:\ffmpeg\Modi\021.mp3
ffmpeg -y -i D:\ffmpeg\Split\022.mp3 -af atempo=0.9992 D:\ffmpeg\Modi\022.mp3
ffmpeg -y -i D:\ffmpeg\Split\023.mp3 -af atempo=1.0000 D:\ffmpeg\Modi\023.mp3
ffmpeg -y -i D:\ffmpeg\Split\024.mp3 -af atempo=1.0008 D:\ffmpeg\Modi\024.mp3
ffmpeg -y -i D:\ffmpeg\Split\025.mp3 -af atempo=1.0000 D:\ffmpeg\Modi\025.mp3
ffmpeg -y -i D:\ffmpeg\Split\026.mp3 -af atempo=0.9992 D:\ffmpeg\Modi\026.mp3
ffmpeg -y -i D:\ffmpeg\Split\027.mp3 -af atempo=1.0000 D:\ffmpeg\Modi\027.mp3
ffmpeg -y -i D:\ffmpeg\Split\028.mp3 -af atempo=1.0008 D:\ffmpeg\Modi\028.mp3
ffmpeg -y -i D:\ffmpeg\Split\029.mp3 -af atempo=1.0000 D:\ffmpeg\Modi\029.mp3
ffmpeg -y -i D:\ffmpeg\Split\030.mp3 -af atempo=0.9992 D:\ffmpeg\Modi\030.mp3
ffmpeg -y -i D:\ffmpeg\Split\031.mp3 -af atempo=1.0000 D:\ffmpeg\Modi\031.mp3
ffmpeg -y -i D:\ffmpeg\Split\032.mp3 -af atempo=1.0008 D:\ffmpeg\Modi\032.mp3
ffmpeg -y -i D:\ffmpeg\Split\033.mp3 -af atempo=1.0000 D:\ffmpeg\Modi\033.mp3
ffmpeg -y -i D:\ffmpeg\Split\034.mp3 -af atempo=0.9992 D:\ffmpeg\Modi\034.mp3
ffmpeg -y -i D:\ffmpeg\Split\035.mp3 -af atempo=1.0000 D:\ffmpeg\Modi\035.mp3
ffmpeg -y -i D:\ffmpeg\Split\036.mp3 -af atempo=1.0008 D:\ffmpeg\Modi\036.mp3
ffmpeg -y -i D:\ffmpeg\Split\037.mp3 -af atempo=1.0000 D:\ffmpeg\Modi\037.mp3
ffmpeg -y -i D:\ffmpeg\Split\038.mp3 -af atempo=0.9992 D:\ffmpeg\Modi\038.mp3
ffmpeg -y -i D:\ffmpeg\Split\039.mp3 -af atempo=1.0000 D:\ffmpeg\Modi\039.mp3
ffmpeg -y -i D:\ffmpeg\Split\040.mp3 -af atempo=1.0008 D:\ffmpeg\Modi\040.mp3
ffmpeg -y -i D:\ffmpeg\Split\041.mp3 -af atempo=1.0000 D:\ffmpeg\Modi\041.mp3
ffmpeg -y -i D:\ffmpeg\Split\042.mp3 -af atempo=0.9992 D:\ffmpeg\Modi\042.mp3
ffmpeg -y -i D:\ffmpeg\Split\043.mp3 -af atempo=1.0000 D:\ffmpeg\Modi\043.mp3
ffmpeg -y -i D:\ffmpeg\Split\044.mp3 -af atempo=1.0008 D:\ffmpeg\Modi\044.mp3
ffmpeg -y -i D:\ffmpeg\Split\045.mp3 -af atempo=1.0000 D:\ffmpeg\Modi\045.mp3
ffmpeg -y -i D:\ffmpeg\Split\046.mp3 -af atempo=0.9992 D:\ffmpeg\Modi\046.mp3
ffmpeg -y -i D:\ffmpeg\Split\047.mp3 -af atempo=1.0000 D:\ffmpeg\Modi\047.mp3
ffmpeg -y -i D:\ffmpeg\Split\048.mp3 -af atempo=1.0008 D:\ffmpeg\Modi\048.mp3
ffmpeg -y -i D:\ffmpeg\Split\049.mp3 -af atempo=1.0000 D:\ffmpeg\Modi\049.mp3
ffmpeg -y -i D:\ffmpeg\Split\050.mp3 -af atempo=0.9992 D:\ffmpeg\Modi\050.mp3
ffmpeg -y -i D:\ffmpeg\Split\051.mp3 -af atempo=1.0000 D:\ffmpeg\Modi\051.mp3
ffmpeg -y -i D:\ffmpeg\Split\052.mp3 -af atempo=1.0008 D:\ffmpeg\Modi\052.mp3
ffmpeg -y -i D:\ffmpeg\Split\053.mp3 -af atempo=1.0000 D:\ffmpeg\Modi\053.mp3
ffmpeg -y -i D:\ffmpeg\Split\054.mp3 -af atempo=1.0000 D:\ffmpeg\Modi\054.mp3
Here I used 1.0000 for normal speed and 1.0008 for increased speed and 0.9992 for decreased speed
Spet 4: Merging small pieces of audio
ffmpeg -f concat -safe 0 -i D:\ffmpeg\f.txt -c copy D:\ffmpeg\output.mp3
where f.txt contains :
file 'D:\ffmpeg\Modi\000.mp3'
file 'D:\ffmpeg\Modi\001.mp3'
file 'D:\ffmpeg\Modi\002.mp3'
file 'D:\ffmpeg\Modi\003.mp3'
file 'D:\ffmpeg\Modi\004.mp3'
file 'D:\ffmpeg\Modi\005.mp3'
file 'D:\ffmpeg\Modi\006.mp3'
file 'D:\ffmpeg\Modi\007.mp3'
file 'D:\ffmpeg\Modi\008.mp3'
file 'D:\ffmpeg\Modi\009.mp3'
file 'D:\ffmpeg\Modi\010.mp3'
file 'D:\ffmpeg\Modi\011.mp3'
file 'D:\ffmpeg\Modi\012.mp3'
file 'D:\ffmpeg\Modi\013.mp3'
file 'D:\ffmpeg\Modi\014.mp3'
file 'D:\ffmpeg\Modi\015.mp3'
file 'D:\ffmpeg\Modi\016.mp3'
file 'D:\ffmpeg\Modi\017.mp3'
file 'D:\ffmpeg\Modi\018.mp3'
file 'D:\ffmpeg\Modi\019.mp3'
file 'D:\ffmpeg\Modi\020.mp3'
file 'D:\ffmpeg\Modi\021.mp3'
file 'D:\ffmpeg\Modi\022.mp3'
file 'D:\ffmpeg\Modi\023.mp3'
file 'D:\ffmpeg\Modi\024.mp3'
Step 5: The last operation is combining the both channels :
ffmpeg -i D:\ffmpeg\L.mp3 -i D:\ffmpeg\output.mp3 -filter_complex [0:a][1:a]amerge=inputs=2[aout] -map [aout] D:\ffmpeg\LRM.mp3
But even then the result is very poor. It looks like FFmpeg combines audio in Step 4 took a delay after each audio.
I think there may be some bug in my solution. I don't think that I can change tempo like this in audio without splitting the audio(Let me know if I am wrong).
Does anyone have a different solution to achieve this? Please help me in this. Thanks in advance...