Comments (8)
thanks for your contributions. I don't really see a difference between the arguments you use and the one used in write.py
. Here is an example what is actually called by stempeg:
ffmpeg -y -f s16le -acodec pcm_s16le -ar 44100 -ac 2 -i mix.wav -i vocals.wav -i drums.wav -i bass.wav -i other.wav -map 0 -map 1 -map 2 -map 3 -map 4 -vn -acodec aac -ar 44100 -strict -2 -loglevel error -ab 256000 stems.mp4
maybe you can point me to the relevant changes one would need to make to improve the write functions?
from stempeg.
The difference should be in the codec.
I'm trying this example but then there must be something wrong in the way I use stempeg, but I can't understand what:
y, sr = librosa.load('STEMS/mix.wav')
# CREATE STEMS
which_stem = 1
if which_stem == 1:
# stems x samples x channels
y_0 = y.reshape((-1, 1))
y_1 = np.zeros((y.shape[0], 1))
else:
# stems x channel x samples
y_0 = y.reshape((1, -1))
y_1 = np.zeros((1, y.shape[0]))
# CREATE TENSOR
S = np.array([y_0, y_1])
# WRITE STEMS
output_wav = 'STEMS/stem_OUT.mp4'
stempeg.write_stems(S, output_wav, rate=sr)
For some reason, using stems x samples x channels
, the generated .mp4 file runs twice the speed it should be, but the single .wav files are correct.
The stems x channel x samples
, which should be the format required by stempeg.write, results in an error, as the vector has wrong size.
Error opening '/var/folders/zk/xlbb09bs2j3_wrxkj0fwbhvc0000gn/T/tmp2z3t3wiv.wav': Format not recognised.
Do you see any error in what I am doing?
Thanks a lot!
from stempeg.
The difference should be in the codec.
you mean the output codec (acodec
)? I also check if libfdk_aac
is available and use it. So that doesn't look to be different.
Lines 79 to 84 in ebbaec8
For some reason, using stems x samples x channels, the generated .mp4 file runs twice the speed it should be, but the single .wav files are correct.
Do you see any error in what I am doing?
Are you writing mono files? The STEMS format is stereo only, that is why its hardcoded here. I might need to add a check for this to warn users...
from stempeg.
Yes in this case is mono.
I understand, thanks a lot for the clarification.
from stempeg.
Hi, sorry if I am reopening the issue.
I am saving the audio setting 2 channels as:
def save_stereo(filename):
sound = AudioSegment.from_wav(filename)
sound = sound.set_channels(2)
sound.export(filename, format="wav", bitrate="256k", parameters=["-ac", "2"])
return
Then I am collecting the stems and creating S but the error still pops up.
I am making sure nothing goes wrong in the numpy array when saving and when I listen back to it. It sounds okay.
mix: (2, 13340160)
drums: (2, 13340160)
bass: (2, 13340160)
accompaniment: (2, 13340160)
vocals: (2, 13340160)
S.shape: (5, 2, 13340160)
stempeg.write_stems(S, output_mp4, rate=sr_mix)
Error opening '/var/folders/zk/xlbb09bs2j3_wrxkj0fwbhvc0000gn/T/tmpwqt3zrer.wav': Format not recognised.
I also have these warnings. Could the error above be related to those?
/usr/local/lib/python3.7/site-packages/stempeg/write.py:84: UserWarning: For better quality, please install libfdc_aac
warnings.warn("For better quality, please install libfdc_aac")
/usr/local/lib/python3.7/site-packages/stempeg/write.py:96: UserWarning: Number of samples does not divide by 1024, be aware that the AAC encoder add silence to the input signal
"Number of samples does not divide by 1024, be aware that "
from stempeg.
[UPDATE]
Correct me if I am wrong, could It be related to bastibe/python-soundfile#203 ?
So stems x samples x channels
should be the right format.
from stempeg.
has this issue been addressed?
from stempeg.
Sorry, I solved using the stems x samples x channels
ordering.
Closing now.
from stempeg.
Related Issues (20)
- Support seeking HOT 2
- check if ffmpeg and ffprobe is installed HOT 1
- Add a check for mono files HOT 1
- OSX quicklook support HOT 8
- Publishing conda package on conda-forge HOT 1
- Reading is too slow HOT 2
- add audio2stem cli HOT 1
- Evaluate dropping soundfile
- A loading error in Win System. HOT 6
- Native Instruments (Traktor) Format HOT 36
- add docs HOT 1
- ffmpeg -version contains letter in version string HOT 1
- switch from travis to github worflow HOT 1
- Support reading from file-like objects
- 16 bit flac output conversion? HOT 3
- stempeg.read_stems got an unexpected keyword argument 'sample_rate' 'ffmpeg_format' HOT 2
- warnings.warning() does not exist HOT 1
- Add ffmpeg 5 tests
- Ffprobe command returns non-zero exit status 3221225478 HOT 9
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from stempeg.