Comments (6)
I think I fixed the issue by using np.dot(), but in doing so I have found that this code is really not suited for newer versions of numpy/python. This sort of thing comes up multiple times.
from pianoputer.
I am also getting this error,
s1 = np.fft.fft(hanning_window * a1)
ValueError: operands could not be broadcast together with shapes (8192,) (8192,2)
from pianoputer.
This error is due to the fact that you are trying to broadcast and array shape (8192, 2) into a smaller array length 8192.
This scripts is coded for single track (mono sound track) sound and using a stereo sound track will raised
the below error message:
ValueError: operands could not be broadcast together with shapes (8192,) (8192,2)
To avoid this error, you will have to transform your sound into a mono track.
I would strongly recommend to use Audacity to load your sound file and export it as mono soundtrack .
(Audacity) : In the menu go to Tracks -> Mix -> Mix stereo Sound to Mono
When done, export your new sound as a WAV format and use it instead of Bowl.wav sound.
Keep in mind that the mixer has to be init accordingly
e.g
for mono sound : pygame.mixer.init(frequency, -16, 1, 2048)
for stereo sound : pygame.mixer.init(frequency, -16, 2, 2048)
Kind Regards
from pianoputer.
@spacether Good day to you, The above answer provide the explanation of this issue. The ValueError is raised when numpy is trying to broadcast two arrays with different sizes/dimensions.
This happen when a user is loading a stereo sound with the mono version of pianoputer.
If the user is loading a mono track sound then it will works fine for both versions of pianoputer (single & stereo mode).
The stereo version has a method that can check for the sound model (mono or stereo) and process the sound accordingly.
A permanent fix would be to implement a method that check the sound model and throw and explicit error message when user is loading a stereo sound and using the mono version of pianoputer.
Best wishes,
from pianoputer.
Thank you for that explanation. This issue should be fixed in the next version of pianoputer which handles mono and stereo in the same python file. That update is in a PR right now.
from pianoputer.
The above pitchshift code no longer exists in master branch so this issue should be resolved.
Testing with the included mono and stereo wav files verifies that this is resolved.
from pianoputer.
Related Issues (20)
- Nothing happens?
- not supporting two-channel wave files HOT 2
- Direction on the input audio file for the azerty keyboard HOT 2
- PYGAME 2 , SDL2: fix mixer errors, mixer.init(..., allowchanges=0) #861 HOT 7
- Running in background HOT 4
- video effect when playing pianoputer HOT 3
- Can't save KB file HOT 2
- Publishing to pypi HOT 3
- Cannot build/run from source HOT 2
- AttributeError: 'Event' object has no attribute 'key' HOT 6
- 跪拜大佬牛年福星高照 (Kneel down to the big man, the year of the ox???) HOT 2
- 请教您键盘布局图是怎么绘制的?(Ask you how to draw the keyboard layout) HOT 7
- Can i install this with python 3.11? HOT 1
- License
- pitch_shift() takes 1 positional argument but 2 positional arguments (and 1 keyword-only argument) were given HOT 1
- hey why doesnt this thing get fixed
- Harpsichord more than a PianoForte?? HOT 2
- Unable to Transpond Sound File HOT 2
- Idea: Try mapping the keys to a stenography machine layout. HOT 7
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 pianoputer.