Audio-Signal-Processing icon indicating copy to clipboard operation
Audio-Signal-Processing copied to clipboard

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

Open saurabhbidwai opened this issue 6 years ago • 11 comments

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)

saurabhbidwai avatar Dec 13 '18 05:12 saurabhbidwai

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

rudrathegreat avatar Dec 14 '18 05:12 rudrathegreat

I know that but the process you defined will give this structure at that point

On Fri, Dec 14, 2018 at 10:58 AM Rudra [email protected] wrote:

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

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/davidpraise45/Audio-Signal-Processing/issues/2#issuecomment-447218129, or mute the thread https://github.com/notifications/unsubscribe-auth/AVYJOjGZXdbilkEOyy2gPFUivDq96facks5u4zbugaJpZM4ZQ7rA .

saurabhbidwai avatar Dec 14 '18 05:12 saurabhbidwai


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

rudrathegreat avatar Jan 02 '19 13:01 rudrathegreat

not working @rudrathegreat

rakky18 avatar Mar 28 '19 20:03 rakky18

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

shreyask724 avatar Aug 29 '19 12:08 shreyask724

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

rudrathegreat avatar Sep 01 '19 05:09 rudrathegreat

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

JinSolChoi avatar Sep 18 '19 05:09 JinSolChoi

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

UrsTrulyMahesh84 avatar Dec 09 '19 08:12 UrsTrulyMahesh84

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.

rudrathegreat avatar Dec 10 '19 02:12 rudrathegreat

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?

manarelbagoury avatar Aug 01 '20 22:08 manarelbagoury

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

rudrathegreat avatar Aug 02 '20 04:08 rudrathegreat