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

Enable real time playback #7

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Enable real time playback #7

wants to merge 2 commits into from

Conversation

reckoner165
Copy link
Collaborator

This change adds additional methods to play the output waveform once at the end of creation.
It also includes the addition of SoundModule to enable wave shaping and other real time playback features - working towards achieving #6

It's a big change by virtue of addition of an entire module and could use a good round of reviewing and testing.

cc @amoghpj @onstash

@reckoner165 reckoner165 self-assigned this Dec 31, 2017
track1.append([0 for n in range(0,max_len - len_list[0])])
track2.append([0 for n in range(0,max_len - len_list[1])])

track1 = [x for x in track1 if x != []]
Copy link
Contributor

Choose a reason for hiding this comment

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

I think the if condition in the list comprehension could be modified from if x != [] to if x as the latter is more idiomatic to python specifically.


x_stereo = [0 for n in range(0,2*len(x))]
if gain_L > 1 or gain_L < 0 or gain_R > 1 or gain_R < 0:
print "Invalid Gain. Try between 0 and 1"
Copy link
Contributor

Choose a reason for hiding this comment

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

I have a doubt here - what will pan_stereo(...) do if the gains are invalid. Should it proceed with the flow with invalid gains? Or should it return immediately?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

ah, good catch. I was meaning to raise a ValueError there. Noted.

Copy link
Contributor

Choose a reason for hiding this comment

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

If you're planning on raising a ValueError, how is it going to be handled downstream?

Copy link
Contributor

Choose a reason for hiding this comment

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

If you're planning on raising a ValueError, it would be best if the list generation x_stereo is moved from line#21 to line#25.

Sumanth Srinivasan - December 2016
"""

import math
Copy link
Contributor

Choose a reason for hiding this comment

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

All math imports could be clubbed together as -
from math import cos, sin, pi, ceil, floor, isnan (please add other methods that I have missed).

Copy link
Contributor

Choose a reason for hiding this comment

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

Hi @reckoner165. You needn't club them together in this pull request. We will do it as a separate one as a lot of imports need to be clubbed together. Sorry for the confusion. 😅

@reckoner165
Copy link
Collaborator Author

reckoner165 commented Jan 2, 2018

@onstash I've been working on turning the Sound Module into a separate class to make things more modular. Here is a WIP version of it. Happy to have you contribute!
https://github.com/reckoner165/soundmodular/blob/class-refactor/soundmodular2.py

I also set it up to handle playback and write to file, so maybe that will take away some burden from here.

@onstash
Copy link
Contributor

onstash commented Jan 3, 2018

Hi @reckoner165. Saw your rewrite. Beautifully documented and written! I like it. But I am afraid my contribution is limited to code and not music. And I will definitely contribute. 😅

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.

None yet

2 participants