AyahSender is a Python package that allows you to have Quranic audio
and images
easily.
- Fetch a single ayah audio.
- Merge multiple ayahs into a single audio file.
- Supports various reciters.
- Saves audio files in MP3 format.
- Save transparent .png file of an ayah
Install the package via pip:
pip install ayah-sender
requests
pydub
ffmpeg
- PyDub requiresffmpeg
to perform its operations.
Follow the articles to install ffmpeg on your system if you don't have it installed.
Here is an example of how to use AyahSender:
from ayah_sender import AyahSender
ayahSender = AyahSender()
# Show available reciters
reciters_dict = ayahSender.reciter.show_reciters()
print(reciters_dict)
# Fetch a single ayah's audio
audio_data = ayahSender.get_single_ayah(reciter_id=1, chapter_num=1, verse_num=1)
# Save the single ayah audio
ayahSender.save_audio(audio_data, output_dir='.')
# Merge multiple ayahs' audio
merged_audio_data = ayahSender.merge_ayahs(reciter_id=5, chapter_num=1, start_verse=1, end_verse=5)
# Save the merged audio file
ayahSender.save_audio(merged_audio_data, output_dir='.')
# Getting png image of an ayah
ayahSender.get_image(chapter_num=2, verse_num=255, output_dir='ayah-png')
- Fetches the total number of verses in a given chapter.
- Fetches a single ayah from a specified reciter, chapter, and verse.
- Fetches and merges a range of ayahs from a specified reciter and chapter.
- Saves the audio data to the specified directory.
- Fetches and saves png image of an ayah
The reciters.csv
file contains the list of reciters. The Reciter
class reads this file to fetch reciter information.
See examples folder for examples.
Feel free to submit issues or pull requests. For major changes, please open an issue first to discuss what you would like to change.
For any queries, contact us at dev.asib@proton.me.
- everyayah.com - Jazahumullahu Khairan to them for the
audio files
. - Quran.com - Jazahumullahu Khairan to them for the
API
.
Enjoy using AyahSender
for your Quranic audio needs!