- 浏览: 411647 次
- 性别:
- 来自: 北京
文章分类
- 全部博客 (79)
- 管理信息系统技术 (1)
- .net控制扫描仪 (1)
- 框架设计 架构设计 (1)
- java扫描仪编程 java扫描仪 (1)
- 数据交换平台 (1)
- BS程序代码分类与框架开发 (1)
- mybatis (1)
- jsr303 (1)
- mybatis plugin (1)
- Mondrian (1)
- 高拍仪控件与示例 (1)
- web图像打印 web图像打印预览 (1)
- tomcat高并发应用项目案例 (1)
- 浏览器图像打印 (1)
- 扫描仪 (1)
- extjs (1)
- 全文检索 (1)
- (0)
- springmvc (1)
- shiro (1)
- 数据库部署 (1)
- solr 7.1 linux安装部署 (1)
- java一体机扫描 (1)
- golang (2)
最新评论
-
wanglei409:
...
java摄像头操作代码 -
变得心如止水:
楼主这个怎么弄啊,里面的cabs有什么用吗
jsp扫描仪编程示例程序源代码下载 -
bd604139:
怎么用的啊,运行后 只 显示上传结果 未签名 XActive ...
java摄像头操作代码 -
bd604139:
怎么用的啊??好难用的,能不能附加个完整解释呢,打开浏览器要求 ...
java摄像头操作代码 -
pipilang3220119:
请问,这样自己写的/login,在人直接请求/checklog ...
shiro在springmvc里面的集成使用
语言压缩技术celp下的java解码程序。
celp技术是所有 voip技术的基础,几乎所有的voip语音通讯技术都使用了机遇celp压缩算法的扩展算法。
package com.demo; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.*; import java.net.URL; import javax.sound.sampled.*; import javax.swing.*; public class CelpDec extends JApplet implements ActionListener, Runnable { private byte buf[]; private double k[]; private double temp[]; private double grid[]; private short data[]; private int mode[]; private int p[]; private int c[]; private double pg[]; private double cg[]; private short num; private short datanum; private double K0[]; private double K1[]; private double K2[]; private double K3[]; private double K4[]; private double K5[]; private double K6[]; private double K7_9[][]; private double Pitch_Gain[]; private double Code_Gain[]; private double codebook[][]; private double shift_code[]; private int pitch; private int bit_count; private int a; private double current[]; private int frames; private int frame_num; private URL urls[]; private JPanel buttonPanel; private JTextArea title; private Button Man; private Button Woman; private Button Speech; private JTextArea board; private String files[] = { "d://man.cps", "d://woman.cps" }; private DataInputStream datain; private SourceDataLine soundout; private boolean eof; private Thread decodeThread; private byte type; public CelpDec() { buf = new byte[18]; k = new double[10]; temp = new double[240]; grid = new double[10]; data = new short[240]; mode = new int[5]; p = new int[5]; c = new int[5]; pg = new double[5]; cg = new double[5]; current = new double[48]; frames = 0; frame_num = 872; urls = new URL[2]; buttonPanel = new JPanel(); title = new JTextArea(); Man = new Button("Man"); Woman = new Button("Woman"); Speech=new Button("Speech"); board = new JTextArea(); eof = true; type = 0; } public void run() { do { while (!eof && datanum == 18) { read(); excite(); lattic(); output(); frames++; } soundout.drain(); soundout.stop(); if (datanum != 18) { Man.setEnabled(true); Woman.setEnabled(true); frames = 0; try { datain.close(); datain = new DataInputStream(urls[type].openStream()); board.setText("Push a button"); } catch (Exception e) { board.setText(e.toString()); } parameter_init(); eof = true; } while (eof) ; } while (true); } private void table_init() { K0 = (new double[] { 0.0D, 0.99218726160000004D, 0.98828089240000005D, 0.98437452309999995D, 0.98046815389999997D, 0.97656178469999999D, 0.97265541550000001D, 0.96874904630000003D, 0.95312356939999998D, 0.94531083100000002D, 0.93749809260000005D, 0.92968535419999998D, 0.92187261570000001D, 0.90624713889999997D, 0.89843440050000001D, 0.88280892359999996D, 0.86718344680000004D, 0.81249427780000005D, 0.7499923704D, 0.67186498610000001D, 0.57029938660000001D, 0.45310831019999998D, 0.31247901849999998D, 0.1640369884D, -0.15622425000000001D, -0.31247901849999998D, -0.44529557180000001D, -0.57029938660000001D, -0.66405224770000004D, -0.7499923704D, -0.81249427780000005D, -0.86718344680000004D }); K1 = (new double[] { 0.0D, 0.6484267708D, 0.60155034029999999D, 0.53904843290000004D, 0.4843592639D, 0.41404461809999998D, 0.34372997220000001D, 0.27341532639999999D, 0.1952879421D, 0.1171605579D, -0.046845912000000003D, -0.12497329629999999D, -0.21091341899999999D, -0.28122806480000001D, -0.3593554491D, -0.42967009490000002D, -0.49217200230000002D, -0.5468611713D, -0.60936307869999995D, -0.65623950929999997D, -0.70311593979999998D, -0.74217963190000003D, -0.77343058570000001D, -0.80468153939999998D, -0.83593249309999995D, -0.85937070829999995D, -0.88280892359999996D, -0.89843440050000001D, -0.91405987730000005D, -0.92968535419999998D, -0.94531083100000002D, -0.99218726160000004D }); K2 = (new double[] { 0.0D, 0.8749961852D, 0.76561784720000003D, 0.65623950929999997D, 0.55467390969999997D, 0.44529557180000001D, 0.33591723379999999D, 0.2343516343D, 0.12497329629999999D, -0.085909604200000003D, -0.1952879421D, -0.2968535417D, -0.40623187960000001D, -0.51561021760000003D, -0.6249885556D, -0.72655415509999999D }); K3 = (new double[] { 0.0D, 0.6484267708D, 0.53904843290000004D, 0.42967009490000002D, 0.32029175700000001D, 0.21091341899999999D, 0.101535081D, -0.1171605579D, -0.2265388958D, -0.34372997220000001D, -0.45310831019999998D, -0.56248664820000005D, -0.67186498610000001D, -0.78124332409999997D, -0.89062166200000004D, -0.99218726160000004D }); K4 = (new double[] { 0.0D, 0.6484267708D, 0.55467390969999997D, 0.46873378700000001D, 0.37498092589999998D, 0.28122806480000001D, 0.18747520370000001D, 0.101535081D, -0.085909604200000003D, -0.17966246529999999D, -0.26560258799999997D, -0.3593554491D, -0.45310831019999998D, -0.5468611713D, -0.64061403240000003D, -0.72655415509999999D }); K5 = (new double[] { 0.0D, 0.50779747919999996D, 0.4218573565D, 0.33591723379999999D, 0.24216437269999999D, 0.15622425000000001D, 0.070284127299999999D, -0.1093478195D, -0.1952879421D, -0.28122806480000001D, -0.36716818750000002D, -0.46092104859999999D, -0.5468611713D, -0.63280129399999996D, -0.72655415509999999D, -0.81249427780000005D }); K6 = (new double[] { 0.0D, 0.4218573565D, 0.2343516343D, -0.14841151159999999D, -0.33591723379999999D, -0.52342295599999999D, -0.70311593979999998D, -0.81249427780000005D }); K7_9 = (new double[][] { new double[] { 0.0D, 0.0D, 0.0D }, new double[] { -0.31363872189999997D, 0.054689169000000003D, -0.20645771660000001D }, new double[] { -0.53071687980000004D, -0.036500137299999999D, -0.099246192799999994D }, new double[] { -0.55073702199999996D, 0.33539841910000001D, 0.27210303050000001D }, new double[] { -0.27835932489999998D, 0.51298562579999996D, 0.084292123199999999D }, new double[] { -0.22013000890000001D, 0.017365031900000001D, -0.037537766700000003D }, new double[] { -0.14966277049999999D, 0.19660023800000001D, -0.14307077239999999D }, new double[] { -0.30442213200000001D, -0.016266365599999999D, 0.14130069889999999D }, new double[] { -0.1252784814D, 0.11590929899999999D, 0.1894283883D }, new double[] { -0.52110354930000002D, -0.2937101352D, -0.20682393869999999D }, new double[] { -0.25925473799999998D, -0.28870509960000001D, -0.048249763500000001D }, new double[] { -0.0481276894D, -0.22635578479999999D, -0.31324198130000003D }, new double[] { -0.29203161719999998D, -0.21326334420000001D, -0.29142124699999999D }, new double[] { -0.0763573107D, -0.10190130310000001D, 0.107760857D }, new double[] { 0.086458937299999997D, -0.247871334D, 0.079989013299999995D }, new double[] { -0.1102023377D, -0.14441358679999999D, -0.0821558275D }, new double[] { -0.1204870754D, 0.49531540880000002D, -0.2416760765D }, new double[] { 0.054414502400000002D, 0.50758384960000003D, -0.082461012599999994D }, new double[] { 0.015076143700000001D, 0.1768547624D, -0.4007080294D }, new double[] { 0.22943815419999999D, 0.3003936888D, -0.30826746420000001D }, new double[] { 0.24668111209999999D, 0.305978576D, 0.024719992699999999D }, new double[] { 0.0020142215999999998D, 0.28287606430000001D, 0.2187566759D }, new double[] { 0.1196020386D, 0.1234778893D, -0.082369457100000001D }, new double[] { -0.018158513099999999D, 0.18378246409999999D, 0.027222510500000002D }, new double[] { 0.47944578389999998D, 0.13202307199999999D, -0.14926602980000001D }, new double[] { 0.48933378090000001D, -0.17654957730000001D, 0.0044557023999999999D }, new double[] { 0.25205236980000001D, -0.063692129299999997D, -0.32184820089999999D }, new double[] { 0.19183935060000001D, -0.33011871700000001D, -0.14102603229999999D }, new double[] { -0.0096438489999999995D, 0.011017181900000001D, -0.19840083010000001D }, new double[] { 0.087527085199999993D, -0.1025421918D, -0.089541306799999998D }, new double[] { 0.25946836760000003D, -0.015259254700000001D, -0.043855098100000003D }, new double[] { 0.1064180425D, 0.039124729099999998D, 0.1074861904D } }); Pitch_Gain = (new double[] { -3.9598339999999999D, -3.1899649999999999D, -2.39873D, -1.6899040000000001D, -1.2173119999999999D, -0.88914700000000002D, -0.60615300000000005D, -0.32962999999999998D, 0.39042900000000003D, 0.65291200000000005D, 0.88304199999999999D, 1.072519D, 1.434013D, 2.0404100000000001D, 2.8552070000000001D, 3.9337080000000002D }); Code_Gain = (new double[] { 0.0D, 0.013825D, 0.031220000000000001D, 0.047455999999999998D, 0.066133999999999998D, 0.088260000000000005D, 0.112522D, 0.140324D, 0.172155D, 0.20740400000000001D, 0.25437199999999999D, 0.31913200000000003D, 0.41209099999999999D, 0.554338D, 0.80159899999999995D, 0.95291000000000003D }); codebook = (new double[][] { new double[] { 0.12024659710000001D, -0.0148934872D, -0.34725019839999999D, -0.18250625649999999D, -0.1751815907D, -0.31734114629999999D, 0.2686931575D, 0.0941829946D, 0.054324604800000002D, -0.12818165170000001D, 0.0260025636D, -0.095159616700000005D, 0.1159738754D, 0.0024415552999999999D, -0.041079167399999998D, -0.139412806D, 0.1290972349D, -0.015686992600000001D, -0.1700543246D, 0.00054934989999999996D, 0.1958737716D, 0.0253921748D, 0.0824024904D, 0.222486724D, -0.029481779900000001D, 0.051089544000000001D, -0.033571385000000002D, 0.049075260900000001D, 0.1516205823D, 0.10443752670000001D, -0.19172312759999999D, -0.10010376610000001D, 0.027955807799999999D, 0.046206433499999998D, -0.24244643839999999D, 0.1014466215D, -0.1976438992D, 0.1467985107D, -0.16694134159999999D, -0.30995544159999999D, 0.0322285296D, -0.039003845400000001D, 0.092718061399999996D, -0.1157907587D, -0.0272843802D, 0.18183482879999999D, -0.051699932900000002D, 0.092107672599999996D }, new double[] { 0.0469389001D, 0.093999877900000001D, -0.0690960142D, -0.0754440579D, 0.2057620704D, -0.21876335229999999D, -0.17969846789999999D, 0.039309039900000002D, 0.1785997681D, -0.0147103705D, 0.050234999699999998D, 0.1046816822D, -0.15534395409999999D, 0.033205151699999998D, 0.049014222099999998D, 0.12348165780000001D, -0.098638832900000001D, -0.015992187000000001D, -0.0078129769000000009D, 0.0498687664D, 0.23152047849999999D, -0.0676921199D, -0.010925959799999999D, -0.028871391100000001D, -0.18281145090000001D, -0.0351583959D, -0.1417322835D, -0.027345418999999999D, 0.2655801746D, -0.2691204297D, -0.081670023800000005D, -0.21760361349999999D, -0.1034609046D, -0.069279130800000005D, -0.15583226519999999D, -0.085881706599999996D, -0.1879997558D, 0.038637612199999997D, 0.1100531038D, 0.25239577610000002D, -0.0415064396D, 0.28456326679999999D, -0.049746688599999998D, 0.1583958982D, -0.0954037722D, -0.23152047849999999D, 0.0518830495D, 0.32558139530000002D }, new double[] { 0.018983092199999999D, 0.1221998413D, -0.1895867668D, 0.20319843739999999D, -0.30452298109999998D, -0.30995544159999999D, -0.15827382039999999D, -0.073796008100000005D, 0.0382713789D, -0.1342855399D, -0.12006348040000001D, 0.15577122630000001D, -0.082646645899999996D, 0.075505096699999996D, 0.098455716299999996D, -0.1971555881D, -0.1912958555D, 0.049319416499999998D, 0.0083623268000000001D, 0.0153817982D, 0.0061038882000000001D, -0.1752426296D, 0.073246658100000001D, -0.1038271379D, 0.12543490199999999D, -0.010315571000000001D, -0.033510346099999998D, -0.2058231093D, -0.23115424530000001D, 0.0570103156D, 0.096929744200000001D, -0.021180491999999999D, -0.16785692490000001D, 0.3481657816D, 0.15082707679999999D, 0.0073246657999999996D, 0.0227675029D, 0.088506378600000005D, -0.19331013859999999D, 0.1073063541D, -0.0297259354D, 0.15290239880000001D, 0.21168284200000001D, -0.031251907500000002D, -0.093023255799999996D, -0.13562839530000001D, 0.097234938699999995D, -0.14283098329999999D }, new double[] { 0.29463468230000001D, 0.20014649330000001D, 0.069523286300000001D, -0.0565220045D, 0.11402063110000001D, -0.020142831D, -0.084599890100000005D, -0.0067142770000000003D, -0.134224501D, 0.0280168467D, -0.071598608300000005D, -0.25428798139999997D, -0.051455777299999998D, -0.19910883230000001D, 0.24568149910000001D, -0.094732344499999996D, -0.16034914240000001D, -0.129585546D, 0.092412866999999996D, 0.0504791552D, -0.024537630500000001D, -0.0058597325999999996D, 0.1953244217D, 0.0133675151D, 0.2132698529D, -0.021790880799999999D, -0.060062259700000002D, -0.037233717899999998D, -0.0078129769000000009D, -0.098089483000000005D, 0.17652444610000001D, -0.041628517400000002D, 0.26112433619999997D, -0.0809985961D, -0.1936763718D, -0.0061649271000000002D, -0.0771531466D, -0.020875297599999999D, 0.064151864700000005D, 0.1566868095D, -0.1544894098D, 0.073979124699999996D, 0.14099981689999999D, -0.34456448760000002D, 0.16694134159999999D, 0.2535555149D, 0.22450100710000001D, 0.0100714155D }, new double[] { -0.26710614659999998D, 0.1085881707D, -0.26808276869999997D, -0.0073246657999999996D, 0.0028688274000000001D, 0.16401147529999999D, 0.11463102D, 0.058963559800000002D, -0.13013489589999999D, -0.095770005500000005D, 0.12842580719999999D, -0.1143258256D, 0.14362448880000001D, -0.049380455400000002D, 0.0184337423D, 0.042483061699999998D, 0.078740157500000005D, -0.045412927999999998D, 0.073246658100000001D, 0.1467985107D, 0.36513459069999998D, 0.2097906366D, -0.1872672893D, 0.0429103339D, -0.025209058199999999D, -0.014954525999999999D, -0.034975279300000002D, -0.023438930600000001D, -0.10816089850000001D, -0.14142708909999999D, 0.2183360801D, 0.2928645547D, 0.0195324422D, -0.071537569400000001D, 0.29707623760000001D, -0.16950497470000001D, -0.0061649271000000002D, 0.10071415490000001D, -0.039125923200000003D, 0.0895440396D, -0.080937557199999996D, 0.1953244217D, 0.25215162060000001D, -0.0272843802D, -0.0985167552D, 0.1189037417D, -0.0051272660999999997D, 0.16718549720000001D } }); } private void parameter_init() { for (num = 0; num < 10; num++) grid[num] = 0.0D; datanum = 18; shift_code = new double[175]; for (num = 0; num < 48; num++) { shift_code[num] = codebook[0][num] * 0.078125D; shift_code[num + 48] = codebook[1][num] * 0.078125D; shift_code[num + 96] = codebook[2][num] * 0.078125D; } for (num = 0; num < 31; num++) shift_code[num + 144] = codebook[3][num] * 0.078125D; pitch = 0; frames = 0; } private void stream_init() { AudioFormat audioFormat = new AudioFormat(8000F, 16, 1, true, false); javax.sound.sampled.DataLine.Info dataLineInfo = new javax.sound.sampled.DataLine.Info(javax.sound.sampled.SourceDataLine.class, audioFormat); try { soundout = (SourceDataLine)AudioSystem.getLine(dataLineInfo); soundout.open(audioFormat); } catch (LineUnavailableException e) { board.setText(e.toString()); } try { //urls[0] = new URL(getCodeBase(), files[0]); //urls[1] = new URL(getCodeBase(), files[1]); urls[0] = new URL(getCodeBase(), files[0]); urls[1] = new URL(getCodeBase(), files[1]); } catch (Exception e) { board.setText(e.toString()); } try { //datain = new DataInputStream(urls[type].openStream()); switch(type){ case 0:{ datain = new DataInputStream(new java.io.FileInputStream(new java.io.File("d://man.cps"))); break; } case 1:{ datain = new DataInputStream(new java.io.FileInputStream(new java.io.File("d://women.cps"))); break; } case 2:{ datain = new DataInputStream(new java.io.FileInputStream(new java.io.File("d://man.cps"))); break; } } //urls[type].openStream()); } catch (Exception e) {e.printStackTrace(); } } private void panal_init() { setLayout(null); getContentPane().setBackground(Color.DARK_GRAY); Font f = new Font("Roman", 0, 12); Man.addActionListener(this); Woman.addActionListener(this); Speech.addActionListener(this); title.setBounds(50, 10, 380, 30); board.setBounds(50, 100, 250, 50); Man.setBounds(300, 70, 60, 25); Woman.setBounds(300, 120, 60, 25); Speech.setBounds(300, 160, 60, 25); title.setEditable(false); title.setText("声音解码"); title.setBackground(Color.DARK_GRAY); title.setForeground(Color.WHITE); //title.setFont(new Font("Arial", 1, 30)); board.setEditable(false); board.setText("点击要播放的按钮"); board.setBackground(Color.DARK_GRAY); board.setForeground(Color.lightGray); //board.setFont(new Font("Arial", 1, 26)); Man.setFont(f); Woman.setFont(f); Speech.setFont(f); add(board); add(title); add(Man); add(Woman); add(Speech); } public void init() { table_init(); parameter_init(); stream_init(); panal_init(); soundout.start(); decodeThread = new Thread(this); decodeThread.start(); } private int getbit(int len) { bit_count -= len; int num = a >>> bit_count; a = a % (1 << bit_count); return num; } private void read() { try { datanum = (short)datain.read(buf, 0, 18); } catch (IOException e) { datanum = 0; } int buf1[] = new int[18]; for (int j = 0; j < 18; j++) if (buf[j] < 0) buf1[j] = buf[j] + 256; else buf1[j] = buf[j]; for (int j = 0; j < 6; j++) { buf1[j] = buf1[j * 3] << 16; buf1[j] += buf1[j * 3 + 1] << 8; buf1[j] += buf1[j * 3 + 2]; } if (datanum == 18) { bit_count = 24; a = buf1[0]; k[0] = K0[getbit(5)]; k[1] = K1[getbit(5)]; k[2] = K2[getbit(4)]; k[3] = K3[getbit(4)]; k[4] = K4[getbit(4)]; a = a << 24; a += buf1[1]; bit_count = 26; k[5] = K5[getbit(4)]; k[6] = K6[getbit(3)]; int num1 = getbit(5); k[7] = K7_9[num1][0]; k[8] = K7_9[num1][1]; k[9] = K7_9[num1][2]; mode[0] = getbit(1); if (mode[0] == 1) { p[0] = getbit(7); c[0] = getbit(6); } else { p[0] = getbit(3); c[0] = getbit(10); } a = buf1[2]; bit_count = 24; pg[0] = Pitch_Gain[getbit(4)]; cg[0] = Code_Gain[getbit(4)]; mode[1] = getbit(1); if (mode[1] == 1) { p[1] = getbit(7); c[1] = getbit(6); } else { p[1] = getbit(3); c[1] = getbit(10); } a = a << 24; a += buf1[3]; bit_count = 26; pg[1] = Pitch_Gain[getbit(4)]; cg[1] = Code_Gain[getbit(4)]; mode[2] = getbit(1); if (mode[2] == 1) { p[2] = getbit(7); c[2] = getbit(6); } else { p[2] = getbit(3); c[2] = getbit(10); } a = a << 24; a += buf1[4]; bit_count = 28; pg[2] = Pitch_Gain[getbit(4)]; cg[2] = Code_Gain[getbit(4)]; mode[3] = getbit(1); if (mode[3] == 1) { p[3] = getbit(7); c[3] = getbit(6); } else { p[3] = getbit(3); c[3] = getbit(10); } a = a << 24; a += buf1[5]; bit_count = 30; pg[3] = Pitch_Gain[getbit(4)]; cg[3] = Code_Gain[getbit(4)]; mode[4] = getbit(1); if (mode[4] == 1) { p[4] = getbit(7); c[4] = getbit(6); } else { p[4] = getbit(3); c[4] = getbit(10); } pg[4] = Pitch_Gain[getbit(4)]; cg[4] = Code_Gain[getbit(4)]; } } void excite() { double count = 0.0D; for (int i = 0; i < 5; i++) { int j; for (j = 0; j < 48; j++) current[j] = 0.0D; if (mode[i] == 1) { for (j = 0; j < 48; j++) temp[i * 48 + j] = shift_code[j + p[i]] * pg[i]; label0: switch (c[i] % 4) { default: break; case 0: // '\0' { c[i] /= 4; for (int n = 0; n < 4; n++) { int bit = c[i] % 2; if (bit == 1) for (j = 0; j < 48; j++) current[j] += codebook[n][j]; else for (j = 0; j < 48; j++) current[j] -= codebook[n][j]; c[i] /= 2; } break; } case 1: // '\001' { c[i] /= 4; int n = 0; do { if (n >= 4) break label0; int bit = c[i] % 2; if (bit == 1) for (j = 0; j < 48; j++) current[j] += codebook[n][47 - j]; else for (j = 0; j < 48; j++) current[j] -= codebook[n][47 - j]; c[i] /= 2; n++; } while (true); } case 2: // '\002' { c[i] /= 4; int n = 0; do { if (n >= 4) break label0; int bit = c[i] % 2; int sign = 1; if (bit == 1) for (j = 0; j < 48; j++) { current[j] += codebook[n][j] * (double)sign; sign = -sign; } else for (j = 0; j < 48; j++) { current[j] -= codebook[n][j] * (double)sign; sign = -sign; } c[i] /= 2; n++; } while (true); } case 3: // '\003' { c[i] /= 4; int n = 0; do { if (n >= 4) break label0; int bit = c[i] % 2; int sign = 1; if (bit == 1) for (j = 0; j < 48; j++) { current[j] += codebook[n][47 - j] * (double)sign; sign = -sign; } else for (j = 0; j < 48; j++) { current[j] -= codebook[n][47 - j] * (double)sign; sign = -sign; } c[i] /= 2; n++; } while (true); } } pitch = p[i]; for (j = 0; j < 48; j++) current[j] /= 2D; } else { pitch = (pitch + p[i]) - 4; if (pitch < 0) pitch = 0; if (pitch > 127) pitch = 127; System.out.println(pitch); for (j = 0; j < 48; j++) temp[i * 48 + j] = shift_code[j + pitch] * pg[i]; count = 0.0D; label1: switch (c[i] % 4) { default: break; case 0: // '\0' { c[i] /= 4; for (int n = 0; n < 5; n++) { int bit = c[i] % 3; c[i] /= 3; switch (bit) { case 0: // '\0' default: break; case 2: // '\002' count++; for (j = 0; j < 48; j++) current[j] += codebook[n][j]; break; case 1: // '\001' count++; for (j = 0; j < 48; j++) current[j] -= codebook[n][j]; break; } } break; } case 3: // '\003' { c[i] /= 4; int n = 0; do { if (n >= 5) break label1; int bit = c[i] % 3; c[i] /= 3; int sign = 1; switch (bit) { case 0: // '\0' default: break; case 2: // '\002' count++; for (j = 0; j < 48; j++) { current[j] += codebook[n][47 - j] * (double)sign; sign = -sign; } break; case 1: // '\001' count++; for (j = 0; j < 48; j++) { current[j] -= codebook[n][47 - j] * (double)sign; sign = -sign; } break; } n++; } while (true); } case 1: // '\001' { c[i] /= 4; int n = 0; do { if (n >= 5) break label1; int bit = c[i] % 3; c[i] /= 3; switch (bit) { case 0: // '\0' default: break; case 2: // '\002' count++; for (j = 0; j < 48; j++) current[j] += codebook[n][47 - j]; break; case 1: // '\001' count++; for (j = 0; j < 48; j++) current[j] -= codebook[n][47 - j]; break; } n++; } while (true); } case 2: // '\002' { c[i] /= 4; int n = 0; do { if (n >= 5) break label1; int bit = c[i] % 3; c[i] /= 3; int sign = 1; switch (bit) { case 0: // '\0' default: break; case 2: // '\002' count++; for (j = 0; j < 48; j++) { current[j] += codebook[n][j] * (double)sign; sign = -sign; } break; case 1: // '\001' count++; for (j = 0; j < 48; j++) { current[j] -= codebook[n][j] * (double)sign; sign = -sign; } break; } n++; } while (true); } } count = Math.sqrt(count); for (j = 0; j < 48; j++) current[j] /= count; } for (j = 0; j < 48; j++) temp[i * 48 + j] += current[j] * cg[i]; for (j = 0; j < 100; j++) shift_code[j] = shift_code[j + 48]; for (; j < 148; j++) shift_code[j] = temp[(j - 100) + 48 * i]; if (mode[i] == 0) p[i] = pitch; if (p[i] <= 121) { for (j = 0; j < 27; j++) shift_code[j + 148] = shift_code[j + p[i]]; continue; } for (j = 0; j + p[i] < 148; j++) shift_code[j + 148] = shift_code[j + p[i]]; p[i] -= j; for (; j < 27; j++) shift_code[j + 148] = shift_code[j + p[i]]; } } private void lattic() { for (short i = 0; i < 240; i++) { for (short j = 9; j >= 0; j--) { temp[i] += k[j] * grid[j]; grid[j] -= temp[i] * k[j]; } for (short j = 9; j > 0; j--) grid[j] = grid[j - 1]; grid[0] = temp[i]; } } void output() { byte buffer[] = new byte[480]; for (short i = 0; i < 240; i++) { if (temp[i] >= 1.0D) temp[i] = 1.0D; else if (temp[i] <= -1D) temp[i] = -1D; data[i] = (short)(int)(temp[i] * 32767D); buffer[i * 2] = (byte)(data[i] & 0xff); buffer[i * 2 + 1] = (byte)(data[i] >>> 8); } soundout.write(buffer, 0, 480); } private void initDatainStream(){ try{ switch(type){ case 0:{ datain = new DataInputStream(new java.io.FileInputStream(new java.io.File("d://man.cps"))); break; } case 1:{ datain = new DataInputStream(new java.io.FileInputStream(new java.io.File("d://woman.cps"))); break; } case 2:{ datain = new DataInputStream(new java.io.FileInputStream(new java.io.File("d://man.cps"))); break; } } }catch(Exception e){ e.printStackTrace(); } } public void actionPerformed(ActionEvent action) { java.util.Properties p; Man.setEnabled(false); Woman.setEnabled(false); if (action.getSource() == Man) type = 0; else if (action.getSource() == Woman) type = 1; else if (action.getSource() == Speech) type = 2; board.setText("Now decoding..."); initDatainStream(); try { // datain = new DataInputStream(urls[type].openStream()); } catch (Exception e) { board.setText(e.toString()); } parameter_init(); eof = false; soundout.start(); } }
- speech.rar (42.2 KB)
- 下载次数: 11
相关推荐
**CELP语音编码技术详解** CELP(Code Excited Linear Prediction)编码是一种高效、低比特率的语音编码技术,主要用于语音通信和音频压缩领域。它在保持语音质量的同时,极大地降低了数据传输的需求,使得在有限...
基于CELP的语音编码.ppt 语音压缩编码培训_定稿.ppt CELP算法软件实现.pdf 20MS一帧的改进4kbps的CELP基音搜索算法.pdf C语言编写的语音编码算法 celp4.8 4.8kbps FS1016 standard rate voice compression source ...
**CELP编码技术详解** ...总之,`celp_codec-master`项目为学习和实践CELP编码提供了宝贵的资源,通过深入研究这个项目,我们可以更好地理解这一经典编码技术的内在机制,并将其应用于实际的语音通信系统中。
《G.728 CELP语音编码技术详解》 G.728是国际电信联盟(ITU-T)制定的一种低延迟码激励线性预测(Low-Delay Code Excited Linear Prediction, LD-CELP)语音编码标准,其核心在于提供高质量的语音编码服务,同时...
【标题】"CELP4.8语音压缩程序源码"涉及的是通信与音频处理领域中的关键技术——码激励线性预测(Code Excited Linear Prediction, CELP)编码技术。这种技术在语音压缩中扮演着重要角色,尤其适用于低带宽通信环境...
A Float Model of CELP Speech Codec in MATLAB Including: • CELP speech codec • CELP encoder Frame Analysis Sub-frame analysis • CELP decoder
**基于CELP算法的语音编码** 语音编码是通信和音频处理领域中的关键技术,它主要用于将原始的模拟语音信号转换为数字形式,以便于传输、存储和处理。在众多的语音编码算法中,码本激励线性预测(Code Excited ...
### CELP语音编码格式介绍 #### 一、概述 Code-Excited Linear Prediction (CELP) 是一种高效的语音编码技术,被广泛应用于低比特率的语音通信系统中。CELP 技术通过模拟人类发音机制来高效压缩语音信号,使得在...
**CELP语音编码详解** **一、CELP技术概述** CELP(Code Excited Linear Prediction,码激励线性预测)是一种高效、低速率的语音编码技术,广泛应用于语音通信、语音压缩以及各种数字信号处理系统中。CELP的核心...
**CELP编码技术详解** 在语音通信领域,CELP(Code Excited Linear Prediction,码激励线性预测)编码是一种广泛采用的高效语音压缩技术。它主要用于实现高质量的语音压缩,尤其在有限带宽的通信系统中,如数字移动...
描述中提到,这个压缩包不仅提供了CELP 3.2a的编码解码程序,还包含了相关的文档说明。这意味着用户在使用此软件时,可以参考这些文档来理解其工作原理、如何操作以及可能遇到的问题解决方案。此外,提到了“ulaw”...
1. `main.m`: 主程序,调用其他函数实现CELP编码和解码。 2. `lp_analysis.m`: 线性预测分析模块。 3. `pulse_excitation.m`: 脉冲激励生成模块。 4. `quantizer.m`: 量化器实现。 5. `decoder.m`: 解码器。 6. `...
**celp编解码(MATLAB)** **一、celp简介** CELP(Code Excited Linear Prediction,编码激励线性预测)是一种广泛应用于语音压缩的编码技术,它结合了线性预测编码(LPC)的高效性和脉冲编码调制(PCM)的音质...
**CELP(Code Excited Linear Prediction)编码是数字语音编码技术的一种,广泛应用于通信系统、音频压缩和语音识别等领域。本资源提供的是一个基于C语言实现的CELP编解码器,版本为3.2a。** CELP编码的核心原理...
基于ADPCM_CELP和语音分类的变速率语音压缩编码基于ADPCM_CELP和语音分类的变速率语音压缩编码
窄带CELP(Code Excited Linear Prediction)编码是一种在语音编码领域广泛应用的高效算法,尤其在低比特率通信系统中。此技术旨在通过压缩语音信号,以减少数据传输的需求,同时保持可接受的语音质量。"nb_celp.rar...
而"G729(LD-CELP)"很可能是包含G729编码器实现的主程序或库文件。 总的来说,这个压缩包对于理解G729编码算法及其优化,特别是LD-CELP技术,以及与GSM610编码器的比较,都是非常有价值的资源。开发者和研究人员可以...
CELP Voice Coder Version 3.2c The U.S. Government shall not be held liable for any damages resulting from this code. Further reproduction or distribution of this code without prior written ...
"Modified CELP_celp_Modified_ModifiedCELP_" 这个标题指的是一个经过修改的码本激励线性预测(CELP)算法在MATLAB环境中的实现。CELP是一种广泛应用于语音编码的数字信号处理技术,尤其在低比特率语音编码中表现...