Tool (2.7): Add/Remove Silence

that’s a great idea!

try “trim left” then. I just checked the vanilla version to make sure, and could reproduce it… and I haven’t even touched that part of the code (yet I wouldn’t be surprised if something else I changed broke stuff, naturally, that’s why I wanted to make sure…)

huh, there is definitely something wrong with trim left :D

here’s what I have so far. the GUI is still ugly as in the screenshot above :P

the “remove silence” tool now applies to the current selection. this seems to work great, unless you use trim left twice of course XD

one thing that puzzles me: as mentioned above, “get duration from selection” doesn’t work when the selection is shorter than 3 frames – but only in the add silence tool, in the remove silence tool it works as expected, though I’m using the exact same code? probably something simple, silly, but still, that’s the one open question I currently have with what I’m uploading now. I think I even put a comment to that effect in the code, but it can’t hurt to mention these things can it :)

uhh there’s still a crash on an empty song, hang on…

which came from notifier code I pasted from the Custom Wave Generator

function new_song_loaded()  
 if dialog.visible then  
 dialog:close()  
 if renoise.tool().app_new_document_observable:has_notifier(new_song_loaded)  
 then  
 renoise.tool().app_new_document_observable:add_notifier(new_song_loaded)  
 end  
 end  
end  
  

that line should read

!

in order to avoid the problem with left trim, search for the following line in your code:

  
 if int_silence_start ~= 0 then  
 -- the sample ends with silence  
  

and change with this

  
 if int_silence_start ~= 0 and not (int_mode == MODE_TRIMLEFT) then  
 -- the sample ends with silence  
  

hmm wow, I seem to have broken stuff quite a bit in the remove silence tool uhh…

a.) getting the volume from a selection, and then muting that doesn’t work at all like expected. either I’m not reading the correct max volume, or something else is going wrong there. both, most likely. this is so broken I don’t even know where to begin… but I noticed the text boxes don’t update each other, so I’ll at least try to fix that and see if that helps. but at this point I may be doing more harm than good…

b.) sometimes pressing apply results in a new sample being created, and I have no idea why.

okay, done that.

updated the attachment above with that, and your fix for trim left (and it now uses the math.abs when trying to find out the peak volume… blush)

“mute silence” seems reeeally broken now though. sometimes it just mutes everything to the right of the selection, sometimes it creates a new sample, and it generally never mutes what I’d except it to mute.

removing and trimming silence seems okay, but even there I get the distinct feeling that the maximum volume I’m detecting is BS, from what it cuts as well as from the fact that it reads -200dB WAY too often.

well, I’ve had enough for today ^^ I hope this can be salvaged somehow, fresh sets of eyes (read: not mine) might help… !

okay, I fixed that (attachment above updated… again… because it was too silly to not immediately fix it), and the numbers now seem to make sense – but mute silence still doesn’t work right.

Johann, I don’t want to sound harsh, but I don’t think we can go anywhere with these continuous patching without a way to easily synchronize them. either you thoroughly test them before “committing” modifications here, or you ask for features and I try to find the time, which unfortunately I really have not much of as of now, to add them.

it’s since last sunday that I can’t put my hands on scripts code before 1AM without taking time from office dues, so for me is really hard to follow the current path.

keep the enthusiasm but regulate yourself :)

I understand, but the thing is, I test it, see it’s not working right, I look at the code - and it is exactly the code I would write, where I can find no problem. At least that’s how it is in this case.

I stopped when I thought either you can spot what I did wrong (in code I hardly understand, the trimming etc. parts I mean), OR I just do the same thing over again from scratch, in smaller steps. I’d be willing to do that actually… doing neither until I heard from you, so what did give you the impression I’m impatient or anything?

Cut me some slack, too. I mean geez, this came out on monday, apart from game and forum software bugfixes I think this is the first time I ever contributed to public code in any meaningful way, and at the start it all DID seemed so easy heh, it really wasn’t my intention to require handholding or bughunting. And never was I assuming about it, I went to great pains to just explain my every move, try to be as helpful as I could and expect nothing.

And I slowed down as soon as I realized I wasn’t just improving stuff, but creating bugs.

So yeah, don’t worry, I have slowed down already, at least in this case…

… but generally speaking, it feels very bad to come up with an improvement for something and not share it. I should just stagger it more, and point taken about the testing, but still… right now I’m thinking of Rubberband: Suva said we should pm the author, fair enough, but he can’t receive pm’s, so now I end up sharing my (pretty trivial yet OH SO powerful) Rubberband improvements with s-n-s who is actually happy to use them, which is great, but feels very awkward at the same time. Which it shouldn’t, I’m just improving on a frontend ffs.

And this is just day 3. So yeah, let’s discuss this.

Part of me understands, part of me wants to code (well, let’s say, learn to code haha) at my speed and not be shy about it. Testing yeah, I really stould stagger stuff more… but not releasing stuff to the forum because the author has no time to look at it, and not being allowed to fork either?! That would be a very hard pill to swallow.

Would it be better to not even talk about what I’m doing, not share the incremental updates, and then have so many changes it essentially becomes a fork out of nowhere? Also, the longer code the author hasn’t time to look at is “out there”, the higher the chance someone else improves/fixes it, which leaves the more important stuff to the author. In my naive mind at least, I’m not saying that’s correct. But still, it’s not like there is a deadline, so if you don’t have time to work on it, you’re not working on it anyway, so just ignore me? maybe I have fixed what I broke by the time you do have the time.

At least that’s my take on it, and if this isn’t cool on these forums/individual authors then we need to discuss that surely. Because I can accept that, but I need clearer communication then… it’s not like I knew you had no time, for example, and it also wasn’t like I was bugging you to review my code. I put the stuff out there, and it will still be there in 3 months…

I code in bursts, I always have, and I lose interest when stuff becomes stable. which is why I’m in the long run looking forward to having my own pet projects anyway, otherwise I would drive everybody nuts including myself, I know that. I’ve been thinking that since tuesday, just haven’t come up with anything really good yet. But even then, sometimes stuff just screams fix/improve(/break) me, and then I obey. That cannot be changed, we can only change how I share it on the forums etc.

I don’t see any specific problem in users posting modified sources here on the forum. At least you get feedback if the changes work or not. If the original author has time to glance in in case there are troubles that is an unavoidable thing unfortunately but patience is virtue in these matters or someone else may have a look at it and see what is going on.

One thing i could appreciate is that another programmer comments his additions specially with the background “why” these changes are committed. That alone also might save quite some extra questions.

Johann, sorry, I probably didn’t manage to avoid sounding harsh :)

I had to read all your comments in an hurry these three days, so I got a bit confused about what was going on with your modifications. I suffer of the same form of anxiety about sharing as you do, so believe me: I really understand you, but two anxious people are a big problem, expecially when one of them has little spare time.

I don’t think I am going to have the time to carefully check your changes until at least Sunday, but I’m sorry if my words were stressing

Just my two cents:

Why not create an account on github and put a repo for that particular tool there? Johann seems to already have an account there (I see you seeing me ;)) and that way, he could easily press the “fork” button, have it’s on repo, and hack away all day, happily introducing bugs ;) Then he and the forum users could test his improvements as he makes incremental changes, and as soon as he feels he’s got it right, submit a “pull request” over github. Then you could merge his changes/commits into your own repo, either automatically or in a commit-by-commit process guided by git that steps you through all the changes he made.

The scripts in com.renoise are all published under MIT licence, so you can fork them. Just we don’t encourage to forking for every tiny change.

I also personally prefer to get unified diffs not just random pieces of code. Makes it easier to review and apply it.

But that’s exactly what I’m talking about! A fork with git doesn’t mean that it has to become a separate project. It’s more like a “branch” of the repo (think “local repo with write access”) where a dev can make it’s own commits without affecting the main trunk and then submit them in batch (with git and all it’s bells and whistles [like guided step-merging, leaving his own commit history intact]), or even as one big fat diff/patch file, if you prefer that.

That’s why I recommended github. If the main repo would be there, the owner of the repo would have a nice overview over all forks and the fork owners could submit their changes to the master repo (or get pulled by the master repo) easily.

  
o==[master repo]==o=====[master devs make their commits=====o===[*hack*hack*hack*]===o====>  
 | | ^  
 v v | (devs pull randomdude's changes  
 o==[randomdude forks repo, hacks away]====o==[pull from master]===/ because they think they're good)  
  

Or take at look at this nice graph. This project has 64(!) forks and most of them sync to/from master and other forks. Those are not separate projects. It may look like a mess but git makes it really easy to merge stuff (nothing compared to svn) because everyone has it’s own full history in addition to the master history.

cheers it-alien, and sorry, please take that with a grain of salt.

also cheers noisebeuter, and yes, your mentioning of GIT made me get that account :P but I can only either contribute to projects on there, or start my own - how would that help me contributing patches to other stuff? I’m asking because frankly, beyond registering and following you I haven’t used that site yet, I kinda intended to learn about it by starting my first own project (I already have a good idea btw, simple yet neat: something to manipulate selection size/position in the sample editor, store them as presets etc… yay, can’t wait :lol:)

It’s not like want to, anyway. but making a lot of changes not in sync with the author and then posting them, could in some cases lead to a fork in practice, or confusion etc.

I was VERY tired yesterday, so if my reply sounds pissed off and defensive please credit it to that, it wasn’t meant that way, I really understand that generally, I need to decide between doing my own stuff like I want it, and contributing patches, and the later I really do need to regulate. No debate there. It will take a while to tame myself but I fully intend to try haha.

But I still need that “hey let’s just try this and then ask people on the forum about it” freedom, and I know I have it legally, but can only enjoy it if you people know I’m not expecting my code to get adopted just like that. I code because I enjoy it (and because I enjoy using the results), plain and simple, and I’m a bit nilly willy right now because it’s ALL so new… but I won’t keep that up, promise.

good to know! that and “patches for individual issues/purposes” (rather than “a bunch of changes”) are probably better.

Git != GitHub

Git is a “Version Control System”. Think of it as a big undo history where you can save every change you make to a source file as a patch and later revert to a certain version of the source file. Read this and this.

Github is a site where you can publish your projects with git for others to check it out, make patches etc.

If you have any questions about using git or github, PM me or catch me in #renoise (I’m going to be there tonight). Enough Off-Topic stuff.

cheers :)

version 0.4 uploaded on tools page:

only “add silence” is affected, featuring “frames” measure unit for duration of silence and selection support (thanks Johann). some tiny bugfixes here and there.

Johann: about “remove silence”: I saw in your version you have removed the silence duration definition (the “For more than:” label). was this intended? I don’t understand how the user should define the duration of what they define as “silence” to be removed

but there are two text boxes, where you can enter that amount in seconds or frames. they have tooltips, I just removed that text label… ?