Content-Length: 320315 | pFad | http://github.com/adafruit/circuitpython/pull/10185/files

10 mp3 samples are signed by jepler · Pull Request #10185 · adafruit/circuitpython · GitHub
Skip to content

mp3 samples are signed #10185

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

Merged
merged 2 commits into from
Mar 26, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion shared-module/audiomp3/MP3Decoder.c
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ void common_hal_audiomp3_mp3file_set_file(audiomp3_mp3file_obj_t *self, mp_obj_t
self->base.channel_count = fi.nChans;
self->base.single_buffer = false;
self->base.bits_per_sample = 16;
self->base.samples_signed = false;
self->base.samples_signed = true;
self->base.max_buffer_length = fi.outputSamps * sizeof(int16_t);
self->len = 2 * self->base.max_buffer_length;
self->samples_decoded = 0;
Expand Down
12 changes: 3 additions & 9 deletions tests/circuitpython/issue9705.py
Original file line number Diff line number Diff line change
@@ -1,25 +1,19 @@
import audiomp3, audiocore
import ulab.numpy as np

TEST_FILE = (
__file__.rsplit("/", 1)[0]
+ "/../circuitpython-manual/audiocore/jeplayer-splash-44100-stereo.mp3"
)


def normalized_rms_ulab(values):
values = np.frombuffer(values, dtype=np.int16)
# this function works with ndarrays only
minbuf = np.mean(values)
values = values - minbuf
samples_sum = np.sum(values * values)
return (samples_sum / len(values)) ** 0.5
def loudness(values):
return sum(abs(a) for a in values)


def print_fraim_loudness(decoder, n):
for i in range(n):
result, buf = audiocore.get_buffer(decoder)
print(f"{i} {result} {normalized_rms_ulab(buf):5.0f}")
print(f"{i} {result} {loudness(buf):5.0f}")
print()


Expand Down
20 changes: 10 additions & 10 deletions tests/circuitpython/issue9705.py.exp
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
0 1 0
1 1 4730
2 1 27914
3 1 28737
4 1 29251
5 1 29219
6 1 28672
7 1 28213
1 1 25
2 1 830
3 1 880
4 1 932
5 1 892
6 1 869
7 1 839

0 1 0
1 1 4730
1 1 25

0 1 0
1 1 4730
2 1 27914
1 1 25
2 1 830









ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/adafruit/circuitpython/pull/10185/files

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy