Skip to content

Audio buffer classes using pyfar.Signal#5

Merged
mberz merged 57 commits intodevelopfrom
feature/generators
Nov 3, 2023
Merged

Audio buffer classes using pyfar.Signal#5
mberz merged 57 commits intodevelopfrom
feature/generators

Conversation

@mberz
Copy link
Copy Markdown
Member

@mberz mberz commented Sep 23, 2022

WIP: This is not a final PR but only a draft of the functionality, things like documentation are not final.
Implements audio buffer classes to iterate pyfar.Signal in callbacks.

@sikersten sikersten self-requested a review September 28, 2022 14:58
@mberz mberz changed the title Buffer classes using numpy arrays Audio buffer classes using pyfar.Signal Nov 2, 2022
@mberz mberz requested review from sikersten and removed request for sikersten November 2, 2022 14:35
Copy link
Copy Markdown
Member

@sikersten sikersten left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice and elegant concept!

@mberz mberz mentioned this pull request Mar 31, 2023
twennemann
twennemann previously approved these changes Apr 10, 2023
Copy link
Copy Markdown
Member Author

@mberz mberz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

update data needs to pad the data if sampling rate or block size changes were made

super()._set_block_size(block_size)
self._update_data()

def _update_data(self):
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method should maybe also reset the index after the new strides were created.

Copy link
Copy Markdown
Member Author

@mberz mberz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please have a quick look at the slicing and check if that's an issue

def _set_block_size(self, block_size):
super()._set_block_size(block_size)
self._update_data()
self.data = self._data[:self._n_samples]
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
self.data = self._data[:self._n_samples]
self.data.time = self._data.time[..., :self._n_samples]

I think this may not work as intended. Slicing a Signal will slice along the channel axes, not the time samples of the underlying time data.

Comment on lines +195 to +196
self.data = pf.dsp.resample(self._data[:self._n_samples],
sampling_rate)
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this may not work as intended. Slicing a Signal will slice along the channel axes, not the time samples of the underlying time data.

@mberz mberz merged commit 5f16dbe into develop Nov 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants