You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When working on an example to send recorded data via radio like walkie-talkie, one idea is to record AudioFrames of the same size than the packet size for radio.
With the current API is not straightforward at all to work out how to create an AudioFrame of say 64 bytes.
We need to use a sample rate that is easily divisible by the packet size, and a packet size that is a multiple of 32 bytes.
Initial attempts using the default rate (which is not a multiple of 32 bytes either) ended up with floats as the duration, which doesn't work as duration has to be an integer. So you end up setting a non-default rate.
We originally discarded a size arguments (AudioFrame(size, duration, rate)), as size is directly related to the other two parameters, so providing all three options would have to raise an error or similar.
We could replace the duration parameter from AudioFrame, but still have it for microphone.record(duration, rate), as that is the simplest way to create an audio sample.
In this case we would end up with code like this:
Not too sure what other simple options we might have, or if there is a better way to implement a size parameter.
Any suggestions are very welcomed.
As a workaround, I've been creating AudioFrames with the size as the rate and 1s duration, but then we need to set the rate back to the value we'd like. For example, for 128 bytes:
When working on an example to send recorded data via radio like walkie-talkie, one idea is to record AudioFrames of the same size than the packet size for radio.
With the current API is not straightforward at all to work out how to create an AudioFrame of say 64 bytes.
We need to use a sample rate that is easily divisible by the packet size, and a packet size that is a multiple of 32 bytes.
Initial attempts using the default rate (which is not a multiple of 32 bytes either) ended up with floats as the
duration
, which doesn't work asduration
has to be an integer. So you end up setting a non-default rate.We originally discarded a
size
arguments (AudioFrame(size, duration, rate)
), as size is directly related to the other two parameters, so providing all three options would have to raise an error or similar.We could replace the
duration
parameter fromAudioFrame
, but still have it formicrophone.record(duration, rate)
, as that is the simplest way to create an audio sample.In this case we would end up with code like this:
Not too sure what other simple options we might have, or if there is a better way to implement a
size
parameter.Any suggestions are very welcomed.
As a workaround, I've been creating AudioFrames with the size as the rate and 1s duration, but then we need to set the rate back to the value we'd like. For example, for 128 bytes:
The text was updated successfully, but these errors were encountered: