# ZRAM swap alternative

**URL:** <https://discourse.zynthian.org/t/zram-swap-alternative/3722>\
**Category:** Development\
**Created:** [January 23, 2020, 11:45pm UTC](https://discourse.zynthian.org/t/zram-swap-alternative/3722 "2020-01-23T23:45:29Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Baggypants](https://discourse.zynthian.org/user_avatar/discourse.zynthian.org/baggypants/32/1911_2.png) [@Baggypants](https://discourse.zynthian.org/u/Baggypants)\
**Post date:** [January 23, 2020, 11:45pm UTC](https://discourse.zynthian.org/t/zram-swap-alternative/3722/1 "2020-01-23T23:45:29Z")

</div>

I’ve noticed that the buster image seems to have 100MiB swap enabled on /var/swap. I’m currently testing ZRAM from here [https://www.novaspirit.com/2016/12/24/increasing-ram-raspberry-pi/](https://www.novaspirit.com/2016/12/24/increasing-ram-raspberry-pi/)

on my 1GiB pi4 it gives me an effective extra 1GiB ram. I’ve been testing with my usual snapshots and the computational overhead hasn’t had much effect.

Unfortunately it’s still not enough to load the Ivy Audio Piano in 162.

Does anyone know of a SFZ file that linuxsampler struggles to load in 1GiB that might load in 2?

---

<div class="post-metadata">

**Author:** ![sm7x7](https://discourse.zynthian.org/user_avatar/discourse.zynthian.org/sm7x7/32/3126_2.png) [@sm7x7](https://discourse.zynthian.org/u/sm7x7)\
**Post date:** [January 24, 2020, 2:46am UTC](https://discourse.zynthian.org/t/zram-swap-alternative/3722/2 "2020-01-24T02:46:06Z")

</div>

Buy 2gb version, and problem will be solved immediately 🙂

---

<div class="post-metadata">

**Author:** ![Baggypants](https://discourse.zynthian.org/user_avatar/discourse.zynthian.org/baggypants/32/1911_2.png) [@Baggypants](https://discourse.zynthian.org/u/Baggypants)\
**Post date:** [January 24, 2020, 6:43am UTC](https://discourse.zynthian.org/t/zram-swap-alternative/3722/3 "2020-01-24T06:43:49Z")

</div>

Ha, which only works up to 4GiB. At some point it may becomes useful as there may be a soundfont that needs 5GiB. As it is, apart from the Ivy soundfont pretty much everything else fits in 1GB.

---

<div class="post-metadata">

**Author:** ![daniel-jozsef](https://discourse.zynthian.org/user_avatar/discourse.zynthian.org/daniel-jozsef/32/3183_2.png) [@daniel-jozsef](https://discourse.zynthian.org/u/daniel-jozsef)\
**Post date:** [January 24, 2020, 9:26am UTC](https://discourse.zynthian.org/t/zram-swap-alternative/3722/4 "2020-01-24T09:26:16Z")

</div>

Well I see absolutely no point in NOT enabling zram on any linux kernel (especially on SSD systems), besides the potential processing power overhead… I mean, Android phones are all making use of it, so it’s gotta be worth the tradeoff.  
That said, it’s not a magic bullet. It’s compression. I’m not entirely sure, but aren’t soundfonts usually in a format that’s already compressed? Lz4ing a compressed media format will make it _larger_, not smaller. (It has to do with advanced mathematical concepts like entropy, read up at [https://en.wikipedia.org/wiki/Information\_theory](https://en.wikipedia.org/wiki/Information_theory) if interested.) You won’t be loading 5G of soundfonts into a 4G rPi with this.

---

<div class="post-metadata">

**Author:** ![Baggypants](https://discourse.zynthian.org/user_avatar/discourse.zynthian.org/baggypants/32/1911_2.png) [@Baggypants](https://discourse.zynthian.org/u/Baggypants)\
**Post date:** [January 24, 2020, 10:02am UTC](https://discourse.zynthian.org/t/zram-swap-alternative/3722/5 "2020-01-24T10:02:37Z")

</div>

> [@daniel-jozsef](#):
>
> format that’s already compressed?

Not the raw wav ones 🙂

edit: Although the Ivy one I suggested is flac so it’s a moot point.

---

<div class="post-metadata">

**Author:** ![B00t-eek](https://discourse.zynthian.org/user_avatar/discourse.zynthian.org/b00t-eek/32/1867_2.png) [@B00t-eek](https://discourse.zynthian.org/u/B00t-eek)\
**Post date:** [January 24, 2020, 12:04pm UTC](https://discourse.zynthian.org/t/zram-swap-alternative/3722/6 "2020-01-24T12:04:47Z")

</div>

How long would audio samples in a 5gB SF-2 be? Who would have time to hear them? 😉

---

<div class="post-metadata">

**Author:** ![Baggypants](https://discourse.zynthian.org/user_avatar/discourse.zynthian.org/baggypants/32/1911_2.png) [@Baggypants](https://discourse.zynthian.org/u/Baggypants)\
**Post date:** [January 24, 2020, 12:57pm UTC](https://discourse.zynthian.org/t/zram-swap-alternative/3722/7 "2020-01-24T12:57:24Z")

</div>

I rather think we’re talking about a set of samples rather than one. SFZ and SF2 use multiple samples at different pitches and different velocities.

---

<div class="post-metadata">

**Author:** ![jofemodo](https://discourse.zynthian.org/user_avatar/discourse.zynthian.org/jofemodo/32/2_2.png) [@jofemodo](https://discourse.zynthian.org/u/jofemodo)\
**Post date:** [January 24, 2020, 4:00pm UTC](https://discourse.zynthian.org/t/zram-swap-alternative/3722/8 "2020-01-24T16:00:42Z")

</div>

It could be useful for really big FluidSynth (SF2) soundfonts. Linuxsampler implements a on-the-fly-read-from-disk algorithm, so you can use soundfonts much larger than your RAM. Obviously, you need a good SD.

For the rest of engines, i don’t see any benefit and CPU power is too precious for wasting it on compression when not really needed.

Anyway, a checkbox in the webconf is harmless 😉

Regards,
