Version 0.2 is a rewrite of stempeg
that focusses on speed and performance but also adding a number of additional features.
Furthermore, stempeg
now can read and write stem files in three different ways to utilize best the different audio containers. For example, as pcm/wav
doesn't support multiple audio streams, instead, stempeg
can read and write into streams aggregated into multiple pairs of stereo channels.
Audio Loading
- Underlying reading backend is now based on python-ffmpeg.
- With this new backend, the creation of any temporary files is reduced, thus audio is directly piped into numpy via stdio. This leads to loading time improvement of 20%-30%.
- A target sample rate can be specified to resample audio on-the-fly using ffmpeg.
- An optional
stems_from_multichannel
was added to load stems that are aggregated into multichannel audio (concatenation of pairs of stereo channels), see more info on audio writing. - substream titles metadata can be read from the Info object.
- Loading audio now uses the same API as in spleeters audio loading backend.
Audio Writing
This new version stabilizes writing support adding writer
methods to be passed to stempeg.write_stems()
to save multi-stream audio.
The choice of the writing method mainly depends on the audio container and codec. E.g. some containers supports multiple stems (mp4/m4a
, opus
, mka
) where as others does do not (wav
, mp3
...).
stempeg.FilesWriter
saves stems into multiple files. This writer can be boosted in performance usingmultiprocess=True
. Which writes the stems in parallel.stempeg.ChannelsWriter
saves as multiple channels. Stems will be multiplexed into channels and saved as a single
multichannel file. E.g. anaudio
tensor ofshape=(stems, samples, 2)
will be converted to a single-stem multichannel audio
(samples, stems*2)
.stempeg.StreamsWriter
saves into a single a multi-stream file.stempeg.NIStemsWriter
saves into a single multistream audio. Finally one can create stems files that are fully compatible with Native Instruments stems. For this, MP4Box has to be installed. See more info here.
Furthermore the following features were added:
- Names for each substream can now be embedded into metadata.
stempeg
can be used to just write normal audio files (mono and multichannel) usingwrite_audio
which also is fully API compatible to spleeters audio backend.
For more information see the updated documentation
Thanks to @mmoussallam, @romi1502, @Rhymen, @nlswrnr, and @axeldelafosse