monome / softcut-lib Goto Github PK
View Code? Open in Web Editor NEWsample cutting library
License: GNU General Public License v3.0
sample cutting library
License: GNU General Public License v3.0
i feel like i've stumbled onto a bug, so logging it here before i look at the softcut code (tomorrow)
ex: if looping from 0-2 and move the loop points to 2-4 and the position to 3 (ie, mid-loop) somehow the position lands on 2, not 3.
likewise if loop is at 2-4, setting it to 0-2 and position to 1 (mid-loop) will actually put position at 0 (loop start).
test code below shows this (use K2 and K3 to set loop regions, feedback is visual from the phase callback)
function init()
softcut.enable(1,1)
softcut.buffer(1,1)
softcut.loop(1,1)
softcut.loop_start(1,0)
softcut.loop_end(1,2)
softcut.position(1,0)
softcut.play(1,1)
softcut.phase_quant(1,0.0625)
softcut.event_phase(update_positions)
softcut.poll_start_phase()
end
pos = {}
function update_positions(n,d)
pos[n] = d
redraw()
end
function redraw()
screen.clear()
screen.move(20,10)
screen.line_rel(pos[1]*16,0)
screen.stroke()
screen.move(0,50)
screen.font_face(2)
screen.text(pos[1])
screen.update()
end
function key(n,z)
if n==2 and z==1 then
softcut.loop_start(1,0)
softcut.loop_end(1,2)
softcut.position(1,1)
elseif n==3 and z==1 then
softcut.loop_start(1,2)
softcut.loop_end(1,4)
softcut.position(1,3)
end
end
record head position is computed by adding record offset to write head position, then wrapping.
this wraps to buffer size, not to loop size, e.g. here:
https://github.com/monome/norns/blob/master/crone/src/softcut/SubHead.cpp#L130
it doesn't matter until you start changing the offset amount. then you can have material in the loop that was written with the old offset, but which will never be hit with the new offset.
made a branch that had SubHead
tracking loop positions in frames and using that for wrapping. but it's not quite enough, because wrap points should be [start, end+fade]
when rate > 0, and [start-fade, end]
when rate < 0. and rate can change each sample... so this bookkeeping should happen in the parent SoftCutHead
, and maybe it's not quite worth it at all.
add some waveshapers (e.g. from dsp-kit
)
would be helpful to have a non-periodic poll that simply fires when a loop happens in softcut (with voice ID number perhaps)
the old ugen did this.
requires:
lo_send
analog.it would be nice to have a couple more clients
these should be pretty easy to make now.
... stop
for short?
in buffered-state version (dev branch), still some nasty glitches when changing rate sign, which seem to recur every audio block, or something
they seem to go away after the first loop.
i think this is because recordOffsetSamples doesn't get applied to wrIdx until wrIdx is reset when fading in for a new loop. so we probably need to flag rate sign change, and re-apply record offset when needed
replace dumb 1-pole log smoothers with tapered envelopes.
important for a good experience when modulating playback/rec/pre levels.
arbitrary easing functions and LFO/sequencing modes could make it fun for movement rate as well.
see this thread:
https://llllllll.co/t/norns-2-0-softcut/20550/147?u=zebra
under some condition, which is not yet understood, enabling record flag on a playing voice will cause material to be written to the wrong part of the buffer.
it seems likely that the inactive sub-head is erroneously writing (?)
i will work on a minimal repro case. but the example case goes like this:
if step (3) occurs after a loop has already happened, the problem isn't seen.
allow voice N
to modulate its playback level as a function of it's position, and that of a second voice M
.
this can be used to apply a fadeout around the clicks that would otherwise occur when M
is writing and N
is reading, at different rates.
add a mode for any voice N
to copy its position and level settings from voice M
on each block, instead of computing them.
this could be used to create stereo pairs (with arbitrary pan/width no less.)
I tried to compile on a macOS (x86_64) and had to make the following changes to enable compilation without errors.
A fix to clients/softcut_jack_osc/src/BufDiskWorker.cpp
to include <array>
Some additions to clients/softcut_jack_osc/CMakeLists.txt
to make it work nicely with homebrew installed dependencies if available.
The patch is as follows and attached at the end of this post:
diff --git a/clients/softcut_jack_osc/CMakeLists.txt b/clients/softcut_jack_osc/CMakeLists.txt
index 08798c0..6381cc6 100644
--- a/clients/softcut_jack_osc/CMakeLists.txt
+++ b/clients/softcut_jack_osc/CMakeLists.txt
@@ -13,9 +13,38 @@ set(SRC src/main.cpp
add_executable(softcut_jack_osc ${SRC})
-include_directories(../../softcut-lib/include)
-target_link_libraries(softcut_jack_osc softcut jack lo pthread sndfile)
+if(CMAKE_HOST_APPLE)
+ execute_process(
+ COMMAND brew --prefix
+ OUTPUT_VARIABLE HOMEBREW_PREFIX
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+ )
+ if(DEFINED HOMEBREW_PREFIX)
+ set(HAS_HOMEBREW 1)
+ message(STATUS "HAS_HOMEBREW: ${HAS_HOMEBREW}")
+ message(STATUS "HOMEBREW_PREFIX: ${HOMEBREW_PREFIX}")
+ endif()
+endif()
+
+
+include_directories(
+ ../../softcut-lib/include
+ $<${HAS_HOMEBREW}:${HOMEBREW_PREFIX}>/include
+)
+
+target_link_directories(softcut_jack_osc
+ PRIVATE
+ $<${HAS_HOMEBREW}:${HOMEBREW_PREFIX}>/lib
+)
+
+target_link_libraries(softcut_jack_osc
+ softcut
+ jack
+ lo
+ pthread
+ sndfile
+)
target_compile_options(softcut_jack_osc PRIVATE -Wall -Wextra -pedantic)
diff --git a/clients/softcut_jack_osc/src/BufDiskWorker.cpp b/clients/softcut_jack_osc/src/BufDiskWorker.cpp
index e5c8dc4..8b65230 100644
--- a/clients/softcut_jack_osc/src/BufDiskWorker.cpp
+++ b/clients/softcut_jack_osc/src/BufDiskWorker.cpp
@@ -12,6 +12,7 @@
#include <sndfile.hh>
#include <utility>
+#include <array>
#include "BufDiskWorker.h"
a full SVF before write head seems redunant.
considering replacing it, e.g. with a simpler LPF that is always modulated by rate but can be toggled on and off.
add a nice variable bitcrusher (compander + modulo), maybe before post-filter
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.