GithubHelp home page GithubHelp logo

Comments (3)

ViennaMike avatar ViennaMike commented on August 14, 2024

OK, the problem is that when I improved speed by going to numpy routines rather than lists, I forgot that numpy arrays are immutable, hence the error you received. Try changing he overwrite function in audio.py to:

        def overwrite(data, channels):
            """ overwrites left channel onto right channel for playback"""
            if channels != 2:
                raise ValueError("channels must equal 2")
            levels = np.frombuffer(data, dtype='<i2')
            new_levels = np.copy(levels)
            new_levels[1::2] = levels[::2]
            # levels[1::2] = levels[::2]
            # data = new_levels.tolist()
            # return data
            return new_levels

This seems to be working for me now, with limited testing.

from chatterpi.

ViennaMike avatar ViennaMike commented on August 14, 2024

I've now tested the above fix on both a Pi 4 and a Pi Zero W. On the Zero W, you need to edit the config.ini file to set the buffer size to 8192 (otherwise the zero may not keep up and you sometimes get clipped audio. I'll upload the new code and update the user's manual after Halloween, as I need to get my own skull ready for the big day. I'll keep the issue open until the updated code is posted.

from chatterpi.

ViennaMike avatar ViennaMike commented on August 14, 2024

The corrected source code has been uploaded to GitHub and also incorporated in a new image file.

from chatterpi.

Related Issues (15)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.