Make some functions static
Fix int overflow when saving audio clips