Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] Support for Customizable Audio Formats #3

Closed
7enChan opened this issue Sep 13, 2023 · 4 comments
Closed

[Feature Request] Support for Customizable Audio Formats #3

7enChan opened this issue Sep 13, 2023 · 4 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@7enChan
Copy link

7enChan commented Sep 13, 2023

Great project, thank you.
Here’s a suggestion: Currently, the default output audio format is an mp3 with a bitrate of 48kbps, which has a relatively poor sound quality. It would be great if you could add support for other audio formats, allowing users to customize it using the parameter “X-Microsoft-OutputFormat”. Thank you once again.

@p0n1
Copy link
Owner

p0n1 commented Sep 14, 2023

You're welcome. I haven’t noticed that the audio quality of the audiobooks I converted is poor. I am very interested in trying other options and comparing their differences. I will implement this optional feature later. Thanks for the suggestion.

@p0n1
Copy link
Owner

p0n1 commented Sep 18, 2023

I just tried the ogg-24khz-16bit-mono-opus and ogg-48khz-16bit-mono-opus setting. I can hardly tell the difference to the default audio-24khz-48kbitrate-mono-mp3 for the audiobook. Do you have any preference on the settings from the list? I'd love to hear and learn your experience.

And I found we have to deal with filename extensions when enabling custom audio formats or just let user pass in.

output_file = os.path.join(output_folder, f"{idx:04d}_{title}.mp3")

And we have to deal with tags for other audio formats.

# Add ID3 tags to the generated MP3 file
audio = MP3(output_file)
audio["TIT2"] = TIT2(encoding=3, text=title)
audio["TPE1"] = TPE1(encoding=3, text=author)
audio["TALB"] = TALB(encoding=3, text=book_title)
audio["TRCK"] = TRCK(encoding=3, text=str(idx))
audio.save()

@7enChan
Copy link
Author

7enChan commented Sep 18, 2023

I just tried the ogg-24khz-16bit-mono-opus and ogg-48khz-16bit-mono-opus setting. I can hardly tell the difference to the default audio-24khz-48kbitrate-mono-mp3 for the audiobook. Do you have any preference on the settings from the list? I'd love to hear and learn your experience.

And I found we have to deal with filename extensions when enabling custom audio formats or just let user pass in.

output_file = os.path.join(output_folder, f"{idx:04d}_{title}.mp3")

And we have to deal with tags for other audio formats.

# Add ID3 tags to the generated MP3 file
audio = MP3(output_file)
audio["TIT2"] = TIT2(encoding=3, text=title)
audio["TPE1"] = TPE1(encoding=3, text=author)
audio["TALB"] = TALB(encoding=3, text=book_title)
audio["TRCK"] = TRCK(encoding=3, text=str(idx))
audio.save()

Thank you for your reply. I previously used a TTS app that also utilized Azure TTS services, and I often use the audio-24khz-96kbitrate-mono-mp3 format. Honestly, I don't hear a significant difference compared to the current default of 48kbitrate. However, since I have a limited collection of audiobooks and ample disk space, and I also own a HiFi player 😄, I'd prefer to use a higher bitrate format. Nonetheless, if this would compromise the overall user experience, I'm okay with sticking to the current default format. It's already fantastic as it is, and I appreciate your efforts 🙏.


@p0n1
Copy link
Owner

p0n1 commented Sep 20, 2023

Hi @7enChan. I just released a new version and now you can choose more audio formats now.

Check the usage section here for details https://github.com/p0n1/epub_to_audiobook/tree/main#usage. Only MP3 format supported now because I don't want to deal with other formats currently.

I think I can tell the difference on audio quality now if I just choose the audio-48khz-192kbitrate-mono-mp3 config which is the highest and best. But the file size is large though. LOL. 😊

@p0n1 p0n1 added enhancement New feature or request good first issue Good for newcomers labels Sep 25, 2023
@p0n1 p0n1 closed this as completed Sep 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants