evangipson / midio

midio will work really hard to generate you endlessly interesting audio on the fly.
http://evangipson.com/midio
GNU Affero General Public License v3.0
21 stars 0 forks source link

Enable short term memory #24

Closed evangipson closed 6 years ago

evangipson commented 6 years ago

Description

Need to be able to recognize melodies and chords when you listen to midio.

Note: Still have a bug where memories only take the last note's values... I suspect it has something to do with the for loop where melodies and chords are being constructed.

Related Issue/Motivation/Context

https://github.com/evangipson/midio/issues/22

How Has This Been Tested?

I let midio run for awhile and never had more than 5 phrases remembered at any time. I still need to test how frequent the melodies and chords are, and if 5 is even a good limit on melodies to remember. maybe more or maybe less! still have to listen more.

Update: listened a bunch, adjusted the max and min of tempo a bit and I think it's sounding much more recognizable, so gonna merge.

Screenshots

none

evangipson commented 6 years ago

This was a valuable resource here: https://we-are.bookmyshow.com/understanding-deep-and-shallow-copy-in-javascript-13438bad941c

The problem was I was using a shallow copy instead of a deep copy when I expected the members of the object to stay the same after modifying them. That is not how javascript works.

To solve this, I could've also used Object.assign(), but instead decided to go with the spread operator, which has it's own compatiability issues but I'm compiling the JS so it shouldn't really matter. At worst I can add some option to tsconfig probably that can shim away the spread syntax.