WolframScript in Zynthian?

Wolfram software (previously named Mathematica) is available for free for Raspberries. It can produce sound. Has anybody tried to install it on a Zynthian?

If they have, they haven’t talked about it here.

I cannot see any obvious benefit to this. If you want to play with it and report on your sucess and give some context of how it may be useful, then feel free. We are always interested to hear what people are doing with zynthian.

In Wolfram, one can give a mathematical function as a waveform and immediately listen to it. I put some examples of this on one of my websites. Waveforms and sounds

1 Like

I tried, and installation failed.
Are there any experts here who can tell me what the error messages indicate and how this might be possibly resolved?
(venv) root@zynthian:~# sudo apt install wolfram-engine
Reading package lists… Done
Building dependency tree… Done
Reading state information… Done
The following additional packages will be installed:
libpcre3
The following NEW packages will be installed:
libpcre3 wolfram-engine
0 upgraded, 2 newly installed, 0 to remove and 80 not upgraded.
Need to get 1,656 MB of archives.
After this operation, 4,446 MB of additional disk space will be used.
Do you want to continue? [Y/n]
Get:1 Index of /debian bookworm/main arm64 libpcre3 arm64 2:8.39-15 [313 kB]
Get:2 Index of /debian bookworm/main arm64 wolfram-engine arm64 14.1.0+202408191410 [1,656 MB]
Fetched 1,656 MB in 56s (29.4 MB/s)
E: Unable to mkstemp /var/cache/debconf/tmp.ci/wolfram-engine.template.v40HwK - GetTempFile (30: Read-only file system)
E: Unable to mkstemp /var/cache/debconf/tmp.ci/wolfram-engine.config.IWrDv5 - GetTempFile (30: Read-only file system)
debconf: apt-extracttemplates failed: No such file or directory
Could not exec dpkg!
E: Could not open file /var/lib/apt/extended_states - open (5: Input/output error)
E: Failed to open StateFile /var/lib/apt/extended_states
E: Sub-process /usr/bin/dpkg returned an error code (100)
W: Problem unlinking the file /var/cache/apt/pkgcache.bin - pkgDPkgPM::Go (30: Read-only file system)
E: Problem executing scripts DPkg::Post-Invoke ā€˜/usr/bin/test -e /usr/share/dbus-1/system-services/org.freedesktop.PackageKit.service && /usr/bin/test -S /var/run/dbus/system_bus_socket && /usr/bin/gdbus call --system --dest org.freedesktop.PackageKit --object-path /org/freedesktop/PackageKit --timeout 4 --method org.freedesktop.PackageKit.StateHasChanged cache-update > /dev/null; /bin/echo > /dev/null’
E: Sub-process returned an error code

You seem to have a readonly filesystem. Post the result of mount which should show your filesystem mounts and parameters.

On my zynthian this is not happening. I can run the installation without error, so it is an issue with your machine.

This happene d on a fresh copy of oram, i just created the SD card, booted and then tried to instal wolffram-engine

(venv) root@zynthian:~# mount

sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)

proc on /proc type proc (rw,relatime)

udev on /dev type devtmpfs (rw,nosuid,relatime,size=4081728k,nr_inodes=255108,mode=755)

devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)

tmpfs on /run type tmpfs (rw,nosuid,nodev,noexec,relatime,size=824560k,mode=755)

/dev/mmcblk0p2 on / type ext4 (rw,noatime)

securityfs on /sys/kernel/security type securityfs (rw,nosuid,nodev,noexec,relatime)

tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev)

tmpfs on /run/lock type tmpfs (rw,nosuid,nodev,noexec,relatime,size=5120k)

cgroup2 on /sys/fs/cgroup type cgroup2 (rw,nosuid,nodev,noexec,relatime,nsdelegate,memory_recursiveprot)

pstore on /sys/fs/pstore type pstore (rw,nosuid,nodev,noexec,relatime)

bpf on /sys/fs/bpf type bpf (rw,nosuid,nodev,noexec,relatime,mode=700)

systemd-1 on /proc/sys/fs/binfmt_misc type autofs (rw,relatime,fd=30,pgrp=1,timeout=0,minproto=5,maxproto=5,direct,pipe_ino=4218)

mqueue on /dev/mqueue type mqueue (rw,nosuid,nodev,noexec,relatime)

tracefs on /sys/kernel/tracing type tracefs (rw,nosuid,nodev,noexec,relatime)

debugfs on /sys/kernel/debug type debugfs (rw,nosuid,nodev,noexec,relatime)

fusectl on /sys/fs/fuse/connections type fusectl (rw,nosuid,nodev,noexec,relatime)

configfs on /sys/kernel/config type configfs (rw,nosuid,nodev,noexec,relatime)

ramfs on /run/credentials/systemd-sysctl.service type ramfs (ro,nosuid,nodev,noexec,relatime,mode=700)

ramfs on /run/credentials/systemd-sysusers.service type ramfs (ro,nosuid,nodev,noexec,relatime,mode=700)

ramfs on /run/credentials/systemd-tmpfiles-setup-dev.service type ramfs (ro,nosuid,nodev,noexec,relatime,mode=700)

/dev/mmcblk0p1 on /boot/firmware type vfat (rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,errors=remount-ro)

tmpfs on /tmp type tmpfs (rw,nosuid,nodev,noatime,size=102400k)

tmpfs on /var/log type tmpfs (rw,nosuid,nodev,noexec,noatime,size=51200k)

tmpfs on /var/tmp type tmpfs (rw,nosuid,nodev,noatime,size=204800k)

ramfs on /run/credentials/systemd-tmpfiles-setup.service type ramfs (ro,nosuid,nodev,noexec,relatime,mode=700)

sunrpc on /run/rpc_pipefs type rpc_pipefs (rw,relatime)

binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,nosuid,nodev,noexec,relatime)

tmpfs on /run/user/0 type tmpfs (rw,nosuid,nodev,relatime,size=824544k,nr_inodes=206136,mode=700)

Looks okay. What is the output of df -h?

(venv) root@zynthian:~# df -h
Filesystem Size Used Avail Use% Mounted on
udev 3.9G 0 3.9G 0% /dev
tmpfs 806M 14M 792M 2% /run
/dev/mmcblk0p2 59G 16G 41G 28% /
tmpfs 4.0G 104M 3.9G 3% /dev/shm
tmpfs 5.0M 48K 5.0M 1% /run/lock
tmpfs 100M 80K 100M 1% /tmp
tmpfs 50M 80K 50M 1% /var/log
tmpfs 200M 0 200M 0% /var/tmp
/dev/mmcblk0p1 510M 65M 446M 13% /boot/firmware
tmpfs 806M 0 806M 0% /run/user/0

Hmmm… all looks okay. What about memory? Try, free to show the memory usage.

[Edit] The only thing I noticed different in the mount is that I have a larger /tmp which I did to work around an issue compiling large projects. I reset to default and was still able to install wolfram.

You could also check the file permission of your /var/cache/debconf/tmp.ci folder, e.g. ls -ld /var/cache/debconf/tmp.ci. And you can check whether it is writable with:

touch /var/cache/debconf/tmp.ci/test
ls /var/cache/debconf/tmp.ci
rm /var/cache/debconf/tmp.ci/test

Everything you mentioned works

(venv) root@zynthian:~# free
total used free shared buff/cache available
Mem: 8245568 678064 7217568 121504 557664 7567504
Swap: 0 0 0
(venv) root@zynthian:~# ls -ld /var/cache/debconf/tmp.ci
drwxr-xr-x 2 root root 4096 Jun 14 11:19 /var/cache/debconf/tmp.ci
(venv) root@zynthian:~# touch /var/cache/debconf/tmp.ci/test
(venv) root@zynthian:~# ls /var/cache/debconf/tmp.ci
test
(venv) root@zynthian:~# rm /var/cache/debconf/tmp.ci/test
(venv) root@zynthian:~#

I got further.
Until now, I had used oram 2504.1, and doung updates from the browser interface did not upgrade to 2505.1.
So I created a new SD-card with 2505.1.
Then I could install wolfram-engine, and it works!
The Wolfram function EmitSound, however, does not produce any sound.
So i created a wav file and tried to play it from the command line, which produced an error
(venv) root@zynthian:~# aplay tone.wav

aplay: main:831: audio open error: Device or resource busy

Zynthian uses jack as it’s audio layer which takes control of the raw alsa devices. You would need to find a way to make Wolfram use jack.

This produces sound, but nevertheless shows errors

(venv) root@zynthian:~# vlc --aout jack tone.wav

VLC media player 3.0.21 Vetinari (revision 3.0.21-0-gdd8bfdbabe8)

[000055567b74fdb0] main interface error: no suitable interface module

[000055567b671560] main libvlc error: interface ā€œglobalhotkeys,noneā€ initialization failed

[000055567b671560] main libvlc: Running vlc with the default interface. Use ā€˜cvlc’ to use vlc without interface.

[000055567b74fdb0] skins2 interface error: cannot initialize OSFactory

[000055567b74fdb0] [cli] lua interface: *Listening on host "console".

VLC media player 3.0.21 Vetinari

Command Line Interface initialized. Type `help’ for help.

perplexity suggested to create
/etc/asound.conf

with content

pcm.!default {
type plug
slave.pcm ā€œjackā€
hint.description ā€œJack Audioā€
}

which should reroute ALSA output to JACK (which wolfram is supposed to use), but this did not work.