SBC decoded discussion #745
-
i am getting framelen: -1 and framelen: -2 what this -1 and -2 ? and what is frame length ? Also i am getting decoded bytes always zero 0 why ? I feed manually 16 byte array and display the decoded out put . In same pattern encoder is working see the minimal code and log #include "AudioTools.h" for(int aa=0;aa<bytesC;aa++) // view decoded data //////////////////////////// [I] CodecSBC.h : 48 - virtual void audio_tools::SBCDecoder::begin() |
Beta Was this translation helpful? Give feedback.
Replies: 6 comments 15 replies
-
You're really pulling your own leg here! Each encoder uses a different logic and this complexity has been abstracted away by my API. It has however the expectation that you constantly feed it data, and it splits the data up automatically dependent on the rule of the encoder. The underlying SBC encoder expects data of a defined length as input (=code size) and translates it to a result of constant length (=frame size); As indicated in my last anwer you can query the API what these sizes are for the selected parameters. If you don't get any result you were just breaking this contract and you did not provide enough data to be processed... |
Beta Was this translation helpful? Give feedback.
-
THIS BELOW IMAGE I WANT TO ACHEVE . THE FRST PART IS COMPLETE NOW I FEED THE DATA TO PART 2 DECODER int bytesC = streamout.available() ; -------------> WHY THIS RETURN ZERO ? BELOW IS THE MNMAL CODE #include "AudioTools.h" int bytesC = streamout.available () ; [I] CodecSBC.h : 48 - virtual void audio_tools::SBCDecoder::begin() |
Beta Was this translation helpful? Give feedback.
-
Wth CsvStream I can only view/looK the data either in seral or plotter .i need to perform some mathematical operation with the data so that why i need resulting data in some sort of array |
Beta Was this translation helpful? Give feedback.
-
this some what i need to start .I need to have bufferstream in mid of encoder and decoder . and copy data from buffer stream 1 to buffer stream 2 . I try it like below but the out is not proper sine wave . How to get proper SINE wave with bufferstreams in mid? #include "AudioTools.h" uint16_t sample_rate = 44100; void setup() { // start I2S // Setup sine wave // start decoder // start encoder Serial.println("Test started..."); static uint8_t buffer[1024]; copierencoder.copy(); } |
Beta Was this translation helpful? Give feedback.
-
Ok i will update the version later but what about it didn't start plotting
?
…On Mon, Apr 3, 2023, 13:38 Phil Schatzmann ***@***.***> wrote:
Update to the latest version or use the name used in your version...
—
Reply to this email directly, view it on GitHub
<#745 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/APTMWZTQP2XVVS6WUAXJGDTW7KD7RANCNFSM6AAAAAAWQFSCJY>
.
You are receiving this because you authored the thread.Message ID:
<pschatzmann/arduino-audio-tools/repo-discussions/745/comments/5507321@
github.com>
|
Beta Was this translation helpful? Give feedback.
-
Here is my test that works #include "AudioTools.h"
#include "AudioCodecs/CodecSBC.h"
AudioInfo info(44100, 2, 16);
// input
SineWaveGenerator<int16_t> gen( 32000); // subclass of SoundGenerator with max amplitude of 32000
GeneratedSoundStream<int16_t> sineStream( gen); // Stream generated from sine wave
// output
CsvStream<int16_t> csv;
// encoding
SBCEncoder enc;
SBCDecoder dec;
EncodedAudioStream encStream(sineStream, enc); // to read encoded data
EncodedAudioStream decStream(csv, dec); // decode to out
int frameSize=0;
int frameCopyCount = 10; // or any other factor
void setup() {
Serial.begin(115200);
AudioLogger::instance().begin(Serial, AudioLogger::Warning);
// Setup sine wave
gen.begin(info, N_B4);
sineStream.begin(info);
// start encoder
encStream.begin(info);
frameSize=enc.bytesCompressed();
Serial.print("Frame Size ");
Serial.println(frameSize);
// start decoder
decStream.begin(info);
// setup output
csv.begin(info);
Serial.println("Test started...");
}
void loop() {
// copy full frames
int copyBytes = frameSize*frameCopyCount;
uint8_t buffer[copyBytes];
int copied = encStream.readBytes(buffer, copyBytes);
decStream.write(buffer, copied);
}
|
Beta Was this translation helpful? Give feedback.
You're really pulling your own leg here!
Each encoder uses a different logic and this complexity has been abstracted away by my API. It has however the expectation that you constantly feed it data, and it splits the data up automatically dependent on the rule of the encoder.
The underlying SBC encoder expects data of a defined length as input (=code size) and translates it to a result of constant length (=frame size); As indicated in my last anwer you can query the API what these sizes are for the selected parameters.
If you don't get any result you were just breaking this contract and you did not provide enough data to be processed...