Giter Site home page Giter Site logo

weiweichen / musicalnumbers Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 24 KB

Musical Numbers - A quest to find out the most musical number in the universe. ๐ŸŽถ๐Ÿ”ข

License: MIT License

Makefile 2.17% Scala 97.83%
folk-music tune-generator

musicalnumbers's People

Contributors

weiweichen avatar

Stargazers

 avatar

Watchers

 avatar  avatar

musicalnumbers's Issues

Neural Network for folk tune generator.

Neil: I have a... complex relationship with ML (read: I actively avoid it where possible), but perhaps this is one of the places that a neural net can do better than logic or stats, simply because of the endless self-referential and recursive nature of music. I like the idea of training a network to recognise good patterns of rhythm or harmony and using the deep-dream idea to find what the network believes is the 'best' pattern.

Weiwei: This can a very interesting setup to try out ML, as I likewise have been avoiding it, but since Iโ€™m now working in a ML/AI infrastructure company, I probably should get my hands dirty sooner than later. To train a neural network, weโ€™ll need structured training data, probably some web crawling for abc notations + parsing infrastructures need to be in place first to be able to feed data to the model. Letโ€™s see how will ML perform in doing creative things.

Neil's idea for a tune generator

Neil:

But even without resorting to ML, here are some patterns you might be able to exploit in a more logical tune generator:

Some notes appear more than others; in (very) rough order of precedence: root, octave, fifth, fourth, second, seventh, third, sixth. The cool thing is that there are actually many root notes working in a tune at the same time - the root of the key, the root of the phrase (usually the root of the chord that goes with the phrase, and there could be many but the most basic one is usually also related to the key), the previous note... I think you could create some measure of how much a note 'fits' harmonically into the tune based on that and skew your algorithm towards notes that fit. But don't totally exclude the weirder notes; they make it interesting and can twist a phrase into having a different root. The position of the note in the tune also affects how much it needs to fit. The last note of the part is heavily skewed towards either being the root of the key or, occasionally, the fifth (you know those tunes that just never want to stop repeating - they usually end on an unresolved fifth). The end of a four-bar phrase usually also skews more towards a root, octave, fifth or fourth.

The reason behind that is super-interesting, but I can't find any good short explanations (here's a longer but very interesting read: https://arxiv.org/html/1202.4212), You can derive it from the fact that we like frequency multiples of the root note and that our brains are bad at distinguishing octaves (which are ratios of 2:1).

Some concrete ideas from Neil

Neil:

My favourite way to skew an even distribution is to take the log base 2 of n (or 2^n if you want to skew the other way). Which I think is neat because we're dealing with ratios so much.

Rhythm is another pattern to explore. I don't have as much theory on this, maybe make the last note at least a crotchet and insert pseudo-random crotchets throughout the music. I like the idea of working the fibonacci sequence into it but I'm not sure how or whether it would work (since everything else is so based around integer ratios)

The other one is that folk tunes rely heavily on the call-and-response idea. Maybe there's a general way to measure how 'call-and-response'y a tune is and optimise for that. Or it's probably easier to hardcode a pattern where bar 9 is a repeat of bar 1 and bar 13 is a repeat of bar 5 (this is why we should use index 0 everyone, it makes much more sense than index 1!).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.