Skip to content

Commit

Permalink
Merge pull request #7 from AdityaSeth777/dev-v3.2
Browse files Browse the repository at this point in the history
Added Docker Support.
  • Loading branch information
AdityaSeth777 authored May 16, 2024
2 parents 647687a + d56525e commit b012591
Show file tree
Hide file tree
Showing 6 changed files with 151 additions and 7 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
@@ -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
16 changes: 16 additions & 0 deletions .github/workflows/label.yml
Original file line number Diff line number Diff line change
@@ -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."
14 changes: 14 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]
91 changes: 86 additions & 5 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -24,6 +24,7 @@ Audio-SpectraCLI/
│ CODE_OF_CONDUCT.md
│ Contributing.md
│ Dockerfile
│ LICENSE
│ Readme.md
│ requirements.txt
Expand All @@ -42,7 +43,13 @@ Audio-SpectraCLI/
main.py
```

## Installation & Usage
## Installation Types:

├───Using PIP <br>
├───Using Docker <br>
└───Using Docker locally <br>

## Installation & Usage (Using PIP)

1. Install using pip

Expand All @@ -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
Expand All @@ -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.
Expand Down Expand Up @@ -102,7 +183,7 @@ Contact: [[email protected]]

## 🙋‍♂️ Support

💙 If you like this project, give it a ⭐ and share it with friends!<br><br>
💙 If you like this project, give it a ⭐ and share it with friends!`<br><br>`
[☕ Buy me a coffee](https://www.buymeacoffee.com/adityaseth)

---
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = Audio-SpectraCLI
version = 3.1
version = 3.2
author = Aditya Seth
author_email = [email protected]
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.
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down

0 comments on commit b012591

Please sign in to comment.