Ryanteck RTK.GPIO - x86 port?

Hi All

I am in the process of trying an x86 build of the zynthian using a mini itx platform with a core2duo cpu.

I have already built a PI 3 version, with hdmi touchscreen which worked ok, but had audio dropouts and was looking for a small cheap alternative with more power.

I came across this and purchased one https://ryanteck.uk/electronics/166-rtkgpio.html as it appears to be perfect to bridge the hardware gap for this alternative platform. It would also provide an easy way to expand the gpio on the pi itself.

It only has a python library available, so i contacted gordon who wrote wiringpi and also ryan at ryanteck himself but have not had much luck getting an easy info regarding porting the zyncoder software over to this interface.

Would implementing a pure python version of zyncoder be plausible (with threading etc) or would a C port be necessary to get this working?

I have background in .NET coding and haven’t done any python but could probably get something running - just looking for an input or someone to say “hold on, this will never work!”

Cheers

Ben

FYI here is a link to the discussion I started with Ryanteck

https://rtkgpio.xyz/t/wiringpi-compatibility/100

Hi @benwaterson,

perhaps a native python app can do the encoder stuff… but working with encoders means not to miss an edge of the signal. The best way for this is to use interrupt-service-routines. I am not a python specialist, but I think python cannot do this on its own - you will need some C code in the background (as python-lib-modul?). But give it a try and look for ISR handling of GPIOs for this board (or encoder modules).

The alternative way with an Arduino was also an idea I had a year ago. Currently I have not traced this idea (only some small tests). But this would solve all the encoder problems for very much platforms, because the IRQ handling is “outsourced” onto a separate platform.

“Only” the communication protocoll (via USB-serial) has to be defined and implemented into Zyncoder:

  • self-made (ASCII/binary)?
  • OSC or MIDI?
  • other protocol??? (MQTT, COAP,…)?

I have a problem which also could be solved with an external sensor interface:
I need a Zynthian without TFT. Maximum a small LCD display… if there would be a bidirectional protocol, also LCDs can be used.

Regards, Holger

Hi Ben!

What Audio interface do you plan to use?

Regarding the WiringPi library, the code is pretty straightforward and clean, so i think is better to implement the rtkgpio port. The zyncoder library is not a piece of cake. It implements encoders and switches, but also direct encoder=>MIDI (jack MIDI!) and encoder=>OSC (UDP) bridges. Currently i’m implementing inside it a MIDI router that will allow a few tricks, like having general MIDI-learning, transpose and tuning for all the engines. So, you would have a good amount of work for rewriting zyncoder in Python ;-9

Regards!

Hi

I am using USB midi so don’t need it on the board and don’t need I2C for the audio card as am using the onboard sound of the motherboard and also don’t need pins for display as using hdmi.

So literally just the pins for the rotary controls for now.

If I can implement the serial connection with the board inside the C code (instead of wiringpi) then it may be the easiet option, however I would have to write from scratch as there are no C libraries available as of yet for that board.

The gpio board has an stm32f302 controller on board, so implementing an alternative via an arduino seems counter productive when the board is essentially doing the same thing already so the suggestion about usb <> serial integration in zyncoder from c0d3man seems to fit the bill as this is how the board already works.

I have the rtk.gpio python library downloaded so will have a look at the serial code in there to see how involved converting the protocol over to C would be (i can then retain all of the other zyncoder code mentioned above)

Ideally this would be an add on library to zyncoder (like a plugin)

Cheers

Ben

p.s I have options for pcie sound cards if needed as there is one slot on board.

I appreciate this isn’t a “pure” zynthian device and may not be in the spirit of the project but I like the idea of having a “super zynthian” that uses all the core principles of the project!

Of course is a Zynthian device! :wink: From the Zynthian Wiki:

A Zynthian Box is a hardware device, a small digital computer designed to run the Zynthian Software. Currently it’s based in the Raspberry Pi platform, but it could be easily adapted to other computer platforms.

Regards!

So Ryan at Ryanteck replied and is considering porting wiringpi over to support the gpio board.

I am going to start looking at some C code soon to see if I can integrate into zyncoder as a back up.

I considered looking at using .NET Core as it now supports linux, but this would mean trying to integrate Jack / Alsa which would be a stretch I think (although there is serial comms support)

Will keep you posted of any progress…

Hi @benwaterson!

Can you be more explicit about your audio dropouts with your RBPi-3 Zynthian? What engines/presets provoke the dropouts?

Thanks!

Hi @jofemodo

It was the zynaddsubfx engine with various presets. The notes would just cut out mid playback, seemingly at random.

This is with a pi3 and DAC+ sound card, nothing special apart from using HDMI with a waveshare tft.

Other engines were generally OK unless hitting a lot of notes at once (then the audio would just degrade)

Ben

Hi @jofemodo

I am wondering whether I could retain the RPI as the zyncoder slave and then forward the data to the PC host for processing in zynthian? The RPI would be powered from one of the internal USB ports on the ITX board.

Either over TCP or USB connection? (OSC perhaps)

Is this easily achievable do you think with small modifications to the zyncoder C source?

Is it as easy as changing zyncoder.c line 95 to :

osc_lo_addr=lo_address_new(“xxx.xxx.xxx.xxx”,osc_port_str);

xxx.xxx.xxx.xxx being the remote IP of the PC?

Are all the MIDI references in zyncoder used for the MIDI port on the mcp23008 expansion?

Cheers

Ben

It’s not an easy task, @benwaterson ! The Zynthian GUI is not controlable by OSC/MIDI right now. I would like to implement this feature in the near future, but it will take some months. Of course, you are very welcome to advance the work, but if you intend to do so, better wait a little bit, because i’m finishing a deep refactorization of the engine code and it’s not in the repository yet.

Anyway, i think it’s a lot better if you use an Arduino as controller device. Using a RBpi for that is like killing flies with guns … ;-D

Regards!