当前位置:网站首页>[music] playing city of the sky based on MATLAB [including Matlab source code 1874]
[music] playing city of the sky based on MATLAB [including Matlab source code 1874]
2022-06-11 01:58:00 【Poseidon light】
One 、 How to get the code
How to get the code 1:
【 music 】 be based on matlab play 《 The city of the sky 》【 contain Matlab Source code 1874 period 】
How to get the code 2:
By subscribing to Ziji Shenguang blog Paid column , With proof of payment , Private Blogger , This code is available .
remarks :
Subscribe to Ziji Shenguang blog Paid column , Free access to 1 Copy code ( The period of validity From the Subscription Date , Valid for three days );
Two 、 Introduction to the study of music generation
1 Preface
In recent years, many virtual singers have appeared on the Internet , For example, Sony's virtual singer sonizi , With cartoon 、CG Image and role presentation , Combined sound by speech synthesis engine ( for example VOCALOID 2) Based on the development of virtual singer software role . Recently, Tencent video also launched 《 The children of tomorrow 》 show , In the program, the two-dimensional virtual players are startled “ Haze He Z”, Haze He Z With an original song 《 can 》 Competition , As soon as it appeared, it aroused the discussion of the vast number of Internet users . thus it can be seen , Music composition has great entertainment significance .
Music synthesis is a part of speech signal processing , Belong to Matlab One of the important application fields of software , Matlab It has powerful drawing and computing ability , master Matlab Use of software , It has laid a foundation for the future research of electronic information , So I hope I can do it by myself on the computer Matlab Realize the synthesis of your favorite music .
2 Overview of the development of music generation technology
Computer music , seeing the name of a thing one thinks of its function , It means using computer software and cooperating with MIDI The keyboard makes open music , He can compose and express music , It is also a new form of music expression , In recent years, it is especially hot at home and abroad . In recent years in our country , Computer music has also become a trend .
2.1 The sprout of music generation technology
Early game music was not as usable as it is now CD High quality recording with high-level sound quality , Because there was not enough technical support for the game console at that time . So the game music needs to be synthesized , Designers must embed the basic sound synthesis engine into the hardware of the game console . Chip music was born , This is the sprout of music generation technology .
2.2 Matlab In music generation
Matlab ( Matrix lab ) yes MATrix LABoratory Abbreviation , It can be used for algorithm development , Data visualization , Data analysis, numerical calculation and so on , Is a very excellent technology application software .
Music for different instruments , Analyze with audio software , You can get the difference of audio signals of different musical instruments , Then you can go through Matlab Simulate the audio signal , To get the sounds of different instruments , Realize virtual performance .
3 The background and significance of music generation research
3.1 The research background of music generation
The application of computer music technology is very extensive , For example, music creation , Music education and music score making , And greatly improve the efficiency of music creation and production . At the same time, people make music , The playing process is simplified , And can participate in the creation and production , Be able to listen to and appreciate your own music . Modern technology makes everyone's dream of becoming a musician come true . This is conducive to the popularization and promotion of music and computer technology , It plays an inestimable role in the future development .
3.2 The entertainment significance of music generation
At present, with the progress and development of Technology , There have been many virtual singers , Among them, the most famous is the future of Chu Yin . It is from CRYPTON FUTUREMEDIA utilize YAMAHA Of VOCALOID A series of speech synthesis programs to carry out the audio source of card method . This software has brought great changes to synthetic technology , But some parts still need to be further improved .“ Virtual singer ” and “ Hertz He Z” The appearance of virtual singers , It also brings great vitality to the entertainment circle , thus it can be seen , The study of music synthesis has great entertainment significance .
3.3 The significance of music generation to music creation
Traditional music creation is a long-term , complex , A job that requires multi-party cooperation . But computer generated music , The composer can do the work by himself , At the same time, it can also better reflect their own music ideas in the creative process . Producers can also constantly modify their music during the creation process , The efficiency of music creation has been improved .
4 Research methods of music generation
4.1 Realize music generation
Matlab Music playing can be realized by sound Function implementation , There are three variables (Y, fs, bits) Each represents the input signal 、 Sampling rate 、 Bit rate . The sampling rate here is set to fs=44100. Input signal Y It is usually a sine wave , Such as A·sin (2·pi·w·t) . among A Controls the size of the sound , w Controlling the level of the sound , t The range controls the length of the sound . The bit rate adopts the default value . The editing of sound quality and timbre is not involved here .
The frequency of sound is shown in the table 1 Shown , Pitch and frequency are exponentially related , They satisfy the following relationship , p It's pitch , f It's the frequency .f=440x2 (p-69) /12, Every semitone rise in pitch , p+1.
Through the understanding of the above knowledge , We can use matlab To make music .
surface 1 The frequency of sound 
4.2 Fourier series to achieve music generation
To realize the synthesis of music , First of all, we should understand the three characteristics of sound : tone , Loudness and timbre [.
The pitch is the pitch , The main factor affecting tone is the frequency of sound wave . Loudness is the strength of a sound , The main factor affecting loudness is the vibration amplitude of sound wave . The change of timbre is caused by the harmonic wave in the music waveform , Different instruments have different timbres , So the harmonics are different .
4.2.1 tone
Every piece of music has a tone , Every roll call (do re mi) The fundamental frequency is not fixed , The tone determines the fundamental frequency value of the medium roll in the music . For example, the score is 1=C, It means that the tone is C Regulation “1 (do) ” The fundamental frequency of is 261.6Hz, If the score is 1=E be “1 (do) ” The frequency is 239.6Hz, The score is 1=G be “1 (do) ” The frequency is 392.1Hz, “3 (mi) ” The frequency is 493.9Hz.
4.2.2 timbre
The difference in timbre is due to the effect of harmonics , In the field of music, we often call harmonics overtones . When we determine the pitch of the score , We only specify the fundamental frequency of the roll call , But I can't tell what instrument makes the sound , Only monotonous do re mi. And different instruments , His envelope waveforms are also different . Because the envelope waveform of music is very complex , We will approximately linearize the complex envelope function , So the envelope of music waveform is usually broken line type .
4.2.3 The law of twelve averages
The law of twelve averages , Also known as the law of twelve equal processes , It's a kind of music method , Divide an octave into twelve equal parts , Each bisection is called a semitone , It's the main tuning method . because “ The law of five degrees ” and “ The law of twelve averages ” The pronunciation is very similar and the twelve mean law can solve the problem of transfer , therefore , It is widely used in keyboard instruments and symphony orchestras .
To facilitate the analysis of the above three features , We need to analyze the spectrum of the signal , That is, using Fourier transform , Get the spectrum structure of the music signal , Extract its spectral characteristics .
To compose a piece of music , You need to know the fundamental frequency of the music 、 Harmonic composition, etc . Therefore, Fourier analysis must be performed [4].
Using this formula , The Fourier transform value of any frequency point can be calculated .
4 The principle of music score analysis
This experiment selects songs despacito Parse and compose . First of all, let's introduce some basic knowledge of music score , Pictured 1 Shown : The song itself has a quarter beat , The note with a horizontal line under it is one eighth of a beat , Two horizontal lines are one sixteenth of a beat , Tempo can be understood as speed .
The small black dots at the bottom of each note indicate that the tone drops by an octave , Two means two octaves lower .
The dot after each note means that the note is repeated again but the beat is increased by one ( For example, one quarter beat becomes one eighth beat ) . And if the note is followed by a horizontal line , It means that this note is repeated again , The beat is the same .
Because the tune of this song is D transfer , So according to 12 The calculation method of the law of averages , First A=440Hz.12 The adjacency of a chromatic scale is 12 2 (122≈1.0594631) then B=440Hz x 1.0594631=466.16Hz B=466.16Hz x 1.0594631=493.88Hz C=493.88Hz x1.0594631=523.25Hz therefore D=554.36Hz.
3、 ... and 、 Partial source code
fs = 44100; % Sampling rate
dt = 1/fs;
T16 = 0.25;
t16 = [0:dt:T16];
[temp k] = size(t16);
t8=linspace(0,2*T16,2*k);
t8fd=linspace(0,3*T16,3*k);
t4=linspace(0,4*T16,4*k);
t4fd=linspace(0,5*T16,5*k);
t2fd=linspace(0,7*T16,7*k);
t2=linspace(0,6*T16,6*k);
[temp i] = size(t4);
[temp j] = size(t8);
Four 、 Running results
Only music effect , No visual effects
5、 ... and 、matlab Edition and references
1 matlab edition
2014a
2 reference
[1] Zhang Zihao . be based on Matlab The study of music production in [J]. Electronic production . 2018,(16)
3 remarks
This part of the introduction is taken from the Internet , For reference only , If infringement , Contact deletion
边栏推荐
- LeetCode 1010 Pairs of Songs With Total Durations Divisible by 60 (hash)
- 2021-7-18 ROS笔记-xml语言相关
- 1.6 Px4 initialization calibration
- [Haas hands on] creative case of new video program launch we started the first phase together E01: Internet of things engineers started the remote control manipulator with you
- Win11触摸键盘主题如何更换?Win11更换触摸键盘主题的方法
- Thoughts on small steamed stuffed bun's dividend
- 2021-2-14 gephi学习笔记
- [leetcode] reverse linked list II
- [leetcode] reverse linked list
- The argument type ‘int?‘ can‘t be assigned to the parameter type ‘num‘
猜你喜欢

关于概率统计中的排列组合
![[leetcode] path sum II (first glimpse recursion + backtracking)](/img/a8/54920e54a026ebef3eb0a1336e5b62.jpg)
[leetcode] path sum II (first glimpse recursion + backtracking)

Win11系统使用DISM命令备份驱动程序的方法

Byte Beijing 23K and pinduoduo Shanghai 28K, how should I choose?

Flutter status management
![[leetcode] reverse linked list](/img/b9/4d8e47d2b4bb1f6b5b9b4dfad30dca.jpg)
[leetcode] reverse linked list

Leetcode 430 flat a multilevel double linked list (DFS linked list)

Task01: be familiar with the basic process of news recommendation system
![[leetcode] construct a binary tree by traversing the sequence from front to middle (continuous optimization)](/img/02/114618065e090769543a2aa106aa66.jpg)
[leetcode] construct a binary tree by traversing the sequence from front to middle (continuous optimization)

2021-2-26 compilation of programming language knowledge points
随机推荐
【图像处理】基于matlab GUI多功能图像处理系统【含Matlab源码 1876期】
Leetcode permutation and combination problem backtracking
The problem of slow response of cs-3120 actuator during use
【BSP视频教程】BSP视频教程第17期:单片机bootloader专题,启动,跳转配置和调试下载的各种用法(2022-06-10)
1.4px4 program download
[leetcode] construct a binary tree by traversing the sequence from front to middle (continuous optimization)
2021-7-18 ROS notes XML language related
Px4 from abandonment to mastery (twenty four): customized model
Leetcode 2171 removing minimum number of magic beans (prefix and recommendation)
C语言 深度探究具有不定参数的函数
[matlab] basic operation of MATLAB image processing
Coordonnées des capitales provinciales des provinces chinoises
Leetcode 1248 count number of nice subarrays
EXJ形儿多眼前因断会满意接MBtXE
[traitement d'image] système multifonctionnel de traitement d'image basé sur l'interface graphique MATLAB [y compris le code source MATLAB 1876]
flutter_swiper 轮播图 插件
Well paid test development programmers, why are you leaving? Kill each other with products until the sky is dark
Interviewer: let me introduce the items in your resume. Tell me more about them, and attach the actual project
Leetcode linked list queue stack problem
Leetcode 2054 two best non overlapping events