Cody

Problem 46973. How many bytes an audio requires from RAM?

Solution 3472233

Submitted on 29 Oct 2020 at 18:26 by Tim
  • Size: 56
  • This is the leading solution.
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test Status Code Input and Output
1   Pass
filetext = fileread('audio_size.m'); assert(~contains(filetext, 'eval'), 'eval is forbidden.'); assert(~contains(filetext, 'fopen'), 'fopen is forbidden.'); assert(~contains(filetext, 'regexp'), 'regexp is forbidden.'); assert(~contains(filetext, '!'), 'Shell commands are forbidden.'); assert(~contains(filetext, 'mlock'), 'mlock is forbidden.'); assert(~contains(filetext, 'munlock'), 'munlock is forbidden.');

2   Pass
t = '3m45s'; s = 44100; c = 5; d = 32; assert(strcmp(audio_size(t,s,c,d,[]), '189.26 MB'));

3   Pass
t = '3m36s'; b = 9216; assert(strcmp(audio_size(t,[],[],[],b), '237.30 MB'));

4   Pass
t = '4m17s'; s = 384000; c = 7; d = 24; assert(strcmp(audio_size(t,s,c,d,[]), '1.93 GB'));

5   Pass
t = '3m13s'; b = 1411; assert(strcmp(audio_size(t,[],[],[],b), '32.46 MB'));

6   Pass
t = '9m42s'; b = 132; assert(strcmp(audio_size(t,[],[],[],b), '9.16 MB'));

7   Pass
t = '1m30s'; s = 22050; c = 2; d = 16; assert(strcmp(audio_size(t,s,c,d,[]), '7.57 MB'));

8   Pass
t = '3m37s'; s = 384000; c = 2; d = 16; assert(strcmp(audio_size(t,s,c,d,[]), '317.87 MB'));

9   Pass
t = '4m30s'; s = 92000; c = 2; d = 24; assert(strcmp(audio_size(t,s,c,d,[]), '142.14 MB'));

10   Pass
t = '4m38s'; b = 9216; assert(strcmp(audio_size(t,[],[],[],b), '305.42 MB'));

11   Pass
t = '4m54s'; s = 22050; c = 1; d = 8; assert(strcmp(audio_size(t,s,c,d,[]), '6.18 MB'));

Suggested Problems

More from this Author5

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!