diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml new file mode 100644 index 0000000..f1c1bc2 --- /dev/null +++ b/.github/workflows/docker-publish.yml @@ -0,0 +1,33 @@ +name: Publish Docker image + +on: + push: + branches: + - main # Change to your main branch name + +jobs: + build-and-push: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - name: Log in to Docker Hub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKER_HUB_USERNAME }} + password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} + + - name: Build and push Docker image + uses: docker/build-push-action@v3 + with: + context: . + push: true + tags: ${{ secrets.DOCKER_HUB_USERNAME }}/audio-spectra-cli:latest + + - name: Logout from Docker Hub + run: docker logout diff --git a/.github/workflows/label.yml b/.github/workflows/label.yml new file mode 100644 index 0000000..525b926 --- /dev/null +++ b/.github/workflows/label.yml @@ -0,0 +1,16 @@ +name: Greetings + +on: [pull_request_target, issues] + +jobs: + greeting: + runs-on: ubuntu-latest + permissions: + issues: write + pull-requests: write + steps: + - uses: actions/first-interaction@v1 + with: + repo-token: ${{ secrets.GREETINGS_TOKEN }} + issue-message: "Greetings and Thank you for submitting the issue ! This message is automated, in case you are wondering. I will get back to you on this." + pr-message: "Congratulations on submitting your PR ! It will be merged if it passes the requirements. Thanks." diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..b0e030e --- /dev/null +++ b/Dockerfile @@ -0,0 +1,14 @@ +# Use an official Python runtime as a parent image +FROM python:3.9-slim + +# Set the working directory in the container +WORKDIR /app + +# Copy the current directory contents into the container at /app +COPY . /app + +# Install any needed dependencies specified in requirements.txt +RUN pip install --no-cache-dir -r requirements.txt + +# Command to run your module +CMD ["python", "-m", "Audio_SpectraCLI.main"] diff --git a/Readme.md b/Readme.md index b3dc7cc..0ceca7a 100644 --- a/Readme.md +++ b/Readme.md @@ -9,7 +9,7 @@ Audio Spectrum Visualization is a Python project that visualizes real-time audio input as a spectrum using Fast Fourier Transform (FFT). It provides an interactive CLI interface for users to start the visualization and exit the program. -## Current Features (with respect to 3.1) +## Current Features (with respect to 3.2) - Real-time visualization of Fast Fourier Transform (FFT) spectrum of audio input. - Support for adjusting parameters such as duration, sampling rate, and block size. @@ -24,6 +24,7 @@ Audio-SpectraCLI/ │ CODE_OF_CONDUCT.md │ Contributing.md +│ Dockerfile │ LICENSE │ Readme.md │ requirements.txt @@ -42,7 +43,13 @@ Audio-SpectraCLI/ main.py ``` -## Installation & Usage +## Installation Types: + +├───Using PIP
+├───Using Docker
+└───Using Docker locally
+ +## Installation & Usage (Using PIP) 1. Install using pip @@ -53,7 +60,43 @@ pip install Audio-SpectraCLI 2. Import and use modules - Create a Python file. -- You can use [Example.py](https://github.com/AdityaSeth777/Audio-SpectraCLI/blob/3.1/tests/main.py) as a reference or use the following code : +- You can use [Example.py](https://github.com/AdityaSeth777/Audio-SpectraCLI/blob/main/tests/main.py) as a reference or use the following code : + +``` +from Audio_SpectraCLI import AudioSpectrumVisualizer + +# Creating an instance of AudioSpectrumVisualizer with custom parameters. +audio_visualizer = AudioSpectrumVisualizer( + duration=5, frequency_range=(50, 5000), color='red') + +# Starting the audio spectrum visualization +audio_visualizer.start_visualization() +``` + +Once you have activated the audio_visualizer instance, feel free to use it wherever in the program. It consists of several parameters (which gives more control to the user), so make sure to configure and add those before using it in your code. + +--- + +## Installation & Usage (Using Docker) + +1. Prerequisites + You should have docker installed on your machine. You can download and install Docker from [here](https://www.docker.com/products/docker-desktop). +2. Pulling the Docker Image + +You can pull the pre-built Docker image from Docker Hub using the following command: + +```sh +docker pull adityaseth777/audio-spectra-cli +``` + +3. Running the Docker Container + To run the Docker container, use the following command: + +``` +docker run --rm -it adityaseth777/audio-spectra-cli:latest +``` + +4. You can use [Example.py](https://github.com/AdityaSeth777/Audio-SpectraCLI/blob/main/tests/main.py) as a reference or use the following code : ``` from Audio_SpectraCLI import AudioSpectrumVisualizer @@ -66,10 +109,48 @@ audio_visualizer = AudioSpectrumVisualizer( audio_visualizer.start_visualization() ``` -- Once you have activated the audio_visualizer instance, feel free to use it wherever in the program. It consists of several parameters (which gives more control to the user), so make sure to configure and add those before using it in your code. +Once you have activated the audio_visualizer instance, feel free to use it wherever in the program. It consists of several parameters (which gives more control to the user), so make sure to configure and add those before using it in your code. --- +## Building the Docker Image Locally + +If you prefer to build the Docker image locally, follow these steps: + +1. Clone the repository : + +```sh +git clone https://github.com/AdityaSeth777/Audio-SpectraCLI.git +cd Audio-SpectraCLI +``` + +2. Build the Docker image: + +```sh +docker build -t audio-spectra-cli . +``` + +3. Run the Docker container: + +```sh +docker run --rm -it audio-spectra-cli +``` + +4. You can use [Example.py](https://github.com/AdityaSeth777/Audio-SpectraCLI/blob/main/tests/main.py) as a reference or use the following code : + +``` +from Audio_SpectraCLI import AudioSpectrumVisualizer + +# Creating an instance of AudioSpectrumVisualizer with custom parameters. +audio_visualizer = AudioSpectrumVisualizer( + duration=5, frequency_range=(50, 5000), color='red') + +# Starting the audio spectrum visualization +audio_visualizer.start_visualization() +``` + +Once you have activated the audio_visualizer instance, feel free to use it wherever in the program. It consists of several parameters (which gives more control to the user), so make sure to configure and add those before using it in your code. + ## Upcoming Features - CLI endpoints. @@ -102,7 +183,7 @@ Contact: [contact@adityaseth.in] ## 🙋‍♂️ Support -💙 If you like this project, give it a ⭐ and share it with friends!

+💙 If you like this project, give it a ⭐ and share it with friends!`

` [☕ Buy me a coffee](https://www.buymeacoffee.com/adityaseth) --- diff --git a/setup.cfg b/setup.cfg index 2af08b0..223197e 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = Audio-SpectraCLI -version = 3.1 +version = 3.2 author = Aditya Seth author_email = contact@adityaseth.in description = AudioSpectraCLI is a command-line tool that provides real-time FFT visualization of audio spectra. It captures audio input from the microphone and displays the corresponding frequency spectrum directly in the terminal window, allowing users to monitor and analyze audio signals without the need for graphical interfaces. diff --git a/setup.py b/setup.py index e2c2aff..6fc7180 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ setup( name='Audio_SpectraCLI', - version='3.1', + version='3.2', author="Aditya Seth", long_description=open('Readme.md', encoding='utf-8').read(), long_description_content_type='text/markdown',