How to Generate an AI podcast and Publish to Julep

Get started generating and sharing generative AI podcasts with the AudioStack Python SDK.

If you've ever dreamed of launching your own AI generated podcast and sharing it with the world, you're in the right place. With AudioStack, the process of creating and sharing a podcast has never been easier. Whether you're an aspiring podcaster looking to start your journey or a seasoned pro seeking a streamlined solution, our API empowers you to harness the power of audio and bring your ideas to life. In this Quick Start guide, we'll walk you through the essential steps to get started.

πŸ“˜

Pre-Requisites for this API Recipe

You will need to have set up your development environment and installed AudioStack to complete this tutorial. Follow the steps here to get set up.

Step One - Sign up for a Hosting Account

Firstly, if you'd like to distribute your podcast and don't work with a solution for this already, you can create an account with Julep here.

πŸ—£οΈ

Julep is a podcast hosting platform based in Germany.

In addition to hosting your audio content, they offer monetization and their own embeddable player. It is currently available in Germany :de:, Austria πŸ‡¦πŸ‡Ή, Spain :es: and SwitzerlandπŸ‡¨πŸ‡­, but you can check out their free trial without providing any credit card or address details.

If you want to upload your podcasts somewhere else, or your country isn't listed above, please continue to Step Two.

Step Two - Write your Script

If you don't already have a script in mind, you might want to generate one using a generative text tool such as ChatGPT. Alternatively, you can use our default podcast script (created by asking ChatGPT for an essay on parrots that is conversational, engaging and doesn't have any section headings) by keeping the code example below exactly as is.

Step Three - Produce your Audio

Now you're ready to get going, copy and paste the code below into a new python file and run it. Don't forget to add your API key into line 5. Please note: If you want to add your own script, you can do so by editing the text between lines 9 and 21.

import audiostack
import os

audiostack.api_key = "APIKEY"

script = """

<as:section name="main" soundsegment="main">
Well hello there to all my favourite bird enthusiasts and curious minds! Welcome back to this week's episode of Parrotcast, the podcast devoted to all things Parrot. 
Today, we're going to take a friendly stroll into the vibrant world of our favourite feathered friends. Picture this: dazzling feathers, awe inspiring mimicry, and social lives that rival any drama series. Parrots are the real showstoppers of the avian world, and we're about to dive right in.
First things first, let's talk diversity. Parrots are a lively bunch, with over 400 different species strutting their stuff worldwide. They call every continent home, except Antarctica: I guess even parrots need a break from the icy cold! These feathered friends come in all shapes and sizes. From the tiniest pygmy parrot, fitting right on your thumb, to the colossal Hyacinth Macaw, who could give even the tallest human a run for their money.
But what truly sets parrots apart, and makes them the envy of every fashionista in the bird world, is their colorful plumage. They've got a dazzling wardrobe with all the colors of the rainbow: electric blues, fiery reds, and soft pastels, you name it. Those fabulous feathers serve multiple purposes, from blending into the jungle to turning heads in the dating game.
Now, let's talk brains. Parrots aren't just a bunch of pretty faces; they're brainiacs too! These birds have some serious gray matter. They're like the Einstein of the aviary, acing complex problem-solving tests and even using tools. But what really wows us is their knack for mimicry. You've probably heard of parrots that talk like humans – that's no exaggeration. The African Grey Parrot, for instance, can chat you up with human-like sentences!
But it's not all about imitating sounds; parrots are chatterboxes in their own right. In the wild, they have intricate conversations with their feathered friends, using a mix of calls, body language, and dance moves. It's a bit like a lively social gathering in the jungle.
Now, here comes the serious stuff. Our parrot pals are facing some tough times out in the wild. The destruction of their homes, mainly due to deforestation, is a massive threat. And don't get me started on illegal pet trade: it's like a bad heist movie, with parrots as the unfortunate stars. Climate change and diseases are adding to their worries.
But there's hope! Conservation heroes worldwide are stepping in to protect these colorful creatures. They're saving habitats, cracking down on illegal pet trade, and even setting up matchmaking services for captive parrots. We've got to do our part to support these efforts.
Now, let's talk about us... humans and parrots. Parrots have been our feathered friends for centuries, admired for their beauty and smarts. But it's not all sunshine and rainbows. Some parrots, sadly, don't get the care they deserve in captivity. We've got to be responsible pet parents and give them the love and attention they need.
In many cultures, parrots are more than just birds; they're symbols of wisdom, love, and even messengers from the beyond. These connections remind us how deeply intertwined our lives are with these feathered friends.
So, there you have it: a sneak peek into the dazzling world of parrots. These birds are more than just pretty faces; they're intelligent, social, and sometimes a bit mischievous. But they need our help to survive and thrive. Let's make sure their colorful voices keep echoing through the treetops, reminding us of the magic of the natural world.
</as:section>


"""


names = ["Myriam"]
templates = ["your_take"]


print(f"Creating your script...")
script = audiostack.Content.Script.create(scriptText=script, scriptName="test", projectName="podcast_test")        

for name in names:
    print(f"Generating speech for {name}...")
    speech = audiostack.Speech.TTS.create(
            scriptItem=script,
            voice=name,
            speed=1,
            voiceIntelligence= True,
    )
    for template in templates:
        print(f"Applying mixing and mastering...")
        mix = audiostack.Production.Mix.create(
            speechItem=speech,
            soundTemplate=template,
            masteringPreset="podcast",
        )
        print(mix)
      
        print(f"Preparing for download...")
        mix.download(fileName=f"{name}_{template}")
        print(mix)

You can hear (and see) from the final result that the code is doing a few things different things here: creating your script, generating speech, applying music in the intro section, and mixing and mastering to optimise your audio file for podcasting. This can all be done in one go, so it's a really quick process.

πŸ‘

Congratulations!

You just created your first AI podcast using the AudioStack API.

Optional - Upload your Podcast Directly to Julep

Rather than uploading your podcast content manually, AudioStack has a built in "connector" so you can upload directly to Julep from your code. To do this, go to Julep, log in and follow the simple steps to create a new podcast, then a new episode within that podcast. You'll need to enter some details, such as the title of the podcast, and a display image.

Then you should be able to see an entry for your podcast, including a Podcast ID, which you'll use in your code.

To create your first episode and upload it to Julep all in one go, you can copy and paste the following code - notice you'll need to fill in some details in lines 6, 15, 16 and 85.

🚧

In this code example, your login credentials are entered directly into the code

It's extremely important not to share these, such as in shared code repositories (e.g. Github)

import audiostack
import os
import requests

audiostack.api_base = "https://v2.api.audio"
audiostack.api_key = "APIKEY" ### Fill in!

### Connect to Julep

print(f"Connecting to Julep...")

julepAuthenticationUrl = "https://v2.api.audio/delivery/connectors/authenticate-julep"

julepDetails = {
    "username": "YOUR EMAIL", ### Fill in!
    "password": "YOUR PASSWORD" ### Fill in!
}
headers = {
    "accept": "application/json",
    "content-type": "application/json",
    "x-api-key": audiostack.api_key
}

julepAuthenticationResponse = requests.put(julepAuthenticationUrl, json=julepDetails, headers=headers)
print(julepAuthenticationResponse.text)

### Create your podcast

script = """

<as:section name="main" soundsegment="main">
Well hello there to all my favourite bird enthusiasts and curious minds! Welcome back to this week's episode of Parrotcast, the podcast devoted to all things Parrot. 
Today, we're going to take a friendly stroll into the vibrant world of our favourite feathered friends. Picture this: dazzling feathers, mind-boggling mimicry, and social lives that rival any drama series. Parrots are the real showstoppers of the avian world, and we're about to dive right in.
First things first, let's talk diversity. Parrots are a lively bunch, with over 400 different species strutting their stuff worldwide. They call every continent home, except Antarctica: I guess even parrots need a break from the icy cold! These feathered friends come in all shapes and sizes. From the tiniest pygmy parrot, fitting right on your thumb, to the colossal Hyacinth Macaw, who could give even the tallest human a run for their money.
But what truly sets parrots apart, and makes them the envy of every fashionista in the bird world, is their colorful plumage. They've got a dazzling wardrobe with all the colors of the rainbow: electric blues, fiery reds, and soft pastels, you name it. Those fabulous feathers serve multiple purposes, from blending into the jungle to turning heads in the dating game.
Now, let's talk brains. Parrots aren't just a bunch of pretty faces; they're brainiacs too! These birds have some serious gray matter. They're like the Einstein of the aviary, acing complex problem-solving tests and even using tools. But what really wows us is their knack for mimicry. You've probably heard of parrots that talk like humans – that's no exaggeration. The African Grey Parrot, for instance, can chat you up with human-like sentences!
But it's not all about imitating sounds; parrots are chatterboxes in their own right. In the wild, they have intricate conversations with their feathered friends, using a mix of calls, body language, and dance moves. It's a bit like a lively social gathering in the jungle.
Now, here comes the serious stuff. Our parrot pals are facing some tough times out in the wild. The destruction of their homes, mainly due to deforestation, is a massive threat. And don't get me started on illegal pet trade: it's like a bad heist movie, with parrots as the unfortunate stars. Climate change and diseases are adding to their worries.
But there's hope! Conservation heroes worldwide are stepping in to protect these colorful creatures. They're saving habitats, cracking down on illegal pet trade, and even setting up matchmaking services for captive parrots. We've got to do our part to support these efforts.
Now, let's talk about us... humans and parrots. Parrots have been our feathered friends for centuries, admired for their beauty and smarts. But it's not all sunshine and rainbows. Some parrots, sadly, don't get the care they deserve in captivity. We've got to be responsible pet parents and give them the love and attention they need.
In many cultures, parrots are more than just birds; they're symbols of wisdom, love, and even messengers from the beyond. These connections remind us how deeply intertwined our lives are with these feathered friends.
So, there you have it: a sneak peek into the dazzling world of parrots. These birds are more than just pretty faces; they're intelligent, social, and sometimes a bit mischievous. But they need our help to survive and thrive. Let's make sure their colorful voices keep echoing through the treetops, reminding us of the magic of the natural world.
</as:section>


"""


names = ["Myriam"]
templates = ["your_take"]


print(f"Creating your script...")
script = audiostack.Content.Script.create(scriptText=script, scriptName="test", projectName="podcast_test")        

for name in names:
    print(f"Generating speech for {name}...")
    speech = audiostack.Speech.TTS.create(
            scriptItem=script,
            voice=name,
            speed=1,
            voiceIntelligence= True,
    )
    for template in templates:
        print(f"Applying mixing and mastering...")
        mix = audiostack.Production.Mix.create(
            speechItem=speech,
            soundTemplate=template,
            masteringPreset="podcast",
        )
        print(mix)
        print(mix.productionId)
      
        print(f"Preparing for download...")
        mix.download(fileName=f"{name}_{template}")
        print(mix)

production_id = mix.productionId

### Send your podcast to Julep
print(f"Uploading to Julep...")
julepSubmissionUrl = "https://v2.api.audio/delivery/connectors/julep"

podcastDetails = {
    "podcastId": "PODCAST ID FROM JULEP", ### Fill in!
    "permalink": "new-episode",
    "title": "The Wonderful World of Parrots intro",
    "productionId": production_id,
}

julepSubmissionResponse = requests.post(julepSubmissionUrl, json=podcastDetails, headers=headers)
print(julepSubmissionResponse.text)

πŸ‘

Congratulations!

The completed podcast can now be displayed in Julep or shared online. Check out ours below :point-down:


What’s Next

Find out more about using connectors below: