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

你这个能实现和ChatGpt官方APP实时对话的效果吗 #201

Open
hechuanhua opened this issue Dec 1, 2023 · 1 comment
Open

你这个能实现和ChatGpt官方APP实时对话的效果吗 #201

hechuanhua opened this issue Dec 1, 2023 · 1 comment

Comments

@hechuanhua
Copy link

我大概看了一下文档,直觉是可以支持的,我先说一下大致流程
首先开启长录音,然后根据音量大小判断是否说完,比如3秒钟音量太低就代表一句话说完了,然后实时截取录音流转成mp3格式提交给第三方转成文字,然后把文字发给GPT让他回答,他返回文字结果后转成mp3播放出来
麻烦点
1、对音量的判断,因为长时间录音,需要再他声音变化的时候精准捕获说话时间段,不然生成出来是体积很大的静音mp3
2、精准捕获的时间段咋转成map3格式?能否根据时间戳之类的东西去截取对应的媒体流然后转成mp3
3、长时间录音的内存管理问题

@xiangyuecn
Copy link
Owner

支持,你的流程是正确的

你把录音数据buffers里面的新数据自己缓冲一下,比如缓冲1秒的数据,比较容易检测到是否开始说话,不需要太精确从哪个位置开始说话,然后从这1秒的数据开始 将后续的录音数据全部存起来

最后在检测停止说话,检测到停止后,已缓冲的数据就是语音数据,你直接用Recorder.SampleData+mock方法,直接进行转码就可以得到mp3了

内存管理很容易做的,参考【教程】【音频流】【上传】实时转码并上传-通用版,用unknown格式+清理一下buffers,不会占用内存

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants