Arpeggiator extended #2130

Merged
merged 1 commit into from Sep 10, 2016

Projects

None yet

4 participants

@zonkmachine
Member
zonkmachine commented Jun 23, 2015 edited

Se issue: #2080
Here are some of the new arpeggiator functions.


New functions:

  • Skip - Skips notes. Full on 1% of the notes are played.
  • Miss - Miss notes. Full on this is the same as having 'Random' setting in direction.
@zonkmachine
Member

I couldn't make the original 'Skip' function work as I intended it and I'm not sure it's my coding that's the problem this time. It could be some other bug that's being exposed here.
Anyway. I let the Skip function mute notes last in the arpeggiator function instead and that's a bit wasteful compared to the earlier method of actually skipping over notes but now it works.

@Wallacoloo Wallacoloo referenced this pull request Sep 17, 2015
Open

New arpeggiator functions #2080

3 of 7 tasks complete
@zonkmachine
Member

Toggle switch removed + Squashed.

@tresf
Member
tresf commented Sep 17, 2015

👍

@tresf tresf added the enhancement label Sep 18, 2015
@tresf tresf added this to the 1.2.0 milestone Sep 18, 2015
@zonkmachine zonkmachine modified the milestone: 1.3.0, 1.2.0 Feb 16, 2016
@zonkmachine
Member
zonkmachine commented Feb 24, 2016 edited

@Fastigium
With the fix in #2603 this hack got one step closer to merge.
I rebased it to the latest master and reverted/commented out, a workaround to counter for the base notes hanging which got especially annoying at higher randomness. With #2603 this is fixed but not for the single streamed instruments. The workaround unfortunately leaves lb302 totally untouched by the effect. There is a muted lb302 track in the BBTrack of the demo.
arpextendeddemo.mmp.zip

@Fastigium
Contributor

@zonkmachine Woah there, I'm not sure I get everything you're saying/asking. Let me see...
You're talking about your new Skip function, right? I'm actually not sure why #2603 fixed the base notes hanging for certain instruments. Normally, the NotePlayHandle that was originally sent to an instrument with stacking/arpeggio enabled gets muted because it gets child NotePlayHandles. You can see this here. NotePlayHandle::isMasterNote() returns true if the NotePlayHandle has subnotes or has had them in the past.
So that means that if you skip the first arpeggio note, the original note (base note?) does not get muted that way. Perhaps it gets muted some other way for non-single-streamed instruments now? Weird stuff.

As for the muted lb302 track in the BBTrack, I can't seem to find it. The B&B Editor only shows a kick and a snare, and the lb302 track under the BBTrack is not muted. That one does leave the original NotePlayHandle hanging though, probably for the reason I outlined above. To prevent it, you could add a method setMasterNote() to NotePlayHandle that sets m_hadChildren to true. That'd allow you to mute the base note without actually instantiating a child note.

@zonkmachine zonkmachine changed the title from [WIP] Arpeggiator extended to Arpeggiator extended Sep 7, 2016
@zonkmachine
Member
zonkmachine commented Sep 7, 2016 edited

@Fastigium Thank you so very much! I'm sorry for not replying earlier but I fell out of coding a bit. My post wasn't very clear and the demo project was ill labelled, but you managed to get what I was after.
Anyway, this was precisely what I needed to stomp out the hanging notes bug and by doing so finishing a coding project that's been following me for over two years.

To prevent it, you could add a method setMasterNote() to NotePlayHandle that sets m_hadChildren to true. That'd allow you to mute the base note without actually instantiating a child note.

Worked like a charm... together with setUsesBuffer( false );

@LMMS/developers The new arpeggiator functions for randomisation skip and miss are now ready for testing. Also, a new range limiting function is under development.

@zonkmachine zonkmachine removed the in progress label Sep 8, 2016
@zonkmachine zonkmachine modified the milestone: 1.2.0, 1.3.0 Sep 8, 2016
@zonkmachine
Member

Since the 'hanging note bug' is fixed I'm now switching this back to 1.2

@jasp00 jasp00 and 1 other commented on an outdated diff Sep 9, 2016
src/core/InstrumentFunctions.cpp
@@ -408,7 +408,37 @@ void InstrumentFunctionArpeggio::processNote( NotePlayHandle * _n )
continue;
}
- const int dir = m_arpDirectionModel.value();
+ // Skip notes randomly
+ if( m_arpSkipModel.value() )
+ {
+
+ if( 101 * ( (float) rand() / (float) RAND_MAX ) < m_arpSkipModel.value() )
@jasp00
jasp00 Sep 9, 2016 Member

Why 101 * r / RM < skip instead of 100 * r / (RM + 1) < skip? 100% skip rate should skip always.

@zonkmachine
zonkmachine Sep 9, 2016 edited Member

Yeah. I was trying to find a more interesting response from the knobs. I've reverted to the same algorithm for both functions. Keep it simple, etc...

100% skip rate should skip always.

You're right, and i promised full amnesia.

@jasp00 jasp00 commented on an outdated diff Sep 9, 2016
src/core/InstrumentFunctions.cpp
+ // update counters
+ frames_processed += arp_frames;
+ cur_frame += arp_frames;
+ continue;
+ }
+ }
+
+ int dir = m_arpDirectionModel.value();
+
+ // Miss notes randomly. We intercept int dir and abuse it
+ // after need. :)
+
+ int miss = m_arpMissModel.value();
+ if( miss )
+ {
+ if( 100 * ( (float) rand() / (float) RAND_MAX ) < ( miss * miss ) / 100 )
@jasp00
jasp00 Sep 9, 2016 Member

It should be RAND_MAX + 1 here to get 100% miss rate. Why miss * miss? This is not a percentage.

@jasp00 jasp00 commented on an outdated diff Sep 9, 2016
src/gui/widgets/InstrumentFunctionViews.cpp
@@ -137,6 +139,22 @@ InstrumentFunctionArpeggioView::InstrumentFunctionArpeggioView( InstrumentFuncti
"number of octaves." ) );
+ m_arpSkipKnob->setLabel( tr( "SKIP" ) );
+ m_arpSkipKnob->setHintText( tr( "Fail rate:" ) + " ", " " + tr( "%" ) );
+ m_arpSkipKnob->setWhatsThis(
+ tr( "The skip function will make the arpeggiator pause one step "
+ "randomly. From it's start in full counter clockwise "
@jasp00
jasp00 Sep 9, 2016 Member

From its.

@jasp00 jasp00 commented on an outdated diff Sep 9, 2016
src/gui/widgets/InstrumentFunctionViews.cpp
@@ -137,6 +139,22 @@ InstrumentFunctionArpeggioView::InstrumentFunctionArpeggioView( InstrumentFuncti
"number of octaves." ) );
+ m_arpSkipKnob->setLabel( tr( "SKIP" ) );
+ m_arpSkipKnob->setHintText( tr( "Fail rate:" ) + " ", " " + tr( "%" ) );
+ m_arpSkipKnob->setWhatsThis(
+ tr( "The skip function will make the arpeggiator pause one step "
+ "randomly. From it's start in full counter clockwise "
+ "position and no effect it will gradually progress to "
+ "more or less full amnesia at maximum setting.") );
@jasp00
jasp00 Sep 9, 2016 Member

more or less should not be necessary.

@jasp00 jasp00 commented on an outdated diff Sep 9, 2016
src/gui/widgets/InstrumentFunctionViews.cpp
@@ -137,6 +139,22 @@ InstrumentFunctionArpeggioView::InstrumentFunctionArpeggioView( InstrumentFuncti
"number of octaves." ) );
+ m_arpSkipKnob->setLabel( tr( "SKIP" ) );
+ m_arpSkipKnob->setHintText( tr( "Fail rate:" ) + " ", " " + tr( "%" ) );
@jasp00
jasp00 Sep 9, 2016 Member

Why not Skip rate:?

@jasp00 jasp00 commented on an outdated diff Sep 9, 2016
src/gui/widgets/InstrumentFunctionViews.cpp
@@ -137,6 +139,22 @@ InstrumentFunctionArpeggioView::InstrumentFunctionArpeggioView( InstrumentFuncti
"number of octaves." ) );
+ m_arpSkipKnob->setLabel( tr( "SKIP" ) );
+ m_arpSkipKnob->setHintText( tr( "Fail rate:" ) + " ", " " + tr( "%" ) );
+ m_arpSkipKnob->setWhatsThis(
+ tr( "The skip function will make the arpeggiator pause one step "
+ "randomly. From it's start in full counter clockwise "
+ "position and no effect it will gradually progress to "
+ "more or less full amnesia at maximum setting.") );
+
+
+ m_arpMissKnob->setLabel( tr( "MISS" ) );
+ m_arpMissKnob->setHintText( tr( "Fail rate:" ) + " ", " " + tr( "%" ) );
@jasp00
jasp00 Sep 9, 2016 Member

Miss rate:?

@zonkmachine
Member

@jasp00 I've complied with all of your suggestions. 🐶

@jasp00 jasp00 and 1 other commented on an outdated diff Sep 10, 2016
src/gui/widgets/InstrumentFunctionViews.cpp
@@ -137,6 +139,22 @@ InstrumentFunctionArpeggioView::InstrumentFunctionArpeggioView( InstrumentFuncti
"number of octaves." ) );
+ m_arpSkipKnob->setLabel( tr( "SKIP" ) );
+ m_arpSkipKnob->setHintText( tr( "Skip rate:" ) + " ", " " + tr( "%" ) );
@jasp00
jasp00 Sep 10, 2016 Member

According to the general style, there is no space before %.

@jasp00
jasp00 Sep 10, 2016 Member

The description is trimmed, so there is no need for a space after tr( "Skip rate:" ).

@zonkmachine
zonkmachine Sep 10, 2016 Member

Fixed! I have not clue as to what precisely I was thinking when laying out the text. The Gate knob already has the layout I needed?

@jasp00 jasp00 merged commit a4f5834 into LMMS:master Sep 10, 2016

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
@zonkmachine
Member

🎉

Thanks for meticulous scrutiny and merge!

@zonkmachine zonkmachine deleted the zonkmachine:arpeggiator-extended-squashed branch Sep 10, 2016
@sambler sambler pushed a commit to sambler/lmms that referenced this pull request Sep 19, 2016
sambler Merge branch 'master' into jackmidi
* master: (213 commits)
  Update Pattern and AutomationPattern length (#3037)
  Refresh i18n strings
  Hint text update
  Drop notes with length zero (#3031)
  Background tweak
  Background
  Update Flanger
  Exclude .ts files from the Github linguist
  Redesign Multitap echo (#3008)
  Update i18n source strings
  Extended arpeggiator functions (#2130)
  Fix sample track playback in BB tracks (#3023)
  Sort plug-in embedded resources (#3014)
  Implement version major.minor.release-stage.build (#3011)
  Fix regressions on loading broken projects (#3013)
  Improved file input validation. (#2523)
  Fix sample track view in BB editor (#3002)
  Request change in model when dropping a track (#3000)
  Add LocklessAllocator and use it in LocklessList (#2998)
  Drop forceStep in AutomatableModel (#3010)
  ...
68e72ba
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment