Help modifying Pure Data patch

Hello,

I’m just got my Zynthian and I’m very happy with it. Thank you for this lovely machine.

I’m a lousy drummer and an even louzier midi programmer. Maybe lazy, don’t know.
Because of that I found this Puredata patch for Organelle, which play CR78 drum-patterns with the press of a button. I love the sound of that machine!

Would someone be so kind to explain to me how to modify it to work on the Zynthian?
This is the original: ComputerRhythm78 | Patchstorage

Thank you very much!
Nathan

Give me some time to study the patch and I’ll give you some tips on how to modify it. Do you have a good working knowledge of PureData?

Not really. I’ve played with it and understand the concept but willing to research and learn.
For this patch I would like to be able to choose a rythm/pattern and just start/stop it with a MIDI message.

Thanks for helping!

Hi @NathanI , you can search for @ronsum posts in the forum, he made good contribs about Pure Data Search results for '@ronsum puredata' - Zynthian Discourse

4 Likes

Here’s one of the posts from the link @le51 provided. I think this one would be good to start with as it covers the bulk of the required steps to prepare a PD patch to work with zynthian. Adapt pd files for Zynthian - #9 by ronsum

I studied the patch you want to modify. You can get most of it working on zynthian with about 8 controls.
1.) Volume 2.) Midi Clock (Int/Ext) 3.) Tempo 4.) Compressor (On,Off)
5.) Tamb. Level 6.) Guiro Level 7.)Rhythm/Pattern 8.) Start/Stop
I’m leaving out the Bass Cymbol and Snare mutes, but they could be added if you wanted to. If you want to display the Rhythm names on the zynthian, that will be the most time consuming, but not too difficult. The patch will need some modification to get 5, 6 and 7 working, but that will be simple. If you need help with that, I’ll explain further. I went ahead and make a control patch you will need to add:
midicontrol.pd (1.7 KB)

Of course you will also need to write a yaml file to make the controls show up on the zynthian screen.

Okay, I tried the things explained in your posts but first I want to say that if you don’t have the time for this then don’t pleas feel free to say so. I am a total noob in Puredata.

I have some questions:

  • Should the midicontrol.pd be zipped with the rest of the patch or should I copy the content to the main patch?
  • If so is this the right way?
    Schermafdruk van 2025-01-28 22-30-27
  • I also tried this:
    Schermafdruk van 2025-01-28 22-35-19
    Schermafdruk van 2025-01-28 22-41-05

This is based on stuff I found on the internet. I would be very happy if I could succeed in starting the machine. The with some motivation (and your help) I could do the rest.

Thanks man!

1 Like

I went ahead and updated the midicontrol patch to make it work better and to start the drum machine when it loads. I renamed it to midicontrol2 to keep it from being confused with the original. You can copy the contents to the main patch and it will work, but here is the way I prefer to help keep from more clutter in the main patch. First, place the midicontrol2.pd file in the same folder as the main.pd patch. Next, open the main.pd patch and create a new object and type midicontrol2 in the object box. Save the file and close it. Now reopen main.pd and click on the new midicontrol2 object you just created. A new window should popup showing the midicontrol2.pd patch. Write a yaml file as described in the previous link using the same controller numbers and names used in the midicontrol2 patch. Save it in the same directory as main.pd, then select all of the files and folders in that directory and create a zip file. Follow the intructions in the previous link. The link also explains how to get the patch into your Zynthian. If you did everything correctly, you will see the controllers from your yaml file when the patch loads. Let me know how it goes.
midicontrol2.pd (2.5 KB)

Just my 2 cents… if it was in puredata vanilla without special things like blocksize change and file access, it could then be compiled into a lv2 plugin.
Regards

2 Likes

Woohoo! It works! Thank you very much sir @ronsum !
Here is the patch:
ComputerRhythm78.zip (615.2 KB)

Your midi patch looked way more complex than I would have thought it would be. Thanks!
If you don’t mind, could you explain how “thicks” and “labels” work? I don’t really see an explanation in the wiki. That would be for selecting rhythms instead of from 0 to 127.

Never mind, sorry! I found an old post of yours. I’m trying it out now.

Hey @NathanI - could you please post the link you found for people following along? Thanks.

Most of it comes from this post: Adapt pd files for Zynthian - #11 by Flierelier → All Ronsum’s answers in there are very useful!

I changed the patch. Now it show values and thicks. I hope I got al the rhythms right, maybe someone can check? I counted 20.
ComputerRhythm78.zip (615.3 KB)

Some rhythm changes are very subtle so listen carefuly!

2 Likes

Great job!

Actually, there are 21 rhythms. You’re yaml file allows you to select all of them (0 to 20).
Some things you may want to consider to improve you’re yaml file:

Compressor is only off or on ( value: ‘Off’ labels: [ ‘Off’, ‘On’ ]

Your 21 rhythms could be changed to the rhythm names (Rock 1A, Rock 2A, etc.) instead of numbers 0 to 20. The names can be found by clicking on three objects in the main patch, pd presets (the first 12 names) , pd presets2 ( the next 7 names) and pd shuffle presets (the last two names).

The patch could also be revised to let you use a midi keyboard to select a rhythm using the keyboard keys starting at middle C. This would let you jump directly from lets say rhythm 5 to rhythm 16 by pressing the associated key. Allow me to explain. The patch uses midi notes 60 to 80 to select a patch. Midi note 60 = middle C (C4). The midicontrol.pd uses ctlin 72 to send numbers 60 to 80 to the ‘r notes unpack’ objects in pd presets, pd presets2 and pd shuffle presets. To make it respond to midi notes from a midi keyboard too, just add the following to the midicontrol2.pd patch:
Example

Thanks!

Okay, I changed the yaml file with proper names. When I listen closely it seems that preset 1 & 2 are the same or is it just me?

I followed your advise for adding midi note in select. Is the same patch possible for the mute keys? Example:

I thought your example would work. For some reason, it doesn’t.
To make it work, you will need to edit the main.pd file. Near the center of the patch, you should find the s mute1, s mute2 and s mute2 objects. Delete the moses and sel objects and replace them with a select 81 82 83 object. It should look like this:
mutes
Save the edited main.pd file.

Now add the s notes object to the midicontrol2 file. There’s no need to add another notein object, just connect it to the existing notein like this:
s notes
Save this file too and midi notes 81, 82 and 83 will control the mutes.

Hmm, I did this but it doesn’t mute when pressing the notes.
This is the file I made:
ComputerRhythm78_mutewithnotes.zip (616.1 KB)

  • I made another file where the muting is controlled by midi CC. Lowering the volume is possible by turning the encoders. The yaml file is edited to display the controls. This works quite well.
    ComputerRhythm78_mutewithCC.zip (616.1 KB)

→ Something else: When turning the encoder to change the rhythms Rock 1A and Rock 1B are exactly the same. Only when turning to rhythm 3 the drums changes.
When I do this with the midi notes, Rhythm 1 and Rhythm 2 are different rhythms, so that works. Any idea what this could be?

→ Is this the part that autostarts the patch?

Thanks again!

Sorry, I made several screen captures and sent you the wrong one. To make the mutes work with keys, there needs to be another connection from notein to stripnote. Not only that, but the connections from note in to stripnote must be done in the proper order or it wont work. First delete the existing connection, then add a connection from r notes to the right inlet of stripnote and finally add a connection from r notes to the left inlet of stripnote:
Mutes

Good job using midi CC to control volume. I noticed you got cymbals and snare reversed. Should be mute2 for cymbals, mute3 for snare.

To make the encoder change the rhythms properly is a bit complicated. Short answer, the 21 rhythm names in the yaml are not changed in sync with the object in the patch that actually changes the rhythm. It can be fixed. PM me if you want further details.

Yes, what you suspected autostarts the patch.

2 Likes

Okay, I changed it and everything should work now! Thank you very much!

ComputerRhythm78.zip (616.2 KB)

  • Everything works with encoders
  • Choose rhythms more precisely with midi notes, starting from note 60 (C)
  • Mute bass drum with note 81 (A5)
  • Mute snare & percussion with note 83 (B5)
  • Mute cymbals with 82 (A#5)

Thanks @ronsum for all the heavy lifting!

1 Like

Hi @NathanI !

Good work!! Congratulations!

I’ve tested and it works mostly OK, but i found some details:

  • Rythm selector seems to be offset by 1 or some labels doesn’t match the rythm.

  • The “mute” word in the part volume control titles is confusing for me. I would remove or replace by “vol”.

Thanks!

1 Like