Comments (3)
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.
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.
The corrected source code has been uploaded to GitHub and also incorporated in a new image file.
from chatterpi.
Related Issues (15)
- Could I use and i2c servo controller? HOT 1
- Wont start at boot? HOT 3
- Audio playback stops intermittently HOT 6
- Kill PID vs. .py script HOT 2
- Buffer underrun HOT 7
- Image file not working HOT 2
- Issues when running main.py HOT 4
- Unable to get Chatterpi to Use Microphone - Stops execution HOT 7
- ALSA buffer underruns on some models of Raspberry Pi HOT 18
- Error in control.py causes ChatterPi to not function in one mode. HOT 1
- GUI + Boot On Startup Not Working HOT 37
- Invalid configuration not caught HOT 1
- PIR issue and cannot run on startup HOT 21
- New Feature: upload the .img file for easier installation and use. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from chatterpi.