Metadata-Version: 2.4
Name: bhargava_swara
Version: 0.0.7
Summary: A library for analysis and synthesis of Indian classical music
Home-page: 
Author: Kuchi Chaitanya Krishna Deepak
Author-email: kckdeepak29@gmail.com
License: MIT
Keywords: music,analysis,synthesis,carnatic,hindustani,indian classical music,raga,tala,spectograms,signal
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Education
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.6
Description-Content-Type: text/markdown
License-File: LICENSE.txt
Requires-Dist: google-generativeai>=0.1.0
Requires-Dist: librosa>=0.10.0
Requires-Dist: matplotlib>=3.7.0
Requires-Dist: numpy>=1.24.0
Requires-Dist: seaborn>=0.11.0
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: keywords
Dynamic: license
Dynamic: license-file
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary

# Bhargava Swara

A Python library for analyzing and visualizing Indian classical music, including raga, tala, tempo, tradition, ornaments, full analysis, and mel-frequency spectrograms.

## Prerequisites

- **Gemini API Key:**  
  This library uses Google's Gemini API for music analysis. To obtain a key, follow these steps:  
  1. Sign up for a Google Cloud account.  
  2. Enable the Generative AI API in the Google Cloud Console.  
  3. Create an API key in the "Credentials" section.  
  Refer to [Google's Generative AI Docs](https://cloud.google.com/generative-ai/docs) for detailed instructions.

- **Audio Files:**  
  Supported formats include WAV and MP3 for spectrogram generation.

## Installation

Install the library using pip:

```sh
pip install bhargava_swara
```

## Usage

### Music Analysis

Analyze various aspects of Indian classical music using the Gemini API.

```python
from bhargava_swara import (
    analyze_raga,
    analyze_tala,
    analyze_tempo,
    analyze_tradition,
    analyze_ornaments,
    analyze_music_full
)

# Set your Gemini API key
api_key = "YOUR_API_KEY"
audio = "path/to/audio.wav"

# Individual analyses
print(f"Raga: {analyze_raga(audio, api_key)}")
print(f"Tala: {analyze_tala(audio, api_key)}")
print(f"Tempo: {analyze_tempo(audio, api_key)}")
print(f"Tradition: {analyze_tradition(audio, api_key)}")
print(f"Ornaments: {analyze_ornaments(audio, api_key)}")

# Full analysis
print(f"Full Analysis:\n{analyze_music_full(audio, api_key)}")
```

### Mel-Frequency Spectrogram Generation

Generate a mel-frequency spectrogram to visualize the frequency content of an audio file over time.

```python
from bhargava_swara import generate_mel_spectrogram

# Define input and output paths
audio = "path/to/audio.wav"
output = "path/to/output_mel_spectrogram.png"

# Generate the spectrogram
generate_mel_spectrogram(audio, output, n_mels=128, fmax=8000)
print("Mel spectrogram generated successfully!")
```

#### Parameters:
- `audio`: Path to the input audio file (e.g., WAV or MP3).  
- `output`: Path to save the PNG file (e.g., "spectrogram.png").  
- `n_mels`: Number of mel bands (default: 128).  
- `fmax`: Maximum frequency in Hz (default: 8000).

## Dependencies

- `google-generativeai>=0.1.0`  
- `librosa>=0.10.0`  
- `matplotlib>=3.7.0`  
- `numpy>=1.24.0`

## Contributing

Contributions are welcome! Please submit a pull request or open an issue on the GitHub repository (if available).

## License

This library is licensed under the MIT License. See the `LICENSE` file for details.
```

Change Log
==========

0.0.1 (26/03/2025)
-------------------
- First Release

===========

0.0.2 (27/03/2025)
-------------------
- Fixed missing module files in package

0.0.3 (27/03/2025)
-------------------
- Fixed ornaments detection file

0.0.4 (27/03/2025)
-------------------
- Fixed real time full analysis file

0.0.5 (27/03/2025)
-------------------
- Added mel-frequency spectogram generation

0.0.6 (27/03/2025)
-------------------
- seaborn included. README.txt updated

0.0.7 (27/03/2025)
-------------------
- mel-frequency spectogram issue resolved. README.md is created
