Giter Site home page Giter Site logo

2fps / recorder Goto Github PK

View Code? Open in Web Editor NEW
982.0 17.0 242.0 2.36 MB

html5 js 浏览器 web端录音

Home Page: https://recorder.zhuyuntao.cn/

License: MIT License

JavaScript 97.59% HTML 0.03% TypeScript 2.38%
javascript recorder audio pcm wav html5 web typescript lu-yin webaudio

recorder's People

Contributors

2fps avatar dependabot[bot] avatar rubikplanet avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

recorder's Issues

如何播放外部音频

我在一个vue页面 import Recorder from "js-audio-recorder";之后,没办法使用Player.play()。
使用 import Player from './player/player' 也是错误的。
我该如何做,才能正常使用这个函数?
可以解答一下吗,新手一个见谅

声音输入和输出不一致

录音声音和播放声音音色不一样如何调整,demo可以原声播放,代码down下来后运行,播放音色略微厚重,这是什么问题呢

兼容性测试

求协助测试除pc端chrome以外的浏览器,例如:

pc端(或移动端) xx浏览器(xxx版本),运行成功。

pc端(或移动端) xx浏览器(xxx版本),运行失败,报错:......

在next.js的seo架构里import 'js-audio-recorder'会报错

你好涛老师:

我在使用next.js对seo架构使用您的模块包发现会报错window,document is not defined,这是基于seo架构一开始渲染时是服务端而非客户端所以没有window对象。

看了下的源码里window是直接调用的,所以请求对window做一个判断处理,判断window对象是否存在。

前一次录音残留

前一次录音会略微残留到下一次录音中,怀疑audioprocess需要到4096才触发,前次未满4096的数据会残留在缓存中,待下次触发,则出现前次音频,不过disconnect后并未释放数据,待处理。。

关于浏览器获取语音权限后一直未关闭的问题

通过MediaDevices.getUserMedia()方式获取音视频流后,销毁组件后,浏览器的录音标志一直未消失,Windows会提示该网页的麦克风一直处于监听状态。是否应当在销毁组件后,关闭监听状态?请教一下。

pcm 数据如何压缩

拿到的pcm数据太大 给如何压缩?按照文档最大的压缩比 1s生成的文件也大概30k左右

录音文件大小问题

设置相同的采样率、通道、采样位数录制的音频文件大小与标准的音频计算方法计算的文件大小不一致
标准计算方法: 音频大小 = 采样率x声道数x采样位数字节数x时间
列:1600012*0.02(毫秒)=640
而插件得出的是2730
想问问怎么解决这个问题

建议支持mp3

function convertWavToMp3(wavDataView: DataView) {
  const wav = lamejs.WavHeader.readHeader(wavDataView);
  const samples = new Int16Array(wavDataView.buffer, wav.dataOffset, wav.dataLen / 2);
  const { channels, sampleRate } = wav;
  const buffer = [];
  const mp3enc = new lamejs.Mp3Encoder(channels, sampleRate, 128);
  let remaining = samples.length;
  const maxSamples = 1152;
  for (let i = 0; remaining >= maxSamples; i += maxSamples) {
    const mono = samples.subarray(i, i + maxSamples);
    const mp3buf = mp3enc.encodeBuffer(mono);
    if (mp3buf.length > 0) {
      buffer.push(new Int8Array(mp3buf));
    }
    remaining -= maxSamples;
  }
  const d = mp3enc.flush();
  if (d.length > 0) {
    buffer.push(new Int8Array(d));
  }

  return new Blob(buffer, { type: 'audio/mp3' });
}

Example:

const mp3Blob = convertWavToMp3(recorder.getWAV())

我这边试了下是可以work的

为什么 getRecordAnalyseData返回的全是128

start开始录音的时候,获取波形数据,数组里全是128,怎么根据声音高低来得到对的数据绘制出来
play的时候,getPlayAnalyseData返回的也全是128,显示的波形是一条横线

error

Project running error reporting

pc chrome无法正常使用

在线演示地址https://recorder.zhuyuntao.cn/
在 pc chrome 版本 67.0.3396.79(正式版本) (64 位) 中
无法录音, 日志为: 异常了,NotFoundError:Requested device not found
无法播放pcm文件.日志为
Uncaught Error: EncodingError: Unable to decode audio data /example.js:978:9 Error: EncodingError: Unable to decode audio data at Function../src/recorder.ts.Recorder.throwError (https://recorder.zhuyuntao.cn/example.js:978:15) at AudioContext.<anonymous> (https://recorder.zhuyuntao.cn/example.js:577:22)

ios的chrome浏览器貌似不行

android chrome浏览器是可以的。但是ios的貌似不行,是这样的吗?
@2fps 请问readme上提到的兼容性上是对ios和android同时测试的吗?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.