Coder Social home page Coder Social logo

Comments (9)

jeremychone avatar jeremychone commented on June 16, 2024 1

Just FYI, this isn't about async-openai lib but more about what is returned from OpenAI API.

I'm doing some further investigation, and it's quite strange.

It appears that the .flac file returned by the OpenAI API lacks certain details like duration, which causes playback issues in QuickTime and DaVinci Resolve.

However, Chrome seems able to play it.

Also, if I take a .aac file and convert it to .flac using software like Isotope RX10, then it plays fine in QuickTime and DaVinci Resolve.

The openai flac file is also much smaller compared to a .flac file converted from .aac (89kb vs 163kb from the exported .flac file).

Anyway, just noting this down for the record. No action needed.

from async-openai.

jeremychone avatar jeremychone commented on June 16, 2024 1

Okay, apologies, this will be my last comment on this topic. (In case someone else encounters the same issue)

The workaround is to use ffmpeg to re-encode.

ffmpeg -i test-audio-from-openai.flac -c:a flac test-audio-fixed.flac

Since both input and output are lossless, and we do not change any parameters, there should be no loss in quality.

from async-openai.

64bit avatar 64bit commented on June 16, 2024 1

πŸ˜„ it's all good, thank you for making note for next person stumbling on similar problem.

Video sounds exciting, looking forward to it!

from async-openai.

64bit avatar 64bit commented on June 16, 2024 1

In addition, if you'd like to, we can add link to video on README, it will be a good resource for fellow Rustaceans.

from async-openai.

jeremychone avatar jeremychone commented on June 16, 2024 1

That will be cool. I am busy right now, but I definitely want to do this sometime.

from async-openai.

64bit avatar 64bit commented on June 16, 2024

Thank you for detailed description. I ran it to generate flac and it works for me.

I ran this on Ubuntu, what OS are you running? Does it play other .flac files?

I'm attaching the audio file that I got from output , does this play for you?
issue-161-flac.zip

from async-openai.

jeremychone avatar jeremychone commented on June 16, 2024

Interesting, I cannot play the file you sent me. I am on Mac M3.

But the weird thing, is when I do the same API call with TypeScript, i can play the flac file fine.

from async-openai.

64bit avatar 64bit commented on June 16, 2024

I tried this on Mac M1. It appears that by default .flac is opened in QuickTime player but it cannot play it.

When I open same .flac file in VLC player it does work. Not sure what to make of it though.

from async-openai.

jeremychone avatar jeremychone commented on June 16, 2024

Oh, I'm so sorry, I think it is my mistake.

In TypeScript, while I thought I had the types correct, it turned out to be one of those corner cases. The issue was with the output format; it was saved with a .flac extension, but the default was actually .mp3 as the property format was not a property, as it was response_format. So, I mistakenly thought Quicktime and Davinci Resolve supported FLAC, but they were just playing the mp3 (under the .flac extension).

So, it's a Mac & Resolve issue.

My apologies for this confusion. I think we can close this ticket.

I will conduct further investigations, but at this point, I don't believe it's an issue with async-openai.

Thank you. async-openai has been working very well, and I am planning to make a video about it one of these days.

from async-openai.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.