Skip to content
This repository has been archived by the owner on Dec 13, 2023. It is now read-only.

Migrate to using librosa and librubberband for formant shifting #37

Closed
megabytesofrem opened this issue Aug 29, 2020 · 2 comments
Closed
Assignees
Labels
enhancement New feature or request help wanted Extra attention is needed planned-migration Planned migration to a new codebase

Comments

@megabytesofrem
Copy link
Collaborator

megabytesofrem commented Aug 29, 2020

Migrate to using librosa and librubberband for formant shifting. This would make the male and most importantly female voices, much more accurate and allow even more vocal flexibility in the future, since we could easily implement phaser effects and vocoders using librosa later on when we have the groundwork for a low-level streaming solution, rather than relying on sox.

I've played around, and it seems to be possible to use librubberband from Python and read data from a wave file (called bad.wav), apply a pitch shift effect with formant shifting and write it to "good.wav".

import soundfile as sf
import pyrubberband as pyrb

y, sr = sf.read('/home/char/bad.wav')
shifted = pyrb.pitch_shift(y, sr, n_steps=2.4)
sf.write('good.wav', shifted, sr)

The code to achieve this for a wave file is above, however in order to make this realtime we will need to do something like the following.

  1. Read from the microphone input, and stream into a buffer/numpy array(?)
  2. Process the buffer whenever new data is added to it, and apply the pitch shift effect
  3. Write this new buffer out to a Pulse null output, like before in sox only this time writing the numpy array
    instead of piping directly from sox
@megabytesofrem megabytesofrem added enhancement New feature or request help wanted Extra attention is needed planned-migration Planned migration to a new codebase labels Aug 29, 2020
@megabytesofrem megabytesofrem pinned this issue Aug 29, 2020
@megabytesofrem megabytesofrem changed the title Migrate to using librosa and librubberband for formant shifting rather than relying on sox Migrate to using librosa and librubberband for formant shifting Aug 29, 2020
@ghost
Copy link

ghost commented Sep 11, 2020

@chxrlt What's the official status now? Still using rubberband and other DSP libs?

@ghost
Copy link

ghost commented Mar 13, 2021

C rewrite is the future of Lyrebird 😎

@ghost ghost closed this as completed Mar 13, 2021
@ghost ghost unpinned this issue Mar 13, 2021
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request help wanted Extra attention is needed planned-migration Planned migration to a new codebase
Projects
None yet
Development

No branches or pull requests

1 participant