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

channels error in func saveWave #20

Closed
lomizandtyd opened this issue Sep 18, 2017 · 1 comment
Closed

channels error in func saveWave #20

lomizandtyd opened this issue Sep 18, 2017 · 1 comment
Labels

Comments

@lomizandtyd
Copy link

def saveWave(filename, data, samplerate, verbose=False) :
    if verbose: print("Saving wave file:",filename)
    blockSize = 512
    channels, frames = data.shape                             # data.shape -> (channels, frames)
    fullblocks = frames // blockSize
    lastBlockSize = frames % blockSize
    with WaveWriter(filename, channels=channels, samplerate=samplerate) as w :
        for i in range(fullblocks) :
            w.write(data[blockSize*i:blockSize*(i+1)])    # blockSize for 'frames'  dimension, not for 'channels' dimension..
        if lastBlockSize :
            w.write(data[fullblocks*blockSize:])

in line w.write(data[blockSize*i:blockSize*(i+1)])

it may be w.write(data[:, blockSize*i : blockSize*(i+1)])

@vokimon
Copy link
Owner

vokimon commented Sep 21, 2017 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants