-
Notifications
You must be signed in to change notification settings - Fork 273
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
Is there anyway to properly convert the audio array (float*) into UTF 8? #127
Comments
Actually, NSData didn't help with translating it over properly. Only popping sounds. How could I transfer or convert float over properly to be played on another device? |
Hey, unfortunately, all Novocaine does is get data off the microphone and
give it to you as floats — you'd need to depend on a separate library or
build separate code for this functionality.
…On Mon, Mar 27, 2017 at 4:01 PM cdrandin ***@***.***> wrote:
Actually, NSData didn't help with translating it over properly. Only
popping sounds.
How could I transfer or convert float over properly to be played on
another device?
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#127 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAJ4jy1gbdK0tAQruqlLPq_1Ie-deyJLks5rqAtYgaJpZM4MosSt>
.
|
@cdrandin NSData is the answer here, UTF8 is meant for text, so that definitely isn't. Given all the points the conversion could go wrong a small sample or code snippets would go a long way to help anyone point the problem(s). That being said, it sounds like you are trying to put the data in a string then in NSData and then back. This will probably not work as your data is not valid UTF. Either use a NSArchiver or write data directly to the mutableBytes in NSMutableData |
@mitisBlack Thanks for the info. I will try those out and see what I end up getting. This is what I am doing on the iOS side of things.
Now on the other device side, I use Python that gets the data and tries to play it.
EDIT:
Got pretty bad feedback still. So, not sure if this is done correctly. I even try writing the raw PCM values to a file to test it out in Audacity. By importing as raw sound and nothing.
|
@cdrandin I see. I'll take a closer look later, but a quick look over the code tells me you take the wrong size of the incoming data.
try using for size |
@mitisBlack I tried what you recommended. I am unsure if this is correct, at least how I am storing into a mutable array.
All comes back as static feedback. I even was playing with the chunk size and the channels on the Python side to see if that helped. I printed out the hex values of |
I have found this example which does a large part of what is needed and I am able to grab the stream. https://github.com/vlider/Mic-recording-minimal-example/blob/master/MicRec/ViewController.swift. Though it is in Swift. I tried writing the raw PCM values directly to file and still came back awful. So, seems |
Just wondering if it was possible to somehow turn the array of float values into UTF-8.
I am trying some stuff out that would properly send audio data over a network and play it on another device.
Whenever I try to manipulate the data and receive it on the other end I still end up with floating points.
To put it silly, I kind of need to get it to look like this, bytes
Edit:
More specific what I am trying to do is target a machine that wants to play audio through Port Audio.
The text was updated successfully, but these errors were encountered: