6 comments

[ 2.4 ms ] story [ 15.3 ms ] thread
In case anyone is up at this hour I just finished a demo of 6 Romanian Folk dances by Béla Bartók.

I've included the settings used to make it in each dance in the video

https://www.youtube.com/watch?v=_WqnPJdPrW0

I reckon these 6 songs took about 3 hours to complete. I always wanted to learn to play violin. Just too lazy to do it.

How did you make the synth?
I found a huge collection of samples on archive.org made by the London Philharmonia orchestra back from 2013. It went largely ignored for a long time even getting some pretty harsh criticism for not releasing the samples as wavs or 24 bit/96k whatever quality. From my research 96k samples might help with sound stretching quality but I'm so happy with rubberband-cli I doubt I'd notice a difference.

I discovered something interesting as I was tinkering with midi. It appears that midi does not understand the length of a sound utterance, only when it begins and ends. So the midi library that I use in python can read those events and I work backwards to obtain the length of the notes. My premise was that if the sample was fit within the boundries of the playback time, things like attack, sustain, and release envelopes would be unnecessary. And it appears that I am correct. In the cases where samples really don't sound good stretched 8x (like when they have a touch of vibrato), I'm thinking I could make a set of derivatives that crossfade long samples to make extended lengths.

I made a library called get_sample.py that loads a dictionary list combo containing information about the sounds such as the sample file, its offset and true sound length (there is usually emptiness before and after the sample plays). The offset keeps notes firing in the right time and the length is used to find the closest match for the sample. Although there are over 10k samples stretching the samples in ffmpeg led to many unpleasant artifacts even with the rubberband filter. I found however that the rubberband-cli utility has a different set of options and appears to be a different method as the quality is astoundingly better with it as compared to the ffmpeg filter. My get_sample library first finds the closest length of the native samples or sub pitch sample, and then it will run down a list to find the closest scaled version. I had to generate about 2 million derivative samples to get a decent number of lengths to use as ffmpeg can only cleanly scale by about 25% in either direction. Amazingly, rubberband-cli can stretch a sample 8x with little noticeable jitters or stretch problems. Rubberband-cli is even better than sox I found.

It was an iterative process, trying things that work and abandoning things that didn't. After converting my project to use rubberband-cli samples I rerendered my project collection and erased and replaced the old examples on YouTube. By saving those samples as mp3 files the collection comes in at about 50 GB. Since the files started as mp3, it didn't seem like expanding 2 million samples to 800 gb of wavs was worth the space on my drive. I think that is about right as some people using products like Hollywood eastwest opus complain that it can take more than a day to download and more than a day to unpack the samples (it uses almost a whole TB of ssd space). Memory consumption is moderate, but you'll need just a little more memory than a cheap laptop has (8 GB will get it done just fine). The biggest drawback could be that this is actually more of a renderer than what people imagine as a synth. The system cannot play the music in realtime, it has to process the sound in parallel batches using ffmpeg. Usually a song takes much less time to render than to listen to but if it is something like Bach, its going to take a heck of a long time to render a job.

Kind of to my dismay I have been beaten to the punch with similar solutions that came out around 2018 but didn't know because I wasn't in the market for something like this. My solution seems easier to get quick results but is limited to the collection of samples that I have. Many samples were incorrectly labeled for their pitch so I'm still picking them out now and then and putting them in a banned list. I still haven't quite figured out why I cannot realistically make groups of instruments play that sound like they were mic'ed on a stage like some other offerings I've seen. So string ensemble...

Wow, that's a massive accomplishment! Do you plan sharing your code?
I would love to release the code as GPL in the spirit of copyleft. After all I was given the samples in the same vein without any profit back to the original makers. They are so indifferent to their own work they simply ignore any email I send them about it.

I really need some kind of sponsorship. I can't really afford to do a lot of work for free like managing pull requests or merges and tech support without sponsorship. There are so many great libraries I am curious how they attain ramen profitability. I know a lot of them would release their project under the following formula:

1. Make great code

2. Release code to the public for free

3. ?

4. Profit

From being around here for close to 10 years now I've seen a lot of people complain of doing open source work basically for no compensation and them finding themselves on the hook maintaining software they no longer even use themselves. But others like curl seem to have some kind of backing and are able to continue indefinitely.

I'm not greedy. I never thought this could make me rich. But I am really poor right now and need any help I can get. If I had $500 per month in sponsorship I could continue doing this work as long as I was physically able to do so. I have all kinds of desiring with this code including making an advanced GTK GUI that would greatly simplify the workflow and ease of use. I can think of so many cool things I could do with a gui like visual selections, humming a melody, adding harmony, multiple channel delegation, adaptive rendering, preview instruments and piano roll (or some other better notation system) editor. I can think of better ways of editing notes than piano rolls and sheet music.

If you had any leads to funding free software please share. Thank you for participating in my thread.

I made a couple new tracks you might find interesting including two I had never heard of before until I plundered the Lectern's midi files searching for dances:

Grieg: Elves' dance https://www.youtube.com/watch?v=gk6BB1hHYp8

Chopin: Mazurka Op.6 Nº1 strings quartet https://www.youtube.com/watch?v=tS2MRSh9ZoA

Mozart: Turkish March Strings Quartet https://www.youtube.com/watch?v=xojiUZUg7qQ

There are thousands of files like this!

I think this tool could be great for composers wishing to preview their work and discover the ranges instruments play in. They could better sell their work to orchestra patrons that are looking for new work to play in concert or recordings. Sure the Penny Orchestra is cheap, but that is kind of the point. It could never replace real musicians no matter how good it sounds. Other solutions I found often sound really cliché and I don't think that is what they'd want to hear. Not to mention, it just seems to take forever to make anything sound great with them from what I've read.

What you did is essentially re-create an offline sampler using Python libraries. Professional samplers do pretty much the same - they take pre-recorded notes, choose which note to play depending on the MIDI message length and other user-provided info, then stretch or shorten the note with an algorithm that keeps the pitch. This sounds very good, I have to say, and could be the base for a general purpose library to write music.