topcast


Nametopcast JSON
Version 0.1.8 PyPI version JSON
download
home_pagehttps://github.com/gormlabenz/topcast
SummaryA Python package for Topcast
upload_time2024-10-07 17:47:20
maintainerNone
docs_urlNone
authorGorm Labenz
requires_python>=3.7
licenseMIT
keywords topcast tts text-to-speech gcp google openai elevenlabs
VCS
bugtrack_url
requirements annotated-types anyio build cachetools certifi charset-normalizer click distro elevenlabs google-api-core google-auth google-cloud-speech google-cloud-texttospeech googleapis-common-protos grpcio grpcio-status gTTS h11 httpcore httpx idna jiter openai packaging pip-tools proto-plus protobuf pyasn1 pyasn1_modules pydantic pydantic_core pydub pyproject_hooks requests rsa sniffio tqdm typing_extensions urllib3 websockets
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Topcast: The Open-Source Alternative to Google NotebookLM Audio Overview

Topcast is an open-source Python package that transforms your text into engaging podcast-like audio, much like Google NotebookLM's new "Audio Overview" feature. While Google NotebookLM turns documents and slides into conversations, Topcast gives you the freedom to create podcasts from any text using Text-to-Speech (TTS) and language models, adding layers of sound, structure, and effects to create a comprehensive audio experience.

https://github.com/user-attachments/assets/88f8d774-7f4d-4f39-b646-1238d689d3c6

## What is Topcast?

With Topcast, you can provide a text, and the package will generate a dynamic audio output that includes introductions, interviews, conclusions, and more. It supports multiple TTS providers and AI-powered language models like ChatGPT to make your podcast rich and diverse. The key difference? Topcast is fully open-source, and you have complete control over the customization of your audio content.

### Key Features

- **Customizable Audio Layers**: Combine TTS, sound effects, and more to create rich audio experiences.
- **ChatGPT Themes**: Easily transform text into interview-style conversations, summaries, introductions, or conclusions.
- **Multiple TTS Providers**: Choose from Google Cloud, Elevenlabs, or Google Translate TTS, allowing flexibility in voice quality and pricing.
- **Open-Source and Transparent**: Unlike commercial solutions, you can modify and extend Topcast as per your needs. Your data is your own, and nothing is used without your explicit consent.

## Example Implementation

```python
from topcast import Topcaster, set_openai_api_key
from topcast.chatgpt_themes import Introduction

set_openai_api_key("XXX-XXX-XXX-XXX-XXX")

topcast = Topcaster()

topcast.add_chapter(audio_layers=[{ "audio" : "sounds/jingle.wav" }])
topcast.add_chapter(
    audio_layers=[
        {
            "audio": {
                "content": "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.",
                "theme": Introduction,
            },
        },
    ],
    crossfade=2400,
)

topcast.generate()
topcast.export("podcast.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 import (
    set_elevenlabs_api_key,
    set_google_credentials,
    set_openai_api_key,
    Topcaster,
)

from topcast.tts_providers import GCP
from topcast.chatgpt_themes import Summary

set_elevenlabs_api_key("XXX-XXX-XXX") # if you want to use elvenlabs for tts
set_google_credentials("gcp-keyfile.json") # if you want google cloud platform for tts
set_openai_api_key("XXX-XXX-XXX") # if you want to use a ChatGPT theme
```

2. Create a Topcaster object and add chapters with the desired podcast structure:

```python
topcast = Topcaster()

topcast.add_chapter(
    audio_layers=[
        {
            "audio": "sounds/jingle.wav", # use a audio file
            "sets_length": True,
        }
    ]
)
topcast.add_chapter(
    audio_layers=[
        {
            "audio": {
                "content": "Portugal...",
                "tts_provider": GCP, # use google cloud platform for tts
                "theme": Summary, # generate a summary of the text using ChatGPT
            },
            "sets_length": True, # this audio_layer sets the length of the chapter, only one audio_layer can set the length per chapter
            "fade_in": 1200, # fade in 1200 ms
            "fade_out": 1200, # fade out 1200 ms
        },
        {"audio": "sounds/background.mp3", "sets_length": False, "volume": 0.5}, # overlay audio
    ],
    crossfade=2400, # crossfade last chapter
)

```

3. Generate and export the podcast:

```python
topcast.generate()
topcast.export("podcast.wav", format="wav")
```

This will create a podcast using the given chapters and save it as a WAV file named podcast_output.wav.

## ChatGPT Themes

ChatGPT Themes allow you to transform your text into various structures by leveraging ChatGPT, a large language model. With the available themes, you can transform your text into an interview, introduction, summary, or conclusion. You can also choose to leave the text as it is by using the NoneTheme, which is the default theme.

The available ChatGPT Themes are:

- Interview
- Introduction
- Summary
- Conclusion
- NoneTheme (default)

### Usage

To use a specific ChatGPT theme, first import the desired theme:

```python
from topcast.chatgpt_themes import Interview, Introduction, Summary, Conclusion
```

Then, set your OpenAI API key using the set_openai_api_key function:

```python
from topcast import set_openai_api_key

set_openai_api_key("your-openai-api-key")

```

Finally, set the `theme` property in the audio layer of the desired chapter:

```python
{
    "audio": {
        "content": "Text content...",
        "theme": Introduction,  # Replace with the desired theme
    },
}

```

To keep the original text without any transformation, set NoneTheme or don't set `theme` at all

```python
from topcast.chatgpt_themes import NoneTheme

{
    "audio": {
        "content": "Text content...",
        "theme": NoneTheme,  # Keeps the text as it is
    },
}
```

## TTS Providers

Topcast allows you to use various Text-to-Speech (TTS) providers to convert your text into speech. The currently implemented TTS providers are:

- GCP (Google Cloud Platform) - Requires a Google Cloud Platform account
- Elevenlabs - Requires an Elevenlabs account
- GTTS (Google Translate) - No account required (default)

### Comparison

- **Elevenlabs**: Offers the best voices but is expensive and has API limits.
- **GCP (Google Cloud Platform)**: Relatively cheap but requires a Google Cloud Platform account with the Text-to-Speech API enabled.
- **GTTS (Google Translate)**: Free and does not require an account, but the voice quality is not as good as the other options.

### Usage

First, import the desired TTS provider:

```python
from topcast.tts_providers import GCP, Elevenlabs, GTTS

```

Next, set the API key or credentials for the provider, if required:

```python
from topcast import set_elevenlabs_api_key, set_google_credentials

set_elevenlabs_api_key("your-elevenlabs-api-key")
set_google_credentials("path-to-gcp-keyfile.json")
```

Finally, specify the tts_provider property in the audio layer of the desired chapter:

```python
{
    "audio": {
        "content": "Text content...",
        "tts_provider": GCP,  # Replace with the desired TTS provider
    },
}

```

For example, to create a chapter using the GCP TTS provider:

```python
topcast.add_chapter(
    audio_layers=[
        {
            "audio": {
                "content": "Text content...",
                "tts_provider": GCP,
                "theme": Summary,
            },
            "sets_length": True,
            "fade_in": 1200,
            "fade_out": 1200,
        },
    ],
    crossfade=2400,
)

```

To use the default GTTS provider, you can simply omit the tts_provider property:

```python
{
    "audio": {
        "content": "Text content...",
    },
}
```

## Why Topcast?

If you're looking for a free, open-source alternative to tools like Google NotebookLM, Topcast gives you the freedom to create personalized audio content without platform restrictions. Whether it's for study, entertainment, or work, Topcast puts the power of AI and audio creation in your hands.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/gormlabenz/topcast",
    "name": "topcast",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": null,
    "keywords": "topcast tts text-to-speech gcp google openai elevenlabs",
    "author": "Gorm Labenz",
    "author_email": "gorm@labenz.io",
    "download_url": "https://files.pythonhosted.org/packages/5d/57/e7f4b24e5b0ea0cc2f3af0eb03887ddf0135a901b63720fa106da9410122/topcast-0.1.8.tar.gz",
    "platform": null,
    "description": "# Topcast: The Open-Source Alternative to Google NotebookLM Audio Overview\n\nTopcast is an open-source Python package that transforms your text into engaging podcast-like audio, much like Google NotebookLM's new \"Audio Overview\" feature. While Google NotebookLM turns documents and slides into conversations, Topcast gives you the freedom to create podcasts from any text using Text-to-Speech (TTS) and language models, adding layers of sound, structure, and effects to create a comprehensive audio experience.\n\nhttps://github.com/user-attachments/assets/88f8d774-7f4d-4f39-b646-1238d689d3c6\n\n## What is Topcast?\n\nWith Topcast, you can provide a text, and the package will generate a dynamic audio output that includes introductions, interviews, conclusions, and more. It supports multiple TTS providers and AI-powered language models like ChatGPT to make your podcast rich and diverse. The key difference? Topcast is fully open-source, and you have complete control over the customization of your audio content.\n\n### Key Features\n\n- **Customizable Audio Layers**: Combine TTS, sound effects, and more to create rich audio experiences.\n- **ChatGPT Themes**: Easily transform text into interview-style conversations, summaries, introductions, or conclusions.\n- **Multiple TTS Providers**: Choose from Google Cloud, Elevenlabs, or Google Translate TTS, allowing flexibility in voice quality and pricing.\n- **Open-Source and Transparent**: Unlike commercial solutions, you can modify and extend Topcast as per your needs. Your data is your own, and nothing is used without your explicit consent.\n\n## Example Implementation\n\n```python\nfrom topcast import Topcaster, set_openai_api_key\nfrom topcast.chatgpt_themes import Introduction\n\nset_openai_api_key(\"XXX-XXX-XXX-XXX-XXX\")\n\ntopcast = Topcaster()\n\ntopcast.add_chapter(audio_layers=[{ \"audio\" : \"sounds/jingle.wav\" }])\ntopcast.add_chapter(\n    audio_layers=[\n        {\n            \"audio\": {\n                \"content\": \"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.\",\n                \"theme\": Introduction,\n            },\n        },\n    ],\n    crossfade=2400,\n)\n\ntopcast.generate()\ntopcast.export(\"podcast.wav\", format=\"wav\")\n\n\n```\n\n## Installation\n\nInstall the package using pip:\n\n```bash\npip install topcast\n```\n\n## Usage\n\n1. Import the necessary modules and set the API keys:\n\n```python\nfrom topcast import (\n    set_elevenlabs_api_key,\n    set_google_credentials,\n    set_openai_api_key,\n    Topcaster,\n)\n\nfrom topcast.tts_providers import GCP\nfrom topcast.chatgpt_themes import Summary\n\nset_elevenlabs_api_key(\"XXX-XXX-XXX\") # if you want to use elvenlabs for tts\nset_google_credentials(\"gcp-keyfile.json\") # if you want google cloud platform for tts\nset_openai_api_key(\"XXX-XXX-XXX\") # if you want to use a ChatGPT theme\n```\n\n2. Create a Topcaster object and add chapters with the desired podcast structure:\n\n```python\ntopcast = Topcaster()\n\ntopcast.add_chapter(\n    audio_layers=[\n        {\n            \"audio\": \"sounds/jingle.wav\", # use a audio file\n            \"sets_length\": True,\n        }\n    ]\n)\ntopcast.add_chapter(\n    audio_layers=[\n        {\n            \"audio\": {\n                \"content\": \"Portugal...\",\n                \"tts_provider\": GCP, # use google cloud platform for tts\n                \"theme\": Summary, # generate a summary of the text using ChatGPT\n            },\n            \"sets_length\": True, # this audio_layer sets the length of the chapter, only one audio_layer can set the length per chapter\n            \"fade_in\": 1200, # fade in 1200 ms\n            \"fade_out\": 1200, # fade out 1200 ms\n        },\n        {\"audio\": \"sounds/background.mp3\", \"sets_length\": False, \"volume\": 0.5}, # overlay audio\n    ],\n    crossfade=2400, # crossfade last chapter\n)\n\n```\n\n3. Generate and export the podcast:\n\n```python\ntopcast.generate()\ntopcast.export(\"podcast.wav\", format=\"wav\")\n```\n\nThis will create a podcast using the given chapters and save it as a WAV file named podcast_output.wav.\n\n## ChatGPT Themes\n\nChatGPT Themes allow you to transform your text into various structures by leveraging ChatGPT, a large language model. With the available themes, you can transform your text into an interview, introduction, summary, or conclusion. You can also choose to leave the text as it is by using the NoneTheme, which is the default theme.\n\nThe available ChatGPT Themes are:\n\n- Interview\n- Introduction\n- Summary\n- Conclusion\n- NoneTheme (default)\n\n### Usage\n\nTo use a specific ChatGPT theme, first import the desired theme:\n\n```python\nfrom topcast.chatgpt_themes import Interview, Introduction, Summary, Conclusion\n```\n\nThen, set your OpenAI API key using the set_openai_api_key function:\n\n```python\nfrom topcast import set_openai_api_key\n\nset_openai_api_key(\"your-openai-api-key\")\n\n```\n\nFinally, set the `theme` property in the audio layer of the desired chapter:\n\n```python\n{\n    \"audio\": {\n        \"content\": \"Text content...\",\n        \"theme\": Introduction,  # Replace with the desired theme\n    },\n}\n\n```\n\nTo keep the original text without any transformation, set NoneTheme or don't set `theme` at all\n\n```python\nfrom topcast.chatgpt_themes import NoneTheme\n\n{\n    \"audio\": {\n        \"content\": \"Text content...\",\n        \"theme\": NoneTheme,  # Keeps the text as it is\n    },\n}\n```\n\n## TTS Providers\n\nTopcast allows you to use various Text-to-Speech (TTS) providers to convert your text into speech. The currently implemented TTS providers are:\n\n- GCP (Google Cloud Platform) - Requires a Google Cloud Platform account\n- Elevenlabs - Requires an Elevenlabs account\n- GTTS (Google Translate) - No account required (default)\n\n### Comparison\n\n- **Elevenlabs**: Offers the best voices but is expensive and has API limits.\n- **GCP (Google Cloud Platform)**: Relatively cheap but requires a Google Cloud Platform account with the Text-to-Speech API enabled.\n- **GTTS (Google Translate)**: Free and does not require an account, but the voice quality is not as good as the other options.\n\n### Usage\n\nFirst, import the desired TTS provider:\n\n```python\nfrom topcast.tts_providers import GCP, Elevenlabs, GTTS\n\n```\n\nNext, set the API key or credentials for the provider, if required:\n\n```python\nfrom topcast import set_elevenlabs_api_key, set_google_credentials\n\nset_elevenlabs_api_key(\"your-elevenlabs-api-key\")\nset_google_credentials(\"path-to-gcp-keyfile.json\")\n```\n\nFinally, specify the tts_provider property in the audio layer of the desired chapter:\n\n```python\n{\n    \"audio\": {\n        \"content\": \"Text content...\",\n        \"tts_provider\": GCP,  # Replace with the desired TTS provider\n    },\n}\n\n```\n\nFor example, to create a chapter using the GCP TTS provider:\n\n```python\ntopcast.add_chapter(\n    audio_layers=[\n        {\n            \"audio\": {\n                \"content\": \"Text content...\",\n                \"tts_provider\": GCP,\n                \"theme\": Summary,\n            },\n            \"sets_length\": True,\n            \"fade_in\": 1200,\n            \"fade_out\": 1200,\n        },\n    ],\n    crossfade=2400,\n)\n\n```\n\nTo use the default GTTS provider, you can simply omit the tts_provider property:\n\n```python\n{\n    \"audio\": {\n        \"content\": \"Text content...\",\n    },\n}\n```\n\n## Why Topcast?\n\nIf you're looking for a free, open-source alternative to tools like Google NotebookLM, Topcast gives you the freedom to create personalized audio content without platform restrictions. Whether it's for study, entertainment, or work, Topcast puts the power of AI and audio creation in your hands.\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A Python package for Topcast",
    "version": "0.1.8",
    "project_urls": {
        "Homepage": "https://github.com/gormlabenz/topcast"
    },
    "split_keywords": [
        "topcast",
        "tts",
        "text-to-speech",
        "gcp",
        "google",
        "openai",
        "elevenlabs"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "77dcfc780384755a979a8cceb14d212401c5b5c831265d0048274b2295ac948d",
                "md5": "3cef03e7ed8283c369f45667fcd01659",
                "sha256": "4f701136c8b6288ed06b40c6d35f9717a20de08451a8ba7a75e0c3d0d7e82644"
            },
            "downloads": -1,
            "filename": "topcast-0.1.8-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "3cef03e7ed8283c369f45667fcd01659",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 20738,
            "upload_time": "2024-10-07T17:47:18",
            "upload_time_iso_8601": "2024-10-07T17:47:18.971294Z",
            "url": "https://files.pythonhosted.org/packages/77/dc/fc780384755a979a8cceb14d212401c5b5c831265d0048274b2295ac948d/topcast-0.1.8-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "5d57e7f4b24e5b0ea0cc2f3af0eb03887ddf0135a901b63720fa106da9410122",
                "md5": "fd5b3891c6b72336e5bb1f64a9bdb368",
                "sha256": "61e5f018244814444964387bb78ef3b6678510dda6d7b99204d257f57780334e"
            },
            "downloads": -1,
            "filename": "topcast-0.1.8.tar.gz",
            "has_sig": false,
            "md5_digest": "fd5b3891c6b72336e5bb1f64a9bdb368",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 16917,
            "upload_time": "2024-10-07T17:47:20",
            "upload_time_iso_8601": "2024-10-07T17:47:20.439514Z",
            "url": "https://files.pythonhosted.org/packages/5d/57/e7f4b24e5b0ea0cc2f3af0eb03887ddf0135a901b63720fa106da9410122/topcast-0.1.8.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-10-07 17:47:20",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "gormlabenz",
    "github_project": "topcast",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "annotated-types",
            "specs": [
                [
                    "==",
                    "0.7.0"
                ]
            ]
        },
        {
            "name": "anyio",
            "specs": [
                [
                    "==",
                    "4.6.0"
                ]
            ]
        },
        {
            "name": "build",
            "specs": [
                [
                    "==",
                    "1.2.2.post1"
                ]
            ]
        },
        {
            "name": "cachetools",
            "specs": [
                [
                    "==",
                    "5.5.0"
                ]
            ]
        },
        {
            "name": "certifi",
            "specs": [
                [
                    "==",
                    "2024.8.30"
                ]
            ]
        },
        {
            "name": "charset-normalizer",
            "specs": [
                [
                    "==",
                    "3.3.2"
                ]
            ]
        },
        {
            "name": "click",
            "specs": [
                [
                    "==",
                    "8.1.7"
                ]
            ]
        },
        {
            "name": "distro",
            "specs": [
                [
                    "==",
                    "1.9.0"
                ]
            ]
        },
        {
            "name": "elevenlabs",
            "specs": [
                [
                    "==",
                    "1.9.0"
                ]
            ]
        },
        {
            "name": "google-api-core",
            "specs": [
                [
                    "==",
                    "2.20.0"
                ]
            ]
        },
        {
            "name": "google-auth",
            "specs": [
                [
                    "==",
                    "2.35.0"
                ]
            ]
        },
        {
            "name": "google-cloud-speech",
            "specs": [
                [
                    "==",
                    "2.27.0"
                ]
            ]
        },
        {
            "name": "google-cloud-texttospeech",
            "specs": [
                [
                    "==",
                    "2.17.2"
                ]
            ]
        },
        {
            "name": "googleapis-common-protos",
            "specs": [
                [
                    "==",
                    "1.65.0"
                ]
            ]
        },
        {
            "name": "grpcio",
            "specs": [
                [
                    "==",
                    "1.66.2"
                ]
            ]
        },
        {
            "name": "grpcio-status",
            "specs": [
                [
                    "==",
                    "1.66.2"
                ]
            ]
        },
        {
            "name": "gTTS",
            "specs": [
                [
                    "==",
                    "2.5.3"
                ]
            ]
        },
        {
            "name": "h11",
            "specs": [
                [
                    "==",
                    "0.14.0"
                ]
            ]
        },
        {
            "name": "httpcore",
            "specs": [
                [
                    "==",
                    "1.0.6"
                ]
            ]
        },
        {
            "name": "httpx",
            "specs": [
                [
                    "==",
                    "0.27.2"
                ]
            ]
        },
        {
            "name": "idna",
            "specs": [
                [
                    "==",
                    "3.10"
                ]
            ]
        },
        {
            "name": "jiter",
            "specs": [
                [
                    "==",
                    "0.5.0"
                ]
            ]
        },
        {
            "name": "openai",
            "specs": [
                [
                    "==",
                    "1.51.0"
                ]
            ]
        },
        {
            "name": "packaging",
            "specs": [
                [
                    "==",
                    "24.1"
                ]
            ]
        },
        {
            "name": "pip-tools",
            "specs": [
                [
                    "==",
                    "7.4.1"
                ]
            ]
        },
        {
            "name": "proto-plus",
            "specs": [
                [
                    "==",
                    "1.24.0"
                ]
            ]
        },
        {
            "name": "protobuf",
            "specs": [
                [
                    "==",
                    "5.28.2"
                ]
            ]
        },
        {
            "name": "pyasn1",
            "specs": [
                [
                    "==",
                    "0.6.1"
                ]
            ]
        },
        {
            "name": "pyasn1_modules",
            "specs": [
                [
                    "==",
                    "0.4.1"
                ]
            ]
        },
        {
            "name": "pydantic",
            "specs": [
                [
                    "==",
                    "2.9.2"
                ]
            ]
        },
        {
            "name": "pydantic_core",
            "specs": [
                [
                    "==",
                    "2.23.4"
                ]
            ]
        },
        {
            "name": "pydub",
            "specs": [
                [
                    "==",
                    "0.25.1"
                ]
            ]
        },
        {
            "name": "pyproject_hooks",
            "specs": [
                [
                    "==",
                    "1.2.0"
                ]
            ]
        },
        {
            "name": "requests",
            "specs": [
                [
                    "==",
                    "2.32.3"
                ]
            ]
        },
        {
            "name": "rsa",
            "specs": [
                [
                    "==",
                    "4.9"
                ]
            ]
        },
        {
            "name": "sniffio",
            "specs": [
                [
                    "==",
                    "1.3.1"
                ]
            ]
        },
        {
            "name": "tqdm",
            "specs": [
                [
                    "==",
                    "4.66.5"
                ]
            ]
        },
        {
            "name": "typing_extensions",
            "specs": [
                [
                    "==",
                    "4.12.2"
                ]
            ]
        },
        {
            "name": "urllib3",
            "specs": [
                [
                    "==",
                    "2.2.3"
                ]
            ]
        },
        {
            "name": "websockets",
            "specs": [
                [
                    "==",
                    "13.1"
                ]
            ]
        }
    ],
    "lcname": "topcast"
}
        
Elapsed time: 2.79927s