Music playing method and device, electronic equipment and computer readable storage medium

CN122548002APending Publication Date: 2026-08-11SHENZHEN WANSHENG CULTURE TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-07-14
Publication Date
2026-08-11

AI Technical Summary

Technical Problem

[0005]因此,现有技术针对传入“play_specified_song (song_id)”函数的音乐播放参数与音乐搜索结果中的真实音乐播放参数不一致的情况,存在无法兼顾音乐播放成功率和准确率的技术问题

Benefits of technology

[0012] The music playback method, apparatus, electronic device, and computer-readable storage medium provided in this application have the following technical effects: In the music search stage, a candidate execution context is generated based on the music search results. The candidate execution context is used to limit the correction range of music playback parameters, so that subsequent music playback parameter correction does not deviate from the most recent music search candidate set. In the music playback parameter correction stage, the music playback parameters carried in the music playback request are corrected within the candidate execution context. Compared with the prior art, this application corrects the music playback parameters within a limited music playback parameter correction space, which can improve the music playback success rate while maintaining the playback safety boundary, avoid the problem of music playback failure due to local numerical errors in music playback parameters, and reduce the risk of misplay caused by open fuzzy matching. Thus, it can achieve the technical effect of balancing music playback success rate and accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122548002A_ABST
    Figure CN122548002A_ABST
Patent Text Reader

Abstract

This application proposes a music playback method, apparatus, electronic device, and computer-readable storage medium. Upon receiving a music search request, this application performs a music search based on the request to obtain music search results; generates a candidate execution context based on the music search results, the candidate execution context being used to limit the correction range of music playback parameters; upon receiving a music playback request, extracts the music playback parameters carried in the music playback request; determines whether to correct the music playback parameters carried in the music playback request; if it is determined that the music playback parameters carried in the music playback request should be corrected, then corrects the music playback parameters carried in the music playback request within the candidate execution context to obtain corrected music playback parameters; and plays music based on the corrected music playback parameters. This application can balance music playback success rate and accuracy.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of edge-side intelligent agent tool invocation technology, and more specifically, to a music playback method, device, electronic device, and computer-readable storage medium. Background Technology

[0002] In a music tool calling scenario driven by a large model, the "search_music (keyword)" function is first used to search for music, obtain the long numeric music playback parameter "song_id" (e.g., 4082750), and then the music playback parameter is passed to the "play_specified_song (song_id)" function to complete the music playback.

[0003] However, since the model does not directly reuse the program's internal variables after successfully searching for music, but instead regenerates the music playback parameters based on the music search results, the generation of long numerical music playback parameters is prone to local transcription errors such as missing, added, replaced, or misplaced digits. This results in the music playback parameters passed to the "play_specified_song (song_id)" function being inconsistent with the actual music playback parameters in the music search results, ultimately leading to playback failure or playback errors.

[0004] Regarding situations where the music playback parameters passed to the "play_specified_song (song_id)" function are inconsistent with the actual music playback parameters in the music search results, one existing technology directly rejects playback when the music playback parameters are inconsistent with the actual music playback parameters in the music search results. Although this improves the music playback accuracy, the music playback success rate is low. Another existing technology uses weakly constrained fault tolerance conditions to replace the music playback parameters when they are inconsistent with the actual music playback parameters in the music search results. Although this improves the music playback success rate, the music playback accuracy is low, the risk of misplay is high, and the results are untraceable. "Weakly constrained fault tolerance" refers to the system directly replacing an incorrect music playback parameter with a candidate playback parameter based solely on fuzzy similarity, empirical rules, or default priority, without being strictly restricted by the candidate set. For example, if the passed music playback parameter is not in the candidate set, the system does not require "unique approximate hit" but directly takes the first song in the latest candidate as the fallback result, which is a case of weakly constrained fault tolerance. "Weakly constrained fault tolerance" may improve the success rate, but it carries the risk of misplay.

[0005] Therefore, existing technologies have a technical problem in addressing situations where the music playback parameters passed to the "play_specified_song (song_id)" function are inconsistent with the actual music playback parameters in the music search results, making it impossible to balance music playback success rate and accuracy. Summary of the Invention

[0006] This application provides a music playback method, apparatus, electronic device, and computer-readable storage medium to solve the aforementioned technical problems.

[0007] In a first aspect, embodiments of this application provide a music playback method, the method comprising: upon receiving a music search request, performing a music search based on the music search request to obtain music search results; generating a candidate execution context based on the music search results, the candidate execution context being used to limit the correction range of music playback parameters; upon receiving a music playback request, extracting the music playback parameters carried in the music playback request; determining whether to correct the music playback parameters carried in the music playback request; if it is determined that the music playback parameters carried in the music playback request should be corrected, correcting the music playback parameters carried in the music playback request within the candidate execution context to obtain corrected music playback parameters; and playing music based on the corrected music playback parameters.

[0008] Secondly, embodiments of this application provide a music playback device, comprising: a music search module, configured to perform a music search based on a music search request after receiving the request, and obtain music search results; a context generation module, configured to generate a candidate execution context based on the music search results, wherein the candidate execution context is used to limit the correction range of music playback parameters; a playback parameter extraction module, configured to extract music playback parameters carried in the music playback request after receiving the request; a playback parameter detection module, configured to determine whether to correct the music playback parameters carried in the music playback request; a playback parameter correction module, configured to, if it is determined that the music playback parameters carried in the music playback request should be corrected, correct the music playback parameters carried in the music playback request within the candidate execution context to obtain corrected music playback parameters; and a music playback module, configured to play music based on the corrected music playback parameters.

[0009] Thirdly, embodiments of this application provide an electronic device, which includes a memory and a processor. The memory stores an application program that, when invoked by the processor, causes the processor to execute the method provided in the embodiments of this application.

[0010] Fourthly, embodiments of this application provide a computer-readable storage medium storing program code, which, when invoked by a processor, causes the processor to execute the method provided in embodiments of this application.

[0011] Fifthly, embodiments of this application provide a computer program product, which, when invoked by a processor, causes the processor to execute the method provided in embodiments of this application.

[0012] The music playback method, apparatus, electronic device, and computer-readable storage medium provided in this application have the following technical effects: In the music search stage, a candidate execution context is generated based on the music search results. The candidate execution context is used to limit the correction range of music playback parameters, so that subsequent music playback parameter correction does not deviate from the most recent music search candidate set. In the music playback parameter correction stage, the music playback parameters carried in the music playback request are corrected within the candidate execution context. Compared with the prior art, this application corrects the music playback parameters within a limited music playback parameter correction space, which can improve the music playback success rate while maintaining the playback safety boundary, avoid the problem of music playback failure due to local numerical errors in music playback parameters, and reduce the risk of misplay caused by open fuzzy matching. Thus, it can achieve the technical effect of balancing music playback success rate and accuracy. Attached Figure Description

[0013] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments and drawings obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0014] Figure 1 This is a flowchart illustrating the interaction between the client and the server according to an embodiment of this application; Figure 2 This is a structural block diagram of a music playback system provided in one embodiment of this application; Figure 3 This is a flowchart of a music playback method provided in an embodiment of this application; Figure 4 This is a flowchart of a music playback method provided in another embodiment of this application; Figure 5 This is a structural block diagram of a music playback device provided in one embodiment of this application; Figure 6 This is a structural block diagram of an electronic device provided in an embodiment of this application. Detailed Implementation

[0015] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings.

[0016] The music playback method in this application can be applied to music playback devices or electronic devices (clients), and the music playback device can be deployed in an electronic device. Electronic devices can include, but are not limited to, smartphones, tablets, laptops, and in-vehicle computers. Electronic devices can communicate with other electronic devices or servers via wired or wireless networks. Servers can be independent physical servers, server clusters or distributed systems composed of multiple physical servers, or cloud servers providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and artificial intelligence platforms.

[0017] See Figure 1 , Figure 1This is a flowchart illustrating the interaction between the client and server according to an embodiment of this application. The method of this application involves both the client and server. The caller of the Large Language Model (LLM) / Agent (the LLM / Agent caller refers to an external system or program that actively initiates a request and triggers the model or agent to execute a task) uses the client's Model Context Protocol (MCP) tool call entry "mcp_call_tool" to initiate a music search request "search_music (keyword)". After receiving the music search request, the client performs a music search based on the request and returns the music search results. Based on the music search results, it generates and caches candidate execution contexts (trace identifier "trace_id" + candidate set + time-to-live (TTL) window). The LLM / Agent caller uses the client's MCP tool call entry "mcp_call_tool" to initiate a music playback request "play_specified_song (song_id)". Upon receiving a music playback request, the client validates the music playback parameters carried in the request within a valid candidate execution context to determine if the parameters need correction. If correction is not required, the client sends the parameters to the server, enabling the server to play the music using them. If correction is needed, the client corrects the parameters within the candidate execution context and sends the corrected parameters to the server, enabling the server to play the music using them. If no definitive music playback parameters can be obtained after correction, playback is refused. The client writes the information generated during this process back to the auditing module. The client's auditing module then feeds back the audit data of this request chain to the LLM / Agent caller and the server's "MCP_AUDIT," which is a security auditing tool configured for MCP.

[0018] Specifically, after the music search "search_music" returns, the client generates a candidate playlist "play_candidates" and objects it as a candidate execution context. The lifecycle of the candidate execution context is managed using a trace identifier "trace_id", a candidate snapshot identifier "snapshot_id", and an expiration window "expire_at". Before calling the function "play_specified_song(song_id)" corresponding to the music playback request, the music playback parameter "song_id" is first validated within the candidate execution context. Only after determining that playback parameter correction is needed is the playback parameter corrected within the candidate execution context. The system performs playback parameter correction; it records whether playback parameters need correction via MCP "B7_MCP_PLAY_VALIDATE", whether automatic correction is performed if correction is required, the reason for correction, and the final music playback parameters used; finally, it returns the original music playback parameters "song_id_original", the corrected music playback parameters "song_id_corrected", the music playback parameter correction flag "song_id_corrected_bool", the correction reason "correct_reason", and the candidate trace identifier "candidate_trace_id" carried in the music playback request to the upper layer. The server (with the music application installed) maintains the business capabilities and return protocol of the function "play_specified_song" corresponding to the music playback request; it outputs the execution results through the "MCP_AUDIT" tool in MCP; and it uses the trace identifier "trace_id" to form an end-to-end audit chain with the client correction log.

[0019] See Figure 2 , Figure 2This is a structural block diagram of a music playback system provided in an embodiment of this application. The music playback system 100 can be deployed on a client. The music playback system 100 includes a context building module 110, a context caching module 120, a parameter verification module 130, a correction decision module 140, an execution module 150, and an auditing module 160. The context building module 110 is used to generate candidate execution contexts based on music search results. The context caching module 120 is used to maintain candidate execution contexts by session or request window. Specifically, after each successful music search, candidate playback parameter sets and corresponding entry mappings are extracted from the music search results and written to the candidate context cache using the trace identifier "trace_id" as the association key. The writing time is also recorded. When a music playback request is received subsequently, the timeout cache is cleared first, and then the most recent candidate execution context is read from the valid time window for music playback parameter verification and correction. The parameter verification module 130 is used to verify the music playback parameters carried in the music playback request within the candidate execution context. The correction decision module 140 is used to perform music playback parameter verification within the candidate execution context to complete the unique candidate selection. The execution module 150 is used to invoke the playback tool using the corrected music playback parameters. The audit module 160 is used to record the parameters before and after correction and their associated identifiers. For the specific working process of the above modules, please refer to the relevant sections in the method embodiments below.

[0020] See Figure 3 , Figure 3 This is a flowchart of a music playback method provided in an embodiment of this application. The music playback method includes steps S110 to S160.

[0021] Step S110: After receiving a music search request, perform a music search based on the music search request and obtain music search results.

[0022] The system receives a music search request, "search_music (keyword)," which carries the search term "keyword." The search term can include, but is not limited to, music title, artist name, album name, and radio station name. Upon receiving the music search request, the system performs a music search based on the request to obtain music search results. The music search results (candidate result set) include at least music playback parameters and music title, and typically also structured information such as artist, album, and duration. In this application, the music playback parameters are numerical playback parameters, i.e., the music's identification number (song_id).

[0023] Step S120: Generate a candidate execution context based on the music search results. The candidate execution context is used to limit the correction range of the music playback parameters.

[0024] Step S120 includes: extracting candidate music item objects "result_items" from music search results (candidate music item objects include music playback parameters "song_id", music name, artist, album, duration, etc.); extracting the music playback parameter "song_id" from the candidate music item objects as candidate playback parameters to form a candidate playback parameter set; establishing a mapping relationship between candidate playback parameters and candidate music item objects; extracting a candidate playlist "play_candidates" from the candidate music item objects (each candidate in the candidate playlist includes at least the search return ranking "rank", candidate playback parameter "song_id", candidate music name "name", and artist "artist"); and saving the candidate playback parameter set, the mapping relationship, the candidate playlist, and the candidate snapshot identifier, time window, and request association key of the music search request together as a candidate execution context. Subsequent music playback requests are only allowed to perform playback parameter verification and correction within the candidate range limited by the candidate execution context, thereby ensuring that playback parameter correction is performed within a limited playback parameter correction space, improving the accuracy of playback parameter correction, and improving the success rate and accuracy of music playback.

[0025] The candidate execution context in this application is not ordinary display data, but rather the unique constraint space for subsequent music playback parameter correction. The candidate execution context includes at least the following data: 1. Candidate playback parameter set: The candidate playback parameter set includes multiple candidate playback parameters, which are the identification numbers (song_id) of the candidate music. 2. The mapping relationship between candidate playback parameters (song_id) and candidate music item objects (item) (song_id-item). The music item object should include at least structured information such as music name, artist, album, and duration, which will be used for subsequent verification, display and correction. 3. Candidate snapshot identifier (snapshot_id): The candidate snapshot identifier is used to distinguish different music search result snapshots. More specifically, the candidate snapshot identifier is used to identify "the unique snapshot version of this batch of candidate results returned by this music search". During subsequent playback correction, the search result snapshot can be used to limit the judgment to this batch of candidates, avoiding the reference of other batches or changed data, ensuring the timeliness of music playback, and thus improving the accuracy of music playback. 4. Expires window (expire_at): The expires window is used to limit the effective period of the candidate execution context. More specifically, the expires window represents the effective deadline of the candidate execution context. Before this time, music playback parameter correction within the candidate execution context is allowed. After this time, automatic correction is no longer allowed, and music must be searched again to ensure the timeliness of music playback and thus improve the accuracy of music playback. 5. Request association key. The request association key must include at least the trace identifier (trace_id) or an association identifier equivalent to the trace identifier. The trace identifier is a unique identifier for the entire request chain and consists of a string of characters / numbers. 6. Candidate Ranking Information: This information includes the ranking, status, and weight fields for each candidate song in the music search results. It is used by the front-end / model to determine which candidate song to prioritize and whether it can be played. The candidate ranking information must at least include the search return order and playable status of the candidate song. Optionally, it may also include a ranking score or an executable flag. The search return order is used for deterministic selection when multiple candidates conflict. The search return order is the ranking / sequence of the candidate song in the music search results list, starting from 1, representing the order in which the search results were returned. The playable status is a Boolean / status code used to indicate whether the candidate song can be played normally. The ranking score is the algorithm matching score; a higher ranking score indicates a higher degree of match between the candidate song and the search keywords. The executable flag indicates whether the current candidate song entry allows playback (complementing the playable status, focusing on API call permissions).

[0026] It should be understood that the candidate snapshot identifier, expiration window, and request association key in the candidate execution context are abstract fields of the candidate execution context in this application, used to define the boundaries of technical objects, and do not indicate that the fields with the same names have been exposed externally item by item in the code.

[0027] Optionally, candidate music item objects can be extracted from the music search results. The first specified number of candidate music item objects can be extracted from the music search results in the order they are returned by the search, or all candidate music item objects can be extracted directly.

[0028] Step S130: After receiving the music playback request, extract the music playback parameters carried in the music playback request.

[0029] The system receives a music playback request. The music playback request "play_specified_song (song_id)" carries the music playback parameter "song_id" generated by the system based on music search results. After receiving the music playback request, the music playback parameter carried in the music playback request can be extracted.

[0030] Step S140: Determine whether to correct the music playback parameters carried in the music playback request.

[0031] Step S140 includes: detecting whether there is an unexpired candidate execution context; if there is an unexpired candidate execution context, determining whether to correct the music playback parameters carried in the music playback request based on the candidate execution context; if there is no unexpired candidate execution context, rejecting the current playback.

[0032] This application limits subsequent playback parameter correction to only accepting the most recent candidate execution context that is still valid. However, in practical applications, there are various situations such as: the user has not yet successfully executed a music search; although a music search has been executed, the candidate cache has exceeded the valid time window; the music search results are empty and no valid candidate set has been formed; the cache has been cleared or there is no available candidate execution context in the current session. Therefore, this application first verifies the validity of the candidate execution context, and only considers the candidate execution context valid if there is a most recent candidate execution context that has not expired. Subsequent music playback parameter verification and correction are then performed when a valid candidate execution context exists. Playback is rejected when no valid candidate execution context exists. This strictly limits the constraint space used for playback parameter verification and correction, avoids combining and inferring across historical search candidate sets, and does not make open guesses based on free text music names, which can ensure the accuracy of playback parameter verification and correction to a certain extent.

[0033] Specifically, the system can first check whether there are candidate execution contexts in the system; if there are candidate execution contexts, it can check whether the candidate execution context has expired based on the expiration window of the candidate execution context; if the candidate execution context has not expired, it can be determined that there are unexpired candidate execution contexts; if there are no candidate execution contexts, or if there are candidate execution contexts but they have expired, it can be determined that there are no unexpired candidate execution contexts.

[0034] If an unexpired candidate execution context exists, it means that the playback request can undergo further playback parameter verification and correction within that candidate scope. Specifically, determining whether to correct the music playback parameters carried in the music playback request (playback parameter verification) based on the candidate execution context includes: detecting whether the music playback parameters carried in the music playback request belong to the candidate playback parameter set; if the music playback parameters carried in the music playback request belong to the candidate playback parameter set, it is determined that the music playback parameters carried in the music playback request will not be corrected; if the music playback parameters carried in the music playback request do not belong to the candidate playback parameter set, it is determined that the music playback parameters carried in the music playback request will be corrected.

[0035] Detecting whether the music playback parameters carried in a music playback request belong to the candidate playback parameter set requires that the music playback parameters carried in the music playback request "exactly match" the candidate playback parameter set; that is, the music playback parameters carried in the music playback request must be completely consistent with a certain music playback parameter in the candidate playback parameter set. If the music playback parameters carried in the music playback request exactly match the candidate playback parameter set, it means that the model did not make any transcription errors when generating music playback parameters based on music search results, and no playback parameter correction is needed. In this case, music can be played directly based on the music playback parameters carried in the music playback request. If the music playback parameters carried in the music playback request do not exactly match the candidate playback parameter set, it means that the model made some partial transcription errors when generating music playback parameters based on music search results, and playback parameter correction is needed. In this case, playback parameter correction can be further performed within the candidate execution context to avoid the problem of high error rates in playback parameter correction and music playback due to open correction without limiting the playback parameter correction space.

[0036] In some embodiments, if it is determined that the music playback parameters carried in the music playback request will not be corrected, music is played based on the music playback parameters carried in the music playback request.

[0037] Step S150: If it is determined that the music playback parameters carried in the music playback request need to be corrected, then the music playback parameters carried in the music playback request need to be corrected within the candidate execution context to obtain the corrected music playback parameters.

[0038] This application corrects the music playback parameters carried in the music playback request within the candidate execution context by first performing distance threshold matching and then performing a conflict resolution chain. Specifically, step S150 includes: calculating the edit distance between each candidate playback parameter in the candidate playback parameter set and the music playback parameters carried in the music playback request; obtaining candidate playback parameters from the candidate playback parameter set whose edit distance is less than the distance threshold; if no candidate playback parameter is obtained, rejecting the current playback; if only one candidate playback parameter is obtained, using that candidate playback parameter as the corrected music playback parameter; if at least two candidate playback parameters are obtained, performing conflict resolution on at least two candidate playback parameters, and using the candidate playback parameter obtained after conflict resolution as the corrected music playback parameter.

[0039] This application sets the distance threshold to 2 and adopts a single edit distance rule, allowing the system to perform only one erroneous operation when generating music playback parameters based on music search results: character insertion; character deletion; character replacement. That is, the maximum edit distance between two music playback parameters is 1, thereby ensuring the accuracy of playback parameter correction.

[0040] In some embodiments, if there is only one candidate playback parameter obtained based on the edit distance, it is also necessary to detect whether the music corresponding to the candidate playback parameter is playable; if it is playable, the candidate playback parameter is used as the corrected music playback parameter; if it is not playable, the current playback is rejected.

[0041] The conflict resolution process involves resolving conflicts between at least two candidate playback parameters and using the resolved candidate playback parameters as the corrected music playback parameters (the conflict resolution chain). This includes: selecting candidate playback parameters from at least two candidate playback parameters that allow the music to play; if only one candidate playback parameter is selected, then that candidate playback parameter is used as the corrected music playback parameter; if at least two candidate playback parameters are selected, then the candidate playback parameter with the highest search return order is used as the corrected music playback parameter.

[0042] As an example, suppose the candidate playback parameter set includes 44083971, 44082937, and 44082750. If the music playback parameter generated by the model / system based on the music search request is 4082750, then by adopting the correction decision of this application, 44082750 can be identified as the only approximate candidate of 4082750 within the candidate execution context. The 4082750 in the music playback request can be rewritten as 44082750, and then the function corresponding to the music playback request can be executed to play the music corresponding to 44082750. The correction reason is then written back as "correct_reason = single_edit_distance".

[0043] In some embodiments, if a unique candidate playback parameter cannot be obtained according to the search return order, the playback is rejected to ensure the accuracy of music playback parameter correction and improve music playback accuracy.

[0044] The conflict resolution chain of this application, when the edit distance of multiple candidate playback parameters simultaneously meets the distance threshold, first filters according to whether the candidate playback parameters can be played. When there are at least two selected candidate playback parameters, the candidate playback parameters are selected according to the search return order. If the unique candidate playback parameter cannot be obtained by selecting the candidate playback parameters according to the search return order, the playback is rejected. This can improve the accuracy of music playback parameter correction and thus improve the accuracy of music playback.

[0045] The music playback parameter correction in this application is performed only on digital music playback parameters; the comparison objects are limited to candidate playback parameters in the currently valid candidate execution context, ensuring the timeliness of music playback and improving music playback accuracy; the distance metric is limited to one of single character insertion, deletion, and replacement, and the distance matching is limited to the edit distance being less than the distance threshold (e.g., 2). If multiple candidates simultaneously meet the distance threshold, they cannot be directly corrected and must enter the conflict resolution chain. If no candidate meets the distance threshold, open inference cannot be made, thus improving the accuracy of music playback parameter correction and music playback accuracy.

[0046] Step S160: Play music based on the corrected music playback parameters.

[0047] After obtaining the corrected music playback parameters, the corrected music playback parameters can be used to replace the original music playback parameters carried in the music playback request, and then the function corresponding to the music playback request can be called to play the music corresponding to the corrected music playback parameters.

[0048] Steps S110 to S160 have the following technical effects: In the music search stage, a candidate execution context is generated based on the music search results. The candidate execution context is used to limit the correction range of music playback parameters, so that subsequent music playback parameter correction does not deviate from the most recent music search candidate set. In the music playback parameter correction stage, the music playback parameters carried in the music playback request are corrected within the candidate execution context. Compared with the prior art, this application corrects the music playback parameters within the limited music playback parameter correction space, which can improve the music playback success rate while maintaining the playback safety boundary, avoid the problem of music playback failure due to local numerical errors in music playback parameters, and reduce the risk of misplay caused by open fuzzy matching. Thus, it can achieve the technical effect of balancing music playback success rate and accuracy.

[0049] See Figure 4 , Figure 4 This is a flowchart of a music playback method provided in another embodiment of this application. The music playback method may include steps S210 to S270.

[0050] Step S210: After receiving the music search request, perform a music search based on the music search request and obtain the music search results.

[0051] Step S220: Generate a candidate execution context based on the music search results. The candidate execution context is used to limit the correction range of the music playback parameters.

[0052] Step S230: After receiving the music playback request, extract the music playback parameters carried in the music playback request.

[0053] Step S240: Determine whether to correct the music playback parameters carried in the music playback request.

[0054] Step S250: If it is determined that the music playback parameters carried in the music playback request need to be corrected, then the music playback parameters carried in the music playback request need to be corrected within the candidate execution context to obtain the corrected music playback parameters.

[0055] Step S260: Play music based on the corrected music playback parameters.

[0056] Step S270: After playing music based on the corrected music playback parameters, record the music playback parameters carried in the music playback request, the corrected music playback parameters, the correction reason, and the associated information of the music search request.

[0057] After recording the music playback parameters carried in the music playback request, the corrected music playback parameters, the reason for correction, and the associated information of the music search request, this information (i.e., the correction result) is written back to the execution link and the audit link to form auditable evidence. This clearly records the original music playback parameters, the corrected music playback parameters, whether automatic correction was performed, and the reason for correction. The client's correction behavior is linked with the actual playback result on the server through the associated information "trace_id" to form an end-to-end closed loop. This provides a data foundation for subsequent statistics on indicators such as recovery success rate, misplay rate, and conflict rejection rate.

[0058] Steps S210 to S270 have the following additional technical effects compared to steps S110 to S160: the music playback parameter correction results are involved in the subsequent execution chain and written back as audit metadata, so that the music playback parameter correction process has verifiable, replayable and serializable audit evidence.

[0059] See Figure 5 , Figure 5This is a structural block diagram of a music playback device according to an embodiment of this application. The music playback device 200 includes a music search module 210, a context generation module 220, a playback parameter extraction module 230, a playback parameter detection module 240, a playback parameter correction module 250, and a music playback module 260. The music search module 210 is used to perform a music search based on a music search request after receiving the request, and obtain music search results. The context generation module 220 is used to generate a candidate execution context based on the music search results, wherein the candidate execution context is used to limit the correction range of music playback parameters. The playback parameter extraction module 230 is used to extract the music playback parameters carried in the music playback request after receiving the request. The playback parameter detection module 240 is used to determine whether to correct the music playback parameters carried in the music playback request. The playback parameter correction module 250 is used to correct the music playback parameters carried in the music playback request within the candidate execution context if it is determined that correction is needed, to obtain corrected music playback parameters. The music playback module 260 is used to play music based on the corrected music playback parameters. The specific working process of each module, including the music search module 210, the context generation module 220, the playback parameter extraction module 230, the playback parameter detection module 240, the playback parameter correction module 250, and the music playback module 260, can be found in the relevant sections above and will not be repeated here.

[0060] In some embodiments, the music playback device 200 further includes a calibration result recording module. This module records, after playing music based on the calibrated music playback parameters, the music playback parameters carried in the music playback request, the calibrated music playback parameters, the calibration reason, and the associated information of the music search request. The specific working process of the calibration result recording module is described in the relevant sections above and will not be repeated here.

[0061] Those skilled in the art will clearly understand that the apparatus provided in the embodiments of this application can implement the methods provided in the embodiments of this application. The specific working process of the described apparatus and modules can be found in the corresponding processes of the methods in the embodiments of this application, and will not be repeated here.

[0062] In the embodiments provided in this application, the coupling, direct coupling, or communication connection between the modules shown or discussed may be indirect coupling or communication coupling through some interfaces, devices, or modules, and may be electrical, mechanical, or other forms. The embodiments of this application do not impose specific limitations on this.

[0063] Furthermore, the functional modules in the embodiments of this application can be integrated into one processing module, or each module can exist physically separately, or two or more modules can be integrated into one module. The integrated modules described above can be implemented in hardware or as software functional modules.

[0064] See Figure 6 , Figure 6 This is a structural block diagram of an electronic device provided in an embodiment of this application. The electronic device 300 may include a memory 310 and a processor 320. The memory 310 stores an application program, which is configured to cause the processor 320 to execute the method provided in the embodiment of this application when invoked by the processor 320.

[0065] The memory 310 may include random access memory (RAM) or read-only memory (ROM). The memory 310 can be used to store instructions, programs, code, code sets, or instruction sets. The memory 310 may include a program storage area and a data storage area. The program storage area may store instructions for implementing an operating system, instructions for implementing at least one function, instructions for implementing the various method embodiments described above, etc. The data storage area may store data created by the electronic device 300 during use.

[0066] Processor 320 may include one or more processing cores. Processor 320 connects to various parts within the electronic device 300 using various interfaces and lines, and is used to run or execute instructions, programs, code sets, or instruction sets stored in memory 310, as well as to call and execute data stored in memory 310, performing various functions and processing data of the electronic device 300. Processor 320 may be implemented using at least one hardware form of Digital Signal Processing (DSP), Field-Programmable Gate Array (FPGA), or Programmable Logic Array (PLA). Processor 320 may integrate one or more of the following: Central Processing Unit (CPU), Graphics Processing Unit (GPU), and Modem. The CPU primarily handles the operating system, user interface, and applications; the GPU is responsible for rendering and drawing the displayed content; and the modem handles wireless communication. It is understood that the modem may also not be integrated into processor 320, but implemented separately through a communication chip.

[0067] This application also provides a computer-readable storage medium. The computer-readable storage medium stores program code configured to cause the processor to execute the method provided in this application embodiment when invoked by the processor. The computer-readable storage medium may be an electronic storage device such as flash memory, electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), hard disk, or ROM.

[0068] In some embodiments, the computer-readable storage medium includes a non-volatile computer-readable storage medium (Non-TCRSM). The computer-readable storage medium has storage space for program code that performs any of the method steps described above. This program code can be read from or written to one or more computer program products. The program code may be compressed in an appropriate form.

[0069] This application also provides a computer program product, which includes a computer program that, when invoked by a processor, causes the processor to execute the method provided in the embodiments of this application.

[0070] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application.

Claims

1. A method for playing music, characterized in that, The method includes: Upon receiving a music search request, a music search is performed based on the request to obtain music search results; Candidate execution contexts are generated based on music search results, and these candidate execution contexts are used to limit the correction range of music playback parameters; After receiving a music playback request, extract the music playback parameters carried in the music playback request; Determine whether to correct the music playback parameters carried in the music playback request; If it is determined that the music playback parameters carried in the music playback request need to be corrected, then the music playback parameters carried in the music playback request need to be corrected within the candidate execution context to obtain the corrected music playback parameters. Play music based on the corrected music playback parameters; The step of correcting the music playback parameters carried in the music playback request within the candidate execution context to obtain the corrected music playback parameters includes: Calculate the edit distance between each candidate playback parameter in the candidate playback parameter set and the music playback parameter carried in the music playback request; If the edit distance of at least two candidate playback parameters meets the distance threshold, then the selection is based on whether the music corresponding to the at least two candidate playback parameters can be played, and the music corresponding to the selected candidate playback parameters can be played. If there are at least two candidate playback parameters selected, the final candidate playback parameter is determined according to the search return order of the selected candidate playback parameters, and the final candidate playback parameter is used as the corrected music playback parameter.

2. The method according to claim 1, characterized in that, The step of determining whether to correct the music playback parameters carried in the music playback request includes: Detect whether the candidate execution context exists before it expires; If a candidate execution context that has not expired exists, then it is determined whether to correct the music playback parameters carried in the music playback request based on the candidate execution context; If no candidate execution context exists that has not expired, then this playback is rejected.

3. The method according to claim 2, characterized in that, The candidate execution context includes a set of candidate playback parameters; The step of determining whether to correct the music playback parameters carried in the music playback request based on the candidate execution context includes: Detect whether the music playback parameters carried in the music playback request belong to the candidate playback parameter set; If the music playback parameters carried in the music playback request belong to the candidate playback parameter set, then it is determined that the music playback parameters carried in the music playback request will not be corrected. If the music playback parameters carried in the music playback request do not belong to the candidate playback parameter set, then it is determined that the music playback parameters carried in the music playback request should be corrected.

4. The method according to any one of claims 1-3, characterized in that, The candidate execution context includes a set of candidate playback parameters; The step of correcting the music playback parameters carried in the music playback request within the candidate execution context includes: Calculate the edit distance between each candidate playback parameter in the candidate playback parameter set and the music playback parameter carried in the music playback request; From the set of candidate playback parameters, obtain the candidate playback parameters whose edit distance is less than the distance threshold; If no candidate playback parameters are obtained, playback is rejected. If only one candidate playback parameter is obtained, then that candidate playback parameter will be used as the corrected music playback parameter. If at least two candidate playback parameters are obtained, conflict resolution is performed on at least two candidate playback parameters, and the candidate playback parameters obtained after conflict resolution are used as the corrected music playback parameters.

5. The method according to claim 4, characterized in that, The step of resolving conflicts between at least two candidate playback parameters and using the conflict-resolved candidate playback parameters as corrected music playback parameters includes: Filter from at least two candidate playback parameters to select the candidate playback parameters that the music can play; If only one candidate playback parameter is selected, then that candidate playback parameter will be used as the corrected music playback parameter. If there are at least two candidate playback parameters selected, the candidate playback parameter with the highest search result will be used as the corrected music playback parameter.

6. The method according to claim 1, characterized in that, The step of generating candidate execution contexts based on music search results includes: Extract candidate music entry objects from music search results; Extract music playback parameters from candidate music entry objects as candidate playback parameters to form a set of candidate playback parameters; Establish a mapping relationship between candidate playback parameters and candidate music entry objects; Extract the candidate playlist from the candidate music entry objects; The candidate playback parameter set, the mapping relationship, the candidate playlist, and the candidate snapshot identifier, time limit window, and request association key of the music search request are collectively saved as a candidate execution context.

7. The method according to claim 1, characterized in that, The method further includes: After playing music based on the corrected music playback parameters, record the music playback parameters carried in the music playback request, the corrected music playback parameters, the reason for correction, and the associated information of the music search request.

8. A music playback device, characterized in that, The device includes: The music search module is used to perform music searches based on music search requests after receiving them, and to obtain music search results. A context generation module is used to generate candidate execution contexts based on music search results. The candidate execution contexts are used to limit the correction range of music playback parameters. The playback parameter extraction module is used to extract the music playback parameters carried in the music playback request after receiving the music playback request. The playback parameter detection module is used to determine whether to correct the music playback parameters carried in the music playback request; The playback parameter correction module is used to correct the music playback parameters carried in the music playback request within the candidate execution context if it is determined that the music playback parameters carried in the music playback request need to be corrected, so as to obtain the corrected music playback parameters. The music playback module is used to play music based on the corrected music playback parameters; The step of correcting the music playback parameters carried in the music playback request within the candidate execution context to obtain the corrected music playback parameters includes: Calculate the edit distance between each candidate playback parameter in the candidate playback parameter set and the music playback parameter carried in the music playback request; If the edit distance of at least two candidate playback parameters meets the distance threshold, then the selection is based on whether the music corresponding to the at least two candidate playback parameters can be played, and the music corresponding to the selected candidate playback parameters can be played. If there are at least two candidate playback parameters selected, the final candidate playback parameter is determined according to the search return order of the selected candidate playback parameters, and the final candidate playback parameter is used as the corrected music playback parameter.

9. An electronic device, characterized in that, include: A memory and a processor, wherein the memory stores an application program that, when invoked by the processor, causes the processor to perform the method as described in any one of claims 1-7.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores program code that, when invoked by a processor, causes the processor to perform the method as described in any one of claims 1-7.