[go: up one dir, main page]

CN118121934A - Method, device, electronic equipment and computer readable storage medium for playing music - Google Patents

Method, device, electronic equipment and computer readable storage medium for playing music Download PDF

Info

Publication number
CN118121934A
CN118121934A CN202410092953.9A CN202410092953A CN118121934A CN 118121934 A CN118121934 A CN 118121934A CN 202410092953 A CN202410092953 A CN 202410092953A CN 118121934 A CN118121934 A CN 118121934A
Authority
CN
China
Prior art keywords
music
data
rhythm
transition
playing
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202410092953.9A
Other languages
Chinese (zh)
Inventor
侯晨钟
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Netease Hangzhou Network Co Ltd
Original Assignee
Netease Hangzhou Network Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Netease Hangzhou Network Co Ltd filed Critical Netease Hangzhou Network Co Ltd
Priority to CN202410092953.9A priority Critical patent/CN118121934A/en
Publication of CN118121934A publication Critical patent/CN118121934A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G10MUSICAL INSTRUMENTS; ACOUSTICS
    • G10HELECTROPHONIC MUSICAL INSTRUMENTS; INSTRUMENTS IN WHICH THE TONES ARE GENERATED BY ELECTROMECHANICAL MEANS OR ELECTRONIC GENERATORS, OR IN WHICH THE TONES ARE SYNTHESISED FROM A DATA STORE
    • G10H1/00Details of electrophonic musical instruments
    • G10H1/0008Associated control or indicating means
    • AHUMAN NECESSITIES
    • A63SPORTS; GAMES; AMUSEMENTS
    • A63FCARD, BOARD, OR ROULETTE GAMES; INDOOR GAMES USING SMALL MOVING PLAYING BODIES; VIDEO GAMES; GAMES NOT OTHERWISE PROVIDED FOR
    • A63F13/00Video games, i.e. games using an electronically generated display having two or more dimensions
    • A63F13/50Controlling the output signals based on the game progress
    • A63F13/54Controlling the output signals based on the game progress involving acoustic signals, e.g. for simulating revolutions per minute [RPM] dependent engine sounds in a driving game or reverberation against a virtual wall
    • GPHYSICS
    • G10MUSICAL INSTRUMENTS; ACOUSTICS
    • G10HELECTROPHONIC MUSICAL INSTRUMENTS; INSTRUMENTS IN WHICH THE TONES ARE GENERATED BY ELECTROMECHANICAL MEANS OR ELECTRONIC GENERATORS, OR IN WHICH THE TONES ARE SYNTHESISED FROM A DATA STORE
    • G10H1/00Details of electrophonic musical instruments
    • G10H1/36Accompaniment arrangements
    • G10H1/40Rhythm
    • GPHYSICS
    • G10MUSICAL INSTRUMENTS; ACOUSTICS
    • G10HELECTROPHONIC MUSICAL INSTRUMENTS; INSTRUMENTS IN WHICH THE TONES ARE GENERATED BY ELECTROMECHANICAL MEANS OR ELECTRONIC GENERATORS, OR IN WHICH THE TONES ARE SYNTHESISED FROM A DATA STORE
    • G10H2210/00Aspects or methods of musical processing having intrinsic musical character, i.e. involving musical theory or musical parameters or relying on musical knowledge, as applied in electrophonic musical tools or instruments
    • G10H2210/021Background music, e.g. for video sequences or elevator music
    • G10H2210/026Background music, e.g. for video sequences or elevator music for games, e.g. videogames
    • GPHYSICS
    • G10MUSICAL INSTRUMENTS; ACOUSTICS
    • G10HELECTROPHONIC MUSICAL INSTRUMENTS; INSTRUMENTS IN WHICH THE TONES ARE GENERATED BY ELECTROMECHANICAL MEANS OR ELECTRONIC GENERATORS, OR IN WHICH THE TONES ARE SYNTHESISED FROM A DATA STORE
    • G10H2210/00Aspects or methods of musical processing having intrinsic musical character, i.e. involving musical theory or musical parameters or relying on musical knowledge, as applied in electrophonic musical tools or instruments
    • G10H2210/375Tempo or beat alterations; Music timing control
    • G10H2210/391Automatic tempo adjustment, correction or control
    • GPHYSICS
    • G10MUSICAL INSTRUMENTS; ACOUSTICS
    • G10HELECTROPHONIC MUSICAL INSTRUMENTS; INSTRUMENTS IN WHICH THE TONES ARE GENERATED BY ELECTROMECHANICAL MEANS OR ELECTRONIC GENERATORS, OR IN WHICH THE TONES ARE SYNTHESISED FROM A DATA STORE
    • G10H2220/00Input/output interfacing specifically adapted for electrophonic musical tools or instruments
    • G10H2220/135Musical aspects of games or videogames; Musical instrument-shaped game input interfaces
    • GPHYSICS
    • G10MUSICAL INSTRUMENTS; ACOUSTICS
    • G10HELECTROPHONIC MUSICAL INSTRUMENTS; INSTRUMENTS IN WHICH THE TONES ARE GENERATED BY ELECTROMECHANICAL MEANS OR ELECTRONIC GENERATORS, OR IN WHICH THE TONES ARE SYNTHESISED FROM A DATA STORE
    • G10H2230/00General physical, ergonomic or hardware implementation of electrophonic musical tools or instruments, e.g. shape or architecture
    • G10H2230/045Special instrument [spint], i.e. mimicking the ergonomy, shape, sound or other characteristic of a specific acoustic musical instrument category

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Physics & Mathematics (AREA)
  • Acoustics & Sound (AREA)
  • Electrophonic Musical Instruments (AREA)

Abstract

The application discloses a method, a device, an electronic device and a computer readable storage medium for playing music, wherein the method comprises the following steps: responding to a switching instruction for switching from the first music piece to the second music piece, and acquiring first rhythm data corresponding to the first music piece and second rhythm data corresponding to the second music piece; determining a first transition paragraph from preset rhythm transition paragraphs according to the first rhythm data and the second rhythm data; switching the playing of the first music piece to the playing of the first transition paragraph, and playing the second music piece after the playing of the first transition paragraph is completed. The scheme provided by the application can enable smooth transition between different music fragments with rhythm differences.

Description

Method, device, electronic equipment and computer readable storage medium for playing music
Technical Field
The present application relates to the field of computer technologies, and in particular, to a method and apparatus for playing music, an electronic device, and a computer readable storage medium.
Background
In a virtual game, a large amount of music content is present, and in general, when the game state is changed, it is often necessary to switch between different music contents. In the related art, in order to avoid that the switching between two pieces of music is too abrupt, the music speeds corresponding to different pieces of music content in the virtual game cannot have too great a difference, so that the music content in the virtual game is relatively single. Therefore, how to make smooth transition between different music contents with large speed difference becomes a problem to be solved.
Disclosure of Invention
The application provides a method, a device, electronic equipment and a computer readable storage medium for playing music, which can enable smooth transition between different music fragments with rhythm differences. The specific scheme is as follows:
In a first aspect, an embodiment of the present application provides a method for playing music, where the music includes a plurality of pieces of music, the method including:
responding to a switching instruction for switching from a first music piece to a second music piece in the plurality of music pieces, and acquiring first rhythm data corresponding to the first music piece and second rhythm data corresponding to the second music piece;
determining a first transition paragraph from preset rhythm transition paragraphs according to the first rhythm data and the second rhythm data;
And switching the playing of the first music piece to the playing of the first transition paragraph, and playing the second music piece after the playing of the first transition paragraph is completed.
In a second aspect, an embodiment of the present application provides an apparatus for playing music, the music including a plurality of pieces of music, the apparatus comprising:
An obtaining unit, configured to obtain first rhythm data corresponding to a first music piece and second rhythm data corresponding to a second music piece in response to a switching instruction for switching from the first music piece to the second music piece in the plurality of music pieces;
a determining unit, configured to determine a first transition paragraph from preset rhythm transition paragraphs according to the first rhythm data and the second rhythm data;
and the switching unit is used for switching the playing of the first music piece to the playing of the first transition paragraph and playing the second music piece after the playing of the first transition paragraph is completed.
In a third aspect, the present application also provides an electronic device, including:
a processor; and
A memory for storing a data processing program, the electronic device being powered on and executing the program by the processor, to perform the method according to the first aspect.
In a fourth aspect, embodiments of the present application also provide a computer readable storage medium storing a data processing program for execution by a processor to perform the method of the first aspect.
Compared with the prior art, the application has the following advantages:
The method for playing music provided by the application comprises the steps that the played music comprises a plurality of music pieces, and first music data corresponding to the first music piece and second rhythm data corresponding to the second music piece are obtained in response to a switching instruction for switching from the first music piece to the second music piece in the plurality of music pieces; determining a first transition paragraph from preset rhythm transition paragraphs according to the first rhythm data and the second rhythm data; switching the playing of the first music piece to the playing of the first transition paragraph, and playing the second music piece after the playing of the first transition paragraph is completed.
In the method for playing music provided by the application, when a switching instruction for switching from the first music piece to the second music piece is received, the first transition paragraph is determined from the preset rhythm transition paragraphs through the first playing data corresponding to the first music piece and the second rhythm data corresponding to the second music piece. The switching from the first music piece to the second music piece is realized through the music playing sequence of the first music piece, the first transition section and the second music piece. In the application, the two pieces of music with different rhythm data are smoothly transited through the preset rhythm transition section, so that the pieces of music before and after the music switching can be the pieces of music with various rhythms with more various rhythms and larger rhythm difference, the limitation on the rhythms of the two pieces of music before and after the music switching is avoided, and the richness of the music content in the music switching project is ensured. Therefore, the method for playing music provided by the application can enable smooth transition between different music pieces with rhythm differences.
Drawings
Fig. 1 is a flowchart of a method for playing music according to an embodiment of the present application;
Fig. 2 is a schematic diagram showing an effect of switching music clips commonly seen in the prior art according to an embodiment of the present application;
FIG. 3 is a schematic diagram showing the effect of a transition segment of tempo inserted between two pieces of music in a method of playing music according to an embodiment of the present application;
FIG. 4 is a schematic diagram of a node network configuration in OM in a method for playing music according to an embodiment of the present application;
FIG. 5 is a schematic diagram of generating a rhythm transition segment in OM in a method for playing music according to an embodiment of the present application;
fig. 6 is a schematic diagram of a MIDI file corresponding to a rhythm transition paragraph generated in OM according to an embodiment of the present application.
Fig. 7 is a block diagram showing an example of a device for playing music according to an embodiment of the present application;
fig. 8 is a block diagram illustrating an example of an electronic device according to an embodiment of the present application.
Detailed Description
In the following description, numerous specific details are set forth in order to provide a thorough understanding of the present application. The present application may be embodied in many other forms than those herein described, and those skilled in the art will readily appreciate that the present application may be similarly embodied without departing from the spirit or essential characteristics thereof, and therefore the present application is not limited to the specific embodiments disclosed below.
It should be noted that the terms "first," "second," "third," and the like in the claims, description, and drawings of the present application are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. The data so used is interchangeable under appropriate circumstances such that the embodiments of the application described herein are capable of operation in sequences other than those illustrated or otherwise described herein. Furthermore, the terms "comprises," "comprising," and their variants are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
Before describing embodiments of the present application in detail, related concepts will be described first and prior art will be further described.
1. Introduction to related concepts
1. OpenMusic (computer music system, OM for short)
OpenMusic (OM) is a computer music system that aims to assist musicians, composers and researchers in creative music composition and exploration. OM uses graphical interfaces and programming languages to represent and process music. OM provides a rich set of music synthesis and analysis tools, as well as support for a variety of music theory and orchestration methods. Through OM, a user (which may be a music designer in the present application) may use advanced algorithms and mathematical models to generate and manipulate musical material in a visual environment.
OM can be used to create, schedule, and record music. OM has the following characteristics: the method supports the import and editing of MIDI and audio files, provides a plurality of virtual musical instruments and audio effectors, has a powerful audio editor, can edit and adjust the output supporting a plurality of formats in real time, comprises MIDI, WAV, MP and other formats, can expand functions through plug-ins and the like.
2. Wwise (Audio engine)
Wwise is an audio engine for interfacing with a game engine that can implement a rich game interactive audio solution. Wwise provide a complete audio development environment including audio editors, sound effect design tools, MIDI generators, sound database management tools, etc., that can help game developers create expressive sound effects and music.
3. BPM (Beat Per Minute)
BPM is used to describe the tempo and speed of music, typically expressed in beats per minute, and can be understood as the number of sound beats emitted between time segments of one minute. For example 120 notes per minute, which is commonly referred to as "120bpm". The BPM of music can be used to describe the tempo and vitality of the music, with faster speeds generally giving a more active and exciting sensation and slower speeds giving a more restless and relaxed sensation.
2. Further description of the prior art
Currently, in order to be able to naturally switch music pieces in a virtual game, generally, different music pieces in the virtual game come from different pieces of the same music piece, for example, a pre-song of the music piece a is played when a user operates a virtual character to a spot 1 in a game scene, a main song of the music piece a is played when the user operates the virtual character to a spot 2 in the game scene, and a sub-song of the music piece a is played when the user operates the virtual character to a spot 3 in the game scene. Thus, when switching from one piece of music to another during the progress of the virtual game, the player is not made to feel abrupt.
However, in the above scheme, the speed difference between the music pieces in the virtual game is limited, so that the music content in the virtual game is single, and when a large number of virtual characters with different characters exist in the virtual game, the character characteristics of the virtual characters cannot be reflected through the music pieces, and the game experience of the player is reduced.
For the above reasons, in order to make smooth transition between different pieces of music with rhythm differences, the first embodiment of the present application provides a method for playing music, where the music includes a plurality of pieces of music, and the method is applied to an electronic device or a server, where the electronic device may be a desktop computer, a notebook computer, a game console, a smart watch, a tablet computer, a mobile phone, a television, or other electronic devices, and the application is not particularly limited. The server may be used to provide background services for clients of applications in the electronic device. For example, the server may be a background server of the application program described above. The server may be an independent physical server, a server cluster or a distributed system formed by a plurality of physical servers, or a cloud server providing cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, a content distribution network (Content Delivery Network, CDN), basic cloud computing services such as big data and an artificial intelligent platform, and the application is not particularly limited.
The following describes a method for playing music according to an embodiment of the present application with reference to fig. 1 to 6.
As shown in fig. 1, the method for playing music provided by the present application includes the following steps S101 to S103.
Step S101: and responding to a switching instruction for switching from a first music piece to a second music piece in the plurality of music pieces, and acquiring first rhythm data corresponding to the first music piece and second rhythm data corresponding to the second music piece.
It will be appreciated that in a virtual game it is often necessary to switch pieces of music, for example, when a virtual character is located at position 1 in the game scene of the virtual game, piece a of music is played, when a virtual character is located at position 2 in the game scene, piece b of music is played, and when the virtual character moves from position 1 to position 2, it is necessary to switch the played music from piece a to piece b of music. For another example, when the virtual character 1 initiates an attack to the virtual character 2, the music piece related to the attack is played, and when the virtual character 1 stops the attack to the virtual character 2 and moves in the game scene, the music piece related to the attack is stopped, and the playing is switched to the playing of the music piece related to the movement.
The switching of music segments in the application can also be used in at least one of listening to books, live broadcasting and film and television plays. Background music is usually corresponding to the listening scene, for example, when the listening software plays to the chapter 1, a music piece c matched with the content of the chapter 1 is played, and when the listening software plays to the chapter 2, a music piece d matched with the content of the chapter 2 is played; live scenes typically also correspond to background music, for example, when a live host plays a product introduction, playing softer music, and when product details are shown, playing faster-paced music; scenes in which music is switched often exist in movie and television dramas, for example, intense music is played when a severe episode is progressed, and relaxed music is played when a warm episode is progressed.
In the present application, the plurality of music pieces may include two or more different music pieces, and the switching instruction for switching from the first music piece to the second music piece may be triggered by a control, or may also be triggered by a gesture action of the user on the touch-sensitive screen, or may also be triggered by voice, which is not particularly limited in this aspect of the present application.
Tempo is one of the fundamental components of music, which refers to the important temporal and intensity sensation in music, typically consisting of a series of regular notes. The tempo can bring a sense of motion and rhythmicity to music, and can help singers or musicians keep the tempo while playing. In music, rhythms may be played by a musical instrument such as a drum, piano, bass, guitar, etc., or may be created by sound effects or an electronic synthesizer.
In step S101, when a switch instruction to switch from the first musical piece to the second musical piece is received, first tempo data of the first musical piece and second tempo data of the second musical piece may be acquired. It should be noted that, in the present application, the first music piece may be a music piece with a fixed rhythm (BPM), and the second music piece may also be a music piece with a fixed rhythm (BPM), so that when the switching instruction triggers, no matter to which bar the first music piece is currently played, the corresponding rhythm is the first playing data.
According to the application, the rhythm data of each music piece in the virtual game can be prestored, and after a switching instruction for switching from the first music piece to the second music piece is triggered, the first rhythm data corresponding to the first music piece and the second rhythm data corresponding to the second music piece are obtained from the prestored rhythm data. Specifically, the rhythm data corresponding to each piece of music may be provided by a music designer who composes each piece of music, or the rhythm data of the piece of music may be extracted, which is not particularly limited in the present application.
In practical application, the rhythm data of the music piece may be extracted by essentia packets (music information extraction packet) or librosa packets (music feature extraction packet). Wherein Essentia is an open source audio analysis and music information extraction library, essentia is commonly used to extract various music features such as pitch, tempo, volume, tonality, etc. from audio signals, essentia provides a powerful tool set for processing audio data and performing advanced music analysis and feature extraction. Librosa is a Python library for audio and music signal processing, librosa provides a wide range of functions for loading, processing and analyzing audio data, librosa can be used to extract audio features such as spectrograms, mel-frequency cepstral coefficients (MFCCs), tempo features, etc., and Librosa also supports audio processing tasks such as time-to-frequency conversion, audio clipping, resampling, etc.
Step S102: determining a first transition paragraph from preset rhythm transition paragraphs according to the first rhythm data and the second rhythm data;
Step S102 is for determining a first transition section for inserting the first music piece and the second music piece according to the first music piece before the switch and the second music piece after the switch, so as to complete a smooth transition from the first music piece to the second music piece through the determined first transition section.
In the application, a plurality of rhythm transition paragraphs can be preset, after a switching instruction for switching from a first music piece to a second music piece is triggered, a first transition paragraph which can be inserted between the first music piece and the second music piece can be determined from the preset plurality of rhythm transition paragraphs according to the acquired first rhythm data of the first music piece and the second rhythm data of the second music piece, wherein the first transition paragraph is a paragraph for enabling the first music piece and the second music piece to realize smooth transition of rhythms.
In a specific implementation manner, a correspondence relationship between the tempo data of the music piece before the switching, the tempo data of the music piece after the switching, and the preset tempo transition section may be preset, so that a first transition section corresponding to the first tempo data and the second tempo data may be determined from the preset correspondence relationship.
The difference value between the start rhythm data corresponding to the first beat in the first transition section and the first playing data of the first music piece determined in the present application may be within a preset range, for example, the start rhythm data corresponding to the first beat in the first transition section and the first playing data of the first music piece are completely consistent, or the difference value between the start rhythm data corresponding to the first beat in the first transition section and the first playing data of the first music piece is within a smaller range (e.g. 1); accordingly, the difference between the ending tempo data corresponding to the last beat in the first transition section and the second tempo data of the second music piece determined in the present application may also be within a preset range, for example, the ending tempo data corresponding to the last beat in the first transition section and the second tempo data of the second music piece are completely consistent, or the difference between the ending tempo data corresponding to the last beat in the first transition section and the second tempo data of the second music piece is within a smaller range.
For example, the first tempo data of the first music piece may be 80, the start tempo data corresponding to the first beat in the first transition section may be 80, 79 or 81, the second tempo data of the second music piece may be 120, and the end tempo data corresponding to the last beat in the first transition section may be 120, 119 or 121. Because the rhythm difference value is smaller, the user can not be too abrupt when in connection, and the rhythm transition is natural when the user listens to the rhythm.
It will be appreciated that in music, a beat is a unit of measure of tempo, and in music, a series of beats of a certain intensity, respectively, repeatedly occur at regular intervals. Beats are organized in a musical composition representing fixed unit time values and intensity laws. The circulation of strong beating and weak beating in each section is called two beats; the circulation of strong beat, weak beat and weak beat is called as three beats. The sign of the time value and number of basic unit beats in each section is called the beat number. The upper number of beats represents the number of beats per bar and the lower number represents the duration of each beat.
For example, 2/4 means 1 beat for a 4-note with 2 beats per bar. The actual time of the clapping medium value should be dependent on the speed at which the composition is targeted. In different beat types, only one beat per bar is called a single beat, e.g., 2/4, 2/8 is a single 2 beat, 3/4, 3/8 is a single 3 beat. Each bar has one beat and a plurality of beats, which are called complex beats, such as 4/4, 6/8 is complex 2 beats, 9/8, 9/16 is complex 3 beats.
In the process of music, the strong beats and the weak beats always regularly and circularly appear, and the part from one strong beat to the next strong beat is called a bar. In the score, bars are drawn by short vertical lines (bar lines). The bars with insufficient beats are also called incomplete bars, and often appear at the beginning and end of a phrase (or music piece), and the two incomplete bars at the beginning and end are combined into a complete bar.
In this way, the start tempo data corresponding to the first beat in the first transition section coincides with the first tempo data, and the end tempo data corresponding to the last beat coincides with the second tempo data. Based on the above, in the music playing sequence of the first music piece, the first transition paragraph and the second music piece, since the rhythm data at the joint of the two music pieces connected with each other are consistent, smooth transition of the rhythm at the time of transition from the first music piece to the second music piece can be realized, so that the user does not feel abrupt in hearing.
The application mainly aims at smooth transition between two music pieces with different rhythms. In the specific embodiment, the first rhythm data corresponding to the first music piece and the second rhythm data corresponding to the second music piece may be the same or different. In case the first and second tempo data are identical, the inserted tempo transition paragraph between the first and second pieces of music may be an empty paragraph, i.e. after triggering a switch instruction to switch from the first piece of music to the second piece of music, a switch may be made directly from the first piece of music to the second piece of music.
It should be noted that, in the first transition section, other music characteristics such as musical instrument timbre may be provided in addition to the rhythm, in the present application, the corresponding music content in the virtual game may be in the same music form, for example, the first music piece and the second music piece are both electronic music, so that the first transition section may use the musical instrument timbre corresponding to the electronic music, such as the electronic drum 808, the electric guitar, and the like.
It will be appreciated that the virtual musical instrument may include, but is not limited to, one or more of the following: guitar, piano, woodwind instrument, percussion instrument. Wherein the guitar may include, but is not limited to, one or more of an electric guitar, a classical guitar, a bass, and the piano may include, but is not limited to, one or more of a classical piano, an electric piano. The woodwind instrument may include, but is not limited to, one or more of a flute, a double reed pipe, a clarinet, a large pipe. The brass instrument may include, but is not limited to, one or more of a small number, a round number, a trombone, a large number. Percussion instruments may include, but are not limited to, one or more of drums, pianos, xylophone, marlin.
As shown in table 1, an exemplary table of music forms that are common in the method for playing music provided by the embodiment of the present application is shown.
Table 1.
Musical form Detailed description of the preferred embodiments
Classical music Symphony, concerto, indoor music, opera and symphony poem
Popular music Popular songs, rock music, hip-hop music, electronic dance music, ballad music
Folk music Traditional folk songs, folk dances and world music
Jazz music Jazz, blue tone music, soul music
Electronic music Electronic dance music, electronic music and experimental music
Among them, there are many differences between different forms of music, including structure, organization, musical instrument, style, emotion, etc. For example, classical music generally has a complex structure and organization, uses a variety of musical instruments, and has serious, elegant, romantic, and the like emotions. Popular music generally has a simple structure and organization, uses a small number of instruments, and has lively, cheerful, perceptual and like emotions. Folk music generally has a conventional structure and organization, uses local musical instruments, and has ethnic, conventional, mystery, and other emotions. Jazz music generally has a free structure and organization, uses a variety of instruments, and has free, impromptu, enthusiasm, and other emotions. Electronic music generally has an abstract structure and organization, uses electronic devices, and has emotions of science, technology, future, super reality, and the like. In addition, there are many other forms of music such as ancient music, new classical music, new century music, etc. The present application is not limited to the kind of music form.
Step S103: and switching the playing of the first music piece to the playing of the first transition paragraph, and playing the second music piece after the playing of the first transition paragraph is completed.
Step S103 is for realizing a smooth transition of tempo from the first piece of music to the second piece of music by inserting a first transition paragraph between the first piece of music and the second piece of music.
After determining a first transition segment for insertion between the first musical piece and the second musical piece, when transitioning from the first musical piece to the second musical piece, switching from the first musical piece to first transition data in which the start tempo data is identical to the first tempo data of the first musical piece, and then switching from first transition data in which the end tempo data is identical to the second tempo data of the second musical piece to the second musical piece, smooth transition of tempo at the time of transition from the first musical piece to the second musical piece can be achieved.
It will be appreciated that in practice, if the rhythms of two music pieces are the same or similar, then the two music pieces will sound similar to the user because they have the same sense of time and intensity, which may be somewhat familiar to the user. Therefore, when the first music piece is switched to the first transition section and then is switched to the second music piece, the user does not feel abrupt in hearing due to the consistency of rhythm data at the joint of the mutually connected music pieces.
In addition, in the application, two pieces of music with different rhythm data are smoothly transited through the preset rhythm transition paragraphs, so that the pieces of music with various rhythms with more various rhythms and larger rhythm difference can be accommodated in the virtual game, the limitation on the rhythms of the pieces of music in the virtual game is avoided, the music content in the virtual game is richer, and the game experience of a user is further improved.
In the following description of the method for playing music according to the embodiment of the present application by inserting the effect of the first transition section for smooth transition between the first music piece and the second music piece through fig. 2 and fig. 3, it should be noted that, for convenience of presentation, the effect of music switching is shown in fig. 2 and fig. 3 by abstracting the rhythm data into a visualized length graph.
Fig. 2 is a schematic diagram showing an effect of switching music pieces commonly seen in the prior art according to an embodiment of the present application. In fig. 2, each rectangle represents one beat in the corresponding piece of music, and the length of each rectangle represents rhythm data of the corresponding beat. The tempo data corresponding to each beat in the first music piece 20 is the same as 80, that is, the first tempo data 22 corresponding to the first music piece 20 is 80. The tempo data corresponding to each beat in the second music piece 21 is also the same and is 120, that is, the second tempo data 23 corresponding to the second music piece 21 is 120. In fig. 2, when switching from the first piece of music 20 to the second piece of music 21, the change in tempo is abrupt and hard when switching from the first piece of music to the second piece of music due to the large difference between the first piece of music 22 and the second piece of tempo data, and when the user listens, the change from a slower tempo to a faster tempo is abrupt. In the case where the difference between the first rhythm data 22 and the second rhythm data 23 is larger, switching between rhythms of which the difference is larger may cause the user to feel acoustically uncomfortable, reducing the user's feeling of well-being and immersion in the virtual game.
Fig. 3 is a schematic diagram showing the effect of inserting a rhythm transition segment between two pieces of music in the method for playing music according to the embodiment of the present application. Fig. 3 adds the rhythm transition segment of the first transition segment 24 on the basis of fig. 2. The tempo data corresponding to the first beat in the first transition section 24 is 80, i.e. the starting tempo data 25 corresponding to the first transition section 24 is the same as the first tempo data 22 corresponding to the first piece of music 20, and is 80; the tempo data corresponding to the last beat in the first transition section 24 is 120, i.e. the ending tempo data 26 corresponding to the first transition section 24 is the same as the second tempo data 23 corresponding to the second piece of music 21, and is 120; the first transition section 24 corresponds to 5 beats, and the rhythm data corresponding to the middle 3 beats are respectively 90, 100 and 110 according to the arrangement sequence from front to back. As can be seen from fig. 3, when switching from the first musical piece 20 to the second musical piece 21, by inserting the first transition section 24 in which the start tempo data 25 corresponding to the first beat is the same as the first tempo data 22 corresponding to the first musical piece 20 and the end tempo data 26 corresponding to the last beat is the same as the second tempo data 23 corresponding to the second musical piece 21, it is possible to make the transition from the first musical piece 20 to the second musical piece 21 by gradually smoothly transitioning from the start tempo data 25 identical to the first tempo data 22 corresponding to the first musical piece 20 to the end tempo data identical to the second tempo data 23 corresponding to the second musical piece 21 in the inserted first transition section, thereby avoiding the abrupt feeling generated by directly transitioning from the first tempo data 22 to the second tempo data 23, and thus, making the transition natural in the sense of hearing by the user.
The method for playing music provided by the application comprises the steps that the played music comprises a plurality of music pieces, and first music data corresponding to the first music piece and second rhythm data corresponding to the second music piece are obtained in response to a switching instruction for switching from the first music piece to the second music piece in the plurality of music pieces; according to the first playing data and the second rhythm data, determining a first transition section from preset rhythm transition sections, switching the playing of the first music piece to the first transition section, and playing a second music piece after the playing of the first transition section is completed.
In the method for playing music provided by the application, when a switching instruction for switching from the first music piece to the second music piece is received, the first transition paragraph is determined from the preset rhythm transition paragraphs through the first playing data corresponding to the first music piece and the second rhythm data corresponding to the second music piece. The switching from the first music piece to the second music piece is realized through the music playing sequence of the first music piece, the first transition section and the second music piece. In the application, the two pieces of music with different rhythm data are smoothly transited through the preset rhythm transition section, so that the pieces of music before and after the music switching can be the pieces of music with various rhythms with more various rhythms and larger rhythm difference, the limitation on the rhythms of the two pieces of music before and after the music switching is avoided, and the richness of the music content in the music switching project is ensured. Therefore, the method for playing music provided by the application can enable smooth transition between different music pieces with rhythm differences.
It can be understood that, in the case that the application scenario is the switching of music in the virtual game, the method for playing music provided by the embodiment of the application can allow the virtual game to accommodate music pieces with more various rhythms and larger rhythm differences, for example, the music pieces can be switched from slow music with extremely slow rhythm to fierce music with extremely fast rhythm.
In an optional implementation manner, the starting rhythm data corresponding to the preset rhythm transition paragraph may include rhythm data of each music segment in the virtual game, and the ending rhythm data corresponding to the preset rhythm transition paragraph may also include rhythm data of each music segment in the virtual game, so that the application may directly determine that a paragraph in which the starting rhythm data is the first rhythm data and the ending rhythm data is the second rhythm data in the rhythm transition paragraph is the first transition paragraph.
It can be understood that the first transition section, in which the starting rhythm data is completely consistent with the first music section corresponding to the first music section before switching, is connected with the first music section, and then after the playing of the first transition section is finished, the first transition section is switched to the playing of the second music section with the second rhythm data completely consistent with the ending rhythm data of the first transition section, so that the transition of the rhythm in the method for playing music provided by the application is more natural and smooth, and the inconformity in rhythm is avoided.
In practical application, the switching instruction for switching from the first music piece to the second music piece can be triggered by a game operation performed by a user in the virtual game, so that the method for playing music provided by the embodiment of the application can trigger the switching instruction for music by the following modes: and responding to the triggering operation of switching the virtual character from the first game state to the second game state in the virtual game, acquiring the second music piece corresponding to the second game state, and triggering the switching instruction for switching the first music piece to the second music piece.
Virtual games refer to applications developed according to game application requirements, and the types of virtual games may include, but are not limited to, at least one of the following: two-dimensional (Two-dimensional) game applications, three-dimensional (Three-dimensional) game applications, virtual Reality (VR) game applications, augmented Reality (Augmented Reality, AR) game applications, mixed Reality (MR) game applications. In the embodiment of the application, the virtual game can be any one of application programs such as a multiplayer online tactical competition game (Multiplayer Online Battle ARENA GAMES, abbreviated as Moba), a multiplayer online role playing game (Multiplayer Online Role-PLAYING GAME, abbreviated as MMORPG) and the like.
The virtual character is a character which is not present in reality and is contained in a game scene of the virtual game, including a fictional character in at least one creative work of a television play, a movie, a cartoon and a game, and in the embodiment of the application, a user can use terminal equipment to operate the virtual character in the game scene of the virtual game to play the game, wherein the game comprises but is not limited to: adjusting at least one of body posture, crawling, walking, running, jumping, driving, picking up, shooting, attacking, throwing, moving, running, defending.
In practical applications, in order to enhance the game immersion of the user, when the user operates the virtual character to switch the game state in the game scene, the music piece is generally switched correspondingly, so the music piece and the game state may have a corresponding relationship. The piece of music may be related to the game scene in which the virtual character is located, or may be related to the game action in which the virtual character is in progress. Accordingly, the game state in the present application may include scene state data or behavior state data of the virtual character. The scene state data may be a scene position where the virtual character is located, and the behavior state data may be a game behavior performed by the virtual character.
Thus, in the present application, the virtual character may be switched from the first game state to the second game state by moving the virtual character from one scene position to another scene position in the game scene, or may be switched from one game behavior to another game behavior, for example, the virtual character is switched from the moving behavior to the attacking behavior.
Each game state in the virtual game may correspond to a music piece having an emotion feature representing the game state, and the music piece may represent an atmosphere of a game scene, or may represent a type of game behavior performed by the virtual character, which is not limited in the present application.
For example, a user operating a virtual character from a virtual room into a virtual forest may switch from soothing, slower paced music to tensing, faster paced music; when the user operates the virtual character to enter the fight state from the non-fight state, the music with the loose rhythm and the slower rhythm can be switched to the music with the fierce rhythm and the faster rhythm.
In the application, the user can trigger the switching of the game state through the control, can trigger the switching of the game state through a specific gesture, and can trigger the switching of the game state through voice, and the application is not limited to the above.
Specifically, after the triggering operation of switching the virtual character from the first game state to the second game state is performed, a second music piece corresponding to the second game state may be obtained, and a switching instruction for switching from the first music piece corresponding to the first game state to the second music piece is correspondingly triggered.
In the present application, the Music pieces and game states can be bound by a Music Segment structure in the audio engine Wwise. In Wwise, music Segment is a structure used to describe a musical paragraph. A musical passage is a portion of a musical composition, typically made up of a series of musical elements, such as instruments, tones, rhythms, volume, etc. The Music Segment structure contains various attributes and parameters of the Music Segment, such as start time, end time of the Music Segment, list of Music elements, tone, tempo, volume of the Music Segment, etc. Music paragraphs and game states can be bound by using a Music Segment structure. For example, we can create a Music Segment, bind it to a game state, and when switching to that game state in a virtual game, the created Music Segment will start playing. In this way, the play and interaction of the music passage can be better controlled and managed in Wwise.
In an alternative embodiment, the rhythm transition segment may be generated in particular by: acquiring each rhythm data corresponding to each music piece; determining ith rhythm data in each rhythm data as initial rhythm data, and determining other rhythm data except the ith rhythm data in each rhythm data as termination rhythm data respectively; wherein i is an integer, i traverses 1-N, and N is the number of each rhythm data; and determining the rhythm transition paragraph according to the starting rhythm data and the ending rhythm data.
In the case that the application scene is the switching of music in the virtual game, the method and the device can specifically acquire each rhythm data corresponding to each music piece in the virtual game. It is understood that a plurality of pieces of music may be corresponding to the virtual game, and in the present application, the music designer who composes each piece of music may provide each piece of rhythm data corresponding to each piece of music in the virtual game, or the above-mentioned essentia (music information extraction package) or librosa (music feature extraction package) may extract each piece of rhythm data.
As shown in table 2, an example table of each music tempo corresponding to each music piece obtained in the method for playing music according to the embodiment of the present application is shown.
Table 2.
After each piece of rhythm data of each piece of music in the virtual game is obtained, each piece of rhythm data can be arranged and combined pairwise to obtain starting rhythm data and ending rhythm data corresponding to all possible rhythm transition paragraphs.
As shown in table 3, the types of the arrangement combinations of the start rhythm data and the end rhythm data that can be composed of the respective rhythm data determined in table 2 described above are shown.
Table 3.
It can be seen that if the number of pieces of rhythm data of each piece of music acquired is N, for each piece of rhythm data, when the rhythm data to be targeted is the starting rhythm data, there may be N-1 combinations. Therefore, when the number of pieces of rhythm data is N, the sequence of (start rhythm data, end rhythm data) is N (N-1) in total.
In this way, each tempo transition paragraph can be generated from the start tempo data corresponding to the first beat and the end tempo data corresponding to the last beat. The rhythm data of each beat in each rhythm transition paragraph is gradually changed from the initial rhythm data to the termination rhythm data according to the arrangement sequence of the beats from front to back.
In practical applications, the tempo transition paragraphs also correspond to the number of beats, where the number of beats is used to indicate how many beats the corresponding tempo transition paragraphs change from starting tempo data to ending tempo data. Therefore, when generating the preset rhythm transition paragraph, the method can be realized by the following steps: determining the number of transition beats required for switching between two different pieces of music in a plurality of pieces of music, wherein the number of transition beats is used for representing the number of beats contained in the rhythm transition paragraph; determining rhythm data corresponding to each beat in the beats of the transition beat number according to the initial rhythm data and the termination rhythm data; and determining the rhythm transition paragraph according to the rhythm data corresponding to each beat.
It should be noted that, the smaller the number of transition beats corresponding to the first transition section, the shorter the first transition section inserted in the middle when the first music section is transitioned to the second music section, and the more timely the response of music switching is heard by the user; when the number of transition beats corresponding to the first transition section is large, the longer the first transition section is inserted in the middle when the first music section is transited to the second music section, the smoother the music switching is when the user listens. In the application, the balance can be carried out in the response speed and smooth transition, and the proper transition beat number is selected to generate the preset rhythm transition paragraph.
In a specific embodiment, the number of beats of the rhythm transition segment may be determined at least by the following optional ways:
Mode one: determining the number of beats of a rhythm transition paragraph based on the user's response speed requirement for music switching
If the user wants to switch music in time when the game state is changed, the rhythm transition paragraphs can be generated by using a smaller transition beat number.
Mode two: determining a number of beats of a tempo transition paragraph based on the start tempo data and the end tempo data
The starting rhythm data and the ending rhythm data are respectively rhythm data corresponding to two different music fragments, and when the difference between the starting rhythm data and the ending rhythm data is smaller, a smaller transition beat number can be used for generating a rhythm transition paragraph. When the difference between the start tempo data and the end tempo data is large, a large number of transition beats may be used to generate a tempo transition paragraph. For example, a difference between the start tempo data and the end tempo data of 60 or more, a corresponding tempo transition paragraph can be generated by 6 transition beats; when the difference between the start tempo data and the end tempo data is smaller than 60, a corresponding tempo transition paragraph can be generated by 4 transition beats.
In the application, the number of transition beats corresponding to each rhythm transition paragraph in the preset rhythm transition paragraphs can be the same or different, and the application is not limited to this. For better description of the embodiment of the present application, the number of transition beats corresponding to each rhythm transition paragraph in the preset rhythm transition paragraphs is the same.
In practical applications, considering the requirement for feedback speed in virtual games, in order to avoid that a player feels that music is too draggy in playing the game, a half bar (two beats) may be used as the number of transition beats to generate a rhythm transition paragraph.
After determining the number of transition beats corresponding to the music switching, the beat data corresponding to each beat in the number of transition beats can be determined according to the start beat data and the end beat data. The first beat corresponds to the first beat and the last beat corresponds to the last beat, so that the beat data corresponding to each beat obtained according to the arrangement sequence of the beats in the beat of the transition beat number gradually changes from the first beat to the last beat.
In an alternative embodiment, the difference between the tempo data corresponding to each two adjacent beats may be the same or different. For example, the start tempo data is 80, the end tempo data is 120, and the number of transition beats is 5; in the case that the difference value of the rhythm data corresponding to each two adjacent beats is the same, the rhythm data from the first beat to the last beat are respectively: 80. 90, 100, 110, 120; in the case that the difference value of the rhythm data corresponding to each two adjacent beats is different, the rhythm data from the first beat to the last beat may be: 80. 87, 96, 107, 120.
In the case that the difference value of the rhythm data corresponding to each two adjacent beats is the same, the present application can specifically calculate the rhythm data corresponding to each beat in the number of transition beats by: determining a difference between the ending tempo data and the starting tempo data; dividing the difference value by the transition number of beats to obtain a beat difference between two adjacent beats; and determining the rhythm data corresponding to each beat in the transition beat number according to any one of the initial rhythm data and the termination rhythm data and the rhythm difference.
Specifically, the rhythm data corresponding to each beat may be calculated by the following formula (1) or formula (2):
Wherein N is the number of transition beats, T m is the rhythm data of the mth beat in the rhythm transition paragraph, m is less than or equal to N, T Initiation is the rhythm data of the first beat in the rhythm transition paragraph, and T Termination of is the rhythm data of the last beat in the rhythm transition paragraph. Thus, when m=1, T m=T Initiation , when m=n, T m=T Termination of .
As shown in table 4, an example table of the tempo data corresponding to each beat in the tempo transition section provided in the embodiment of the present application is shown.
Table 4.
By means of the method, the difference value of the rhythm data between every two adjacent beats in the generated rhythm transition paragraphs is the same value, when a switching instruction for switching from a first music piece to a second music piece is triggered in a game, the change speed of the rhythm in the first transition paragraph is uniform, the speed is increased or reduced at a uniform speed, and when a player listens, the rhythm is uniformly changed, so that smooth transition during music switching is further ensured, and abrupt feeling during music switching is avoided.
Specifically, when the first music piece is switched to play the first transition paragraph, the currently played first music piece may be directly switched to the first transition paragraph, or the playing may be further switched according to the currently played data of the first music piece.
Specifically, when the playing is switched according to the current playing data of the first music piece, after the playing of the music beat of the current playing of the first music piece is completed, the playing of the first music piece can be stopped, and the first transition paragraph can be played; and stopping playing the first music piece and playing the first transition paragraph after the playing of the music section currently played by the first music piece is completed.
For example, the first music piece is electronic music, the corresponding harmony tends to be monotonous, and when the first transition paragraph is directly switched from playing the first music piece to playing the first transition paragraph, the user feel is not abrupt, and then after the playing of the beat of the music currently played by the first music piece is completed, the playing of the first music piece can be stopped and the playing of the first transition paragraph can be started.
For another example, when the first music piece is popular music and the first transition passage is switched from playing the first music piece directly, an abrupt hearing experience may be brought to the user, and then after the playing of the currently played music section of the first music piece is completed, the playing of the first music piece may be stopped and the playing of the first transition passage may be started.
In practical applications, in order to make the rhythm transition segment inserted between two pieces of music more musical, tone color data may be further assigned to the rhythm transition segment in the present application.
Timbre refers to the quality or characteristic that is characteristic of each instrument or sound in the music. The tone color is determined by the physical structure of the instrument, the materials of construction, the playing skills and the playing environment, so that each instrument or sound has its unique tone color. Timbres can be used to distinguish between different instruments or sounds, such as pianos, guitars, violins, human voices, and the like. Timbres can also be used to express emotion and theme of music, e.g., a soft timbre can express gentle emotion, while an aggressive timbre can express emotion of passion. In musical composition, a music designer may use various timbres to create unique musical effects, such as using a special timbre to enhance the sound of a certain instrument, or using a synthesizer to create a new timbre.
As an embodiment, when each music piece in the virtual game is in the same music form, a preset rhythm transition paragraph can be generated by tone color data matched with the music form when the rhythm transition paragraph is preset. For example, each music piece in the virtual game is electronic music, and then a preset rhythm transition paragraph can be generated through an electronic tone corresponding to the electronic music, for example, an electronic drum can be used for generating the rhythm transition paragraph.
As another embodiment, the generated rhythm transition segment may have only rhythm data, and tone color data is further given to the rhythm transition segment during the course of the virtual game.
In an alternative embodiment, the rhythm transition segment generated in the present application may specifically be music data in MIDI (Musical Instrument DIGITAL INTERFACE ) format.
MIDI (Musical Instrument DIGITAL INTERFACE) is a digital music standard that defines communication protocols between instruments, music production software and other music devices. MIDI allows music information, such as notes played by musical instruments, chords, speed and volume, etc., to be exchanged between different musical devices. MIDI works by converting information such as notes, chords, velocity, and volume played by a musical instrument into digital signals and then transmitting these digital signals to other musical devices such as computer music software, synthesizers, audio interfaces, etc. These musical apparatuses can control their own outputs, such as generating corresponding notes, chords, speeds, and volumes, etc., based on the received MIDI signals.
MIDI has the advantage that it allows seamless collaboration between different music devices, so MIDI allows music designers to share music information between different devices. MIDI also allows music designers to make music on a computer, and MIDI also allows computers to recognize and process music information.
In practice, a music designer may create a virtual instrument at Wwise, the timbre data of the virtual instrument may be stored at Actor Mixer Hierarchy, and the corresponding music may be played during the course of the virtual game by driving the timbre data of the virtual instrument using the first transition segment of the MIDI format through Wwise.
It should be noted that, tone color data corresponding to each music piece in the virtual game may be the same or different, so that in order to switch from playing the first music piece to playing the first transition section, and switch to playing the second music piece after the first transition section is played, the tone color transition is smoother and natural, and the present application can assign tone color data to the first transition section by the following steps:
And when the tone color data of the first music piece and the tone color data of the second music piece are both first tone color data, the first tone color data is endowed to the first transition paragraph, and the first transition paragraph endowed with the tone color data is obtained.
Acquiring second tone color data of the first music piece and third tone color data of the second music piece under the condition that tone color data of the first music piece and tone color data of the second music piece are different; setting tone data of the first transition section according to the second tone data and the third tone data to obtain the first transition section endowed with tone data, so that the tone variation trend of the first transition section endowed with tone data is changed from the second tone indicated by the second tone data to the third tone indicated by the third tone data;
after the first transition section to which the tone color data is given is obtained, the playing of the first music piece may be switched to the playing of the first transition section to which the tone color data is given.
In the application, when the tone color data of the first music piece and the second music piece are the same as the first tone color data, the first tone color data can be endowed to the first transition section, so that the tone color data of the first transition section is consistent with the tone color data of the first music piece and the second music piece. In this way, when switching from playing the first music piece of the first tone color data to playing the first transition piece corresponding to the first tone color data, the first transition piece switches to playing the second music piece corresponding to the first tone color data after the playing is completed, and the played music piece and the transition piece have the same tone color data, so that the user listens to have the same tone color.
Under the condition that tone color data of the first music piece and tone color data of the second music piece are different, second tone color data corresponding to the first music piece and third tone color data corresponding to the second music piece can be respectively obtained to set tone color data of the first transition paragraph. Specifically, the starting tone data of the first transition section may be set to the second tone data, the ending tone data of the first transition section may be set to the third tone data, and the intermediate tone data of the first transition section may be set to be gradually changed from the second tone data to the third tone data, so that the tone variation trend of the first transition section is such that the second tone indicated by the second tone data is gradually changed to the third tone indicated by the third tone data.
For example, where the second tone color data is the tone color data of an electronic drum and the third tone color data is the tone color data of an electric guitar, the electronic drum fade-out and the electric guitar fade-in may be controlled in the first transition section to complete a smooth transition from the electronic drum to the electric guitar.
In practical application, a virtual container may be preset for storing tone data corresponding to a virtual instrument used by each music piece in the virtual game, so that when music is switched, corresponding second tone data and third tone data are selected from the virtual container according to second tone data corresponding to a first music piece before switching and third tone data corresponding to a second music piece after switching.
In an alternative embodiment, the first transition section may be further provided with sound data according to the first sound data of the first music section and the second sound data of the second music section, so that the sound change trend corresponding to the first transition section is gradually changed from the first sound corresponding to the first sound data to the second sound corresponding to the second sound data. Specifically, in the first transition section, the first sum sound data fade-out and the second sum sound data fade-in may be set so as to achieve the effect of changing harmony from the first sum sound corresponding to the first sum sound data to the second sum sound corresponding to the second sum sound data.
In the present application, a music designer may generate a tempo transition paragraph specifically through a computer music system. The following describes the generation of rhythm transition paragraphs by means of a computer music system in the present application:
as shown in fig. 4, a schematic diagram of a node network configuration in OM in a method for playing music according to an embodiment of the present application is shown, in the node network of OM, three nodes of start tempo data 10, end tempo data 11, and transition tempo number 12 are connected to an interpolation 13 node, so that OM can generate a tempo transition paragraph based on the configured node network.
Fig. 5 is a schematic diagram of generating a rhythm transition segment in OM in the method for playing music according to the embodiment of the present application, fig. 5 is an example of a rhythm transition segment generated after the node setting shown in fig. 4 is performed in OM, in fig. 4, the starting rhythm data is 80, the ending rhythm data is 120, and the number of transition beats is 5, so that rhythm data of each beat shown in fig. 5 is obtained, and the front-to-back ordering is respectively: 80. 90, 100, 110, 120.
In addition, in OM, in addition to generating the rhythm transition paragraphs, the generated rhythm transition paragraphs may also be stored. Specifically, the generated rhythm Transition paragraphs may be stored as MIDI files, and each MIDI file may be named according to start rhythm data and end rhythm data corresponding to the rhythm Transition paragraphs, where x is the start rhythm data, and y is the end rhythm data, and the naming format may be, for example, transition_from_x_to_y. Thus, it can also be seen from the naming of the MIDI files that the rhythm transition paragraph of the MIDI file transitions from which specific start rhythm data to which specific end rhythm data. In this way, when a switch instruction to switch from a first piece of music to a second piece of music is triggered, a corresponding first transition piece can be quickly determined from the stored tempo transition pieces.
As shown in fig. 6, a schematic diagram of MIDI files corresponding to a transition segment of a rhythm generated in OM according to an embodiment of the present application is shown, in OM, MIDI files corresponding to a transition segment of a rhythm from the start rhythm data 112 to the end rhythm data 116, MIDI files corresponding to a transition segment of a rhythm from the start rhythm data 112 to the end rhythm data 120, MIDI files corresponding to a transition segment of a rhythm from the start rhythm data 112 to the end rhythm data 140, MIDI files corresponding to a transition segment of a rhythm from the start rhythm data 112 to the end rhythm data 145, and the like are stored.
It should be noted that, besides MIDI files, the generated rhythm transition paragraphs may also be stored as file formats that can be read and played in other formats, and the file format stored in the rhythm transition paragraphs is not limited in the present application. In addition, the file corresponding to the stored rhythm transition paragraph may be named as other forms besides the named forms mentioned above, and the rhythm transition paragraph may have a correspondence with the respective start rhythm data and end rhythm data, so that when a switching instruction for switching from the first music piece to the second music piece is triggered, the corresponding first transition paragraph may be determined according to the correspondence. The application is not particularly limited to naming the file corresponding to the rhythm transition paragraph.
Corresponding to the method for playing music provided in the first embodiment of the present application, the second embodiment of the present application further provides an apparatus for playing music, where the played music includes a plurality of pieces of music, as shown in fig. 7, and the apparatus 700 for playing music includes:
An obtaining unit 701, configured to obtain first rhythm data corresponding to a first music piece and second rhythm data corresponding to a second music piece in response to a switching instruction for switching from the first music piece to the second music piece in the plurality of music pieces;
a determining unit 702, configured to determine a first transition paragraph from preset rhythm transition paragraphs according to the first rhythm data and the second rhythm data;
a switching unit 703, configured to switch the playing of the first music piece to the playing of the first transition paragraph, and play the second music piece after the playing of the first transition paragraph is completed.
Optionally, the determining unit 702 is specifically configured to: and determining a paragraph with the initial rhythm data as the first rhythm data and the ending rhythm data as the second rhythm data in the rhythm transition paragraphs as the first transition paragraphs.
Optionally, the apparatus 700 for playing music further includes a generating unit, where the generating unit is configured to generate the rhythm transition segment, and the generating unit is specifically configured to: acquiring each rhythm data corresponding to each music piece; determining ith rhythm data in each rhythm data as initial rhythm data, and determining other rhythm data except the ith rhythm data in each rhythm data as termination rhythm data respectively; wherein i is an integer, i traverses 1-N, and N is the number of each rhythm data; and determining the rhythm transition paragraph according to the starting rhythm data and the ending rhythm data.
Optionally, the generating unit is specifically configured to: determining the number of transition beats required for switching between two different pieces of music in the plurality of pieces of music, wherein the number of transition beats is used for representing the number of beats contained in the rhythm transition paragraph; determining rhythm data corresponding to each beat in the beats of the transition beat number according to the initial rhythm data and the termination rhythm data; and determining the rhythm transition paragraph according to the rhythm data corresponding to each beat.
Optionally, the generating unit is further specifically configured to: determining a difference between the ending tempo data and the starting tempo data; dividing the difference value by the number of beat segments to obtain the rhythm difference between two adjacent beats, wherein the number of beat segments is the difference value between the transition beat number and 1; and determining the corresponding rhythm data of each beat in the transition beat number according to one of the initial rhythm data and the termination rhythm data and the rhythm difference.
Optionally, the switching unit 703 is specifically configured to: stopping playing the first music piece and playing the first transition paragraph after the current played music beat of the first music piece is played; or stopping playing the first music piece and playing the first transition paragraph after the playing of the music section currently played by the first music piece is completed.
Optionally, the apparatus 700 for playing music further includes a giving unit for: when the tone color data of the first music piece and the tone color data of the second music piece are both first tone color data, the first tone color data are endowed to the first transition section, and the first transition section endowed with the tone color data is obtained;
The switching unit 703 is specifically configured to: and switching the playing of the first music piece to the playing of the first transition paragraph endowed with tone color data.
Optionally, the imparting unit is further configured to: acquiring second tone color data of the first music piece and third tone color data of the second music piece under the condition that tone color data of the first music piece and tone color data of the second music piece are different; setting tone data of the first transition section according to the second tone data and the third tone data to obtain the first transition section endowed with tone data, so that the tone variation trend of the first transition section endowed with tone data is changed from the second tone indicated by the second tone data to the third tone indicated by the third tone data;
The switching unit 703 is specifically configured to: and switching the playing of the first music piece to the playing of the first transition paragraph endowed with tone color data.
Optionally, the apparatus 700 for playing music further includes a triggering unit, where the triggering unit is configured to: and responding to a trigger operation of switching the virtual character from a first game state to a second game state in the virtual game, acquiring the second music piece corresponding to the second game state, and triggering a switching instruction of switching the first music piece corresponding to the first game state to the second music piece.
The third embodiment of the present application also provides an electronic device for playing music, corresponding to the method for playing music provided in the first embodiment of the present application. As shown in fig. 8, the electronic device 800 includes: a processor 801; and a memory 802 for storing a program of a method of playing music, the apparatus, after being powered on and running the program of the method of playing music by the processor, performing the steps of:
responding to a switching instruction for switching from a first music piece to a second music piece in the plurality of music pieces, and acquiring first rhythm data corresponding to the first music piece and second rhythm data corresponding to the second music piece;
determining a first transition paragraph from preset rhythm transition paragraphs according to the first rhythm data and the second rhythm data;
And switching the playing of the first music piece to the playing of the first transition paragraph, and playing the second music piece after the playing of the first transition paragraph is completed.
A fourth embodiment of the present application provides a computer-readable storage medium storing a program for a method of playing music, the program being executed by a processor, the program performing the steps of:
responding to a switching instruction for switching from a first music piece to a second music piece in the plurality of music pieces, and acquiring first rhythm data corresponding to the first music piece and second rhythm data corresponding to the second music piece;
determining a first transition paragraph from preset rhythm transition paragraphs according to the first rhythm data and the second rhythm data;
And switching the playing of the first music piece to the playing of the first transition paragraph, and playing the second music piece after the playing of the first transition paragraph is completed.
It should be noted that, for the detailed descriptions of the apparatus, the electronic device, and the computer readable storage medium provided in the second embodiment, the third embodiment, and the fourth embodiment of the present application, reference may be made to the related descriptions of the first embodiment of the present application, and the detailed descriptions are omitted here.
While the application has been described in terms of preferred embodiments, it is not intended to be limiting, but rather, it will be apparent to those skilled in the art that various changes and modifications can be made herein without departing from the spirit and scope of the application as defined by the appended claims.
In one typical configuration, the node devices in the blockchain include one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include volatile memory in a computer-readable medium, random Access Memory (RAM) and/or nonvolatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM). Memory is an example of computer-readable media.
1. Computer readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of storage media for a computer include, but are not limited to, phase change memory (PRAM), static Random Access Memory (SRAM), dynamic Random Access Memory (DRAM), random Access Memory (RAM) of other nature, read Only Memory (ROM), electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), digital Versatile Disks (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage media or any other non-transmission media that can be used to store information that can be accessed by a computing device. Computer readable media, as defined herein, does not include non-transitory computer readable media (transmission media), such as modulated data signals and carrier waves.
2. It will be appreciated by those skilled in the art that embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
While the application has been described in terms of preferred embodiments, it is not intended to be limiting, but rather, it will be apparent to those skilled in the art that various changes and modifications can be made herein without departing from the spirit and scope of the application as defined by the appended claims.

Claims (13)

1. A method of playing music, wherein the music comprises a plurality of pieces of music, the method comprising:
responding to a switching instruction for switching from a first music piece to a second music piece in the plurality of music pieces, and acquiring first rhythm data corresponding to the first music piece and second rhythm data corresponding to the second music piece;
determining a first transition paragraph from preset rhythm transition paragraphs according to the first rhythm data and the second rhythm data;
And switching the playing of the first music piece to the playing of the first transition paragraph, and playing the second music piece after the playing of the first transition paragraph is completed.
2. The method of claim 1, wherein a difference between start tempo data corresponding to a first beat in the first transition section and the first tempo data is within a preset range and a difference between end tempo data corresponding to a last beat in the first transition section and the second tempo data is within the preset range.
3. The method of claim 1, wherein the determining a first transition paragraph from a preset rhythm transition paragraph based on the first and second rhythm data comprises:
And determining a paragraph with the initial rhythm data as the first rhythm data and the ending rhythm data as the second rhythm data in the rhythm transition paragraphs as the first transition paragraphs.
4. The method of claim 1, wherein the rhythm transition segment is generated by:
Acquiring each rhythm data corresponding to each music piece;
Determining ith rhythm data in each rhythm data as initial rhythm data, and determining other rhythm data except the ith rhythm data in each rhythm data as termination rhythm data respectively; wherein i is an integer, i traverses 1-N, and N is the number of each rhythm data;
and determining the rhythm transition paragraph according to the starting rhythm data and the ending rhythm data.
5. The method of claim 4, wherein said determining said tempo transition segment from said start tempo data and said end tempo data comprises:
determining the number of transition beats required for switching between two different pieces of music in the plurality of pieces of music, wherein the number of transition beats is used for representing the number of beats contained in the rhythm transition paragraph;
determining rhythm data corresponding to each beat in the beats of the transition beat number according to the initial rhythm data and the termination rhythm data;
and determining the rhythm transition paragraph according to the rhythm data corresponding to each beat.
6. The method of claim 5, wherein determining the tempo data corresponding to each of the number of transition beats based on the start tempo data and the end tempo data includes:
Determining a difference between the ending tempo data and the starting tempo data;
Dividing the difference value by the number of beat segments to obtain the rhythm difference between two adjacent beats, wherein the number of beat segments is the difference value between the transition beat number and 1;
and determining the corresponding rhythm data of each beat in the transition beat number according to one of the initial rhythm data and the termination rhythm data and the rhythm difference.
7. The method of claim 1, wherein switching from playing the first piece of music to playing the first transition paragraph comprises:
Stopping playing the first music piece and playing the first transition paragraph after the current played music beat of the first music piece is played; or alternatively
And stopping playing the first music piece and playing the first transition paragraph after the playing of the music bar currently played by the first music piece is completed.
8. The method of claim 1, wherein in the case where the timbre data of the first piece of music and the second piece of music are both first timbre data, before the switching from playing the first piece of music to playing the first transition paragraph, the method further comprises:
Assigning the first tone color data to the first transition section to obtain the first transition section to which the tone color data is assigned;
the switching from playing the first music piece to playing the first transition paragraph includes:
and switching the playing of the first music piece to the playing of the first transition paragraph endowed with tone color data.
9. The method of claim 1, wherein in the event that the timbre data of the first piece of music and the second piece of music are different, before the switching from playing the first piece of music to playing the first transition paragraph, the method further comprises:
Acquiring second tone color data of the first music piece and third tone color data of the second music piece;
Setting tone data of the first transition section according to the second tone data and the third tone data to obtain the first transition section endowed with tone data, so that the tone variation trend of the first transition section endowed with tone data is changed from the second tone indicated by the second tone data to the third tone indicated by the third tone data;
the switching from playing the first music piece to playing the first transition paragraph includes:
and switching the playing of the first music piece to the playing of the first transition paragraph endowed with tone color data.
10. The method according to claim 1, wherein the method further comprises:
And responding to a trigger operation of switching the virtual character from a first game state to a second game state in the virtual game, acquiring the second music piece corresponding to the second game state, and triggering a switching instruction of switching the first music piece corresponding to the first game state to the second music piece.
11. An apparatus for playing music, wherein the music comprises a plurality of pieces of music, the apparatus comprising:
An obtaining unit, configured to obtain first rhythm data corresponding to a first music piece and second rhythm data corresponding to a second music piece in response to a switching instruction for switching from the first music piece to the second music piece in the plurality of music pieces;
a determining unit, configured to determine a first transition paragraph from preset rhythm transition paragraphs according to the first rhythm data and the second rhythm data;
and the switching unit is used for switching the playing of the first music piece to the playing of the first transition paragraph and playing the second music piece after the playing of the first transition paragraph is completed.
12. An electronic device, comprising:
a processor; and
A memory for storing a data processing program, the electronic device being powered on and executing the program by the processor, for performing the method of any of claims 1-10.
13. A computer readable storage medium, characterized in that a data processing program is stored, which program is run by a processor, performing the method according to any of claims 1-10.
CN202410092953.9A 2024-01-23 2024-01-23 Method, device, electronic equipment and computer readable storage medium for playing music Pending CN118121934A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202410092953.9A CN118121934A (en) 2024-01-23 2024-01-23 Method, device, electronic equipment and computer readable storage medium for playing music

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202410092953.9A CN118121934A (en) 2024-01-23 2024-01-23 Method, device, electronic equipment and computer readable storage medium for playing music

Publications (1)

Publication Number Publication Date
CN118121934A true CN118121934A (en) 2024-06-04

Family

ID=91236531

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202410092953.9A Pending CN118121934A (en) 2024-01-23 2024-01-23 Method, device, electronic equipment and computer readable storage medium for playing music

Country Status (1)

Country Link
CN (1) CN118121934A (en)

Similar Documents

Publication Publication Date Title
US6093880A (en) System for prioritizing audio for a virtual environment
Vail The synthesizer: a comprehensive guide to understanding, programming, playing, and recording the ultimate electronic music instrument
US7491878B2 (en) Method and apparatus for automatically creating musical compositions
Fritsch et al. The Cambridge companion to video game music
US20220262328A1 (en) Musical composition file generation and management system
Gungormusler et al. barelymusician: An adaptive music engine for video games
US20240055024A1 (en) Generating and mixing audio arrangements
Hoeberechts et al. A flexible music composition engine
WO2025139724A1 (en) Music accompaniment generation method and apparatus, device, storage medium and program product
Loubet et al. Laptop performers, compact disc designers, and no-beat techno artists in Japan: Music from nowhere
CN118121934A (en) Method, device, electronic equipment and computer readable storage medium for playing music
Sporka et al. Design and implementation of a non-linear symphonic soundtrack of a video game
McAlpine The sound of 1-bit: Technical constraint and musical creativity on the 48k Sinclair ZX Spectrum
Redhead Composing and recording for fluid digital music forms
US20240038205A1 (en) Systems, apparatuses, and/or methods for real-time adaptive music generation
Hopkins Chiptune music: An exploration of compositional techniques as found in Sunsoft games for the Nintendo Entertainment System and Famicom from 1988-1992
JP2003177751A (en) Playing data processing device
Liu Advanced Dynamic Music: Composing Algorithmic Music in Video Games as an Improvisatory Device for Players
JP7632589B2 (en) Content data processing method and content data processing device
Yu Computer generated music composition
Lundh Haaland The Player as a Conductor: Utilizing an Expressive Performance System to Create an Interactive Video Game Soundtrack
de Abreu Recreating tracker music sequencers in modern videogames: an integrated model approach for adaptive music
Wells The Crossings: Defining Slave to the Rhythm
da Silva Gomes et al. Densus Bridge: For trumpet and live electronics (live looping and effects)
Tähtinen Use of procedural audio in Unity

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination