How to create a new file?

Every time you open it, it will reply to the previous file. How does sonic-pi create a new file?

Hello @HenDaSheng!

Code storage works a little differently in Sonic Pi.
Each code buffer (0 to 9) is linked to a specific file stored in your home directory, in .sonic-pi/store/default - this is so that when you press ‘Run’, the contents of the current buffer can be stored as a Git commit - allowing each Run to be stored as a separate ‘version’ of the code in the buffer.

If you wish to store a version of your buffer’s code outside of Sonic Pi’s internal Git repository, then you can use the ‘Save’ button in the top button toolbar to save the file wherever you like on your device. (You can also use the ‘Load’ button to open an external Sonic Pi script in the current buffer).

Does that answer your question at all?

Eventually, we’d like to be able to let folks open and save Sonic Pi code files in a more flexible manner - for example, multiple files grouped together in ‘projects’. Perhaps this will include per-project Git storage, rather than a ‘global’ one - who knows. In the meantime though, it is what it is :slightly_smiling_face:


One small note - in the version of Sonic Pi I’m using, the buffers are stored in .sonic-pi/store/default/ (but maybe it’s changed in different versions).


No, that’s just me being in a rush this morning and not having time to confirm it on my computer before I left :wink:

Emlyn is right, .sonic-pi/store/default :slight_smile:


Thanks for your help, but I can’t find the .sonic-pi/store/default folder on my computer, how can I find it?

@HenDaSheng it is a hidden folder - use the menu item or key shortcut available in your Operating System to make hidden files visible if they are not already, and then you should be able to see .sonic-pi in your home directory :slight_smile:

Hope that helps - go ahead and ask if you still have questions :+1:

here the Windows User name is nlb


It is indeed the reason for the hidden folder, I have found it, thank you very much. :grinning:

1 Like

It was so, Thank you very much.