Skip to content
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

Speed of multichannel audio file writing #4

Open
weefuzzy opened this issue Sep 7, 2020 · 4 comments
Open

Speed of multichannel audio file writing #4

weefuzzy opened this issue Sep 7, 2020 · 4 comments
Assignees
Labels
enhancement New feature or request

Comments

@weefuzzy
Copy link
Member

weefuzzy commented Sep 7, 2020

Work on #1 has revealed that, even for quite moderate cases, writing a multichannel audio file can take longer than processing, e.g.

./fluid-nmf -source ~/dev/flucoma-core/AudioFiles/Tremblay-ASWINE-ScratchySynth-M.wav -components 5 -resynth out.wav

At root, this is down to something that's already marked as a FIXME in the HISSTools audio file source: https://github.com/AlexHarker/HISSTools_Library/blob/5cf4a3ad60005cb8208f10be460607eb9b91248e/AudioFile/OAudioFile.cpp#L597

Basically, when writing channel-wise, the code spends a lot of time in seek() which is not a quick thing for a file.

For our part, the reading/storing/writing in the wrapper should change to be interleaved. This is not as huge a change as it seems:

  1. Use readInterleaved from IAudioFile
  2. In common with the BufferAdaptors for other hosts, rely on FluidTensorView to handle the layout logic (obtaining a channel -> reading a column when using interleaved layout)
  3. Use writeInterleaved from OAudioFile
  4. For CSV output we probably want to use the transpose of the interleaved data. I think.
@weefuzzy weefuzzy added the enhancement New feature or request label Sep 7, 2020
@weefuzzy weefuzzy self-assigned this Sep 7, 2020
@weefuzzy
Copy link
Member Author

PR submitted, with hopefully much better performance for multichannel writes.

Still todo: at our end, keep the data in interleaved layout (this is faster still, according to my testing...)

@tremblap
Copy link
Member

should we aspire for this in v1?

@weefuzzy
Copy link
Member Author

It's not really in our hands. The PR code has been merged into an experimental branch on HISSTools, but I don't think that branch has yet made it to main

@AlexHarker
Copy link
Contributor

I think this code is now merged, or on the way to being merged, so once we are header-only we should retest this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants