Metadata-Version: 2.1
Name: topcast
Version: 0.1.4
Summary: A Python package for Topcast
Home-page: https://github.com/gormlabenz/topcast
Author: Gorm Labenz
Author-email: gorm@labenz.io
License: MIT
Keywords: topcast tts text-to-speech gcp google openai elevenlabs
Platform: UNKNOWN
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Requires-Python: >=3.7
Description-Content-Type: text/markdown
License-File: LICENSE.txt

# Topcast: Turn Text into Podcasts with TTS and Language Models
Topcast is a Python package that allows you to transform text into a podcast using Text-to-Speech (TTS) and language models. With Topcast, you can provide a text, and the package will create a podcast with an introduction, interview, conclusion, sound effects, and more. Topcast supports various TTS providers and language models.

##Example Implementation
```python
from topcast.chatgpt_themes import Introduction, Interview, Conclusion, Summary
from topcast.tts_providers import ElevenLabs, GCP
import os
from topcast import generate, set_elevenlab_api_key, set_google_credentials, set_openai_api_key

from dotenv import load_dotenv

load_dotenv()

set_elevenlab_api_key(os.environ["ELEVENLAB_API_KEY"])
set_openai_api_key(os.environ["OPENAI_API_KEY"])
set_google_credentials('gcp-keyfile.json')

timeline = [
    {
        "audio_layers": [
            {
                "audio": 'sounds/jingle.wav', 
                "is_main": True, 
            }
        ],
    },
    {
    "audio_layers": [
        {
            "audio": {
                "content": "Portugal (Portuguese pronunciation: [puɾtuˈɣal]), officially the Portuguese Republic (Portuguese: República Portuguesa [ʁɛˈpuβlikɐ puɾtuˈɣezɐ]),[note 4] is a country located on the Iberian Peninsula, in southwestern Europe, and whose territory also includes the Atlantic archipelagos of the Azores and Madeira. It features the westernmost point in continental Europe, and its Iberian portion is bordered to the west and south by the Atlantic Ocean and to the north and east by Spain, the sole country to have a land border with Portugal. Its two archipelagos form two autonomous regions with their own regional governments. Lisbon is the capital and largest city by population.",
                "theme": Introduction,
                "tts_provider": ElevenLabs
            }, 
            "is_main": True, 
        }
    ],

    "crossfade": 2400, 
},
]

podcast = generate(timeline)
podcast.export("podcast_3.wav", format="wav")
```
##Installation
Install the package using pip:

```bash
pip install topcast
````

##Usage
1. Import the necessary modules and set the API keys:
```python
from topcast.chatgpt_themes import Introduction, Interview, Conclusion, Summary
from topcast.tts_providers import ElevenLabs, GCP
import os
from topcast import generate, set_elevenlab_api_key, set_google_credentials, set_openai_api_key

from dotenv import load_dotenv

load_dotenv()

set_elevenlab_api_key(os.environ["ELEVENLAB_API_KEY"])
set_openai_api_key(os.environ["OPENAI_API_KEY"])
set_google_credentials('gcp-keyfile.json')
```
2. Create a timeline with the desired podcast structure:
```python
timeline = [
    {
        "audio_layers": [
            {
                "audio": 'sounds/jingle.wav', 
                "is_main": True, 
            }
        ],
    },
    {
    "audio_layers": [
        {
            "audio": {
                "content": "Portugal...",
                "theme": Introduction,
                "tts_provider": ElevenLabs
            }, 
            "is_main": True, 
        }
    ],

    "crossfade": 2400, 
},
]
```
3. Generate and export the podcast:
```python
podcast = generate(timeline)
podcast.export("podcast_output.wav", format="wav")
```

This will create a podcast using the given *timeline* and save it as a WAV file named *podcast_output.wav*.
##Customization
You can customize your podcast by modifying the *timeline* list. Each element in the list represents a segment of the podcast. You can add more segments with different themes, TTS providers, and audio layers.

For example, if you want to add an interview segment, you can include it like this:
```python
{
    "audio_layers": [
        {
            "audio": {
                "content": "Interview text...",
                "theme": Interview,
                "tts_provider": GCP
            }, 
            "is_main": True, 
        }
    ],
    "crossfade": 2400, 
}

```

You can also add sound effects or background music by adding additional audio layers:

```python
{
    "audio_layers": [
        {
            "audio": 'sounds/background_music.wav',
            "is_main": False,
            "volume": 0.3,
        },
        {
            "audio": {
                "content": "Text content...",
                "theme": Conclusion,
                "tts_provider": ElevenLabs
            }, 
            "is_main": True, 
        }
    ],
    "crossfade": 2400, 
}
```
This will add background music with a volume of 0.3 to the conclusion segment.

Remember to adjust the *crossfade* value for smoother transitions between segments.






