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

Improve multitrack player #200

Open
bryan-pardo opened this issue Dec 29, 2020 · 3 comments
Open

Improve multitrack player #200

bryan-pardo opened this issue Dec 29, 2020 · 3 comments

Comments

@bryan-pardo
Copy link
Collaborator

bryan-pardo commented Dec 29, 2020

Describe the bug
Take 2 copies of the same audio signal. Hand them to multitrack to produce a 2-track player. Play both tracks simultaneously. There's an echo. Ergo, the tracks are playing a touch out of synch.

Steps To Reproduce

Do this in a python notebook.

import nussl
import matplotlib.pyplot as plt
import numpy as np
from pprint import pprint
from common import viz

signal = nussl.AudioSignal('path/to/file.wav')
signal.stft()
viz.show_sources({'copy A': signal, 'copy B': signal})

Now...run the audio player with both tracks playing.

Expected behavior
You should hear only one signal
What did happen
You hear a signal with an echo.
Audio output
Run it for yourself.

Software versions*
I ran this in Google CoLab

Linux-4.19.112+-x86_64-with-Ubuntu-18.04-bionic
Python 3.6.9 (default, Oct 8 2020, 12:12:24)
[GCC 8.4.0]
NumPy 1.19.4
SciPy 1.4.1
nussl 1.1.3rc5

@Atralb
Copy link

Atralb commented Dec 29, 2020

Hi there, I'm having an issue with common.viz.show_sources too, but it's another one: only the graphs are printed, not the player (like here). Here is a screenshot showcasing the issue.

I'm having a real trouble finding the origin of this module. I've skimmed through the source code in /opt/conda/lib/python3.8/site-packages/common/viz.py, so I understand it is directly related to nussl, but where does it come from ? I can't seem to find this common module in the repo here.

@pseeth
Copy link
Collaborator

pseeth commented Dec 29, 2020

Hi @bryan-pardo, yeah the multitrack player can be improved for sure...it's down to using media elements to play the audio instead of using something more robust like Web Audio API. It's a bit low on the priority list right now, but I have an attempt lying around using trackswitch.js. Usually, with the current multitrack player, I can fix it by just stopping and restarting it.

@Atralb, the common library is not a pip library, rather it's just a set of utilities that was helpful for writing the source separation book. Here is the "library": https://github.com/source-separation/tutorial (under the common package). It gets installed when you clone the tutorial and install it via pip install -e .. By the way, it seems like you're using conda but not using conda environments. I recommend using conda environments to avoid any issues.

As for your issue, I've seen that happen sometimes in other browsers. Usually rerunning the code cell works. The multitrack player sometimes goes away when you refresh the page, when running it in a notebook.

I'm going to rename this issue to "Improve multitrack player", self-assign it, and keep track of progress here.

@pseeth pseeth self-assigned this Dec 29, 2020
@pseeth pseeth changed the title multitrack in play_utilities.py produces a player where the tracks are not snychronized Improve multitrack player Dec 29, 2020
@Atralb
Copy link

Atralb commented Dec 30, 2020

@pseeth Thanks a lot for the answer ! Of course, I forgot to check in source-separation/tutorial, dummy me...

And you're actually right about the player... rerunning the cell now makes it appear. I had tried rerunning a second time when I first encountered the issue, and since it didn't work then, I directly assumed this was an issue with my installation afterwards. Sorry for having gone too fast :/

As for conda and envs, I'm actually running a jupyter notebook server in an ad hoc docker container with a custom image based on scipy-notebook from jupyter/docker-stacks over which I added nussl, so that's why I don't shouldn't need a virtual env.

PS: By the way, if you'd rather I moved my own message in a specific issue to separate it from bryan-pardo's one, I can :). Whatever you prefer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants