The best free alternative to Sonic Pi is SuperCollider, which is both free and Open Source. If that doesn't suit you, our users have ranked more than 10 alternatives to Sonic Pi and 15 is free so hopefully you can find a suitable replacement. Other interesting free alternatives to Sonic Pi are Csound (Free, Open Source), ChucK (Free, Open Source), Synthesine (Free, Open Source) and Nyquist (Free, Open Source).
Gibber is a creative coding environment for audiovisual performance and composition. It contains features for audio synthesis and musical sequencing, 2d drawing, 3d scene construction and manipulation, and live-coding shaders.
AudioMasher is a live, in-browser audio and music programming environment. The app is based on the Sporth audio programming language by Paul Batchelor, is open-source and can be used online or via self-hosting.