carykh / recordTrimEdit

Records audio, trims it, and allows you to edit it, all in one fell swoop.
MIT License
66 stars 9 forks source link

Array reshape error & Output is white noise #6

Open GDNacho opened 5 months ago

GDNacho commented 5 months ago

First:

line 230, in drawWaveforms(screen) line 128, in drawWaveforms audio_array = audio_array.reshape((882))

ValueError: cannot reshape array of size 1764 into shape (882,)

I changed the number to 1764 and the program seemed to work, but the audio input was white noise (the waveform was just a black wall)

Running on Windows 10 x86-64, Python 3.12.2 Opening a new issue because they're 2 different problems it seems

ThaBluNate commented 5 months ago

Getting this on py 3.12.0, I'll try 3.10.4 since that is what Cary uses in the video.

ThaBluNate commented 5 months ago

Using Python 3.10.4 did not work :(

I also tried using pygame 2.1.2, but that didn't work either, there's really no telling what package versions Cary is using past that.

ThaBluNate commented 5 months ago

So I dug into it a little more, and it looks like cary is using the numpy reshape with... 1 parameter? Commenting out the line is equivalent to changing the argument to 1764.

Anyways line 128 is just for drawing the waveform and isn't the cause of the noise, recording seems just a liiiiiiiiittlllle jacked. (and why the waveform is just a black wall, at least it's accurate)

I edited the code a bit to see what audio_waveform was and got this: (this is a very small portion of the actual result)


pygame 2.1.2 (SDL 2.0.18, Python 3.10.4)
Hello from the pygame community. https://www.pygame.org/contribute.html
-9399
11597
-21011
-21107
-22829
11709
-6477
-21001
-12080
11806
8370
-20920
-12425
11896
8319
-20839
28591
11963
-31299
-20763
-11641
12045
-26519
-20685
-1918
12143
-7797
-20556
11893
12355
-3200
12326
32560
-20281
-6201
12589
32254
-20486
1181
-20143
-576
-20653
10258
-20450
27661
-20200
5232
11800
664
-20645
ben9583 commented 5 months ago

Can you try this with the requirements.txt that's been added since? Also is there anything unconventional you know about with your audio device?

GDNacho commented 5 months ago

Can you try this with the requirements.txt that's been added since? Also is there anything unconventional you know about with your audio device?

I tried again, same array reshape error, if i remove the line output is still white noise, nothing unconventional about my microphone, it works in other programs like obs and audacity

ben9583 commented 5 months ago

I'll try and triage this but I'm still not getting this error at all; maybe can you also print the shape of audio_array and some values from it and post it here?

GDNacho commented 5 months ago

audio_array shape is (1764,) some values are [-28984 11126 -30817 ... -18714 25420 -18712]

arpozmocht commented 4 months ago

Also getting this error on Windows 11. Tested multiple microphones, all have the same issue. I'd love to provide any info I can

ben9583 commented 4 months ago

I'm gonna dive deeper on this later in the week; see if I can make something out of this all.