You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Question - What exactly are you trying to save in the file?
If the answer is audio or something to do with audio, then maybe try doing this -
importnumpyasnpfromscipy.io.wavfileimportwritesps=44100# Samples per Secondfreq=440# Frequency is Hztime=5# Duration of the audio in secondsamp=0.3# Create the Audiosamples=np.arange(time*sps)
waveform=amp*np.sin(2*np.pi*samples*freq/sps) # Create Waveformwaveform_int=np.int16(waveform)
write('wave.wav', sps, waveform_int)
print('Wavefile has been saved')
This is a simple program creating a sine wave of freq 440.Hz and a duration of 5 seconds. It then computes the waveform , puts it in an array, decreases each of the values in the array, then saves it in a .wav file giving the samples per second and the data itself.
A function to update a file rather than rewriting it entirely would be far quicker for huge files.
Some chunk could be just nulled and duplicated at the end.
The text was updated successfully, but these errors were encountered: