Skip to content

Write directly into audio output buffer - discussion #102

@trackme518

Description

@trackme518

Hi,
I am wondering what would be the best way to write directly into output buffer - I would like to receive audio from stream as float or byte array and I need to continuously write into the speakers. The only public facing object that seems good for this is AudioSample with write method. But I am not sure how to time the writing into it. Any tips welcomed.

What is the expected range of the audio data written (it assumes float in the source code...)?

Should I create always new AudioSample object when I have new data? Or should I rewrite the data in existing sample object...

//for example
AudioSample sample = new AudioSample(this, 1024, 44100);
sample.loop();
//when should I write into it?
//at what index I should write...
 for (int i = 0; i < floatArray.length; i++) {
        sample.write(i, intArray[i] );
 }

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionQuestion about setting up or using the library

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions