-
Notifications
You must be signed in to change notification settings - Fork 57
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
transfer pcm to opus #15
Comments
There is a difference between an opus stream (which is an ogg/opus stream) and raw opus data. .opus files are really .ogg files with opus data, which this package doesn't provide a way to write. It does have a reader for it (Stream type), but no writer yet (never bothered to because I haven't needed it so far, but feel free to submit a PR). |
Thank you, I got it. |
hraban
added a commit
that referenced
this issue
Oct 30, 2021
hraban
added a commit
that referenced
this issue
Oct 30, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The pcm data I got is "[]byte" format, so how can I transfer it to "int16", and then encode to opus?
I have tried the code as below, but the output file is not opus file, and can't play.
func writeUSBDataToSamples(usbData []byte) []wav.Sample {
samples := make([]wav.Sample, 0)
for i := 0; i < len(usbData); i += 2 {
sample := wav.Sample{}
sample.Values[0] = int(usbData[i])
sample.Values[0] = int(usbData[i+1])
samples = append(samples, sample)
}
return samples
}
The text was updated successfully, but these errors were encountered: