A question of midi from Beginner

hi guys!
i’m a Beginner and also i’m a Beginner of music, I want to ask you guys a question that gives me a headache. how i control a loop sample with midi?


in the tutorial, i haven’t find the way too control these loops with midi. if i want adjust the RATE or AMP, What codes should I use?

Hi there, please use the correct category for your post. I have now moved it from events workshops and lessons which is for announcements, not for support questions. Note that to engage with the full forums (all categories starting with [P]) you need to support further development on Patreon - https://patreon.com/samaaron

To answer your question, you need to look at Section 7 of the built-in tutorial on Control: http://sonic-pi.net/tutorial.html#section-7 This should give you an idea of how to control the modifiable opts of a synth or sample. Then it’s just a matter of creating a live_loop which gets the latest MIDI values and uses them in a call to control periodically or one that syncs on the next MIDI value and uses the value to call control. Note that use_real_time is also important to be called in threads which are working with live external data.

Also, for future posts, please use a more descriptive title. In this case a good candidate would be “Controlling samples with MIDI” :slight_smile:

thank you very much for your answer!
but i still don’t understand how to make my code,forgive me, my logical ability is not good.

Hey lin, thank-you so much for becoming a patron :slight_smile:

Could you possibly explain in a little more detail what it is you’re trying to do? What might be the simplest thing that’s towards your end goal. If we can help you out with that first step, then we can iterate and help you either until you can do what you want or ideally you’re in a position to do it yourself without assistance…

Hey i am here
Yes,I want to try how to use Midi board to control the parameters of the loop, control their rate and sound size

Hi lin,

could you expand a little on what you mean by ‘parameters of the loop’. Are you referring to the synths and samples triggered inside a loop?

I think the first step might be to change and modify these parameters with code before introducing the extra complexity of working with MIDI controllers.

Could you share a short snippet of code and let me know which bits you’d like to be able to change and how?