Skip to main content

# musicgen musicgen is a module for pre-processing audio and to prepare the dataset for neural networks in genarating music. Built on top of Music21 and youtube_dl

Features

  • Download the songs,videos from URL
  • Get the notes from music
  • Prepare the dataset for neural networks

Installation

$ pip install musicgen

get_notes(path='*.mid')

Get all the notes and chords from the midi files

Args:

path : path for the song with midi extension. ‘*.mid’ by default which gets the note of all the songs in the current working directory.

Returns:

List of notes obtained from the midi file

download_song_with_url(url,audio_type='mp3',quality='192')

Downloads the audio of a video present in the given video URL to current working directory.

Args:

url : (string) URL of a video
audio_type :(string)"aac", "flac", "mp3", "m4a", "opus", "vorbis", or "wav". ‘mp3’ by default

create_midi(prediction_output,name='output')

convert the output from the prediction to notes and create a midi file from the notes in current working directory.

Args:

prediction_output : the output predictions of a trained model.
name : (string) name of the generated file. output by default.

prepare_sequences(notes, n_vocab,sequence_length = 100)

Prepare the sequences used by the Neural Network

Args:

notes : (list) notes of midi file
n_vocab : (int) number of unique notes
sequence_length : (int) number of time steps required. 100 by default.

Returns:

network_input, network_output

download_video_with_url(url)

Downloads the video from the given URL into current working directory.

Args:

url : (string) URL of a video

download_videos(path)

Downloads the videos from the URL’s present in a text file into current working directory.

Args:

path : (string) path of a text file containing URL’s

download_songs(path)

Downloads the audio of videos from the URL’s present in a text file into current working directory.

Args:

path : (string) path of a text file containing URL’s.

song_notes_to_pickle(path,output)

saves the notes of a midi file as a pickle object.

Args:

path : (string) path of the songs
output : (string) name of the pickle file.

generate_notes(model, network_input, pitchnames, n_vocab)

generates the notes from the trained keras model

Args:

model : Trained keras model for prediction
network_input : input to the network
pitchnames : set of items in the notes. It is found using pitchnames = sorted(set(item for item in notes))
n_vocab : (int) number of unique notes

Returns:

predicted_output

Metadata

Release files for musicgen 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for musicgen 0.0.1
File Size Uploaded Provenance Actions
musicgen-0.0.1.tar.gz 4.6 kB Without provenance Details for musicgen-0.0.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for musicgen 0.0.1
File Interpreter ABI Platform Actions
musicgen-0.0.1-py3-none-any.whl Python 3 none any Details for musicgen-0.0.1-py3-none-any.whl

Total release size: 10.3 kB

Release files / musicgen-0.0.1.tar.gz

Download URL musicgen-0.0.1.tar.gz
Size 4.6 kB
Tags Source
SHA-256 checksum
How to use checksums
908ccf822537857d569435ed00491ccc6d59a9cf9d2b5548fc11aa0889519fe9
BLAKE2b-256 checksum
How to use checksums
5d86858590baf8d0b06ef87fc5e3a6be0b71a6c59c316f8de535a1aada8eacfa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.3

Release files / musicgen-0.0.1-py3-none-any.whl

Download URL musicgen-0.0.1-py3-none-any.whl
Size 5.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d7b12f62a44b611549d94e7b7ab1ea0fb36fd956d3585e88948d0d23c38e7a42
BLAKE2b-256 checksum
How to use checksums
5a95351d059aff63c9c1fee56a77098bd1b515ecbf15b0a84af8064274a59f97
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.3

Security for musicgen 0.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page