Skip to main content

A module for pre-processing steps in music generation

Project description

# 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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

musicgen-0.0.1.tar.gz (4.6 kB view details)

Uploaded Source

Built Distribution

musicgen-0.0.1-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

File details

Details for the file musicgen-0.0.1.tar.gz.

File metadata

  • Download URL: musicgen-0.0.1.tar.gz
  • Upload date:
  • Size: 4.6 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for musicgen-0.0.1.tar.gz
Algorithm Hash digest
SHA256 908ccf822537857d569435ed00491ccc6d59a9cf9d2b5548fc11aa0889519fe9
MD5 88bb2386b352023355c27fa0e5e96987
BLAKE2b-256 5d86858590baf8d0b06ef87fc5e3a6be0b71a6c59c316f8de535a1aada8eacfa

See more details on using hashes here.

File details

Details for the file musicgen-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: musicgen-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 5.7 kB
  • Tags: Python 3
  • Uploaded using 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

File hashes

Hashes for musicgen-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d7b12f62a44b611549d94e7b7ab1ea0fb36fd956d3585e88948d0d23c38e7a42
MD5 6d4e57ea95338035db5d1329403c2f10
BLAKE2b-256 5a95351d059aff63c9c1fee56a77098bd1b515ecbf15b0a84af8064274a59f97

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page