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

ValueError: operands could not be broadcast together with shapes (472000,) (472000,2) #2

Open
saurabhbidwai opened this issue Dec 13, 2018 · 11 comments

Comments

@saurabhbidwai
Copy link

NewSound = GuassianNoise + array
Traceback (most recent call last):

File "", line 1, in
NewSound = GuassianNoise + array

ValueError: operands could not be broadcast together with shapes (472000,) (472000,2)

@rudrathegreat
Copy link

The arrays are not the same shape.........

@saurabhbidwai
Copy link
Author

saurabhbidwai commented Dec 14, 2018 via email

@rudrathegreat
Copy link

NewSound = np.zeros_like(array) # or array which has shape (472000, 2)

for i in range(2):
    '''If line below gives error, then try doing this - :, i
    If the line still gives the error, then move this part [i, :] next to GuassianNoise and
    then change the line NewSound = np.zeros_like(array) to NewSound = 
    np.zeros_like(GuassianNoise)'''

    NewSound[i, :] = GuassianNoise + array[i, :] 

Or something like that

@rakky18
Copy link

rakky18 commented Mar 28, 2019

not working @rudrathegreat

@shreyask724
Copy link

shreyask724 commented Aug 29, 2019

Same issue can anyone, guide me through this. Please can you give an update if there is any?

@rudrathegreat
Copy link

Hi Guys sorry for the late reply.

Hmmm.... Can't really say much about this problem. I think you need to either -

  1. Read the NumPy documentation
  2. Find a similar problem and see how they solved it
  3. Debug your code in some IDE that allows you to see the shape and content of the array

@JinSolChoi
Copy link

GuassianNoise shape is (n, ) and array shape is (n, 2)
Change array shape (n,2) to (n, )
so just change
-> NewSound = GuassianNoise + array[:, 1]
not NewSound = GuassianNoise + array

@UrsTrulyMahesh84
Copy link

ValueError Traceback (most recent call last)
in
45
46
---> 47 plt.stem(scale[0:5000], np.abs(FourierTransformation[0:5000]), 'r') # The size of our diagram
48 plt.title('Signal spectrum after FFT')
49 plt.xlabel('Frequency(Hz)')

ValueError: setting an array element with a sequence.

i didn't get that.
can i anyone suggest me to solve this error? @saurabhbidwai @rudrathegreat @rakky18 @shreyask724 @JinSolChoi @davidpraise45

@rudrathegreat
Copy link

Again, I am just a 13-year old Python Developer, I have still got a lot to learn. I'm sorry but I can't help in this issue. I'm not an expert.

@manarelbagoury
Copy link

Hello, I have a question. The code was executed perfectly and the new wav file was created but it refuses to be played. How do I solve this?

@rudrathegreat
Copy link

I've experienced similar problems when generating wav files using scipy in general. It's just that the bit rate is way to high, like 18786kbps or something insane like that

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

No branches or pull requests

7 participants