Download the PHP package omnibase/music without Composer

On this page you can find all versions of the php package omnibase/music. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package music

Music

A musician's site on omnibase: the records and the label that released them, the repertoire, the films, the instrument, the people who play along - and one player for the whole page, with no dependency. Written first for two classical musicians: a harpist and a violinist, each with a record label. The label goes first, everywhere: its logo next to the sleeve, "released by", "buy it at the label" as the first button of the page, and only then the streaming platforms.

Six things, each an entity, its back office, its pages and its Twig:

Install

Stable releases follow semantic versioning: this installs the latest 2.x, with omnisense/omnibase 7.0 or later on Symfony (omnibridge/symfony) and Doctrine ORM (DoctrineBundle), omnibase/admin for the back office. No minimum-stability setting is needed.

Then bin/console doctrine:migrations:diff && bin/console doctrine:migrations:migrate and bin/console assets:install (the stylesheet lives in public/css/music.css, the player in public/js/player.js).

What the host provides

The templates extend layout1.html.twig and fill title, description, content, stylesheets and javascripts: that is the whole contract. The pages are /music (music_index), /music/{slug} (music_release), /repertoire, /videos, /videos/{slug} and /instrument, each in the sitemap but the single film.

The player's bar is the host's: {{ music_player_bar() }} once in its layout, before </body>, so the music goes on from page to page of a Turbo site and is there on the home page. It loads player.js itself. Its cross ([data-music-close]) stops the music and hides the bar - MusicPlayer.close(), the music:close event; playing anything brings it back. Escape, with the focus in the bar, folds the sheet, then tucks the bar into its handle: the music goes on. html.music-is-playing while it sounds, html.music-playing-bar while the bar shows.

Twig, for a host's own pages:

music_player(release) "Listen in full" on the platforms, then the tracks with their play buttons and waveforms
music_player(release, {fold: true}) the same for a page showing several records: one "listen" button ([data-music-release-play]), the tracks behind a disclosure
music_player(track) one track's button
music_links(release) the label block, then the platforms as pills
music_full(release) "Listen in full on Spotify / Apple Music / Deezer" alone
music_embed(release, platform?), music_listen_embed(release, platform?) one platform's player of the record, on a click
music_latest(n, type?) ('album': the albums, not the singles between them), music_releases(), music_featured(), music_upcoming() the records
music_videos(n), music_hero_video() the films; the home page's film
music_playlists(kind?), music_playlist_embed(playlist) the playlists (own, recommended, artist) and one's player
music_instrument(), music_performers(release\|video) the instrument; the line of who plays
x\|music_duration seconds as a sleeve prints them: 4:07, 1:02:45

The look is music.css, on custom properties a site sets to its own: --music-accent, --music-bg, --music-fg, --music-soft, --music-line, --music-surface, and the waves' --music-wave and --music-wave-played.

The back office gets the Release, Label, Work, Video, Instrument, Performer and Playlist CRUDs, and a dashboard widget, music_latest: the last record out, the next one announced, and how many tracks the player has nothing to play for.

Omnisong: the catalogues

The links, the previews and the embeds come from glitchr/omnisong: one contract over song.link (Odesli) for the links to every platform, the iTunes Search API for the tracks and their 30 s previews, and the iframes of Spotify, Apple Music, Deezer, YouTube and SoundCloud. Its bundle registers Omnisong\Catalog\Catalog, Omnisong\Player\EmbedderInterface and Omnisong\Player\EmbedOptions; this one only asks them.

On a record in the back office, Complete asks the catalogues what they know of it - by its UPC, else its first platform link - and Look up a record makes one from a single URL or UPC: the links to every platform, the UPC, the sleeve (kept as coverUrl, a remote address, until one is uploaded), the date, the label when it has none and the catalogue names one, and the tracks - matched by their ISRC, else their disc and place - with their length and preview. Nothing typed by hand is overwritten: only empty fields are filled, and the label's link never comes from a catalogue. A catalogue that does not answer is not "not found": the flash says which one was down, try again later. What a lookup gives, for example (invented records):

The player

One <audio> for the whole page. A track plays, in the order music.player.order gives, the site's own excerpt (file), else a catalogue's preview (preview), else - nothing to play here - the record's player on a platform (embed), on the click. The bar shows what plays, play/pause, the previous and next track of the same record, the progress on the waveform, the time, the sound; space plays or pauses, the arrows seek five seconds, Shift+arrows change track.

The waveform is static: 200 bars, computed once on the server from the excerpt and kept on the track (peaks), drawn on a <canvas> with no decoding in the browser - the played part in --music-wave-played, the rest in --music-wave. With live_waves, the bar's canvas follows the sound instead (an AnalyserNode), unless the visitor asks for less motion.

Listen in full. A 30 s preview is a taste; a play on Spotify, Apple Music or Deezer by a listener logged in there is a stream, and counts for the musician - in the platform's statistics and its payments. So beside the previews, on a record's page and in the bar while one of its tracks plays, "Listen in full on Spotify / Apple Music / Deezer" swaps in the platform's own player of the whole record (music.player.full says which platforms, in which order). Nothing loads from a platform before that click.

The whole track, on the site. A catalogue gives 30 seconds; the site plays a track in full from a file of its own: upload it on the track (64 MB at most) and tick "Whole track" - a box per track, unticked by default: nothing plays a work in full unless someone ticked it. The bar then has no "Listen in full" for it - it is. Playing a recording in full on the site presumes the agreement of whoever holds its rights (the label, the publisher): get it in writing before ticking the box; an excerpt stays the default.

The platforms' players wait for a yes. Spotify, Apple Music, Deezer, YouTube or Vimeo set their own cookies: with omnibase/consent installed, a player of theirs ("Listen in full", the sheet of the bar, a film from a platform) loads only once the visitor accepts the MEDIA feature - asked on the click that wants it, the panel opening, and played as soon as they say yes; never on a hover. Its switch is in the panel, named by music.consent.label.

Plays. The player tells the site (POST /music/play/{id}, music_track_play) once a track was heard - 30 seconds of it, or most of a shorter excerpt; a jump on the waveform is not listening. Track::getPlays() is the track's count, Release::getPlays() its record's; the back office shows both on a record (the list, the record, each track's row) and the total on the dashboard's tile. The back office's own listening is not counted, the same visitor on the same track once every 20 seconds, and nothing about the listener is kept. What plays in a platform's own player is counted there, not here.

The player's JavaScript API

player.js exposes window.MusicPlayer, for a site that draws its own visualisation or drives the player from its own buttons:

audio the <audio> element playing now
analyser the AnalyserNode, made on the first play a visitor asked for - even without live_waves - and null before (or when the browser has no Web Audio)
context its AudioContext
current the current track: {src, title, release, peaks}, or null
play(el \| data) plays a [data-music-track] element, or {src, title, release, peaks}
pause(), toggle(), seek(seconds), next(), prev()
full(release, platform?) opens "listen in full" for a record (its slug)
redraw() draws the waveforms again (after a host changed the page)

and dispatches on document:

detail
music:track the track that starts
music:play, music:pause, music:ended the current track
music:time {currentTime, duration}, about four times a second
music:full {release, platform}: a platform's player replaced the preview

A preview from another site (iTunes') goes through Web Audio only when that site answers with CORS; when it does not, it plays on a plain element, without the live wave.

The hero film

{{ music_hero_video() }} on the home page: a film muted, looping and playing by itself (autoplay muted loop playsinline), with a button to hear it, and its poster alone for a visitor who asks for less motion. Which film and which poster are two settings of the back office, music.hero.video and music.hero.poster (an upload or an address); with neither, nothing is rendered.

The waveforms: ffmpeg

or the Waveforms button of a record in the back office. ffmpeg decodes the excerpt to raw mono PCM at 8 kHz (ffmpeg -i in -ac 1 -ar 8000 -f s16le -) and the samples are reduced to 200 loudness values (RMS, the loudest 1). Without ffmpeg on the server (apt install ffmpeg, apk add ffmpeg) nothing is computed - it is said and logged - and the player draws a flat line instead. A new excerpt forgets the old waveform.

Tests

tests/ runs without a kernel: the waveform's reduction (Peaks::reduce() on a synthetic buffer), the label first in Release::getPlatformLinks() (its pattern, the record's own page, its shop), the importer filling only what is empty, durations, the repertoire's grouping, the films' addresses, the playlists' platforms and the links' form.


All versions of music with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
doctrine/orm Version ^2.15|^3.0
doctrine/doctrine-bundle Version ^2.11|^3.0
symfony/doctrine-bridge Version ^6.4|^7.0|^8.0
omnibridge/symfony Version ^3.0
omnisense/omnibase Version ^7.0
omnibase/admin Version ^2.0
omnibase/video Version ^2.0
symfony/config Version ^6.0|^7.0|^8.0
symfony/dependency-injection Version ^6.0|^7.0|^8.0
symfony/form Version ^6.0|^7.0|^8.0
symfony/http-kernel Version ^6.0|^7.0|^8.0
symfony/security-bundle Version ^6.0|^7.0|^8.0
omnisense/omnisong Version ^1.0
symfony/process Version ^6.0|^7.0|^8.0
symfony/twig-bundle Version ^6.0|^7.0|^8.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package omnibase/music contains the following files

Loading the files please wait ...