# Tidal-looper memory allocation failure

**URL:** <https://uzu.lurk.org/t/tidal-looper-memory-allocation-failure/5237>\
**Category:** TidalCycles\
**Tags:** installation\
**Created:** [4 July 2024 15:49 UTC](https://uzu.lurk.org/t/tidal-looper-memory-allocation-failure/5237 "2024-07-04T15:49:02Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![blizzy](https://uzu.lurk.org/user_avatar/uzu.lurk.org/blizzy/32/3116_2.png) [@blizzy](https://uzu.lurk.org/u/blizzy)\
**Post date:** [4 July 2024 15:49 UTC](https://uzu.lurk.org/t/tidal-looper-memory-allocation-failure/5237/1 "2024-07-04T15:49:02Z")

</div>

Hello!

Trying to get [tidal-looper](https://github.com/thgrund/tidal-looper) working, but running into issues with buffer allocation. When I execute a line like `once $ s "looper"` (I'm using the default label), I get this error:

```haskell
/b_alloc: memory allocation failed
/b_alloc: memory allocation failed
/b_alloc: memory allocation failed
/b_alloc: memory allocation failed
/b_alloc: memory allocation failed
/b_alloc: memory allocation failed
/b_alloc: memory allocation failed
/b_alloc: memory allocation failed

```

Here is my SC startup file:

```haskell
(
s.reboot { // server options are only updated on reboot
	// configure the sound server: here you could add hardware specific options
	// see http://doc.sccode.org/Classes/ServerOptions.html
	s.options.numBuffers = 1024 * 256; // increase this if you need to load more samples
	s.options.memSize = 8192 * 32; // increase this if you get "alloc failed" messages
	s.options.numWireBufs = 2048; // increase this if you get "exceeded number of interconnect buffers" messages
	s.options.maxNodes = 1024 * 32; // increase this if you are getting drop outs and the message "too many nodes"
	s.options.numOutputBusChannels = 2; // set this to your hardware output channel size, if necessary
	s.options.numInputBusChannels = 2; // set this to your hardware output channel size, if necessary
	s.options.inDevice_("Aggregate Device"); // for tidal looping
	s.options.outDevice_("Screen Recording Audio"); // for screen recording
	// s.options.inDevice_("MacBook Pro Microphone");
	// s.options.outDevice_("MacBook Pro Speakers");
	// boot the server and start SuperDirt
	s.waitForBoot {
		~dirt.stop; // stop any old ones, avoid duplicate dirt (if it is nil, this won't do anything)
		~dirt = SuperDirt(2, s); // two output channels, increase if you want to pan across more channels
		
		// Initialize the TidalLooper
		~looper = TidalLooper(~dirt);

		// You can adjust these parameter even in runtime
		~looper.rLevel = 1.5; // recording level
		~looper.pLevel = 0.8; // prerecording level
		// ~looper.linput = 0; // Default 0; Set this to your main input port.
		// ~looper.lname = "loop"; // default "loop"

		// load mi-ugens.scd synthdefs
		load("Users/may/Library/Application Support/SuperCollider/synthdefs/mi-ugens.scd");

		// load custom synthdefs
		load("/Users/may/Documents/music-tools/tidal/synths.scd");

		~dirt.loadSoundFiles; // load samples (path containing a wildcard can be passed in)
		// for example: ~dirt.loadSoundFiles("/Users/myUserName/Dirt/samples/*");
		~dirt.loadSoundFiles("/Users/may/Documents/music-tools/Samples/*");
		~dirt.loadSoundFiles("/Users/may/Documents/music-tools/Samples/*/*");

		// s.sync; // optionally: wait for samples to be read
		~dirt.start(57120, 0 ! 12); // start listening on port 57120, create two busses each sending audio to channel 0
		SuperDirt.default = ~dirt; // make this instance available in sclang (optional)

		// optional, needed for convenient access from sclang:
		(
			~d1 = ~dirt.orbits[0]; ~d2 = ~dirt.orbits[1]; ~d3 = ~dirt.orbits[2];
			~d4 = ~dirt.orbits[3]; ~d5 = ~dirt.orbits[4]; ~d6 = ~dirt.orbits[5];
			~d7 = ~dirt.orbits[6]; ~d8 = ~dirt.orbits[7]; ~d9 = ~dirt.orbits[8];
			~d10 = ~dirt.orbits[9]; ~d11 = ~dirt.orbits[10]; ~d12 = ~dirt.orbits[11];
		);

		// directly below here, in your own copy of this file, you could add further code that you want to call on startup
		// this makes sure the server and ~dirt are running
		// you can keep this separate and make it easier to switch between setups
		// by using "path/to/my/file.scd".load and if necessary commenting out different load statements
		// ...

		// define global effects for mutable instruments effects
		~dirt.orbits.do { |x|
			var clouds = GlobalDirtEffect(\global_mi_clouds, [\cloudspitch, \cloudspos, \cloudssize, \cloudsdens, \cloudstex, \cloudswet, \cloudsgain, \cloudsspread, \cloudsrvb, \cloudsfb, \cloudsfreeze, \cloudsmode, \cloudslofi]);
			var verb = GlobalDirtEffect(\global_mi_verb, [\verbwet, \verbtime, \verbdamp, \verbhp, \verbfreeze, \verbdiff, \verbgain]);
			x.globalEffects = x.globalEffects
				.addFirst(clouds)
				.addFirst(verb); 
			x.initNodeTree;    
		};                     
		// end define global effects for mutable instruments effects

	};

	s.latency = 0.3; // increase this if you get "late" messages

};
);

```

For more context, I'm using BlackHole (16ch) in order to loop tidal's output for fun feedback stuff, and also to record the results, so I have two aggregate audio setups in my Audio MIDI Setup: "Aggregate Device" (16in, 16out) for input and "Screen Recording Audio" (0ins, 2out) for output. In total, I load 3101 MB in samples at dirt startup.

I've tried switching to my internal microphone & speakers in lieu of the feedback/aggregate setup so see if it was blackhole or something, but I got the same error. I've also tried increasing `memSize` and `numBuffers` separately (by doubling), and got the same error. Looking into [memSize in the SC docs](https://doc.sccode.org/Classes/ServerOptions.html#-memSize) it looks like the value should by in KB rather than MB, but increasing `memSize` to `8192 * 1000` results in startup failure with the error `Exception in World_New: FAILURE IN SERVER: HashTable allocation failed: out of memory!`. I also tried switching the `~looper.linput` to another channel, to no avail.

I got this working on another machine a while back, so not sure what's wrong this time around. Any guidance is appreciated!

---

<div class="post-metadata">

**Author:** ![vlachaizle](https://uzu.lurk.org/user_avatar/uzu.lurk.org/vlachaizle/32/2383_2.png) [@vlachaizle](https://uzu.lurk.org/u/vlachaizle)\
**Post date:** [10 July 2024 10:37 UTC](https://uzu.lurk.org/t/tidal-looper-memory-allocation-failure/5237/2 "2024-07-10T10:37:06Z")

</div>

hello! what happens when you try to run the looped sample anyway ? i have the same error messages but weirdly it doesn't prevent the looper from functioning for me

---

<div class="post-metadata">

**Author:** ![blizzy](https://uzu.lurk.org/user_avatar/uzu.lurk.org/blizzy/32/3116_2.png) [@blizzy](https://uzu.lurk.org/u/blizzy)\
**Post date:** [25 July 2024 14:18 UTC](https://uzu.lurk.org/t/tidal-looper-memory-allocation-failure/5237/3 "2024-07-25T14:18:57Z")

</div>

don't know why I didn't think of that lol, thank you so much! works perfectly 🙂
