Coder Social home page Coder Social logo

cyberboy666 / r_e_c_u_r Goto Github PK

View Code? Open in Web Editor NEW
266.0 30.0 17.0 16.3 MB

an open diy py/pi based video sampler

License: GNU General Public License v3.0

Python 87.14% Shell 0.36% GLSL 12.50%
video sampler video-sampler diy looper video-looper raspberry-pi hardware video-hardware instrument video-instrument

r_e_c_u_r's Introduction

r_e_c_u_r

an open diy video sampler

vectorfront

r_e_c_u_r is an embedded python/openframeworks application on raspberry pi3 that uses input from the keypad to control video while displaying a simple text ui on a rpi lcd screen

in-depth video demo

video-walkthrough

features

  • seamlessly loop video through rpi's HDMI or composite out
  • intuitively browse video files from external and internal disk and map them into r_e_c_u_r
  • load and trigger video samples from numbered slots in the sampler bank
  • dynamically set and clear the start/end points of each sample as it plays
  • control and sequence all inputs and more with midi-usb
  • many sampler modes for varied playback including: repeat, one-shot, gated, random, fixed-length, random-start and more
  • exhaustive and extendable settings menu to suit your use

extensions

as of V2.0 the r_e_c_u_r platform has been extended in a number of directions to complement live performance and _recur_ , the original video playing engine:

  • _captur_ : input live video via CSI or USB , for live sampling and processing
  • _conjur_ : glsl shader engine, map and trigger shader files and control parameters in real time; generate video or process and mix existing sources
  • _detour_ : in-memory frame sampling (up to 500 frames), video scrubbing, playback speed and direction control, finger drumming
  • toggling internal feedback + strobe effect

NOTE: most of the new V2.0 features are optimised for sd composite video output. Some of these extensions will work over HDMI but they are not fully supported - especially the live video input struggles

extension video walkthroughs

  • conjur_walkthrough
  • captur_walkthrough
  • detour_walkthrough

main objectives:

  • Affordable : reducing the entry cost to performing with video
  • Extendable : laying the foundations (of a user interface and code style) that can be easily iterated on by the community
  • Simple : easy to operate (abstracted completely from ‘driving’ a raspi ) , easy to build (no technical computer install-y or circuit-y knowledge required to diy) , easy to develop (human readable code, inviting amateur/first time coders to contribute)

documentation:

many other things documented on the wiki

status

The nature of this project is to be open-ended and community driven. my r_e_c_u_r already solves the problems i initially built it for. what happens next depends on how it is used and received by you. if you like the idea please let me know / get involved !

contact, donation and thanks

[email protected]

you can find me (and others) at https://scanlines.xyz , an online diy av community space. theres a r_e_c_u_r channel in the chatroom: https://chat.scanlines.xyz/channel/r_e_c_u_r there is also a facebook user group : https://www.facebook.com/groups/114465402691215/

all feedback is appreciated. if you want to donate to this project you can do so with the above email via paypal : everything i receive will go into improving r_e_c_u_r. cheers to Leo Browning for the 3d modelling and vector art and to Ben Caldwell for heaps of help with the code!

r_e_c_u_r's People

Contributors

ben-caldwell avatar bryanlloydtee avatar cabalist avatar coollerue avatar cyberboy666 avatar doctea avatar leobrowning92 avatar perplexagon avatar sebiik avatar steventhebrown avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

r_e_c_u_r's Issues

remove subprocess shell=True calls

various settings and options require the python program to interact with other programs on the pi. apparently its not good practice to use the shell=True , but for some of the more complicated calls i couldnt figure out how to call them correctly.
it is a low priory right now but i should go back and do this properly sometime !

recur handling openframeworks crash

the openframeworks backend sometimes crashes, this seems to be if it tries an action on a video in a format it doesnt like but there could be other reasons ?

  • it would be good to make the of app more resilient to this kindof thing
  • failing that it would be good if recur could 'detect' this or atleast quit the crashed process and start a new one ...

Different play modes including : random, sequence, random start, fixed length etc

some ideas for playback modes :

  • random : loads a random (non-empty) slot from current bank for next playback
  • sequence : allows you to key in a combination of numbers to loop between in current bank
  • random start : loads the next video at a random start point
  • fixed length : always plays videos for the same amount of time (input from BPM tap or something)

create, test and upload v2 of 3d printed panels

some things to consider for v2 of panels:

  • making the panels thicker
  • slightly wider to fix one end of keypad...
  • main support holes slightly bigger for screw size
  • more support pillars ?
  • better screw size? (that doesnt overhang through the top?)
  • add small screw holes for raspberry pi
  • [ ]spacers between screen and pi
  • fitted to the keyboard? a clamp to remove needing to screw in keypad

other vague panel-y things to think about;
how might we design/modify the panels for:

  • eurorack format ? breakout connections of pi inputs?
  • with extra height/inputs of piCaptureHat ?
  • no built in keypad, strictly midi inputs/ a usb a keyboard ?
  • other sbc such as orange pi / pi2 etc ?

changing key mappings on every boot making start up slow

currently , we need to press enter on boot. (due to issue #37 )

then after every boot it maps the keys, however this takes up to 4 seconds , which slows loading time. idealy we wont need to enter on boot (or could have that key press do both enter and our key in meantime) so we can keep the custom mapping until we tell it otherwise

fix the error handling

currently there is some attempt to display info and error messaging on the screen but it needs some work and testing. also should write any 'unexpected' errors to a log file for troubleshooting

write some tests !

its getting to the point where having tests over this project would be v useful !

  • have a view of the code coverage
  • tests over the actions
  • unit tests closer to some pathes
  • changing things breaks the test

creating/accessing different banks

at this stage im thinking of keeping this as simple as possible :

  • each 'bank' has 10 slots. (a video can be refered to as bank.slot )
  • the current display_data.json file will have a list that is appended to
  • three new actions : cycle_bank_forward, cycle_bank_back, clear_current_bank
  • if your highest bank is not empty then auto create a new empty highest bank. if your second highest bank is clear then auto delete the highest bank.

some code refactors

  • need a place for state variables of the system that can be accessed everywhere (kinda weird that the display_mode and control_mode currently live in display class, also needing to access the settings.json without going through data object maybe ?)
  • similar but for helper methods ie read_json
  • some of the depandances around the data area need some work

adjusting video playback speed

on <SAMPLR> mode , an extra column that displayed the playback speed : 1.0 by default ? would have to experiment with max and min values and if different file types / formats have the same or different limits.

a base action : change_speed_by(value) which can be called by parent actions in any of the ways described below

some keys on the num pad are not usable on device

the numlock key and the 000 key have a specific operation that makes it difficult to map within the program. a custom keyboard layout will need to be created on machine to strip these functions and make it easier.

update position variables from integers to floats

start, end and duration need to be updated to floats for more control, rounding up 0.5s could create issues when checking for the end of a clip

also need to add length variable which is the difference between the start and end points

make a dotfiles directory

The purpose of a dotfiles directory being to document the necessary configuration changes made to the pi in order to run the project.

The directory can include the actual config files such as

-.remap
-launcher.sh
-.config/xdg/lxsessions.....autostart
-drivers for the screen
-python packages necessary for installation

fix dev mode

when switching dev on mode the pi reboots with display on hdmi out, when off it reboots to display again

modifying the setting tab to toggle values AND evoke actions

currently settings is used to toggle things - ie change the screen resolution or switch playback mode etc. going forward we may want to trigger an action (ie quit or restart the program, switch to hdmi out). we also could still access key presses that arnt mapped on keyboard - allowing more flexibility around custom mappings, shortcuts and actions...

some hdmi displays struggle with 1080video and the pi struggles with 1080hdmi output

for hdmi devices whose preferred hdmi setting is 1080 , recur seems to drop the video for all filetypes.
it seems to be related to the memory being used (without recur running , two videos is plays fine but three causes same dropout) but changing the gpu/cpu split etc doesnt help.

what does help it is dropping the hdmi output setting down to 720. from here recur will play all videos fine including 1080video files.

while investigating this i also noticed that my hdmi-vga converter (which prefers DMT x DVI) also drops while trying to play 1080 videos. maybe just because it cant handle the scaling etc ?

check if mapped videos still exist

it would be useful if, on startup, the program checked that it could locate each file mapped to a slot. if it couldnt find it, should still display it but grayed out.

support video file types other than mp4

a thorough testing of the video player with respect to a number of variables would be useful including :

  • file type (container and codex ? mp4 vs mkv etc)
  • file length (how does 4 hour videos play ? is seeking slower ? )
  • file resolution (what happens with 1080p files ?)

fix navigation highlighting

the length of selected row is inconsistent

also (internally) the browser index should be absolute rather than relative

also setting and browser navigation seem dependant

recording video input for live sampling

an optional extension : c_a_p_t_u_r - for live video sampling.

  • uses input from raspberry pi camera (or PiCapture boards)
  • a new action : toggle_recording
  • when recording is on, display [recxx:xx] between the now and next on video_display panel.
  • save the file to flashdrive (or pi?) and auto map to a bank
  • have a display mode for monitoring video input, and displaying/switching input channels ...

option to copy videos from device onto recur sd

since most sd cards are 16g or greater , there is plenty of unused space that could store the videos you wanted to perform with , making it easier.

  • would need to check the available space on the sd card before copying.
  • maybe a second function of the browser menu
  • options to copy files or whole folders

usb not showing when inserted after boot

i started up recur , and then plugged in the usb. the files already mapped could be loaded and played fine but the browser mode had not refreshed to reflect this. just need a way to tell the browser list to redraw (if u re-enter the browser screen perhaps ?)

small memory leak in display code

while fixing a noticeable memory leak in the display code (turns out the tk text object stores a list of every state in has been in by default, which is bad if u update the object every half second !) i discovered another much smaller leak in the same area of the code (if i stop the display updating there is no noticeable leaks at all).

when i set the display to update every millisecond , i can see the size of the python process slowly increasing.

im not sure what the problem is atm , i added a reset option in the settings as a workaround if memory maxs out.

v3 of the enclosure

some changes to make to v2 (green) enclosure:

  1. align the raspi slightly under the panel
  2. raise the pi up slightly (?)
  3. tighten the keypad horizontally
  4. adjust the height of keypad platform slightly to fit without rubber feet (?)
  5. resize the keypad platform to fit better and reduce print time (?)
  6. print in black

the video (over HDMI) does not adjust to fit screen

when recur is connected to screens with different resolution it should adjust to fit the screen

have a setting that is screen resolution - this can be toggled between the ones i encounter and can be added to for other cases

compromised video playback on some hdmi displays

  • i have been using an hdmi-to-vga dongle to test and dev recur on an old vga computer monitor.

with this setup the video playback is exactly as expected, however when i try running recur on a real hdmi the video playback experiences some problems :

  • it sometimes freezes the playback a few seconds into playing the video
  • when loading the next video it interrupts the current video and gets stuck displaying first frame of next video rather than finishing what it is playing.

i have spend some time trying to figure out why it seems to work for my hdmi-vga dongle, including trying different (lower) screen resolutions but no luck.

this is the biggest and most crippling bug discovered , if this cant be resolved , i couldnt offer hdmi out from this device

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.