asteroid icon indicating copy to clipboard operation
asteroid copied to clipboard

Support for mobile development (Android)?

Open lxaw opened this issue 1 year ago • 1 comments

First, I'd like to thank everyone for their work here. This is great stuff.

Has anyone tried to download one of the pytorch models and run on Android? I am trying to make a speech separation application, using this model: https://zenodo.org/records/3873670

Following this, I was able to load the model into Android studio, but am having trouble understanding how to call separate on it.

In Python on my PC, I was able to successfully run the following:

from asteroid.models import BaseModel
import soundfile as sf

# 'from_pretrained' automatically uses the right model class (asteroid.models.DPRNNTasNet).
model = BaseModel.from_pretrained("mpariente/DPRNNTasNet-ks2_WHAM_sepclean")

# You can pass a NumPy array:
mixture, _ = sf.read("female-female-mixture.wav", dtype="float32", always_2d=True)
# Soundfile returns the mixture as shape (time, channels), and Asteroid expects (batch, channels, time)
mixture = mixture.transpose()
mixture = mixture.reshape(1, mixture.shape[0], mixture.shape[1])
out_wavs = model.separate(mixture)

# Or simply a file name:
model.separate("female-female-mixture.wav")

However, I cannot call 'separate' in Android.

Anyone ever tried to take a model and run on Android?

lxaw avatar Feb 20 '24 13:02 lxaw

Good question, but sorry, I did not !

mpariente avatar Feb 21 '24 19:02 mpariente

No worries! I'll see if I can get it working. Thanks!

lxaw avatar Mar 14 '24 13:03 lxaw

Hi, how did you run on Android, how the effect is? @lxaw

mehao-aaa avatar Aug 02 '24 13:08 mehao-aaa