Skip to content
This repository was archived by the owner on Feb 7, 2024. It is now read-only.

[SIGNAL] Changed audio loading backend to soundfile#221

Closed
adrian-stepien wants to merge 2 commits intopython-acoustics:masterfrom
adrian-stepien:dev/soundfile
Closed

[SIGNAL] Changed audio loading backend to soundfile#221
adrian-stepien wants to merge 2 commits intopython-acoustics:masterfrom
adrian-stepien:dev/soundfile

Conversation

@adrian-stepien
Copy link
Copy Markdown
Contributor

Using pysoundfile which allows for:

  • Reading 24-bit audio
  • Working on variety of formats such as FLAC

Comment thread acoustics/_signal.pyx
Comment thread acoustics/_signal.pyx Outdated


def to_wav(self, filename, depth=16):
def to_wav(self, filename, normalize=False, depth=16, format="WAV"):
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

remove normalization. It's possible to chain commands so there is no need to add this here

Comment thread acoustics/_signal.pyx

@classmethod
def from_wav(cls, filename):
def from_wav(cls, filename, normalize=False):
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Separate commit. Don't change the default behavior. I'm not yet sure whether I agree on offering this, because typically the level of a WAV file is irrelevant; one always wants to scale with a reference.

Copy link
Copy Markdown
Contributor Author

@adrian-stepien adrian-stepien Feb 12, 2019

Choose a reason for hiding this comment

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

In certain applications, knowing the level simplifies a lot. Currently that information is lost if the file is being saved. An example of that is given in #222.
As you said - normalisation is optional, so it can be done afterwards.

Fixed the `normalize` function to take into account the maximum of
absolute values, not only the positive ones.
Thanks to pysoundfile it's possible to laod WAV and FLAC files
with integer samples. (Floating point is there out of the box,
but requires a bit of API refactoring).

Things removed:
  - When saving, samples are no-longer normalized
  - Normalization is optional during loading - by default it's off
@FRidh
Copy link
Copy Markdown
Member

FRidh commented Oct 28, 2019

Rebased in #238.

@FRidh FRidh closed this Oct 28, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants