-
Notifications
You must be signed in to change notification settings - Fork 1
added conditional import and buffer widget #2
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
base: main
Are you sure you want to change the base?
Conversation
|
You are right! Almost I forgot that the plugin only uses floats 32 format for the audio output. So in whatever format you set the
I think yes for the Ogg and Wav uncompressed, I have to look closer for the others. |
Okay, I see so we should divide the results by 2? Regarding the codecs, Ogg isn't supported on iOS/Safari natively so the best second option for speed would be AAC |
In this case yes.
its support will be coded inside the flutter_soloud plugin, doesn't matter if it isn't supported by the OS. |
|
Hey @callmephil, I have added Opus support. I have added Xiph Ogg and Opus libraries for this. I tested on Linux and Android. I couldn't test on MacOS because I use KVM which doesn't support Metal, but it compiles and should work. Same for iOS, but I cannot compile because the simulator doesn't start!! :) Anyway, the support for Opus/Ogg is in the I have also updated this PR to work with Opus. |
|
You are awesome man! I tried it for iOS, but it doesn't find the library. I'll try to debug that and let you know. Could not build the precompiled application for the device.
Error (Xcode): Undefined symbol: _ogg_page_serialno
Error (Xcode): Undefined symbol: _ogg_stream_clear
Error (Xcode): Undefined symbol: _ogg_stream_init
Error (Xcode): Undefined symbol: _ogg_stream_packetout
Error (Xcode): Undefined symbol: _ogg_stream_pagein
Error (Xcode): Undefined symbol: _ogg_sync_buffer
Error (Xcode): Undefined symbol: _ogg_sync_clear
Error (Xcode): Undefined symbol: _ogg_sync_init
Error (Xcode): Undefined symbol: _ogg_sync_pageout
Error (Xcode): Undefined symbol: _ogg_sync_wrote
Error (Xcode): Undefined symbol: _opus_decode_float
Error (Xcode): Undefined symbol: _opus_decoder_create
Error (Xcode): Undefined symbol: _opus_decoder_destroy
Error (Xcode): Undefined symbol: _opus_strerror
Error launching application on Philippe’s iPhone.btw I think the simulator didn't start because it was missing the iOS config. |
|
On Android, it's working great I also noticed that we don't need to create bigger chunks so we can return the stream as is. |
yes, that's ok for Opus, but for PCM a buffer is still needed
what is "iOS config"? (sorry I am not much familiar with Apple world) Regard the error, in the |
|
So I couldn't get it to work on iOS, I've cloned your branch and re-built the pods on my Mac using sudo on build_iOS_OSX.sh I've also tried importing the compiled output directly in Xcode but it didn't work either. If you have some time next week maybe we can have a pair session and see if we can get somewhere or perhaps I can provide you with access to a Mac in remote so you can play around whenever you feel like. FYI for iOS config, it's the iOS folder generated by Flutter when you create a project on Mac similar to the Android and Linux folders. |
|
Sorry for the late reply, but you inspired me to try Hackintosh again. It took me days, but I finally did it! |
Thanks to you for your support and contributions! Let me know If I can help with anything :) |
|
Hey Phil, good news. I have modified the script to compile the libs. Now instead of making a "fat lib" for both device and simulator, it splits them and links according. I tried on iOS and MacOS and now I can tell that I tested :) Please let me know of any problems! |
|
@alnitak I made a PR for the iOS config and I'll add an extension to be able to switch between custom chunking for pcm. If you want to pull from this branch, so we can stay on the same page. btw it works wonderfully, I need to do some benchmarks, add a cancelation mechanism and test is conditions where the internet is poor. |
…ded an extension to increase chunks if wanted, added cancel token, refactor file and cleanup
|
-- Update --
|
|
Great job! If I understand well, you can now close the other PR without merging and we will continue here? Ok, I am now aligned and I tried successfully on Linux. FYI I already started coding the opus support for the web, but since it is a bad beast, maybe it will take a while :) Since I use |
So far, for the audio player it seems stable! I'll do some benchmarks as soon as possible and start reviewing your Soloud branch for Opus. Perhaps I might be able to help. Regarding the buffer bar I'm not sure what's not working but It seems that the data sounds off. I'll investigate that as well. btw I've noticed OpenAI is counting the whole string despite requesting a stream. I'm trying to monitor the pricing and see if we can optimize the request somewhere... |
|
Hey @callmephil, I've merged your Finally I got opus working also on the Web! The only thing is that I hear clicks when fast adding data at maybe 10 MB/s. Don't know well why. Can you confirm this? I didn't try with this project to save OpenAI counting but it should work fine. Regarding Let me know! |
|
@alnitak I've just tested the branch and it seems to work great for Opus files. PCM broke on my end, probably because of the changes I've made to the chunking mechanism, I'll look into it. Make sure you disable the usePCM at line 41
I'll keep trying different scenarios and let you know if there's anything wrong. |
|
I didn't notice problems using PCM, anyway I have added a buffering natively (hopefully correctly :) ). So I think there is no more need to use the chunking extension. |


I have added a conditional import to make working with the web and other platforms easy.
Added also a buffer widget that lets you see the amount of memory and the total time while receiving the data.
I tried with both Chrome and Linux and I do not have problems with the huge string. Looking at the buffer, the audio is about 20.7 MB.
I see you are using fvm with Flutter v3.24. Maybe it is worth trying to upgrade it? I do not have any other clue regarding that at your end it doesn't complete all the audio! I don't think the flutter_soloud
BufferStreamhas problems handling so much data, I have tested with a lot more and faster streams (locally).Let me know your findings!