Spaudio is a Python application designed to simulate spatial audio effects in a virtual 3D room environment. By leveraging the power of Pyroomacoustics and Pydub, Spaudio provides users with the ability to create realistic acoustic simulations, ideal for research, audio engineering, and immersive sound design.
- Audio File Input: Load your audio files in various formats.
- 3D Room Simulation: Define a room with customizable dimensions and simulate how sound propagates within it.
- Multiple Sources and Microphones: Add multiple sound sources and microphones to capture the spatial audio effect.
- Audio Output: Save the simulated audio to a file or play it directly through your speakers.
Please use headphones/earphones.
You can experience 3D audio to a reasonable degree while maintaining compatibility.
It gives you the experience of having a privileged seat in front of a high-quality TV, but the audio files must be stereo compatible.
Before you begin, ensure you have met the following requirements:
- Python 3.x
- Pyroomacoustics
- Pydub
- ffmpeg (for Pydub)
Clone the repository and install the required packages:
git clone https://github.com/DiamondGotCat/Spaudio.git
cd spaudio
pip install -r requirements.txt
To run Spaudio, use the following command:
python spaudio.py <audio_file> [--output_file <output_file>] [--room_dim <x> <y> <z>] [--source_position <x> <y> <z>]
<audio_file>
: Path to the input audio file.--output_file <output_file>
: (Optional) Path to save the output audio file.--room_dim <x> <y> <z>
: (Optional) Room dimensions.--source_position <x> <y> <z>
: (Optional) Source position.--source_position <x> <y> <z> <x2> <y2> <z2>
: (Optional) Source position for stereo-mode.
(Replacing spaudio.py with spaudio-stereo.py will improve the sound quality)
Simulate an audio file and play it back:
python spaudio.py input.wav
Simulate an audio file and save the output:
python spaudio.py input.wav --output_file output.wav
(Replacing spaudio.py with spaudio-stereo.py will improve the sound quality)
(Square: Speaker ,Circle: Microphone)
- Loading Audio: The script loads the input audio file using Pydub and extracts the audio data and sample rate.
- Audio Normalization: The audio data is normalized to ensure consistent amplitude levels.
- Room Configuration: A 3D room environment is defined with specified dimensions and acoustic properties.
- Source and Microphone Placement: Multiple sound sources and microphones are positioned within the room to capture the spatial audio effect.
- Simulation: Pyroomacoustics simulates the sound propagation and captures the audio signals at each microphone.
- Output: The simulated audio can be saved to a file or played back directly.
This project is licensed under the MIT License - see the LICENSE file for details.
- Pyroomacoustics: https://github.com/LCAV/pyroomacoustics
- Pydub: https://github.com/jiaaro/pydub
Enjoy creating immersive audio experiences with Spaudio!