Generating music with Python using Magenta for TensorFlow




[ad_1]

We ask a lot of our computers in 2019. But let’s stop and ask one more favor of our electronic friends. Using Magenta for TensorFlow (https://magenta.tensorflow.org/) we can have our computers generate music using Python. This video is based on a blog post you can find over on the Twilio Blog at https://www.twilio.com/blog/generate-music-python-neural-networks-magenta-tensorflow

Download all the files you need for this post here: https://www.dropbox.com/s/t6pm40dn9d8yomd/magenta.zip?dl=1
Put them in your project directory and you’re good to go!

Check out the Magenta demos at https://magenta.tensorflow.org/demos

Source


[ad_2]

Comment List

  • Twilio
    November 26, 2020

    Amazing.. Surely I will check it out. I am deeply into CNN for now. But RNN is also amazing to create something from scratch as it seems in the video. Excellent!

  • Twilio
    November 26, 2020

    After installing magenta on a virtual env I run into a problem with the following line: melody_rnn_generate .
    Here is the code:
    (Magenta) PS C:UsersnichoOneDriveDesktopcodingPythonMagenta> melody_rnn_generate

    2020-07-01 17:28:56.581975: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'cudart64_101.dll'; dlerror: cudart64_101.dll not found

    2020-07-01 17:28:56.596242: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine.

    Traceback (most recent call last):

    File "c:usersnichoappdatalocalprogramspythonpython37librunpy.py", line 193, in _run_module_as_main

    "__main__", mod_spec)

    File "c:usersnichoappdatalocalprogramspythonpython37librunpy.py", line 85, in _run_code

    exec(code, run_globals)

    File "C:UsersnichoOneDriveDesktopcodingPythonMagentaScriptsmelody_rnn_generate.exe__main__.py", line 4, in <module>

    File "c:usersnichoonedrivedesktopcodingpythonmagentalibsite-packagesmagenta__init__.py", line 26, in <module>

    import magenta.common.beam_search

    File "c:usersnichoonedrivedesktopcodingpythonmagentalibsite-packagesmagentacommon__init__.py", line 21, in <module>

    from .nade import Nade

    File "c:usersnichoonedrivedesktopcodingpythonmagentalibsite-packagesmagentacommonnade.py", line 23, in <module>

    import tensorflow_probability as tfp

    File "c:usersnichoonedrivedesktopcodingpythonmagentalibsite-packagestensorflow_probability__init__.py", line 76, in <module>

    from tensorflow_probability.python import * # pylint: disable=wildcard-import

    File "c:usersnichoonedrivedesktopcodingpythonmagentalibsite-packagestensorflow_probabilitypython__init__.py", line 23, in <module>

    from tensorflow_probability.python import distributions

    File "c:usersnichoonedrivedesktopcodingpythonmagentalibsite-packagestensorflow_probabilitypythondistributions__init__.py", line 88, in <module>

    from tensorflow_probability.python.distributions.pixel_cnn import PixelCNN

    File "c:usersnichoonedrivedesktopcodingpythonmagentalibsite-packagestensorflow_probabilitypythondistributionspixel_cnn.py", line 37, in <module>

    from tensorflow_probability.python.layers import weight_norm

    File "c:usersnichoonedrivedesktopcodingpythonmagentalibsite-packagestensorflow_probabilitypythonlayers__init__.py", line 31, in <module>

    from tensorflow_probability.python.layers.distribution_layer import CategoricalMixtureOfOneHotCategorical

    File "c:usersnichoonedrivedesktopcodingpythonmagentalibsite-packagestensorflow_probabilitypythonlayersdistribution_layer.py", line 28, in <module>

    from cloudpickle.cloudpickle import CloudPickler

    ImportError: cannot import name 'CloudPickler' from 'cloudpickle.cloudpickle' (c:usersnichoonedrivedesktopcodingpythonmagentalibsite-packagescloudpicklecloudpickle.py)

    Can anyone give a solution?

  • Twilio
    November 26, 2020

    amazing!! are you genius?

  • Twilio
    November 26, 2020

    I really want to get into this but have zero coding background or any real understanding of machine learning. Where would be a good place to start for me? I have played around with Ableton plug-ins by Magenta but want to start writing my own scripts.

  • Twilio
    November 26, 2020

    your training size is super low (4 notes on twinkle, and very close to each other on the scale). So, your coefficient of variation is going to create a song that hugs the "average" on the scale very tightly. It can make for a decent bassline, then overlay a loopback to make a beat or drum-n-bass. But, as long as your sample / training set is so small, you won't get much variety.

  • Twilio
    November 26, 2020

    Sounds like "merengue"

  • Twilio
    November 26, 2020

    What version of python was this video made with? I'm receiving an error

  • Twilio
    November 26, 2020

    Mmm, human music… I like it

  • Twilio
    November 26, 2020

    Thank you so much for this video! I can't wait to train my own RNN model!

  • Twilio
    November 26, 2020

    which python are you using? im using 3.8.0 and getting error when installing

  • Twilio
    November 26, 2020

    tbh if you speed up the song it made to about a 2 or 1.5 its actually a Bop
    and the last song reminded me of old Chinese country music

  • Twilio
    November 26, 2020

    okeyyy

  • Twilio
    November 26, 2020

    Clever tool. @Twilio, how can I reach you via email or WhatsApp? I am looking to team up with an "AI" engineer for my new movie and music company.

  • Twilio
    November 26, 2020

    oh, and due to the fact that you only used a portion of your screen when showing the procedure in iTerm it is still not clear to me how you can make directories for the environment file. Can you briefly explain that too? Thanks in advanced!

  • Twilio
    November 26, 2020

    Is there any way of separating the notes and the rhythm? I was thinking that the actual notes have very little connection to any rhythm, as you can play the same notes and use a completely different rhythm for them to make a different composition. I can't see how any particular note has a connection with the rhythm in any way, i.e the next note can be predicted depending on what went before it, but the note and rhythm does not make as much sense.

  • Twilio
    November 26, 2020

    It's already better than funk!

  • Twilio
    November 26, 2020

    On which console are you writing your code ?

  • Twilio
    November 26, 2020

    Just a little feedback, doing a transition that fades to black slowly makes it look like my screen is turning off via power saving. Very confusing

    Great vid though

  • Twilio
    November 26, 2020

    cool

  • Twilio
    November 26, 2020

    excellent

  • Twilio
    November 26, 2020

    What is the (I guess oh-my-zsh) shell theme you are using?

  • Twilio
    November 26, 2020

    Neat

Write a comment