登录论坛

查看完整版本 : Code for Sonic and Ten Sonic Movies - Cleve Moler on Mathematics and Computing


poster
2024-12-18, 23:52
Two previous blog posts, Dec. 12, 2024 (https://blogs.mathworks.com/cleve/2024/12/08/sonic-adds-sound-to-logo-recaman-chaos/) and Nov. 16, 2024 (https://blogs.mathworks.com/cleve/2024/11/16/lights-camera-action-and-sound/), introduced "Sonic", my new tool for incorporating sound in videos. Today's blog post includes a link to the MATLAB source code for Sonic, as well as links to new versions of ten examples.

Contents


Code (https://www.labfans.com/bbs/#430e1f71-5674-4dd0-9822-ecdf14267246)
Sonic (https://www.labfans.com/bbs/#261cb182-c13b-4b1e-9932-f52485ff1334)
Ten Movies (https://www.labfans.com/bbs/#c9a4823d-d0b6-48fd-a9f0-388f00ec93b3)

Code

The MATLAB code for Sonic and all the examples is available in this 11 MB zip file.

Sonic.zip (https://blogs.mathworks.com/cleve/files/Sonic.zip)

Sonic

There are two ways to generate the musical sounds. The three movies Warm-Up, TanSin and Blackjack use recordings of C-major scales played on three different pianos. All the other movies rely on resampling (https://www.mathworks.com/help/signal/ref/resample.html) a single note from a trumpet, xylophone or piano.

The function sonic_examples(kases,n) is a driver for sonic. The first parameter, kases, is an integer vector of desired examples, 0 though 9. The second parameter, n, is the number of desired samples.


n = 25 is very fast
n = 100 is reasonable
n = 200 is the default
n = 300 is overkill

Ten Movies

Here are links to new versions of the animated videos, and the final frames.

0. Warm-Up

sonic_examples_0.mp4 (https://blogs.mathworks.com/cleve/files/sonic_examples_0.mp4)

http://blogs.mathworks.com/cleve/files/sonic_examples_0.png

1. Lissajous

sonic_examples_1.mp4 (https://blogs.mathworks.com/cleve/files/sonic_examples_1.mp4)

http://blogs.mathworks.com/cleve/files/sonic_examples_1.png

2. Mertens

sonic_examples_2.mp4 (https://blogs.mathworks.com/cleve/files/sonic_examples_2.mp4)

http://blogs.mathworks.com/cleve/files/sonic_examples_2.png

3. TanSin

sonic_examples_3.mp4 (https://blogs.mathworks.com/cleve/files/sonic_examples_3.mp4)

http://blogs.mathworks.com/cleve/files/sonic_examples_3.png

4. Van der Pol

sonic_examples_4.mp4 (https://blogs.mathworks.com/cleve/files/sonic_examples_4.mp4)

http://blogs.mathworks.com/cleve/files/sonic_examples_4.png

5. VdP Derivative

sonic_examples_5.mp4 (https://blogs.mathworks.com/cleve/files/sonic_examples_5.mp4)

http://blogs.mathworks.com/cleve/files/sonic_examples_5.png

6. Blackjack

sonic_examples_6.mp4 (https://blogs.mathworks.com/cleve/files/sonic_examples_6.mp4)

http://blogs.mathworks.com/cleve/files/sonic_examples_6.png

7. Vibrating L-shaped Membrane

sonic_examples_7.mp4 (https://blogs.mathworks.com/cleve/files/sonic_examples_7.mp4)

http://blogs.mathworks.com/cleve/files/sonic_examples_7.png

8. Recamán Sequence

sonic_examples_8.mp4 (https://blogs.mathworks.com/cleve/files/sonic_examples_8.mp4)

http://blogs.mathworks.com/cleve/files/sonic_examples_8.png

9. Swinging Sticks

sonic_examples_9.mp4 (https://blogs.mathworks.com/cleve/files/sonic_examples_9.mp4)

http://blogs.mathworks.com/cleve/files/sonic_examples_9.png


Get the MATLAB code (requires JavaScript) (javascript:grabCode_6be05d5d2be34097bc51738847d9f5b6())

Published with MATLAB® R2024b