小白學習,歌詞解析(半成品)

2021-10-03 18:01:20 字數 2318 閱讀 2361

main.c

#include

#include

#include

#include

"fun.h"

intmain

(int argc,

char ar**)

;//存分割後的歌詞

int i=0;

//記錄歌詞行數

int n=0;

lrc *head=

null

;//煉表頭

file_date=

read_file

("簡單愛.lrc");

//讀取歌詞資料

printf

("%s"

,file_date)

;//測試是否讀到

//切割歌詞

buf[i]

=strtok

(file_date,

"\r\n");

while

(buf[i]

!=null

)

n=i;

//遍歷分割後的歌詞

i=0;

while

(buf[i]

!=null

)//分析前四行

for(i=

0;i<

4;i++

)for

(i=4

;i)char

*str_time = buf[i]

;while

(*str_time ==

'[')

}/*mplayer_play("簡單愛.***");*/

int j =0;

while(1

)sleep(1

);j++;}

return0;

}

fun.c

#include

#include

#include

"fun.h"

char

*read_file

(char

*name)

//讀取歌詞

fseek

(fp,0,

2); file_length=

ftell

(fp)

;rewind

(fp)

; data=

(char*)

calloc(1

,file_length);if

(data==

null

)fread

(data,file_length,

1,fp)

;fclose

(fp)

;return data;

} lrc*

insert_link

(lrc *head,lrc tmp)

//鍊錶插入

*pi = tmp;

pi->next=

null;if

(head==

null

)else

if(pb->time>=pi->time)

else

}else

}return head;

}void

print_link

(lrc *head)

else

while

(pb!=

null);

}return;}

lrc*

search_link

(lrc *head,

int j)

else

if(pb->time==j)

else

}return

null

;}

fun.h

#ifndef __fun_h__

#define __fun_h__

typedef

struct lrc

lrc;

extern

char

*read_file

(char

*name)

;extern lrc*

insert_link

(lrc *head,lrc tmp)

;extern

void

print_link

(lrc *head)

;extern lrc*

search_link

(lrc *head,

int j)

;#endif

oc 歌詞解析

歌詞file ti 傳奇 ar 王菲 00 03.50 傳奇 00 19.10 作詞 劉兵 作曲 李健 00 20.60 演唱 王菲 00 26.60 04 40.75 02 39.90 00 36.25 只是因為在人群中多看了你一眼 04 49.00 02 47.44 00 43.69 再也沒能忘...

krc歌詞檔案解析

做卡拉ok專案時,逐字歌詞同步需要很多高精度的lrc檔案,目前國內有2大家 擁有專利的kugou和沒有專利的qq 二者各推出了一種逐字同步歌詞檔案 krc和qrc。krc有加密處理,直接開啟的話只能看到亂碼。krc.h ioskrcdecoder created by zeng songgen on...

unity 解析歌詞文字

上面方法是使用陣列 下面是使用list 獲取lrc 檔案的,獲取到後 就可以用上面的隨便一種進行分割 根據時間對資料排列 public string sortlyricarrayandtimearray string lyrica float timea out float timearray ti...