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

add humanize function to generate pink noise #57

Merged
merged 12 commits into from
Sep 25, 2020
Merged

add humanize function to generate pink noise #57

merged 12 commits into from
Sep 25, 2020

Conversation

michiboo
Copy link
Contributor

@michiboo michiboo commented Aug 4, 2020

Closes #56

@Datseris Datseris self-requested a review August 4, 2020 09:57
@Datseris
Copy link
Member

Datseris commented Aug 4, 2020

Hi, before reviewing the details, this needs some work at a higher level.

  1. a function humanize! should add the noise components to the positions (or even velocities) of existing notes.
  2. You have to check that the standard deviation of the noise process is sufficiently small, and can be controlled by the user. What is best is that the user provides a σ, and the resulting noise is normalized to have standard deviation σ.
  3. The user should be able to propagate d, φ parameters to ARFIMA.jl.
  4. Please write unit tests.
  5. Have you confirm that the timeseries you get from ARFIMA have power-law spectra?

@michiboo
Copy link
Contributor Author

@Datseris Hi I have coded a test, no.3 and function to add the noise components to the positions. But I am struggling to get a power-law spectra.

@Datseris
Copy link
Member

Datseris commented Aug 20, 2020

Hi, yeap I was fearing that we won't be getting power-law spectra (at least not crisp clean ones) with this approach. Here is what I propose:

  1. Notice that humanize modifies the given notes. Thus, it should end in ! in accordance with the Julia style guide. Rename humanize to humanize!.
  2. Change the call signature of humanize to: humanize!(notes, property, σ, noisetype, args...). The property can be either :position, which does what you do now, or :velocity, which adds noise to the note velocity. Instead of doing notes[i].position = ... you can do setproperty!(notes[i], property, ...) instead, and you cover both lines with 1 line of code!
  3. The noisetype is a symbol that configures what kind of noise we add. This allows us in the future to add different type of noise, that perhaps is more like a power-law.
  4. The args... are propagated into the function that gives you the noise, and of course have to be compatible with the chosen method. In our case, where method = :ARFIMA, we would have noise = arfima(length(notes), σ, args...).
  5. Please ensure that the σ the user gives is the σ the method gets, i.e. transform the output noise to noise = σ .* noise ./ std(noise).
  6. Add a test about the velocity setting as well.

Then this is good to go.

P.s.: If you ever find some code that generates power-law correlated noise please let me know! I still haven't found anything!

@Datseris Datseris merged commit 8d734fc into JuliaMusic:master Sep 25, 2020
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.

Humanizer via addition of pink-noise
2 participants