Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update file function #4

Open
X-Raym opened this issue Jun 10, 2018 · 1 comment
Open

Update file function #4

X-Raym opened this issue Jun 10, 2018 · 1 comment
Labels
help wanted Extra attention is needed

Comments

@X-Raym
Copy link
Owner

X-Raym commented Jun 10, 2018

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.

@X-Raym X-Raym added the help wanted Extra attention is needed label Jun 10, 2018
@rudrathegreat
Copy link

rudrathegreat commented Jan 5, 2019

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 -

import numpy as np
from scipy.io.wavfile import write

sps = 44100  # Samples per Second
freq = 440  # Frequency is Hz
time = 5  # Duration of the audio in seconds
amp = 0.3

# Create the Audio

samples = np.arange(time*sps)
waveform = amp * np.sin(2 * np.pi * samples * freq / sps) # Create Waveform
waveform_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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants